From e886474284763453626f6ae3e985bc2f5989a995 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 13 Aug 2009 21:30:49 +0000 Subject: [PATCH] Draw a fieldset around each Photo and its metadata. Change the delete label so that it is clear that you are deleting the image and the metadata. Redo the image upload form so that it is clear that uploading a new image to a photo with an existing image replaces the existing with the new one. --- docs/changelog/7.x.x.txt | 1 + .../root_import_storymanager_editstory.wgpkg | Bin 0 -> 1644 bytes lib/WebGUI/Asset/Story.pm | 57 ++++-------------- lib/WebGUI/Help/Asset_Story.pm | 16 +++-- lib/WebGUI/i18n/English/Asset_Story.pm | 35 ++++++++++- 5 files changed, 55 insertions(+), 54 deletions(-) create mode 100644 docs/upgrades/packages-7.7.17/root_import_storymanager_editstory.wgpkg diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 908d6fa54..e1889774d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.7.17 + - fixed #10655: Story: can't delete photos - fixed #10769: No default privacy setting for new User profile fields - fixed #10731: i18n Translation for js-based items in Matrix - fixed #10762: testCodebase only runs properly from within the bin directory diff --git a/docs/upgrades/packages-7.7.17/root_import_storymanager_editstory.wgpkg b/docs/upgrades/packages-7.7.17/root_import_storymanager_editstory.wgpkg new file mode 100644 index 0000000000000000000000000000000000000000..256938a1a4c322663956fa8a271fbfe9148f4aaa GIT binary patch literal 1644 zcmV-y29x<8iwFP!00000|Ls|AZ`(Ey&gcFL!Jjsutu4RAv+Egfnzl*TcJ7+A=+-Tu zCE8*`lLAS{b%y@;9Z!;_Sh8!k5>Q|jkjVBO?;ak>yL+UEN7Y}AMx)#9939#FaU1V$ z8}82fY8<(4v+cT#mfPtZIq<=Cj~p0M{k71BD1hck&cyY0e+x~O-Y&M2g9|5z_Z_O= zlL%3}>Hkg#Kerx!)KZiL6f7Rc>t3+_Zl~+EH`c%1a+^mEM6>#{Cf`$ zVa?Ea$cdp>#2DfQb1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rH2ws57St;V)VQpt?ZX*Bc=d%0Mp9h0PaHG&0WN30=hW6W)&q zGM;U#0YuJ=;)DxZN5;H<3XyQ-^oc<&-^^th^Im*8ZI`BiJ7&wsl`CS(*7mxgD&)x# zTSg2{af&RU$j&BQv&oRlaGX%x;=G*0kf>)%NEt8^in}L_M7?YnyV{>zEb>gaj7TJu zcF#y8>SaeFA+!;Ul=|kPkSLZ7;7gP@2P7R(Hk2JyH-{p}bobs9So#Y&t~CMA^0xO@ zSq6)|GY1R$wLGWU8`_ur?!gA9XET;)Fbriz?EWnQ@K2w&VIjsZbqMcZMteP qyO6U~dEM#8`0P8n&-Xr;@jmc}jUN&C5rO|t1pWi4;->=uBme+Uuryu( literal 0 HcmV?d00001 diff --git a/lib/WebGUI/Asset/Story.pm b/lib/WebGUI/Asset/Story.pm index 56314536d..2679eb28b 100644 --- a/lib/WebGUI/Asset/Story.pm +++ b/lib/WebGUI/Asset/Story.pm @@ -426,9 +426,18 @@ sub getEditForm { my $photoData = $self->getPhotoData; my $numberOfPhotos = scalar @{ $photoData }; foreach my $photoIndex (1..$numberOfPhotos) { - my $photo = $photoData->[$photoIndex-1]; + my $photo = $photoData->[$photoIndex-1]; + my $storage = WebGUI::Storage->get($session, $photo->{storageId}); + my $filename = $storage->getFiles->[0]; push @{ $var->{ photo_form_loop } }, { - imgUploadForm => $self->getPhotoUploadForm($photoIndex, $photo->{storageId}), + hasPhoto => $filename ? 1 : 0, + imgThumb => $filename ? $storage->getThumbnailUrl($filename) : '', + imgUrl => $filename ? $storage->getUrl($filename) : '', + imgFilename => $filename ? $filename : '', + newUploadForm => WebGUI::Form::file($session, { + name => 'newPhoto' . $photoIndex, + maxAttachments => 1, + }), imgCaptionForm => WebGUI::Form::text($session, { name => 'imgCaption'.$photoIndex, value => $photo->{caption}, @@ -456,7 +465,7 @@ sub getEditForm { }; } push @{ $var->{ photo_form_loop } }, { - imgUploadForm => WebGUI::Form::image($session, { + newUploadForm => WebGUI::Form::image($session, { name => 'newPhoto', maxAttachments => 1, }), @@ -507,48 +516,6 @@ sub getPhotoData { #------------------------------------------------------------------- -=head2 getPhotoUploadForm ( $index, $storageId ) - -Render a simple file form control that displays the current image if it is -uploaded. - -=head3 $index - -The index of a piece of Photo collateral. An upload form for that index -will be generated. - -=head3 $storageId - -The storage location for that piece of Photo collateral, to display an -existing image if it exists. - -=cut - -sub getPhotoUploadForm { - my $self = shift; - my $session = $self->session; - my $index = shift; - my $storageId = shift; - - my $html = ''; - my $storage = WebGUI::Storage->get($session, $storageId); - my $filename = $storage->getFiles->[0]; - - if ($filename) { - $html .= WebGUI::Form::readOnly($session, { - value => '

