diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-21 14:30:26 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-21 14:30:26 +0100 |
| commit | a06407d8d25a1179047560dabf9065dd00553f71 (patch) | |
| tree | 86f5305d98d85fc36a02b89deddc984f2196cb72 | |
| parent | 39e4ea033f51083c7d556d5bf0dc04b82edee4de (diff) | |
| download | fisheye-a06407d8d25a1179047560dabf9065dd00553f71.tar.gz fisheye-a06407d8d25a1179047560dabf9065dd00553f71.tar.bz2 fisheye-a06407d8d25a1179047560dabf9065dd00553f71.zip | |
Separate pagination counts per gallery style; make galleriffic numThumbs configurable
- 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 <noreply@anthropic.com>
| -rwxr-xr-x | edit.php | 12 | ||||
| -rwxr-xr-x | gallery_views/galleriffic/fisheye_galleriffic_inc_1.tpl | 2 | ||||
| -rwxr-xr-x | gallery_views/galleriffic/fisheye_galleriffic_inc_5.tpl | 2 | ||||
| -rwxr-xr-x | includes/classes/FisheyeGallery.php | 12 | ||||
| -rwxr-xr-x | templates/edit_gallery.tpl | 29 |
5 files changed, 28 insertions, 29 deletions
@@ -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} <script>//<![CDATA[ function updateGalleryPagination() { - document.getElementById('fixed_grid-pagination').style.display = 'none'; - document.getElementById('auto_flow-pagination').style.display = 'none'; - document.getElementById('position_number-pagination').style.display = 'none'; - document.getElementById('simple_list-pagination').style.display = 'none'; - document.getElementById('matteo-pagination').style.display = 'none'; - document.getElementById('galleriffic-pagination').style.display = 'none'; + var paginationIds = ['fixed_grid','auto_flow','position_number','simple_list','matteo','galleriffic']; + paginationIds.forEach(function(id) { + var div = document.getElementById(id+'-pagination'); + div.style.display = 'none'; + div.querySelectorAll('input, select').forEach(function(el) { el.disabled = true; }); + }); var input = document.getElementById('editGalleryForm').gallery_pagination; - var i = input.selectedIndex; - var select = input.options[i].value; - document.getElementById(select+'-pagination').style.display = 'block'; + var select = input.options[input.selectedIndex].value; + var activeDiv = document.getElementById(select+'-pagination'); + activeDiv.style.display = 'block'; + activeDiv.querySelectorAll('input, select').forEach(function(el) { el.disabled = false; }); } +document.addEventListener('DOMContentLoaded', updateGalleryPagination); //]]></script> {/literal} {strip} @@ -76,8 +78,8 @@ function updateGalleryPagination() { </div> <div id="auto_flow-pagination"> - <input type="text" id="gallery-rows-per-page" name="total_per_page" size="2" maxlength="2" value="{$gContent->mInfo.rows_per_page|default:$gBitSystem->getConfig('fisheye_gallery_default_rows_per_page')}"/> {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."} + <input type="text" id="gallery-total-per-page" name="total_per_page" size="3" maxlength="3" value="{$gContent->getPreference('total_per_page', $gContent->mInfo.rows_per_page|default:20)}"/> {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."} </div> <div id="position_number-pagination"> @@ -85,16 +87,17 @@ function updateGalleryPagination() { </div> <div id="simple_list-pagination"> - <input type="text" id="gallery-rows-per-page" name="lines_per_page" size="2" maxlength="2" value="{$gContent->mInfo.rows_per_page|default:$gBitSystem->getConfig('fisheye_gallery_default_rows_per_page')}"/> {tr}Total lines per page{/tr} + <input type="text" id="gallery-total-per-page-list" name="total_per_page" size="3" maxlength="3" value="{$gContent->getPreference('total_per_page', $gContent->mInfo.rows_per_page|default:20)}"/> {tr}Total lines per page{/tr} {formhelp note="This option allows a single column display of images with mime details where available."} </div> <div id="matteo-pagination"> - <input type="text" id="gallery-rows-per-page" name="images_per_page" size="2" maxlength="2" value="{$gContent->mInfo.rows_per_page|default:$gBitSystem->getConfig('fisheye_gallery_default_rows_per_page')}"/> {tr}Total images per page{/tr} + <input type="text" id="gallery-total-per-page-matteo" name="total_per_page" size="3" maxlength="3" value="{$gContent->getPreference('total_per_page', $gContent->mInfo.rows_per_page|default:20)}"/> {tr}Total images per page{/tr} {formhelp note="This option provides an ajax powered scrolling display using the mbGallery jquery library."} </div> <div id="galleriffic-pagination"> + <input type="text" id="galleriffic-num-thumbs" name="galleriffic_num_thumbs" size="3" maxlength="3" value="{$gContent->getPreference('galleriffic_num_thumbs', $gBitSystem->getConfig('fisheye_gallery_default_galleriffic_num_thumbs', 30))}"/> {tr}Thumbnails per page{/tr}<br/> <input type="text" id="galleriffic-style" name="galleriffic_style" size="2" maxlength="2" value="{$gContent->mInfo.galleriffic_style|default:$gBitSystem->getConfig('fisheye_gallery_default_galleriffic_style')}"/> {tr}Galleriffic layout style{/tr} {formhelp note="This option provides a javascript powered tabbed thumbnail list display using the galleriffic jquery library."} </div> |
