Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 18407da4

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

  • ID 18407da47add04b0e16722edcc181a99ef06a241
  • Vorgänger 62b7b5d1
  • Nachfolger 3c255f28

onload in dn.pl und common.pl

Unterschiede anzeigen:

bin/mozilla/common.pl
169 169
  map { $form->{$_} = $options{$_} if ($options{$_}) } qw(no_services no_assemblies assemblies click_button);
170 170

  
171 171
  my $parts = Common->retrieve_parts(\%myconfig, $form, $order_by, $order_dir);
172
  my $onload;
173 172

  
174 173
  if (0 == scalar(@{$parts})) {
175 174
    $form->show_generic_information($locale->text("No part was found matching the search parameters."));
176 175
  } elsif (1 == scalar(@{$parts})) {
177
    $onload = "part_selected('1')";
176
    $::request->{layout}->add_javascripts_inline("part_selected('1')");
178 177
  }
179 178

  
180 179
  map { $parts->[$_]->{selected} = $_ ? 0 : 1; } (0..$#{$parts});
......
199 198
  $form->{title} = $locale->text("Select a part");
200 199
  $form->header();
201 200
  print $form->parse_html_template("generic/part_selection", { "HEADER" => \@header,
202
                                                               "PARTS"  => $parts,
203
                                                               "onload" => $onload });
201
                                                               "PARTS"  => $parts, });
204 202

  
205 203
  $main::lxdebug->leave_sub();
206 204
}
......
222 220
  my $delivery = Common->retrieve_delivery_customer(\%myconfig, $form, $order_by, $order_dir);
223 221
  map({ $delivery->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$delivery}));
224 222

  
225
  my $onload;
226 223
  if (0 == scalar(@{$delivery})) {
227 224
    $form->show_generic_information($locale->text("No Customer was found matching the search parameters."));
228 225
  } elsif (1 == scalar(@{$delivery})) {
229
    $onload = "customer_selected('1')";
226
    $::request->{layout}->add_javascripts_inline("customer_selected('1')");
230 227
  }
231 228

  
232 229
  my $callback = "$form->{script}?action=delivery_customer_selection&";
......
249 246
  $form->{"title"} = $locale->text("Select a Customer");
250 247
  $form->header();
251 248
  print $form->parse_html_template("generic/select_delivery_customer", { "HEADER"   => \@header,
252
                                                                         "DELIVERY" => $delivery,
253
                                                                         "onload"   => $onload });
249
                                                                         "DELIVERY" => $delivery, });
254 250

  
255 251
  $main::lxdebug->leave_sub();
256 252
}
......
272 268
  my $vendor = Common->retrieve_vendor(\%myconfig, $form, $order_by, $order_dir);
273 269
  map({ $vendor->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$vendor}));
274 270

  
275
  my $onload;
276 271
  if (0 == scalar(@{$vendor})) {
277 272
    $form->show_generic_information($locale->text("No Vendor was found matching the search parameters."));
278 273
  } elsif (1 == scalar(@{$vendor})) {
279
    $onload = "vendor_selected('1')";
274
    $::request->{layout}->add_javascripts_inline("vendor_selected('1')");
280 275
  }
281 276

  
282 277
  my $callback = "$form->{script}?action=vendor_selection&";
......
299 294
  $form->{"title"} = $locale->text("Select a Customer");
300 295
  $form->header();
301 296
  print $form->parse_html_template("generic/select_vendor", { "HEADER" => \@header,
302
                                                              "VENDOR" => $vendor,
303
                                                              "onload" => $onload });
297
                                                              "VENDOR" => $vendor, });
304 298

  
305 299
  $main::lxdebug->leave_sub();
306 300
}
......
317 311

  
318 312
  my ($variable_string, $formel) = split /###/,$form->{formel};
319 313
  my @variable;
320
  my $onload; # note! this sub is mostly called over a javascript invocation, and it's unlikey that onload is set.
321 314

  
322 315
  foreach my $item (split m/;/, $variable_string) {
323 316
    next unless $item =~ m/^ \s* (\w+) \s* = \s* (\w+) \s* (\w+) \s* $/x;
......
343 336
  $form->{title}  = $locale->text("Please enter values");
344 337
  $form->header();
345 338
  print $form->parse_html_template("generic/calculate_qty", { "HEADER"    => \@header,
346
                                                              "VARIABLES" => \@variable,
347
                                                              "onload"    => $onload });
339
                                                              "VARIABLES" => \@variable, });
348 340

  
349 341
  $main::lxdebug->leave_sub();
350 342
}
......
549 541
  my $covs = Common->retrieve_customers_or_vendors(\%myconfig, $form, $order_by, $order_dir, $form->{"is_vendor"}, $form->{"allow_both"});
550 542
  map({ $covs->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$covs}));
551 543

  
552
  my $onload;
