From 95e9e52389961147fe42b0f451f7b253036abc1d Mon Sep 17 00:00:00 2001 From: kimd Date: Sun, 2 May 2010 20:47:13 +0200 Subject: [PATCH] Gallery: Allow specification of location when uploading ZIP archives (RFE 11502) --- docs/changelog/7.x.x.txt | 3 ++ ...emplates_default-gallery-add-archive.wgpkg | Bin 0 -> 1485 bytes lib/WebGUI/Asset/Wobject/GalleryAlbum.pm | 7 +++ lib/WebGUI/Help/Asset_GalleryAlbum.pm | 4 ++ lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm | 13 ++++- t/Asset/Wobject/GalleryAlbum/addArchive.t | 51 ++++++++++++++---- 6 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 docs/upgrades/packages-7.9.5/root_import_gallery-templates_default-gallery-add-archive.wgpkg 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 0000000000000000000000000000000000000000..cf6bb0c81caffbffdc34324ad25996830c4505ea GIT binary patch literal 1485 zcmV;;1v2^{iwFP!00000|Ls_9bJ{o%=5v3Ak1uIwO0WUf4dIwcuW7?v+e@c;xtr25 z0t?VZmOPRiLT~!tZzWq;kdR4I=-r2SCJfO^t4GhSb|1W3+5Y4EeiVk4ith(e=vOMu zD1W@g<5z;9`66nzno$^4yufcX!-@w>w*O>OApy{2nz4)d!}o(j!lMtVpNIST$tw-o zp!^I%{XOt^|CXF>2n#rT(Q2)We-N~S#!CE~VE}3HQ&`+q{C77*-j?0`^8_woRpBJ1 zNZ|oe3XP@-W=dAQw)gqVb7Pl^3pBy*P%3zeg(BEYG;Xw~k-*?5el^!~tIeueuMHGQ zb$FF>0oDVvhGmp4%y0{p@n21|AtiE(<8m#-vva~?J~K}J(je!Ir;=QEhp&`CM;OH? zXd;i%=mOknKpjfhg*O#={A<7Zwf;DHijZB}3LxoDjAB0 zVUbjGiUA&0Fr?-whA{=()nOWp)Vn1*K4Vy%N-TQ$<_;T6_zbeX`U%+jqR-5q>iklx zeI{eCcj!f5y2aT2$r%tF-IpK>;4@}18GotO9LkWCSQT{nf3`k0)vNQ<;XqC0*--xV zZSU%1NpB{oVea-A#(0b}s%kd6D2{7LjHcugm#&CBB5{nF@fWz`$AT-a!)#1W>P-aC z(q4QR6J<yf*&;$+M=Bau>hgq`oY`;?nFHUUJJGmV4c)s3a+U+aHrGf%6fPBG1aAC2h z-UzO>gtM7pI8?{XyF{Xx*r|gboph>GFI+f43(I27n2Thf`?0c%6dF>z*u^k-qKDw7 znTrTp&q%DM?PlnwS1>xll%~KNVH2>0CC|#D1}G|CxTI)^Da=|MgDj;S#pb53CriZz zVB>u89sWbM*p$pb-VOla@f0$vt05O0n$x|?l;Z3TfFzvowv0e73YjAIz#V?m%x$UhjprBtm@Ti!HNPaGHBHR)M5WyYQ&FIT#3+Y+Pudks-CVQoPs zQ?>8Zoc#oe31KzG({`v!kgc0a=cKNhx*Fz{EgL3eQQGRT!}6BPv*Fyi8Sr$>WT!8& zDHcSX3i?LyQzSqNnvK>F*lr)4ynlC{P9ooNtzdIey(F87EXZ3unHzm$+uMuw z_QI&)NEm@Hi3H8@+Dh-6!bFUGwyENBJLR(;djl;yXTvdN66c!RD)3cw3{naD#wh2> zRWo%6{4eBna|tzjwd$LGW80Yf zZU`E "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" ); #----------------------------------------------------------------------------