Code to delete photos and their data.

This commit is contained in:
Colin Kuskie 2009-03-23 05:11:01 +00:00
parent c8da6cfe26
commit 7b6ea1350f
2 changed files with 14 additions and 7 deletions

View file

@ -501,10 +501,17 @@ sub processPropertiesFromFormPost {
my $photoData = $self->getPhotoData;
my $numberOfPhotos = scalar @{ $photoData };
##Post process photo data here.
foreach my $photoIndex (1..$numberOfPhotos) {
PHOTO: foreach my $photoIndex (1..$numberOfPhotos) {
##TODO: Deletion check and storage cleanup
my $storageId = $photoData->[$photoIndex-1]->{storageId};
if ($form->process('deletePhoto'.$photoIndex)) {
my $storage = WebGUI::Storage->get($session, $storageId);
$storage->delete if $storage;
splice @{ $photoData }, $photoIndex-1, 1;
next PHOTO;
}
my $newPhoto = {
storageId => $form->process('photo' .$photoIndex, 'image', $photoData->[$photoIndex-1]->{storageId}),
storageId => $form->process('photo' .$photoIndex, 'image', ),
caption => $form->process('imgCaption'.$photoIndex, 'text'),
alt => $form->process('imgAlt' .$photoIndex, 'text'),
title => $form->process('imgTitle' .$photoIndex, 'text'),

View file

@ -191,9 +191,9 @@ cmp_deeply(
#----------------------------------------------------------------------------
# Cleanup
END {
$archive->purge if $archive;
$topic->purge if $topic;
if ($versionTag) {
$versionTag->rollback;
}
# $archive->purge if $archive;
# $topic->purge if $topic;
# if ($versionTag) {
# $versionTag->rollback;
# }
}