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 000000000..256938a1a Binary files /dev/null and b/docs/upgrades/packages-7.7.17/root_import_storymanager_editstory.wgpkg differ 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 => '
', - }) - } - - $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;