553 544
  if (0 == scalar(@{$covs})) {
554 545
    $form->show_generic_information(sprintf($locale->text("No %s was found matching the search parameters."), $type));
555 546
  } elsif (1 == scalar(@{$covs})) {
556
    $onload = "cov_selected('1')";
547
    $::request->{layout}->add_javascripts_inline("cov_selected('1')");
557 548
  }
558 549

  
559 550
  my $callback = "$form->{script}?action=cov_selection_internal&";
......
585 576
  $form->{"title"} = $form->{is_vendor} ? $locale->text("Select a vendor") : $locale->text("Select a customer");
586 577
  $form->header();
587 578
  print($form->parse_html_template("generic/cov_selection", { "HEADER" => \@header,
588
                                                              "COVS" => $covs,
589
                                                              "onload" => $onload }));
579
                                                              "COVS" => $covs, }));
590 580

  
591 581
  $main::lxdebug->leave_sub();
592 582
}
bin/mozilla/dn.pl
154 154
                                          'no_opendocument' => 1,);
155 155

  
156 156
  $form->header();
157
  $form->{onload} = "document.getElementsByName('language_id')[0].disabled =
158
        !document.getElementsByName('force_lang')[0].checked;";
159 157
  print $form->parse_html_template("dunning/show_invoices");
160 158

  
161 159
  $main::lxdebug->leave_sub();
......
312 310

  
313 311
  $form->{jsscript} = 1;
314 312
  $form->{title}    = $locale->text('Dunnings');
315
  $form->{fokus}    = "search.customer";
313
  $::request->{layout}->focus('#customer');
316 314

  
317 315
  $form->header();
318 316

  
......
456 454

  
457 455
  $report->set_options_from_form();
458 456

  
459
  $form->{onload} = "document.getElementsByName('language_id')[0].disabled =
460
        !document.getElementsByName('force_lang')[0].checked;";
461 457
  $report->generate_with_headers();
462 458

  
463 459
  $main::lxdebug->leave_sub();
templates/webpages/dunning/search.html
18 18
       <th align="right">[% 'Customer' | $T8 %]</th>
19 19
       <td colspan="3">
20 20
        [% IF SHOW_CUSTOMER_DDBOX %]
21
         <select name="customer_id">
21
         <select id='customer' name="customer_id">
22 22
          <option value=""></option>
23 23
          [% FOREACH row = ALL_CUSTOMERS %]<option value="[% HTML.escape(row.id) %]">[% HTML.escape(row.name) %]</option>
24 24
          [% END %]
25 25
         </select>
26 26
         [% ELSE %]
27
         <input name="customer" size="35">
27
         <input id='customer' name="customer" size="35">
28 28
        [% END %]
29 29
       </td>
30 30
      </tr>
templates/webpages/dunning/show_dunning_bottom.html
2 2
[% USE HTML %]  <input type="hidden" name="rowcount" value="[% rowcount %]">
3 3

  
4 4
  <p>
5
    <input type="checkbox" name="force_lang" size="6" value="1" onclick="document.getElementsByName('language_id')[0].disabled = !document.getElementsByName('force_lang')[0].checked;">
5
    <input type="checkbox" id='force_lang' name="force_lang" size="6" value="1">
6 6
    [% 'Override invoice language' | $T8 %]
7 7
    [% PRINT_OPTIONS %]
8 8
  </p>
......
15 15
  </p>
16 16

  
17 17
 </form>
18
 <script type='text/javascript'>
19
   $(function(){$("select[name='language_id']").attr('disabled', $('#force_lang').attr('checked') ? '' : 'disabled')})
20
   $('#force_lang').click(function(){ $('select[name="language_id"]').attr('disabled', $('#force_lang').attr('checked') ? '' : 'disabled') })
21
 </script>
templates/webpages/dunning/show_invoices.html
77 77

  
78 78
  <hr size=3 noshade>
79 79

  
80
  <input type="checkbox" name="force_lang" size="6" value="1" onclick="document.getElementsByName('language_id')[0].disabled = !document.getElementsByName('force_lang')[0].checked;">
80
  <input type="checkbox" id='force_lang' name="force_lang" size="6" value="1">
81 81
  [% 'Override invoice language' | $T8 %]
82 82
  [% PRINT_OPTIONS %]
83 83

  
......
95 95
         [% UNLESS DEBUG_DUNNING %]onclick="this.disabled=true; this.value='[% 'The dunning process started' | $T8 %]'; document.Form.submit()"[% END %]>
96 96

  
97 97
 </form>
98
 <script type='text/javascript'>
99
   $(function(){$("select[name='language_id']").attr('disabled', $('#force_lang').attr('checked') ? '' : 'disabled')})
100
   $('#force_lang').click(function(){ $('select[name="language_id"]').attr('disabled', $('#force_lang').attr('checked') ? '' : 'disabled') })
101
 </script>
102

  

Auch abrufbar als: Unified diff