From 9954a2f04d412e8f49f7387385f14a3c51c30752 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 3 Jan 2017 13:24:53 -0500 Subject: [PATCH] Add Management for List Pagination. Adding two new management options. list_pagination Boolean (enable/disable) pagination on member list. list_pagination_count smallint - Number of records to display per page. --- classes/data/settings/dataSettingsGeneral.php | 18 +++- index.php | 2 +- models/front/members/list.php | 42 ++++---- ...1.1.23.sql => create_database_V1.1.24.sql} | 8 +- setup/databaseScripts/dbVersions.php | 3 +- .../update_database_V1.1.24.sql | 14 +++ views/admin/management/index.html | 96 +++++++++++-------- views/front/members/list.html | 11 +-- 8 files changed, 119 insertions(+), 75 deletions(-) rename setup/databaseScripts/{create_database_V1.1.23.sql => create_database_V1.1.24.sql} (98%) create mode 100644 setup/databaseScripts/update_database_V1.1.24.sql diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index 9a0deb9f..505433db 100644 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -259,6 +259,22 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'use' => 'a' ), + // Front-end Listings - Paginate List + 'list_pagination' => array( + 'field' => 'list_pagination', + 'type' => 'checkbox', + 'default' => true, + 'use' => 'a' + ), + + // Front-end Listings - Pagination Count + 'list_pagination_count' => array( + 'field' => 'list_pagination_count', + 'type' => 'integer', + 'default' => 20, + 'use' => 'a' + ), + // Front-end Listings - Show List 'list_header_text' => array( 'field' => 'list_header_text', @@ -1050,4 +1066,4 @@ class GlmDataSettingsGeneral extends GlmDataAbstract } } -?> \ No newline at end of file +?> diff --git a/index.php b/index.php index 3c845e7d..9343c73d 100644 --- a/index.php +++ b/index.php @@ -39,7 +39,7 @@ */ define('GLM_MEMBERS_PLUGIN_VERSION', '2.8.4'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.23'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.24'); // 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/models/front/members/list.php b/models/front/members/list.php index a962a58f..39223e16 100644 --- a/models/front/members/list.php +++ b/models/front/members/list.php @@ -121,7 +121,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo * * 'status' * - * True if successfull and false if there was a fatal failure. + * True if successful and false if there was a fatal failure. * * 'menuItemRedirect' * @@ -136,7 +136,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo * * 'view' * - * A suggested view name that the contoller should use instead of the + * A suggested view name that the controller should use instead of the * default view for this model or false to indicate that the default view * should be used. * @@ -149,27 +149,27 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo public function modelAction ($actionData = false) { - $where = ''; - $whereSep = ''; - $filterPending = false; - $filterArchived = false; - $filterFeatured = false; - $filterName = false; - $haveFilter = false; - $textSearch = ''; - $blankStart = false; - $membersFound = false; - $catSearchSelected = false; + $where = ''; + $whereSep = ''; + $filterPending = false; + $filterArchived = false; + $filterFeatured = false; + $filterName = false; + $haveFilter = false; + $textSearch = ''; + $blankStart = false; + $membersFound = false; + $catSearchSelected = false; $regionSearchSelected = false; - // Paging Parmeters - $paging = true; // This might be better set in a management field - $numbDisplayed = false; - $lastDisplayed = false; - $prevStart = false; - $nextStart = false; - $start = 1; - $limit = 20; // Set to the number of listings per page + // Paging Parameters + $paging = $this->config['settings']['list_pagination']; // Now this is in management + $numbDisplayed = false; + $lastDisplayed = false; + $prevStart = false; + $nextStart = false; + $start = 1; + $limit = $this->config['settings']['list_pagination_count']; // Now this is in management // Check for URL parameter override of shortcode parameters if (isset($_REQUEST['categorySearch'])) { diff --git a/setup/databaseScripts/create_database_V1.1.23.sql b/setup/databaseScripts/create_database_V1.1.24.sql similarity index 98% rename from setup/databaseScripts/create_database_V1.1.23.sql rename to setup/databaseScripts/create_database_V1.1.24.sql index 146297ae..cfb3a5dd 100644 --- a/setup/databaseScripts/create_database_V1.1.23.sql +++ b/setup/databaseScripts/create_database_V1.1.24.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database -- File Created: 12/29/16 12:06:00 --- Database Version: 1.1.23 +-- Database Version: 1.1.24 -- Database Creation Script -- -- To permit each query below to be executed separately, @@ -278,6 +278,8 @@ CREATE TABLE {prefix}settings_general ( list_show_map 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', list_show_search_filters_opened BOOLEAN DEFAULT '0', list_show_search BOOLEAN DEFAULT '1', list_show_search_text BOOLEAN DEFAULT '1', @@ -382,9 +384,9 @@ 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 ) + ( 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) VALUES - ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb' ) + ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb', '1', 20 ) ; ---- diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index b2e73a9f..1e3162d1 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -54,7 +54,8 @@ $glmMembersDbVersions = array( '1.1.20' => array('version' => '1.1.20', 'tables' => 18, 'date' => '10/18/16'), '1.1.21' => array('version' => '1.1.21', 'tables' => 18, 'date' => '10/20/16'), '1.1.22' => array('version' => '1.1.22', 'tables' => 18, 'date' => '10/25/16'), - '1.1.23' => array('version' => '1.1.23', 'tables' => 18, 'date' => '12/29/16') + '1.1.23' => array('version' => '1.1.23', 'tables' => 18, 'date' => '12/29/16'), + '1.1.24' => array('version' => '1.1.24', 'tables' => 18, 'date' => '01/03/17'), ); diff --git a/setup/databaseScripts/update_database_V1.1.24.sql b/setup/databaseScripts/update_database_V1.1.24.sql new file mode 100644 index 00000000..69da088c --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.24.sql @@ -0,0 +1,14 @@ +-- Gaslight Media Members Database +-- File Created: 01/03/17 12:54:00 +-- Database Version: 1.1.24 +-- 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 +-- Sets which character to use to separate phone numbers + +ALTER TABLE {prefix}settings_general ADD COLUMN list_pagination BOOLEAN DEFAULT '1'; + +---- + +ALTER TABLE {prefix}settings_general ADD COLUMN list_pagination_count SMALLINT DEFAULT '20'; diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 23b59d3d..f36fed0a 100644 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -1,10 +1,10 @@ {include file='admin/management/header.html'} - - + +
- + - - + + - + @@ -46,15 +46,15 @@

