diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ad4eb3b57..0001a0852 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,3 +1,6 @@ +7.9.5 + - added #11502: Gallery: Allow specification of location when uploading ZIP archives + 7.9.4 - We're shipping underscore.js now for its suite of extremely handy utility functions. Include it from www/extras/underscore/underscore-min.js. diff --git a/docs/upgrades/packages-7.9.5/root_import_gallery-templates_default-gallery-add-archive.wgpkg b/docs/upgrades/packages-7.9.5/root_import_gallery-templates_default-gallery-add-archive.wgpkg new file mode 100644 index 000000000..cf6bb0c81 Binary files /dev/null and b/docs/upgrades/packages-7.9.5/root_import_gallery-templates_default-gallery-add-archive.wgpkg differ diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index 9ef7f408a..16a82ef49 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -988,6 +988,12 @@ sub www_addArchive { name => "keywords", value => ( $form->get("keywords") ), }); + + $var->{ form_location } + = WebGUI::Form::Text( $session, { + name => "location", + value => ( $form->get("location") ), + }); $var->{ form_friendsOnly } = WebGUI::Form::yesNo( $session, { @@ -1019,6 +1025,7 @@ sub www_addArchiveSave { my $pb = WebGUI::ProgressBar->new($session); my $properties = { keywords => $form->get("keywords"), + location => $form->get("location"), friendsOnly => $form->get("friendsOnly"), }; diff --git a/lib/WebGUI/Help/Asset_GalleryAlbum.pm b/lib/WebGUI/Help/Asset_GalleryAlbum.pm index b8a042a20..7c874ee04 100644 --- a/lib/WebGUI/Help/Asset_GalleryAlbum.pm +++ b/lib/WebGUI/Help/Asset_GalleryAlbum.pm @@ -250,6 +250,10 @@ our $HELP = { name => 'form_keywords', description => 'helpvar form_keywords', }, + { + name => 'form_location', + description => 'helpvar form_location', + }, { name => 'form_friendsOnly', description => 'helpvar form_friendsOnly', diff --git a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm index fd784e874..f033cfd18 100644 --- a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm +++ b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm @@ -277,6 +277,11 @@ our $I18N = { message => 'The keywords for the files being uploaded.', lastUpdated => 0, }, + + 'helpvar form_location' => { + message => 'The location for the files being uploaded.', + lastUpdated => 0, + }, 'helpvar form_friendsOnly' => { message => 'Should the file be friends only?', @@ -451,7 +456,13 @@ our $I18N = { lastUpdated => 0, context => 'Label for the "keywords" field of the Add Archive page', }, - + + 'addArchive location' => { + message => 'Location', + lastUpdated => 0, + context => 'Label for the "location" field of the Add Archive page', + }, + 'addArchive friendsOnly' => { message => 'Friends Only', lastUpdated => 0, diff --git a/t/Asset/Wobject/GalleryAlbum/addArchive.t b/t/Asset/Wobject/GalleryAlbum/addArchive.t index 9673d90c8..cc565a862 100644 --- a/t/Asset/Wobject/GalleryAlbum/addArchive.t +++ b/t/Asset/Wobject/GalleryAlbum/addArchive.t @@ -46,12 +46,19 @@ my $album skipAutoCommitWorkflows => 1, }); -$album->addArchive( WebGUI::Test->getTestCollateralPath('elephant_images.zip') ); +# Properties applied to every photo in the archive +my $properties = { + keywords => "something", + location => "somewhere", + friendsOnly => "1", +}; + +$album->addArchive( WebGUI::Test->getTestCollateralPath('elephant_images.zip'), $properties ); $versionTag->commit; #---------------------------------------------------------------------------- # Tests -plan tests => 5; +plan tests => 8; #---------------------------------------------------------------------------- # Test the addArchive sub @@ -59,28 +66,50 @@ plan tests => 5; my $images = $album->getLineage(['descendants'], { returnObjects => 1 }); is( scalar @$images, 3, "addArchive() adds one asset per image" ); -cmp_deeply( +cmp_bag( [ map { $_->get("filename") } @$images ], - bag( "Aana1.jpg", "Aana2.jpg", "Aana3.jpg" ), + [ "Aana1.jpg", "Aana2.jpg", "Aana3.jpg" ], + "Names of files attached to Photo assets match filenames in archive" ); -cmp_deeply( +cmp_bag( [ map { $_->get("title") } @$images ], - bag( "Aana1", "Aana2", "Aana3" ), + [ "Aana1", "Aana2", "Aana3" ], + "Titles of Photo assets match filenames in archive excluding extensions" ); -cmp_deeply( +cmp_bag( [ map { $_->get("menuTitle") } @$images ], - bag( "Aana1", "Aana2", "Aana3" ), + [ "Aana1", "Aana2", "Aana3" ], + "Menu titles of Photo assets match filenames in archive excluding extensions" ); -cmp_deeply( +cmp_bag( [ map { $_->get("url") } @$images ], - bag( + [ $session->url->urlize( $album->getUrl . "/Aana1" ), $session->url->urlize( $album->getUrl . "/Aana2" ), $session->url->urlize( $album->getUrl . "/Aana3" ), - ), + ], + "URLs of Photo assets match filenames in archive excluding extensions" +); + +cmp_bag( + [ map { $_->get("keywords") } @$images ], + [ "something", "something", "something" ], + "Keywords of Photo assets match keywords in properties" +); + +cmp_bag( + [ map { $_->get("location") } @$images ], + [ "somewhere", "somewhere", "somewhere" ], + "Location of Photo assets match keywords in properties" +); + +cmp_bag( + [ map { $_->get("friendsOnly") } @$images ], + [ "1", "1", "1" ], + "Photo assets are viewable by friends only" ); #----------------------------------------------------------------------------