Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f4a98169

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

  • ID f4a98169e202798ab998e3989b130f952977adc2
  • Vorgänger 05311eb0
  • Nachfolger ed4ab03f

amcvar strict

Unterschiede anzeigen:

bin/mozilla/amcvar.pl
38 38
use Data::Dumper;
39 39
use List::MoreUtils qw(any);
40 40

  
41
1;
42

  
43 41
require "bin/mozilla/common.pl";
44 42

  
43
use strict;
44

  
45
1;
46

  
45 47
# end of main
46 48

  
49
my $locale   = $main::locale;
47 50
our %translations = ('text'      => $locale->text('Free-form text'),
48 51
                     'textfield' => $locale->text('Text field'),
49 52
                     'number'    => $locale->text('Number'),
......
75 78
}
76 79

  
77 80
sub list_cvar_configs {
78
  $lxdebug->enter_sub();
81
  $main::lxdebug->enter_sub();
82

  
83
  my $form     = $main::form;
84
  my $locale   = $main::locale;
79 85

  
80
  $auth->assert('config');
86
  $main::auth->assert('config');
81 87

  
82 88
  $form->{module} = $form->{module} || $form->{cvar_module} || 'CT';
83 89
  $form->{module} = 'CT' unless _is_valid_module($form->{module});
......
104 110

  
105 111
  $main::lxdebug->dump(0, "modules", \@modules);
106 112

  
107
  $lxdebug->leave_sub();
113
  $main::lxdebug->leave_sub();
108 114
}
109 115

  
110 116
sub add_cvar_config {
111
  $lxdebug->enter_sub();
117
  $main::lxdebug->enter_sub();
118

  
119
  my $form     = $main::form;
112 120

  
113
  $auth->assert('config');
121
  $main::auth->assert('config');
114 122

  
115 123
  $form->{module} = $form->{module} || $form->{cvar_module} || 'CT';
116 124

  
117 125
  $form->{edit} = 0;
118 126
  display_cvar_config_form();
119 127

  
120
  $lxdebug->leave_sub();
128
  $main::lxdebug->leave_sub();
121 129
}
122 130

  
123 131
sub edit_cvar_config {
124
  $lxdebug->enter_sub();
132
  $main::lxdebug->enter_sub();
125 133

  
126
  $auth->assert('config');
134
  my $form     = $main::form;
135

  
136
  $main::auth->assert('config');
127 137

  
128 138
  my $config = CVar->get_config('id' => $form->{id});
129 139

  
......
132 142
  $form->{edit} = 1;
133 143
  display_cvar_config_form();
134 144

  
135
  $lxdebug->leave_sub();
145
  $main::lxdebug->leave_sub();
136 146
}
137 147

  
138 148
sub save {
139
  $lxdebug->enter_sub();
149
  $main::lxdebug->enter_sub();
150

  
151
  my $form     = $main::form;
152
  my %myconfig = %main::myconfig;
153
  my $locale   = $main::locale;
140 154

  
141
  $auth->assert('config');
155
  $main::auth->assert('config');
142 156

  
143 157
  $form->isblank('name',        $locale->text('The name is missing.'));
144 158
  $form->isblank('description', $locale->text('The description is missing.'));
......
163 177

  
164 178
  list_cvar_configs();
165 179

  
166
  $lxdebug->leave_sub();
180
  $main::lxdebug->leave_sub();
167 181
}
168 182

  
169 183
sub delete {
170
  $lxdebug->enter_sub();
184
  $main::lxdebug->enter_sub();
185

  
186
  my $form     = $main::form;
187
  my $locale   = $main::locale;
171 188

  
172 189
  CVar->delete_config('id' => $form->{id});
173 190

  
......
175 192

  
176 193
  list_cvar_configs();
177 194

  
178
  $lxdebug->leave_sub();
195
  $main::lxdebug->leave_sub();
179 196
}
180 197

  
181 198
sub display_cvar_config_form {
182
  $lxdebug->enter_sub();
199
  $main::lxdebug->enter_sub();
183 200

  
184
  $auth->assert('config');
201
  my $form     = $main::form;
202
  my %myconfig = %main::myconfig;
203
  my $locale   = $main::locale;
204

  
205
  $main::auth->assert('config');
185 206

  
186 207
  my @types = map { { 'type' => $_, 'type_tr' => $translations{$_} } } @types;
187 208

  
......
195 216
  print $form->parse_html_template("amcvar/display_cvar_config_form", { TYPES   => \@types,
196 217
                                                                        MODULES => \@modules });
197 218

  
198
  $lxdebug->leave_sub();
219
  $main::lxdebug->leave_sub();
199 220
}
200 221

  
201 222
sub swap_cvar_configs {
202
  $lxdebug->enter_sub();
223
  $main::lxdebug->enter_sub();
224

  
225
  my $form     = $main::form;
226
  my %myconfig = %main::myconfig;
203 227

  
204 228
  AM->swap_sortkeys(\%myconfig, $form, 'custom_variable_configs');
205 229

  
206 230
  list_cvar_configs();
207 231

  
208
  $lxdebug->leave_sub();
232
  $main::lxdebug->leave_sub();
209 233
}
210 234

  
211 235
sub dispatcher {
236
  my $form     = $main::form;
237
  my $locale   = $main::locale;
238

  
212 239
  foreach my $action (qw(list_cvar_configs add_cvar_config)) {
213 240
    if ($form->{"action_${action}"}) {
214 241
      call_sub($action);

Auch abrufbar als: Unified diff