From f9c8bb79ab2a415679d182135d0a0a7a33e5dbe2 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 15 Oct 2018 14:27:46 -0400 Subject: [PATCH] Adding new management option for single member profiles only. Hides the add and clone member profile links for members (own entity) --- classes/data/settings/dataSettingsGeneral.php | 7 ++ index.php | 2 +- ...1.1.40.sql => create_database_V1.1.41.sql} | 13 +-- setup/databaseScripts/dbVersions.php | 3 +- .../update_database_V1.1.41.sql | 25 ++++++ views/admin/dashboard/index.html | 88 ++++++++++--------- views/admin/management/index.html | 50 ++++++----- 7 files changed, 116 insertions(+), 72 deletions(-) rename setup/databaseScripts/{create_database_V1.1.40.sql => create_database_V1.1.41.sql} (98%) create mode 100755 setup/databaseScripts/update_database_V1.1.41.sql diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index 652294da..474991ab 100755 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -291,6 +291,13 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'use' => 'a' ), + // Enable Single Profile + 'enable_single_profile' => array( + 'field' => 'enable_single_profile', + 'type' => 'checkbox', + 'use' => 'a' + ), + // How many characters the short description is limited to - also used for importing 'short_desc_char_limit' => array( 'field' => 'short_desc_char_limit', diff --git a/index.php b/index.php index 8f9609f4..6a38b2b6 100755 --- a/index.php +++ b/index.php @@ -48,7 +48,7 @@ if (!defined('ABSPATH')) { */ define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.44'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.40'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.41'); // Check if plugin version is not current in WordPress option and if needed updated it if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { diff --git a/setup/databaseScripts/create_database_V1.1.40.sql b/setup/databaseScripts/create_database_V1.1.41.sql similarity index 98% rename from setup/databaseScripts/create_database_V1.1.40.sql rename to setup/databaseScripts/create_database_V1.1.41.sql index fc5d9478..5134b6e9 100755 --- a/setup/databaseScripts/create_database_V1.1.40.sql +++ b/setup/databaseScripts/create_database_V1.1.41.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database -- File Created: 12/29/16 12:06:00 --- Database Version: 1.1.40 +-- Database Version: 1.1.41 -- Database Creation Script -- -- To permit each query below to be executed separately, @@ -91,6 +91,8 @@ CREATE TABLE {prefix}category_member_info ( CREATE TABLE {prefix}cities ( id INT NOT NULL AUTO_INCREMENT, name TINYTEXT NULL, -- Name of city + lat FLOAT NULL, -- Latitude of city's location + lon FLOAT NULL, -- Longitude of city's location PRIMARY KEY (id) ); @@ -326,6 +328,7 @@ CREATE TABLE {prefix}settings_general ( default_state TINYTEXT DEFAULT NULL, enable_counties BOOLEAN DEFAULT '0', enable_multiple_profiles BOOLEAN DEFAULT '0', + enable_single_profile BOOLEAN DEFAULT '0', -- Hide the add profile and clone profile links/buttons enable_member_reports BOOLEAN DEFAULT '1', enable_caching BOOLEAN DEFAULT '1', enable_contact_edit_only BOOLEAN DEFAULT '0', @@ -340,7 +343,7 @@ CREATE TABLE {prefix}settings_general ( list_show_map BOOLEAN DEFAULT '1', list_show_featured BOOLEAN DEFAULT '0', list_show_featured_count SMALLINT DEFAULT '3', - list_show_list BOOLEAN DEFAULT '1', + list_show_list BOOLEAN DEFAULT '1', list_order_list SMALLINT DEFAULT '10', list_pagination BOOLEAN DEFAULT '1', list_pagination_count SMALLINT DEFAULT '20', @@ -396,7 +399,7 @@ CREATE TABLE {prefix}settings_general ( list_show_packages BOOLEAN DEFAULT '0', list_show_packages_link BOOLEAN DEFAULT '0', list_header_text TINYTEXT DEFAULT NULL, - detail_auto_expand_sections BOOLEAN DEFAULT '0', + detail_auto_expand_sections BOOLEAN DEFAULT '0', detail_show_map BOOLEAN DEFAULT '1', detail_show_directions BOOLEAN DEFAULT '1', detail_show_logo BOOLEAN DEFAULT '1', @@ -459,10 +462,10 @@ CREATE TABLE {prefix}settings_general ( -- Set default entry INSERT INTO {prefix}settings_general ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size, - list_pagination, list_pagination_count, enable_counties, enable_multiple_profiles, enable_member_reports, enable_caching, updates_notification) + list_pagination, list_pagination_count, enable_counties, enable_multiple_profiles, enable_member_reports, enable_caching, updates_notification, enable_single_profile ) VALUES ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb', '1', 20, 0, 0, 1, 1, - 'A member has updated their record and is now in a pending state.') + 'A member has updated their record and is now in a pending state.', 0) ; ---- diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 8b488f39..0882b86e 100755 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -71,7 +71,8 @@ $glmMembersDbVersions = array( '1.1.37' => array('version' => '1.1.37', 'tables' => 23, 'date' => '06/25/18'), '1.1.38' => array('version' => '1.1.38', 'tables' => 23, 'date' => '08/13/18'), '1.1.39' => array('version' => '1.1.39', 'tables' => 23, 'date' => '09/11/18'), - '1.1.40' => array('version' => '1.1.40', 'tables' => 23, 'date' => '09/25/18') + '1.1.40' => array('version' => '1.1.40', 'tables' => 23, 'date' => '09/25/18'), + '1.1.41' => array('version' => '1.1.41', 'tables' => 23, 'date' => '10/12/18'), ); diff --git a/setup/databaseScripts/update_database_V1.1.41.sql b/setup/databaseScripts/update_database_V1.1.41.sql new file mode 100755 index 00000000..48517242 --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.41.sql @@ -0,0 +1,25 @@ +-- Gaslight Media Members Database +-- File Created: 2018-10-12 +-- Database Version: 1.1.41 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +-- Add lat to city +ALTER TABLE {prefix}cities ADD lat FLOAT NULL; -- Latitude of city's location + +---- + +-- Add lon to city +ALTER TABLE {prefix}cities ADD lon FLOAT NULL; -- Longitude of city's location + +---- + +-- Add enable_single_profile to settings_general +ALTER TABLE {prefix}settings_general ADD enable_single_profile BOOLEAN DEFAULT '0'; -- Hide the add profile and clone profile links/buttons + +---- + +-- Update setting for enable_single_profile +UPDATE {prefix}settings_general SET enable_single_profile = false; diff --git a/views/admin/dashboard/index.html b/views/admin/dashboard/index.html index 010c0d77..dd8d0b05 100644 --- a/views/admin/dashboard/index.html +++ b/views/admin/dashboard/index.html @@ -2,56 +2,58 @@

