line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package meon::Web::Form::Delete; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12063669
|
use Digest::SHA qw(sha1_hex); |
|
2
|
|
|
|
|
8490
|
|
|
2
|
|
|
|
|
295
|
|
4
|
2
|
|
|
2
|
|
819
|
use meon::Web::XML2Comment; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use HTML::FormHandler::Moose; |
7
|
|
|
|
|
|
|
extends 'HTML::FormHandler'; |
8
|
|
|
|
|
|
|
with 'meon::Web::Role::Form'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has '+name' => (default => 'form-delete'); |
11
|
|
|
|
|
|
|
#has '+widget_wrapper' => ( default => 'Bootstrap' ); |
12
|
|
|
|
|
|
|
sub build_form_element_class { ['form-horizontal'] }; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has_field 'yes_delete' => ( type => 'Checkbox', required => 1, label => 'Yes delete' ); |
15
|
|
|
|
|
|
|
has_field 'submit' => ( type => 'Submit', value => 'Delete', ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub submitted { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $redirect = $self->get_config_text('redirect'); |
21
|
|
|
|
|
|
|
my $xml = meon::Web::env->xml; |
22
|
|
|
|
|
|
|
my $xpc = meon::Web::env->xpc; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my ($parent_el) = $xpc->findnodes('//w:timeline-entry/w:parent'); |
25
|
|
|
|
|
|
|
if ($parent_el) { |
26
|
|
|
|
|
|
|
my $parent_path = $parent_el->textContent; |
27
|
|
|
|
|
|
|
my $comment_to = meon::Web::XML2Comment->new( |
28
|
|
|
|
|
|
|
path => $parent_path, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
$comment_to->rm_comment(meon::Web::env->current_path); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
my ($image_el) = $xpc->findnodes('//w:timeline-entry/w:image'); |
33
|
|
|
|
|
|
|
if ($image_el) { |
34
|
|
|
|
|
|
|
meon::Web::env->current_dir->file($image_el->textContent)->remove; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
my ($attachment_el) = $xpc->findnodes('//w:timeline-entry/w:attachment'); |
37
|
|
|
|
|
|
|
if ($attachment_el) { |
38
|
|
|
|
|
|
|
meon::Web::env->current_dir->file($attachment_el->textContent)->remove; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
meon::Web::env->xml_file->remove(); |
42
|
|
|
|
|
|
|
$self->redirect($redirect); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
no HTML::FormHandler::Moose; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |