From a06407d8d25a1179047560dabf9065dd00553f71 Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Thu, 21 May 2026 14:30:26 +0100 Subject: Separate pagination counts per gallery style; make galleriffic numThumbs configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rows_per_page/cols_per_page (DB) used only by fixed_grid - total_per_page preference used by auto_flow, simple_list, matteo — shown as one shared field with the style-appropriate label; falls back to old rows_per_page for migration - galleriffic_num_thumbs preference replaces hardcoded numThumbs:30 in JS templates - JS disables hidden style-div inputs on load and switch so only the active style submits Co-Authored-By: Claude Sonnet 4.6 --- edit.php | 12 ++------- .../galleriffic/fisheye_galleriffic_inc_1.tpl | 2 +- .../galleriffic/fisheye_galleriffic_inc_5.tpl | 2 +- includes/classes/FisheyeGallery.php | 12 ++++++--- templates/edit_gallery.tpl | 29 ++++++++++++---------- 5 files changed, 28 insertions(+), 29 deletions(-) diff --git a/edit.php b/edit.php index 486f166..f269b9c 100755 --- a/edit.php +++ b/edit.php @@ -31,21 +31,13 @@ if( $gBitUser->hasPermission( 'p_fisheye_change_thumb_size' ) ) { $gBitSmarty->assign( 'galleryPaginationTypes', $gContent::getAllLayouts() ); if( !empty( $_REQUEST['savegallery'] ) ) { - if( $_REQUEST['gallery_pagination'] == 'auto_flow' ) { - $_REQUEST['rows_per_page'] = $_REQUEST['total_per_page']; - $_REQUEST['cols_per_page'] = '1'; - } elseif ( $_REQUEST['gallery_pagination'] == 'simple_list' ) { - $_REQUEST['rows_per_page'] = $_REQUEST['lines_per_page']; - $_REQUEST['cols_per_page'] = '1'; - } elseif ( $_REQUEST['gallery_pagination'] == 'matteo' ) { - $_REQUEST['rows_per_page'] = $_REQUEST['images_per_page']; - $_REQUEST['cols_per_page'] = '1'; - } if( $gContent->store( $_REQUEST ) ) { $gContent->storePreference( 'is_public', !empty( $_REQUEST['is_public'] ) ? $_REQUEST['is_public'] : null ); $gContent->storePreference( 'allow_comments', !empty( $_REQUEST['allow_comments'] ) ? $_REQUEST['allow_comments'] : null ); $gContent->storePreference( 'gallery_pagination', !empty( $_REQUEST['gallery_pagination'] ) ? $_REQUEST['gallery_pagination'] : null ); $gContent->storePreference( 'link_original_images', !empty( $_REQUEST['link_original_images'] ) ? $_REQUEST['link_original_images'] : null ); + $gContent->storePreference( 'total_per_page', !empty( $_REQUEST['total_per_page'] ) ? (int)$_REQUEST['total_per_page'] : null ); + $gContent->storePreference( 'galleriffic_num_thumbs', !empty( $_REQUEST['galleriffic_num_thumbs'] ) ? (int)$_REQUEST['galleriffic_num_thumbs'] : null ); // make sure var is fully stuffed with current data $gContent->load(); // set the mappings, or if nothing checked, nuke them all diff --git a/gallery_views/galleriffic/fisheye_galleriffic_inc_1.tpl b/gallery_views/galleriffic/fisheye_galleriffic_inc_1.tpl index 50a97a1..b46f1d9 100755 --- a/gallery_views/galleriffic/fisheye_galleriffic_inc_1.tpl +++ b/gallery_views/galleriffic/fisheye_galleriffic_inc_1.tpl @@ -109,7 +109,7 @@ jQuery(document).ready(function($) { // Initialize Advanced Galleriffic Gallery var gallery = $('#thumbs').galleriffic({ delay: 2500, - numThumbs: 30, + numThumbs: {$gContent->getPreference('galleriffic_num_thumbs', $gBitSystem->getConfig('fisheye_gallery_default_galleriffic_num_thumbs', 30))}, preloadAhead: 10, enableTopPager: true, enableBottomPager: true, diff --git a/gallery_views/galleriffic/fisheye_galleriffic_inc_5.tpl b/gallery_views/galleriffic/fisheye_galleriffic_inc_5.tpl index 7dd20d0..c46bfc6 100755 --- a/gallery_views/galleriffic/fisheye_galleriffic_inc_5.tpl +++ b/gallery_views/galleriffic/fisheye_galleriffic_inc_5.tpl @@ -108,7 +108,7 @@ jQuery(document).ready(function($) { // Initialize Advanced Galleriffic Gallery var gallery = $('#thumbs').galleriffic({ delay: 2500, - numThumbs: 30, + numThumbs: {$gContent->getPreference('galleriffic_num_thumbs', $gBitSystem->getConfig('fisheye_gallery_default_galleriffic_num_thumbs', 30))}, preloadAhead: 10, enableTopPager: false, enableBottomPager: false, diff --git a/includes/classes/FisheyeGallery.php b/includes/classes/FisheyeGallery.php index b4d7ebc..c321d99 100755 --- a/includes/classes/FisheyeGallery.php +++ b/includes/classes/FisheyeGallery.php @@ -156,10 +156,14 @@ class FisheyeGallery extends FisheyeBase { if( $this->getPreference( 'gallery_pagination' ) == FISHEYE_PAGINATION_POSITION_NUMBER ) { $this->mInfo['num_pages'] = $this->mDb->getOne( "SELECT COUNT( distinct( floor(`item_position`) ) ) FROM `".BIT_DB_PREFIX."fisheye_gallery_image_map` WHERE gallery_content_id=?", [ $this->mContentId ] ); } else { - // galleriffic JS templates hardcode numThumbs:30 — match that here so image_order.tpl page breaks align - $this->mInfo['images_per_page'] = ( $this->getPreference( 'gallery_pagination' ) == FISHEYE_PAGINATION_GALLERIFFIC ) - ? 30 - : $this->mInfo['cols_per_page'] * $this->mInfo['rows_per_page']; + $pagination = $this->getPreference( 'gallery_pagination' ); + if( $pagination == FISHEYE_PAGINATION_GALLERIFFIC ) { + $this->mInfo['images_per_page'] = (int)$this->getPreference( 'galleriffic_num_thumbs', 30 ); + } elseif( in_array( $pagination, [ FISHEYE_PAGINATION_AUTO_FLOW, FISHEYE_PAGINATION_SIMPLE_LIST, FISHEYE_PAGINATION_MATTEO ] ) ) { + $this->mInfo['images_per_page'] = (int)$this->getPreference( 'total_per_page', $this->mInfo['rows_per_page'] ); + } else { + $this->mInfo['images_per_page'] = $this->mInfo['cols_per_page'] * $this->mInfo['rows_per_page']; + } $this->mInfo['num_pages'] = (int)$this->mInfo['num_images'] / $this->mInfo['images_per_page'] + ($this->mInfo['num_images'] % $this->mInfo['images_per_page'] == 0 ? 0 : 1); } diff --git a/templates/edit_gallery.tpl b/templates/edit_gallery.tpl index 0385406..309a9fe 100755 --- a/templates/edit_gallery.tpl +++ b/templates/edit_gallery.tpl @@ -1,17 +1,19 @@ {literal} {/literal} {strip} @@ -76,8 +78,8 @@ function updateGalleryPagination() {
- {tr}Total images per page{/tr} - {formhelp note="The layout of the images on each gallery page will automatically adjust to the browsers width. You can specify the total number of thumbnails to display per page."} + {tr}Total images per page{/tr} + {formhelp note="The layout of the images on each gallery page will automatically adjust to the browser width. You can specify the total number of thumbnails to display per page."}
@@ -85,16 +87,17 @@ function updateGalleryPagination() {
- {tr}Total lines per page{/tr} + {tr}Total lines per page{/tr} {formhelp note="This option allows a single column display of images with mime details where available."}
- {tr}Total images per page{/tr} + {tr}Total images per page{/tr} {formhelp note="This option provides an ajax powered scrolling display using the mbGallery jquery library."}
+ {tr}Thumbnails per page{/tr}
{tr}Galleriffic layout style{/tr} {formhelp note="This option provides a javascript powered tabbed thumbnail list display using the galleriffic jquery library."}
-- cgit v1.3