From 77e331a1293bb778a980b57ce4ea550072b1534f Mon Sep 17 00:00:00 2001 From: kimd Date: Wed, 19 May 2010 17:37:34 +0200 Subject: [PATCH] Added more owner information to the gallery (RFE 9774) --- docs/changelog/7.x.x.txt | 1 + ...templates_default-gallery-view-photo.wgpkg | Bin 0 -> 4069 bytes lib/WebGUI/Asset/File/GalleryFile.pm | 5 +- lib/WebGUI/Help/Asset_Photo.pm | 12 +++ lib/WebGUI/i18n/English/Asset_Photo.pm | 69 ++++++++++++------ t/Asset/File/GalleryFile/Photo/view.t | 26 ++++--- 6 files changed, 78 insertions(+), 35 deletions(-) create mode 100644 docs/upgrades/packages-7.9.6/root_import_gallery-templates_default-gallery-view-photo.wgpkg diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index c0db8a4d9..beb8ee781 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -2,6 +2,7 @@ - fixed #11577: Gallery Album: "Sort by" radio list missing in "Add Archive" view - fixed #11576: Default WebGUI config has a bad macro - fixed #11578: Collaboration System: add edit stamp uses wrong user + - added #9774: More owner information in the gallery 7.9.5 - Asset->www_copy now has a progress bar diff --git a/docs/upgrades/packages-7.9.6/root_import_gallery-templates_default-gallery-view-photo.wgpkg b/docs/upgrades/packages-7.9.6/root_import_gallery-templates_default-gallery-view-photo.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..ded6e284fab925aab3564092f42ff35daaed9a62 GIT binary patch literal 4069 zcmVpWT}{FWRuAZ%VCwtnvchmYIJ$Cy7DAQT0B{NDWZLt+_*@JO z@IcJ|@Pa`&qYVwS5YK~f5_@@k;wp*Um%<&Kx}*55+rI#CNO3Dp=Du)}`9$n@KrUBF zy&uP&O8Z~l7>ReLk-z?-z8-~PQkReFBiHvuG_PqX#`?)7yt?tMRVSG3R@{%gNn*kN z=w7<=F`%eFY<>Uk#o@u}!Mlg`;WX$cUKlt@I2!rlcTddL`&ChOtAmYCmu}?r_6K2q zimKWiiR8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100644 --- a/lib/WebGUI/Asset/File/GalleryFile.pm +++ b/lib/WebGUI/Asset/File/GalleryFile.pm @@ -567,7 +567,10 @@ sub getTemplateVars { $var->{ canComment } = $self->canComment; $var->{ canEdit } = $self->canEdit; $var->{ numberOfComments } = scalar @{ $self->getCommentIds }; - $var->{ ownerUsername } = $owner->profileField("alias") || $owner->username; + $var->{ ownerUsername } = $owner->get("username"); + $var->{ ownerAlias } = $owner->get("alias") || $owner->get("username"); + $var->{ ownerId } = $owner->getId; + $var->{ ownerProfileUrl } = $owner->getProfileUrl; $var->{ url } = $self->getUrl; $var->{ url_addArchive } = $self->getParent->getUrl('func=addArchive'), $var->{ url_delete } = $self->getUrl('func=delete'); diff --git a/lib/WebGUI/Help/Asset_Photo.pm b/lib/WebGUI/Help/Asset_Photo.pm index 652edebdb..fa7655fa8 100644 --- a/lib/WebGUI/Help/Asset_Photo.pm +++ b/lib/WebGUI/Help/Asset_Photo.pm @@ -62,6 +62,18 @@ our $HELP = { name => 'ownerUsername', description => 'helpvar ownerUsername', }, + { + name => 'ownerAlias', + description => 'helpvar ownerAlias', + }, + { + name => 'ownerId', + description => 'helpvar ownerId', + }, + { + name => 'ownerProfileUrl', + description => 'helpvar ownerProfileUrl', + }, { name => 'thumbnailUrl', description => 'helpvar thumbnailUrl', diff --git a/lib/WebGUI/i18n/English/Asset_Photo.pm b/lib/WebGUI/i18n/English/Asset_Photo.pm index a96365896..a327c23bb 100644 --- a/lib/WebGUI/i18n/English/Asset_Photo.pm +++ b/lib/WebGUI/i18n/English/Asset_Photo.pm @@ -88,17 +88,17 @@ our $I18N = { }, 'helpvar isNewPhoto' => { - message => 'This variable is true if the user is adding a new Photo', + message => 'This variable is true if the user is adding a new Photo.', lastUpdated => 0, }, 'helpvar commentForm_start' => { - message => 'Begin the comment form', + message => 'Begin the comment form.', lastUpdated => 0, }, 'helpvar commentForm_end' => { - message => 'End the comment form', + message => 'End the comment form.', lastUpdated => 0, }, @@ -108,37 +108,52 @@ our $I18N = { }, 'helpvar commentForm_submit' => { - message => 'Submit the comment form', + message => 'Submit the comment form.', lastUpdated => 0, }, 'helpvar canComment' => { - message => 'This is true if the current user can comment on this photo', + message => 'This is true if the current user can comment on this photo.', lastUpdated => 0, }, 'helpvar canEdit' => { - message => 'This is true if the current user can edit this photo', + message => 'This is true if the current user can edit this photo.', lastUpdated => 0, }, 'helpvar fileUrl' => { - message => 'The URL to the normal-sized photo', + message => 'The URL to the normal-sized photo.', lastUpdated => 0, }, 'helpvar numberOfComments' => { - message => 'The total number of comments on this photo', + message => 'The total number of comments on this photo.', lastUpdated => 0, }, 'helpvar ownerUsername' => { - message => 'The username of the user who posted this photo', + message => 'The username of the user who posted this photo.', + lastUpdated => 0, + }, + + 'helpvar ownerAlias' => { + message => 'The alias of the user who posted this photo. Defaults to the username if not available.', + lastUpdated => 0, + }, + + 'helpvar ownerId' => { + message => 'The Id of the user who posted this photo.', + lastUpdated => 0, + }, + + 'helpvar ownerProfileUrl' => { + message => 'The URL to the profile of the user who posted this photo.', lastUpdated => 0, }, 'helpvar thumbnailUrl' => { - message => 'The URL to the thumbnail of this photo', + message => 'The URL to the thumbnail of this photo.', lastUpdated => 0, }, @@ -148,12 +163,12 @@ our $I18N = { }, 'helpvar url_demote' => { - message => 'The URL to demote this photo in rank. Will return the user directly to the parent GalleryAlbum edit form', + message => 'The URL to demote this photo in rank. Will return the user directly to the parent GalleryAlbum edit form.', lastUpdated => 0, }, 'helpvar url_edit' => { - message => 'The URL to edit this photo', + message => 'The URL to edit this photo.', lastUpdated => 0, }, @@ -168,12 +183,12 @@ our $I18N = { }, 'helpvar url_listFilesForOwner' => { - message => 'The URL to list files and albums posted by the owner of this photo', + message => 'The URL to list files and albums posted by the owner of this photo.', lastUpdated => 0, }, 'helpvar url_promote' => { - message => 'The URL to promote this photo in rank. Will return the user directly to the parent GalleryAlbum edit form', + message => 'The URL to promote this photo in rank. Will return the user directly to the parent GalleryAlbum edit form.', lastUpdated => 0, }, @@ -193,22 +208,22 @@ our $I18N = { }, 'helpvar exifLoop' => { - message => 'A loop of EXIF tags', + message => 'A loop of EXIF tags.', lastUpdated => 0, }, 'helpvar exifLoop tag' => { - message => 'The name of the EXIF tag', + message => 'The name of the EXIF tag.', lastUpdated => 0, }, 'helpvar exifLoop value' => { - message => 'The value of the EXIF tag', + message => 'The value of the EXIF tag.', lastUpdated => 0, }, 'helpvar url_addArchive' => { - message => 'The URL to add an archive to the parent Album', + message => 'The URL to add an archive to the parent Album.', lastUpdated => 0, }, @@ -263,7 +278,7 @@ our $I18N = { }, 'helpvar commentLoop' => { - message => 'Loop over a page of comments to this photo', + message => 'Loop over a page of comments to this photo.', lastUpdated => 0, }, @@ -278,12 +293,12 @@ our $I18N = { }, 'helpvar commentLoop creationDate' => { - message => 'The creation date of the comment', + message => 'The creation date of the comment.', lastUpdated => 0, }, 'helpvar commentLoop bodyText' => { - message => 'The body of the comment', + message => 'The body of the comment.', lastUpdated => 0, }, @@ -298,7 +313,7 @@ our $I18N = { }, 'helpvar commentLoop_pageBar' => { - message => 'The bar to navigate through pages of comments', + message => 'The bar to navigate through pages of comments.', lastUpdated => 0, }, @@ -370,13 +385,13 @@ our $I18N = { 'template view title' => { message => 'Photo Details', lastUpdated => 0, - context => 'The title of the default view of Photo assets', + context => 'The title of the default view of Photo assets.', }, 'template view details' => { message => 'Details', lastUpdated => 0, - context => 'List of information about the photo', + context => 'List of information about the photo.', }, 'more details' => { @@ -492,6 +507,12 @@ our $I18N = { lastUpdated => 0, context => 'Label for photos that are not friends only', }, + + 'template filesForUser' => { + message => 'more photos', + lastUpdated => 0, + context => 'Label for the link to the users\' photos.', + }, 'template assetName' => { message => 'Photo', diff --git a/t/Asset/File/GalleryFile/Photo/view.t b/t/Asset/File/GalleryFile/Photo/view.t index 97b3eb317..fc400dd6e 100644 --- a/t/Asset/File/GalleryFile/Photo/view.t +++ b/t/Asset/File/GalleryFile/Photo/view.t @@ -24,15 +24,20 @@ use WebGUI::Asset::File::GalleryFile::Photo; #---------------------------------------------------------------------------- # Init my $session = WebGUI::Test->session; +my $user = WebGUI::User->new( $session, 3 ); my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); + $versionTag->set({name=>"Photo Test"}); +addToCleanup($versionTag); + my $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", groupIdAddComment => 7, # Everyone groupIdAddFile => 2, # Registered Users }); + my $album = $gallery->addChild({ className => "WebGUI::Asset::Wobject::GalleryAlbum", @@ -42,36 +47,40 @@ my $album { skipAutoCommitWorkflows => 1, }); + my $previousPhoto = $album->addChild({ className => "WebGUI::Asset::File::GalleryFile::Photo", - ownerUserId => 3, + ownerUserId => $user->getId, }, undef, undef, { skipAutoCommitWorkflows => 1, }); + my $photo = $album->addChild({ className => "WebGUI::Asset::File::GalleryFile::Photo", - ownerUserId => 3, + ownerUserId => $user->getId, }, undef, undef, { skipAutoCommitWorkflows => 1, }); + my $nextPhoto = $album->addChild({ className => "WebGUI::Asset::File::GalleryFile::Photo", - ownerUserId => 3, + ownerUserId => $user->getId, }, undef, undef, { skipAutoCommitWorkflows => 1, }); + $versionTag->commit; $photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); @@ -87,7 +96,10 @@ my $testTemplateVars = { synopsis => '', # Synopsis is not undef, is changed to empty string canComment => bool( 1 ), canEdit => bool( 0 ), - ownerUsername => WebGUI::User->new( $session, 3 )->username, + ownerUsername => $user->get("username"), + ownerAlias => $user->get("alias") || $user->get("username"), + ownerId => $user->getId, + ownerProfileUrl => $user->getProfileUrl, synopsis_textonly => WebGUI::HTML::filter( $photo->get('synopsis'), "all" ), url => $photo->getUrl, url_addArchive => $album->getUrl('func=addArchive'), @@ -148,9 +160,3 @@ cmp_deeply( $testTemplateVars, "getTemplateVars is correct and complete", ); - -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback(); -}