Gallery: Allow specification of location when uploading ZIP archives (RFE 11502)

This commit is contained in:
kimd 2010-05-02 20:47:13 +02:00
parent 1c70821a6f
commit 95e9e52389
6 changed files with 66 additions and 12 deletions

View file

@ -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.

View file

@ -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"),
};

View file

@ -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',

View file

@ -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,

View file

@ -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"
);
#----------------------------------------------------------------------------