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.
This commit is contained in:
Colin Kuskie 2009-08-13 21:30:49 +00:00
parent d14d468415
commit e886474284
5 changed files with 55 additions and 54 deletions

View file

@ -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 => '<p style="display:inline;vertical-align:middle;"><a href="'.$storage->getUrl($filename).'"><img src="'.$storage->getThumbnailUrl($filename).'" alt="'.$filename.'" style="border-style:none;vertical-align:middle;" /> '.$filename.'</a></p>',
})
}
$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