{$terms.term_member_cap} Profiles - Add New {$terms.term_member_cap} Information Version + {if !$settings.enable_single_profile} + Add New {$terms.term_member_cap} Information Version + {/if}

{if apply_filters('glm_members_permit_admin_member_index_view_member_info_version', true)} - {if apply_filters('glm_members_permit_admin_member_index_add_member_info_version', true)} - {/if} -
- - - - - - - - - + {if apply_filters('glm_members_permit_admin_member_index_add_member_info_version', true)} + {/if} +
+
StatusReference Name
+ + + + + + + + - {if $haveInfoRecords} - {assign var="i" value="0"} - {foreach $memberInfoRecords as $m} + {if $haveInfoRecords} + {assign var="i" value="0"} + {foreach $memberInfoRecords as $m} - {if $m.status.value == $statusTypeNumbers.Active || apply_filters('glm_members_permit_admin_member_index_list_inactive_info', true)} - {if $i++ is odd by 1} - - {else} - - {/if} - - - - - - - {/if} - {/foreach} - {else} + {if $m.status.value == $statusTypeNumbers.Active || apply_filters('glm_members_permit_admin_member_index_list_inactive_info', true)} + {if $i++ is odd by 1} + + {else} + + {/if} + + + + + {/if} + {/foreach} + {else} - {/if} - -
StatusReference Name
- {$m.status.name} - {$m.reference_name} - {if $m.bad_lat_lon}Bad Map Location{/if} - {if apply_filters('glm_members_permit_admin_member_index_clone_activate_info_version', true)} - Clone  - {if $m.status.name != 'Active'}Activate{/if} - {/if} -
+ {$m.status.name} + {$m.reference_name} + {if $m.bad_lat_lon}Bad Map Location{/if} + {if apply_filters('glm_members_permit_admin_member_index_clone_activate_info_version', true)} + {if !$settings.enable_single_profile} + Clone  + {/if} + {if $m.status.name != 'Active'}Activate{/if} + {/if} +
Click here to start entering information for this {$terms.term_member}.
- {/if} + {/if} + + + {/if}
diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 3ff32786..d726533a 100755 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -1,13 +1,13 @@ {include file='admin/management/header.html'} - {if $genSettings.fieldData.selected_map_interface.value == 1} + {if $genSettings.fieldData.selected_map_interface.value == 1} {/if} {if $genSettings.fieldData.selected_map_interface.value == 2} - {/if} + {/if}
@@ -131,6 +131,12 @@ + + Enable Single Member Profile (members only): + + + + Member Info Tabs Selection: @@ -177,7 +183,7 @@