'.$filename.' '.$filename.'

', - }) - } - - $html .= WebGUI::Form::file($session, { - name => 'newPhoto' . $index, - maxAttachments => 1, - }); - return $html; -} - -#------------------------------------------------------------------- - =head2 getRssData ( ) Returns RSS data for this Story. The date of the RSS item is the lastModified diff --git a/lib/WebGUI/Help/Asset_Story.pm b/lib/WebGUI/Help/Asset_Story.pm index 2e3feaa94..e42314d59 100644 --- a/lib/WebGUI/Help/Asset_Story.pm +++ b/lib/WebGUI/Help/Asset_Story.pm @@ -32,13 +32,17 @@ our $HELP = { { name => 'cancelButton', }, { name => 'photo_form_loop', variables => [ - { name => 'imgUploadForm', }, + { name => 'hasPhoto', }, + { name => 'imgThumb', }, + { name => 'imgUrl', }, + { name => 'imgFilename', }, + { name => 'newUploadForm', }, { name => 'imgCaptionForm', }, - { name => 'imgBylineForm', }, - { name => 'imgAltForm', }, - { name => 'imgTitleForm', }, - { name => 'imgUrlForm', }, - { name => 'imgDeleteForm', }, + { name => 'imgBylineForm', }, + { name => 'imgAltForm', }, + { name => 'imgTitleForm', }, + { name => 'imgUrlForm', }, + { name => 'imgDeleteForm', }, ], }, ], diff --git a/lib/WebGUI/i18n/English/Asset_Story.pm b/lib/WebGUI/i18n/English/Asset_Story.pm index 6d167b0c5..d49ad7524 100644 --- a/lib/WebGUI/i18n/English/Asset_Story.pm +++ b/lib/WebGUI/i18n/English/Asset_Story.pm @@ -292,7 +292,7 @@ our $I18N = { lastUpdated => 0, }, - 'imgUploadForm' => { + 'newUploadForm' => { message => q|A form field to upload an image.|, context => q|Template variable for edit form.|, lastUpdated => 0, @@ -365,9 +365,9 @@ our $I18N = { }, 'photo delete' => { - message => q|Delete Photo|, + message => q|Delete Photo and Metadata|, context => q|Label in the edit story form. Request that the photo be deleted, and all information with it.|, - lastUpdated => 0, + lastUpdated => 1250195747, }, 'photo_loop' => { @@ -418,6 +418,30 @@ our $I18N = { lastUpdated => 0, }, + 'hasPhoto' => { + message => q|This template variable will be true if the a photo in the photo_loop has an image in it.|, + context => q|Template variable|, + lastUpdated => 0, + }, + + 'imgThumb' => { + message => q|The URL to the thumbnail of the image, if this photo has an image.|, + context => q|Template variable|, + lastUpdated => 0, + }, + + 'imgUrl' => { + message => q|The URL to the image, if this photo has an image.|, + context => q|Template variable|, + lastUpdated => 0, + }, + + 'imgFilename' => { + message => q|The URL to the image, if this photo has an image.|, + context => q|Template variable|, + lastUpdated => 0, + }, + 'singlePhoto' => { message => q|This template variable will be true if the Story has just 1 photo uploaded to it.|, context => q|Template variable|, @@ -441,6 +465,11 @@ our $I18N = { lastUpdated => 0, }, + 'Replace image with new image' => { + message => q|Replace image with new image|, + lastUpdated => 0, + }, + }; 1;