diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 22ea16cf3..c7680dd4b 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -100,6 +100,7 @@ - added: A template variable to distinguish between Files and Albums in the Gallery Search - added: A thumbnail for Photo edit screen + - added: Configure the amount of files shown per page in the Gallery 7.5.10 - fix: Syntax error in GetCsMail diff --git a/docs/upgrades/upgrade_7.5.10-7.5.11.pl b/docs/upgrades/upgrade_7.5.10-7.5.11.pl index 34adc47b8..7662ce2c2 100644 --- a/docs/upgrades/upgrade_7.5.10-7.5.11.pl +++ b/docs/upgrades/upgrade_7.5.10-7.5.11.pl @@ -78,9 +78,24 @@ addLoginMessage( $session ); addNewApprovalActivities( $session ); addUserListWobject( $session ); addInheritUrlFromParent( $session ); +addDefaultFilesPerPage( $session ); finish($session); # this line required +#---------------------------------------------------------------------------- +# Add default files per page to the Gallery +sub addDefaultFilesPerPage { + my $session = shift; + print "\tAdding Default Files Per Page to Gallery... " unless $quiet; + $session->db->write( + "ALTER TABLE Gallery ADD COLUMN defaultFilesPerPage INT" + ); + $session->db->write( + "UPDATE Gallery SET defaultFilesPerPage=24" + ); + print "DONE!\n" unless $quiet; +} + #---------------------------------------------------------------------------- # Add two new approval activities sub addNewApprovalActivities { diff --git a/lib/WebGUI/Asset/Wobject/Gallery.pm b/lib/WebGUI/Asset/Wobject/Gallery.pm index 6b9775f3a..0f1c1e384 100644 --- a/lib/WebGUI/Asset/Wobject/Gallery.pm +++ b/lib/WebGUI/Asset/Wobject/Gallery.pm @@ -307,6 +307,13 @@ sub definition { label => $i18n->get("workflowIdCommit label"), hoverHelp => $i18n->get("workflowIdCommit description"), }, + defaultFilesPerPage => { + tab => 'display', + fieldType => 'integer', + defaultValue => 24, + label => $i18n->get( 'defaultFilesPerPage label' ), + hoverHelp => $i18n->get( 'defaultFilesPerPage description' ), + }, ); push @{$definition}, { diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index d2b6c38b0..9d05f0cbc 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -440,8 +440,9 @@ url to the current page that will be given to the paginator. sub getFilePaginator { my $self = shift; my $url = shift || $self->getUrl; + my $perPage = $self->getParent->get( 'defaultFilesPerPage' ); - my $p = WebGUI::Paginator->new( $self->session, $url ); + my $p = WebGUI::Paginator->new( $self->session, $url, $perPage ); $p->setDataByArrayRef( $self->getFileIds ); return $p; diff --git a/lib/WebGUI/i18n/English/Asset_Gallery.pm b/lib/WebGUI/i18n/English/Asset_Gallery.pm index 0136f7ea3..5447bfb92 100644 --- a/lib/WebGUI/i18n/English/Asset_Gallery.pm +++ b/lib/WebGUI/i18n/English/Asset_Gallery.pm @@ -699,6 +699,18 @@ our $I18N = { lastUpdated => 0, context => q{Description of template variable}, }, + + 'defaultFilesPerPage label' => { + message => q{Default Files Per Page}, + lastUpdated => 0, + context => q{Asset property label}, + }, + + 'defaultFilesPerPage description' => { + message => q{The number of files to show per page of the album view.}, + lastUpdated => 0, + context => q{Description of asset property}, + }, }; 1;