Map Interface Options

- + Selected Map Interface: @@ -229,17 +235,17 @@ Click and drag anywhere else on the map to move to another area.

- {if $genSettings.fieldData.selected_map_interface.value == 1} + {if $genSettings.fieldData.selected_map_interface.value == 1}

If the map does not load below, please check the Tile Server and Tile Server Key settings above.

{/if} - - {if $genSettings.fieldData.selected_map_interface.value == 2} + + {if $genSettings.fieldData.selected_map_interface.value == 2} -
(map loads here)
+
(map loads here)
{/if} - +

Specify Position Using Lattitude and Longitude:

@@ -639,8 +645,8 @@ } }); - // Only show options for selected map interface - var selectedMap = false; + // Only show options for selected map interface + var selectedMap = false; $('#selected_map_interface').on('change', function() { $('.MapTypeOption').addClass('glm-hidden'); selectedMap = $('#selected_map_interface').val(); @@ -656,20 +662,20 @@ var startLon = $('#glmLng').val(); var defZoom = Number($('#mapDefZoom').val()); - {if $genSettings.fieldData.selected_map_interface.value == 1} - + {if $genSettings.fieldData.selected_map_interface.value == 1} + /* * Leaflet Map * API reference: https://leafletjs.com/reference-1.3.2.html */ - + var leafletMap = L.map('LeafletMap').setView([startLat, startLon], defZoom); var leafletTileServer = '{$genSettings.fieldData.leaflet_tile_server}/{$genSettings.fieldData.leaflet_tile_server_key}/' + {literal}'{z}/{x}/{y}.png'{/literal}; var leafletMinZoom = 5; var leafletMaxZoom = 18; function initMap() { - + // Tile server L.tileLayer(leafletTileServer, { attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Gaslight Media', @@ -677,27 +683,27 @@ maxZoom: leafletMaxZoom, id: 'nothot' }).addTo(leafletMap); - + // Marker var leafletMarker = L.marker([startLat, startLon], { draggable: true }).addTo(leafletMap); - + // Marker Drag/Drop action leafletMarker.on('dragend', function(event){ var marker = event.target; var position = marker.getLatLng(); - + marker.setLatLng(new L.LatLng(position.lat, position.lng),{ draggable:'true' }); leafletMap.panTo(new L.LatLng(position.lat, position.lng)) - + // Assign it to the lat/lon fields for submission $('#glmLat').val(position.lat.toFixed(6)); $('#glmLng').val(position.lng.toFixed(6)); }); } - + // Set map zoom when changing default zoom level $('#mapDefZoom').change(function() { leafletMap.setZoom($(this).val()); @@ -705,8 +711,8 @@ {/if} - {if $genSettings.fieldData.selected_map_interface.value == 2} - + {if $genSettings.fieldData.selected_map_interface.value == 2} + /* * Google Maps * API reference: https://developers.google.com/maps/documentation/javascript/reference @@ -837,7 +843,7 @@ {/if} initMap(); - + }); -- 2.17.1