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 000000000..ded6e284f Binary files /dev/null and b/docs/upgrades/packages-7.9.6/root_import_gallery-templates_default-gallery-view-photo.wgpkg differ diff --git a/lib/WebGUI/Asset/File/GalleryFile.pm b/lib/WebGUI/Asset/File/GalleryFile.pm index 835fa3281..7ee58f527 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(); -}