Debug Settings

- + - + {if $id_error}'Page ID' input should be numerical, not empty and the page must exist{/if} {if $title_error}'Page Name' should not be blank{/if} {foreach from=$requiredPages key=addon item=requiredPage name=count} - + {foreach from=$requiredPage key=requiredPageName item=requiredPageData} @@ -85,9 +85,9 @@ {/foreach} {/foreach}

Plugin: {$addon}

{$requiredPageName}
- + - + @@ -161,9 +161,9 @@

Misc. Settings

- + - + + + + + + + + + @@ -193,17 +205,17 @@ {if $genSettings.fieldFail.list_logo_size}

{$genSettings.fieldFail.list_logo_size}

{/if} - + - @@ -233,10 +245,10 @@ - + - + - + @@ -293,9 +305,9 @@
@@ -180,6 +180,18 @@
Pagination: + +
Pagination Count: + +
Show Member Name as Link to Detail:
List Header Text:
Show Member Logo:
Show Filler Image If No Member Logo:
Show Address:
Address Options: + - +
Show Street:
Show City, State, ZIP:
Show Country:
Show Country:

Member List Map Options

Show Map:
Show Member Name as Link to Detail:
Map Opened by Default:
Show Logo:
Logo Size: @@ -247,7 +259,7 @@
Show Description:
Show Short Description:
Show Address:
- + - + - + - @@ -349,7 +361,7 @@
@@ -312,16 +324,16 @@ {if $genSettings.fieldFail.detail_logo_size}

{$genSettings.fieldFail.detail_logo_size}

{/if}
Show Address:
Address Options: + - +
Show Street:
Show City, State, ZIP:
Show Country:
Show Country:
Show Live Cam Feed:
Autoscroll Offset From Top (height of sticky nav):px
- + @@ -387,11 +399,11 @@

Member Detail Map Options

Show Amenities:
Show Directions:
- + - + - + @@ -409,11 +421,11 @@

Members Only Settings

- +