From b137688f65aa2b4cef2f2275fdec2ceb5be632ad Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Mon, 9 Jun 2008 21:37:23 +0000 Subject: [PATCH] added ability to configure number of files per page in the galleryalbum --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.5.10-7.5.11.pl | 15 +++++++++++++++ lib/WebGUI/Asset/Wobject/Gallery.pm | 7 +++++++ lib/WebGUI/Asset/Wobject/GalleryAlbum.pm | 3 ++- lib/WebGUI/i18n/English/Asset_Gallery.pm | 12 ++++++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) 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;