Code to delete photos and their data.
This commit is contained in:
parent
c8da6cfe26
commit
7b6ea1350f
2 changed files with 14 additions and 7 deletions
|
|
@ -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'),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
# }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue