Revision 58e4b809
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/drafts.pl | ||
---|---|---|
14 | 14 |
require "bin/mozilla/common.pl"; |
15 | 15 |
|
16 | 16 |
sub save_draft { |
17 |
$lxdebug->enter_sub(); |
|
17 |
$main::lxdebug->enter_sub(); |
|
18 |
|
|
19 |
my $form = $main::form; |
|
20 |
my %myconfig = %main::myconfig; |
|
21 |
my $locale = $main::locale; |
|
18 | 22 |
|
19 | 23 |
if (!$form->{draft_id} && !$form->{draft_description}) { |
20 | 24 |
restore_form($form->{SAVED_FORM}, 1) if ($form->{SAVED_FORM}); |
... | ... | |
26 | 30 |
$form->header(); |
27 | 31 |
print($form->parse_html_template("drafts/save_new")); |
28 | 32 |
|
29 |
return $lxdebug->leave_sub(); |
|
33 |
return $main::lxdebug->leave_sub();
|
|
30 | 34 |
} |
31 | 35 |
|
32 | 36 |
my ($draft_id, $draft_description) = ($form->{draft_id}, $form->{draft_description}); |
... | ... | |
40 | 44 |
|
41 | 45 |
update(); |
42 | 46 |
|
43 |
$lxdebug->leave_sub(); |
|
47 |
$main::lxdebug->leave_sub();
|
|
44 | 48 |
} |
45 | 49 |
|
46 | 50 |
sub remove_draft { |
47 |
$lxdebug->enter_sub(); |
|
51 |
$main::lxdebug->enter_sub(); |
|
52 |
|
|
53 |
my $form = $main::form; |
|
54 |
my %myconfig = %main::myconfig; |
|
48 | 55 |
|
49 | 56 |
Drafts->remove(\%myconfig, $form, $form->{draft_id}) if ($form->{draft_id}); |
50 | 57 |
|
51 | 58 |
delete @{$form}{qw(draft_id draft_description)}; |
52 | 59 |
|
53 |
$lxdebug->leave_sub(); |
|
60 |
$main::lxdebug->leave_sub();
|
|
54 | 61 |
} |
55 | 62 |
|
56 | 63 |
sub load_draft_maybe { |
57 |
$lxdebug->enter_sub(); |
|
64 |
$main::lxdebug->enter_sub();
|
|
58 | 65 |
|
59 |
$lxdebug->leave_sub() and return 0 if ($form->{DONT_LOAD_DRAFT}); |
|
66 |
my $form = $main::form; |
|
67 |
my %myconfig = %main::myconfig; |
|
68 |
|
|
69 |
$main::lxdebug->leave_sub() and return 0 if ($form->{DONT_LOAD_DRAFT}); |
|
60 | 70 |
|
61 | 71 |
my ($draft_nextsub) = @_; |
62 | 72 |
|
63 | 73 |
my @drafts = Drafts->list(\%myconfig, $form); |
64 | 74 |
|
65 |
$lxdebug->leave_sub() and return 0 unless (@drafts); |
|
75 |
$main::lxdebug->leave_sub() and return 0 unless (@drafts);
|
|
66 | 76 |
|
67 | 77 |
$draft_nextsub = "add" unless ($draft_nextsub); |
68 | 78 |
|
... | ... | |
75 | 85 |
"SAVED_FORM" => $saved_form, |
76 | 86 |
"draft_nextsub" => $draft_nextsub })); |
77 | 87 |
|
78 |
$lxdebug->leave_sub(); |
|
88 |
$main::lxdebug->leave_sub();
|
|
79 | 89 |
|
80 | 90 |
return 1; |
81 | 91 |
} |
82 | 92 |
|
83 | 93 |
sub dont_load_draft { |
84 |
$lxdebug->enter_sub(); |
|
94 |
$main::lxdebug->enter_sub(); |
|
95 |
|
|
96 |
my $form = $main::form; |
|
85 | 97 |
|
86 | 98 |
my $draft_nextsub = $form->{draft_nextsub} || "add"; |
87 | 99 |
|
... | ... | |
92 | 104 |
|
93 | 105 |
call_sub($draft_nextsub); |
94 | 106 |
|
95 |
$lxdebug->leave_sub(); |
|
107 |
$main::lxdebug->leave_sub();
|
|
96 | 108 |
} |
97 | 109 |
|
98 | 110 |
sub load_draft { |
99 |
$lxdebug->enter_sub(); |
|
111 |
$main::lxdebug->enter_sub(); |
|
112 |
|
|
113 |
my $form = $main::form; |
|
114 |
my %myconfig = %main::myconfig; |
|
100 | 115 |
|
101 | 116 |
my ($old_form, $id, $description) = Drafts->load(\%myconfig, $form, $form->{id}); |
102 | 117 |
|
... | ... | |
104 | 119 |
$old_form = YAML::Load($old_form); |
105 | 120 |
|
106 | 121 |
my %dont_save_vars = map { $_ => 1 } @Drafts::dont_save; |
107 |
my @restore_vars = grep { !$skip_vars{$_} } keys %{ $old_form };
|
|
122 |
my @restore_vars = grep { !$dont_save_vars{$_} } keys %{ $old_form };
|
|
108 | 123 |
|
109 | 124 |
@{$form}{@restore_vars} = @{$old_form}{@restore_vars}; |
110 | 125 |
|
... | ... | |
115 | 130 |
|
116 | 131 |
update(); |
117 | 132 |
|
118 |
$lxdebug->leave_sub(); |
|
133 |
$main::lxdebug->leave_sub();
|
|
119 | 134 |
} |
120 | 135 |
|
121 | 136 |
sub delete_drafts { |
122 |
$lxdebug->enter_sub(); |
|
137 |
$main::lxdebug->enter_sub(); |
|
138 |
|
|
139 |
my $form = $main::form; |
|
140 |
my %myconfig = %main::myconfig; |
|
123 | 141 |
|
124 | 142 |
my @ids; |
125 | 143 |
foreach (keys %{$form}) { |
... | ... | |
132 | 150 |
|
133 | 151 |
add(); |
134 | 152 |
|
135 |
$lxdebug->leave_sub(); |
|
153 |
$main::lxdebug->leave_sub();
|
|
136 | 154 |
} |
137 | 155 |
|
138 | 156 |
sub draft_action_dispatcher { |
139 |
$lxdebug->enter_sub(); |
|
157 |
$main::lxdebug->enter_sub(); |
|
158 |
|
|
159 |
my $form = $main::form; |
|
160 |
my $locale = $main::locale; |
|
140 | 161 |
|
141 | 162 |
if ($form->{draft_action} eq $locale->text("Skip")) { |
142 | 163 |
dont_load_draft(); |
... | ... | |
145 | 166 |
delete_drafts(); |
146 | 167 |
} |
147 | 168 |
|
148 |
$lxdebug->leave_sub(); |
|
169 |
$main::lxdebug->leave_sub();
|
|
149 | 170 |
} |
150 | 171 |
|
151 | 172 |
1; |
Auch abrufbar als: Unified diff
draft strict