Added more owner information to the gallery (RFE 9774)

This commit is contained in:
kimd 2010-05-19 17:37:34 +02:00 committed by Doug Bell
parent 7608200a6b
commit 77e331a129
6 changed files with 78 additions and 35 deletions

View file

@ -2,6 +2,7 @@
- fixed #11577: Gallery Album: "Sort by" radio list missing in "Add Archive" view - fixed #11577: Gallery Album: "Sort by" radio list missing in "Add Archive" view
- fixed #11576: Default WebGUI config has a bad macro - fixed #11576: Default WebGUI config has a bad macro
- fixed #11578: Collaboration System: add edit stamp uses wrong user - fixed #11578: Collaboration System: add edit stamp uses wrong user
- added #9774: More owner information in the gallery
7.9.5 7.9.5
- Asset->www_copy now has a progress bar - Asset->www_copy now has a progress bar

View file

@ -567,7 +567,10 @@ sub getTemplateVars {
$var->{ canComment } = $self->canComment; $var->{ canComment } = $self->canComment;
$var->{ canEdit } = $self->canEdit; $var->{ canEdit } = $self->canEdit;
$var->{ numberOfComments } = scalar @{ $self->getCommentIds }; $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 } = $self->getUrl;
$var->{ url_addArchive } = $self->getParent->getUrl('func=addArchive'), $var->{ url_addArchive } = $self->getParent->getUrl('func=addArchive'),
$var->{ url_delete } = $self->getUrl('func=delete'); $var->{ url_delete } = $self->getUrl('func=delete');

View file

@ -62,6 +62,18 @@ our $HELP = {
name => 'ownerUsername', name => 'ownerUsername',
description => 'helpvar ownerUsername', description => 'helpvar ownerUsername',
}, },
{
name => 'ownerAlias',
description => 'helpvar ownerAlias',
},
{
name => 'ownerId',
description => 'helpvar ownerId',
},
{
name => 'ownerProfileUrl',
description => 'helpvar ownerProfileUrl',
},
{ {
name => 'thumbnailUrl', name => 'thumbnailUrl',
description => 'helpvar thumbnailUrl', description => 'helpvar thumbnailUrl',

View file

@ -88,17 +88,17 @@ our $I18N = {
}, },
'helpvar isNewPhoto' => { '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, lastUpdated => 0,
}, },
'helpvar commentForm_start' => { 'helpvar commentForm_start' => {
message => 'Begin the comment form', message => 'Begin the comment form.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar commentForm_end' => { 'helpvar commentForm_end' => {
message => 'End the comment form', message => 'End the comment form.',
lastUpdated => 0, lastUpdated => 0,
}, },
@ -108,37 +108,52 @@ our $I18N = {
}, },
'helpvar commentForm_submit' => { 'helpvar commentForm_submit' => {
message => 'Submit the comment form', message => 'Submit the comment form.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar canComment' => { '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, lastUpdated => 0,
}, },
'helpvar canEdit' => { '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, lastUpdated => 0,
}, },
'helpvar fileUrl' => { 'helpvar fileUrl' => {
message => 'The URL to the normal-sized photo', message => 'The URL to the normal-sized photo.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar numberOfComments' => { 'helpvar numberOfComments' => {
message => 'The total number of comments on this photo', message => 'The total number of comments on this photo.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar ownerUsername' => { '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, lastUpdated => 0,
}, },
'helpvar thumbnailUrl' => { 'helpvar thumbnailUrl' => {
message => 'The URL to the thumbnail of this photo', message => 'The URL to the thumbnail of this photo.',
lastUpdated => 0, lastUpdated => 0,
}, },
@ -148,12 +163,12 @@ our $I18N = {
}, },
'helpvar url_demote' => { '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, lastUpdated => 0,
}, },
'helpvar url_edit' => { 'helpvar url_edit' => {
message => 'The URL to edit this photo', message => 'The URL to edit this photo.',
lastUpdated => 0, lastUpdated => 0,
}, },
@ -168,12 +183,12 @@ our $I18N = {
}, },
'helpvar url_listFilesForOwner' => { '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, lastUpdated => 0,
}, },
'helpvar url_promote' => { '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, lastUpdated => 0,
}, },
@ -193,22 +208,22 @@ our $I18N = {
}, },
'helpvar exifLoop' => { 'helpvar exifLoop' => {
message => 'A loop of EXIF tags', message => 'A loop of EXIF tags.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar exifLoop tag' => { 'helpvar exifLoop tag' => {
message => 'The name of the EXIF tag', message => 'The name of the EXIF tag.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar exifLoop value' => { 'helpvar exifLoop value' => {
message => 'The value of the EXIF tag', message => 'The value of the EXIF tag.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar url_addArchive' => { '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, lastUpdated => 0,
}, },
@ -263,7 +278,7 @@ our $I18N = {
}, },
'helpvar commentLoop' => { 'helpvar commentLoop' => {
message => 'Loop over a page of comments to this photo', message => 'Loop over a page of comments to this photo.',
lastUpdated => 0, lastUpdated => 0,
}, },
@ -278,12 +293,12 @@ our $I18N = {
}, },
'helpvar commentLoop creationDate' => { 'helpvar commentLoop creationDate' => {
message => 'The creation date of the comment', message => 'The creation date of the comment.',
lastUpdated => 0, lastUpdated => 0,
}, },
'helpvar commentLoop bodyText' => { 'helpvar commentLoop bodyText' => {
message => 'The body of the comment', message => 'The body of the comment.',
lastUpdated => 0, lastUpdated => 0,
}, },
@ -298,7 +313,7 @@ our $I18N = {
}, },
'helpvar commentLoop_pageBar' => { 'helpvar commentLoop_pageBar' => {
message => 'The bar to navigate through pages of comments', message => 'The bar to navigate through pages of comments.',
lastUpdated => 0, lastUpdated => 0,
}, },
@ -370,13 +385,13 @@ our $I18N = {
'template view title' => { 'template view title' => {
message => 'Photo Details', message => 'Photo Details',
lastUpdated => 0, 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' => { 'template view details' => {
message => 'Details', message => 'Details',
lastUpdated => 0, lastUpdated => 0,
context => 'List of information about the photo', context => 'List of information about the photo.',
}, },
'more details' => { 'more details' => {
@ -492,6 +507,12 @@ our $I18N = {
lastUpdated => 0, lastUpdated => 0,
context => 'Label for photos that are not friends only', 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' => { 'template assetName' => {
message => 'Photo', message => 'Photo',

View file

@ -24,15 +24,20 @@ use WebGUI::Asset::File::GalleryFile::Photo;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Init # Init
my $session = WebGUI::Test->session; my $session = WebGUI::Test->session;
my $user = WebGUI::User->new( $session, 3 );
my $node = WebGUI::Asset->getImportNode($session); my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session); my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Photo Test"}); $versionTag->set({name=>"Photo Test"});
addToCleanup($versionTag);
my $gallery my $gallery
= $node->addChild({ = $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery", className => "WebGUI::Asset::Wobject::Gallery",
groupIdAddComment => 7, # Everyone groupIdAddComment => 7, # Everyone
groupIdAddFile => 2, # Registered Users groupIdAddFile => 2, # Registered Users
}); });
my $album my $album
= $gallery->addChild({ = $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum", className => "WebGUI::Asset::Wobject::GalleryAlbum",
@ -42,36 +47,40 @@ my $album
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
my $previousPhoto my $previousPhoto
= $album->addChild({ = $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo", className => "WebGUI::Asset::File::GalleryFile::Photo",
ownerUserId => 3, ownerUserId => $user->getId,
}, },
undef, undef,
undef, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
my $photo my $photo
= $album->addChild({ = $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo", className => "WebGUI::Asset::File::GalleryFile::Photo",
ownerUserId => 3, ownerUserId => $user->getId,
}, },
undef, undef,
undef, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
my $nextPhoto my $nextPhoto
= $album->addChild({ = $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo", className => "WebGUI::Asset::File::GalleryFile::Photo",
ownerUserId => 3, ownerUserId => $user->getId,
}, },
undef, undef,
undef, undef,
{ {
skipAutoCommitWorkflows => 1, skipAutoCommitWorkflows => 1,
}); });
$versionTag->commit; $versionTag->commit;
$photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); $photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
@ -87,7 +96,10 @@ my $testTemplateVars = {
synopsis => '', # Synopsis is not undef, is changed to empty string synopsis => '', # Synopsis is not undef, is changed to empty string
canComment => bool( 1 ), canComment => bool( 1 ),
canEdit => bool( 0 ), 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" ), synopsis_textonly => WebGUI::HTML::filter( $photo->get('synopsis'), "all" ),
url => $photo->getUrl, url => $photo->getUrl,
url_addArchive => $album->getUrl('func=addArchive'), url_addArchive => $album->getUrl('func=addArchive'),
@ -148,9 +160,3 @@ cmp_deeply(
$testTemplateVars, $testTemplateVars,
"getTemplateVars is correct and complete", "getTemplateVars is correct and complete",
); );
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}