Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bce93dd4

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

  • ID bce93dd4b0fbdcee9a7b8d53bae7c7a2e3b319bc
  • Vorgänger 139ae60d
  • Nachfolger f28c26b9

CGI.pm nicht mehr als html Generator verwenden

Die restlichen Vorkommen sind jetzt noch

- header
- redirect
- cookie

und sind alle der Form: $::request->cgi->...

Unterschiede anzeigen:

SL/Auth.pm
574 574
sub restore_session {
575 575
  my $self = shift;
576 576

  
577
  $session_id        =  $::request->{cgi}->cookie($self->get_session_cookie_name());
577
  $session_id        =  $::request->cgi->cookie($self->get_session_cookie_name());
578 578
  $session_id        =~ s|[^0-9a-f]||g if $session_id;
579 579

  
580 580
  $self->{SESSION}   = { };
......
951 951
sub get_api_token_cookie {
952 952
  my ($self) = @_;
953 953

  
954
  $::request->{cgi}->cookie($self->get_session_cookie_name(type => 'api_token'));
954
  $::request->cgi->cookie($self->get_session_cookie_name(type => 'api_token'));
955 955
}
956 956

  
957 957
sub is_api_token_cookie_valid {
SL/Controller/Base.pm
57 57

  
58 58
  return $self->render(SL::ClientJS->new->redirect_to($url)) if $::request->is_ajax;
59 59

  
60
  print $::request->{cgi}->redirect($url);
60
  print $::request->cgi->redirect($url);
61 61
}
62 62

  
63 63
sub render {
SL/Dispatcher.pm
32 32
use SL::MoreCommon qw(uri_encode);
33 33
use SL::Template::Plugin::HTMLFixes;
34 34
use SL::User;
35
use SL::Presenter::Tag qw(pre_tag);
35 36

  
36 37
use Rose::Object::MakeMethods::Generic (
37 38
  scalar => [ qw(restart_after_request) ],
......
327 328
      if ($::request->is_ajax) {
328 329
        eval { render_error_ajax($error) };
329 330
      } else {
330
        $::form->{label_error} = $::request->{cgi}->pre($error);
331
        $::form->{label_error} = pre_tag($error);
331 332
        chdir SL::System::Process::exe_dir;
332 333
        eval { show_error('generic/error') };
333 334
      }
......
508 509

  
509 510
    1;
510 511
  } or do {
511
    $::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR);
512
    $::form->{label_error} = pre_tag($EVAL_ERROR);
512 513
    show_error('generic/error');
513 514
  };
514 515

  
......
534 535

  
535 536
    1;
536 537
  } or do {
537
    $::form->{label_error} = $::request->{cgi}->pre($EVAL_ERROR);
538
    $::form->{label_error} = pre_ta($EVAL_ERROR);
538 539
    show_error('generic/error');
539 540
  };
540 541

  
SL/Form.pm
42 42
use Data::Dumper;
43 43

  
44 44
use Carp;
45
use CGI;
46 45
use Cwd;
47 46
use Encode;
48 47
use File::Copy;
......
228 227
  return $str;
229 228
}
230 229

  
231
sub hide_form {
232
  $main::lxdebug->enter_sub();
233
  my $self = shift;
234

  
235
  if (@_) {
236
    map({ print($::request->{cgi}->hidden("-name" => $_, "-default" => $self->{$_}) . "\n"); } @_);
237
  } else {
238
    for (sort keys %$self) {
239
      next if (($_ eq "header") || (ref($self->{$_}) ne ""));
240
      print($::request->{cgi}->hidden("-name" => $_, "-default" => $self->{$_}) . "\n");
241
    }
242
  }
243
  $main::lxdebug->leave_sub();
244
}
245

  
246 230
sub throw_on_error {
247 231
  my ($self, $code) = @_;
248 232
  local $self->{__ERROR_HANDLER} = sub { SL::X::FormError->throw(error => $_[0]) };
......
370 354
  my $self     = shift;
371 355
  my %params   = @_;
372 356

  
373
  my $cgi      = $::request->{cgi};
374

  
375 357
  my $session_cookie;
376 358
  if (defined $main::auth) {
377 359
    my $uri      = $self->_get_request_uri;
......
382 364
    my $session_cookie_value = $main::auth->get_session_id();
383 365

  
384 366
    if ($session_cookie_value) {
385
      $session_cookie = $cgi->cookie('-name'    => $main::auth->get_session_cookie_name(),
367
      $session_cookie = $::request->cgi->cookie('-name'    => $main::auth->get_session_cookie_name(),
386 368
                                     '-value'   => $session_cookie_value,
387 369
                                     '-path'    => $uri->path,
388 370
                                     '-expires' => '+' . $::auth->{session_timeout} . 'm',
......
396 378

  
397 379
  map { $cgi_params{'-' . $_} = $params{$_} if exists $params{$_} } qw(content_disposition content_length status);
398 380

  
399
  my $output = $cgi->header(%cgi_params);
381
  my $output = $::request->cgi->header(%cgi_params);
400 382

  
401 383
  $main::lxdebug->leave_sub();
402 384

  
......
505 487

  
506 488
  my ($self) = @_;
507 489

  
508
  my $output = $::request->{cgi}->header('-charset' => 'UTF-8');
490
  my $output = $::request->cgi->header('-charset' => 'UTF-8');
509 491

  
510 492
  $main::lxdebug->leave_sub();
511 493

  
......
522 504
  die "Headers already sent" if $self->{header};
523 505
  $self->{header} = 1;
524 506

  
525
  return $::request->{cgi}->redirect($new_uri);
507
  return $::request->cgi->redirect($new_uri);
526 508
}
527 509

  
528 510
sub set_standard_title {
SL/Presenter/Tag.pm
11 11
  html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag
12 12
  checkbox_tag button_tag submit_tag ajax_submit_tag input_number_tag
13 13
  stringify_attributes restricted_html textarea_tag link_tag date_tag
14
  div_tag);
14
  div_tag pre_tag
15
);
15 16
our %EXPORT_TAGS = (ALL => \@EXPORT_OK);
16 17

  
17 18
use Carp;
......
385 386
  return html_tag('div', $content, %params);
386 387
}
387 388

  
389
sub pre_tag {
390
  html_tag('pre', @_)
391
}
392

  
388 393
1;
389 394
__END__
390 395

  
bin/mozilla/ap.pl
382 382
  my $form     = $main::form;
383 383
  my %myconfig = %main::myconfig;
384 384
  my $locale   = $main::locale;
385
  my $cgi      = $::request->{cgi};
386 385

  
387 386
  $::form->{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load if $::form->{id};
388 387

  
bin/mozilla/ar.pl
52 52
use SL::DB::Tax;
53 53
use SL::Helper::Flash qw(flash);
54 54
use SL::Locale::String qw(t8);
55
use SL::Presenter::Tag;
55
use SL::Presenter::Tag qw(checkbox_tag hidden_tag select_tag);
56 56
use SL::Presenter::Chart;
57 57
use SL::ReportGenerator;
58 58

  
......
354 354
  my $form     = $main::form;
355 355
  my %myconfig = %main::myconfig;
356 356
  my $locale   = $main::locale;
357
  my $cgi      = $::request->{cgi};
358 357

  
359 358
  $form->{invoice_obj} = _retrieve_invoice_object();
360 359

  
......
395 394

  
396 395
  my %project_labels = map { $_->{id} => $_->{projectnumber} } @{ $form->{"ALL_PROJECTS"} };
397 396

  
398
  my (@AR_paid_values, %AR_paid_labels);
397
  my @AR_paid_values;
399 398
  my $default_ar_amount_chart_id;
400 399

  
401 400
  foreach my $item (@{ $form->{ALL_CHARTS} }) {
......
403 402
      $default_ar_amount_chart_id //= $item->{id};
404 403

  
405 404
    } elsif ($item->{link_split}{AR_paid}) {
406
      push(@AR_paid_values, $item->{accno});
407
      $AR_paid_labels{$item->{accno}} = "$item->{accno}--$item->{description}";
405
      push @AR_paid_values, [ $item->{accno}, "$item->{accno}--$item->{description}" ];
408 406
    }
409 407
  }
410 408

  
......
427 425
      project_id => ($i==$form->{rowcount}) ? $form->{globalproject_id} : $form->{"project_id_$i"},
428 426
    };
429 427

  
430
    my (%taxchart_labels, @taxchart_values, $default_taxchart, $taxchart_to_use);
428
    my (@taxchart_values, $default_taxchart, $taxchart_to_use);
431 429
    my $amount_chart_id = $form->{"AR_amount_chart_id_$i"} // $default_ar_amount_chart_id;
432 430

  
433 431
    my $used_tax_id;
......
440 438
      $default_taxchart   = $item if $item->{is_default};
441 439
      $taxchart_to_use    = $item if $key eq $form->{"taxchart_$i"};
442 440

  
443
      push(@taxchart_values, $key);
444
      $taxchart_labels{$key} = $item->taxkey . " - " . $item->taxdescription . " " . $item->rate * 100 . ' %';
441
      push @taxchart_values, [ $key, $item->taxkey . " - " . $item->taxdescription . " " . $item->rate * 100 . ' %' ];
445 442
    }
446 443

  
447 444
    $taxchart_to_use    //= $default_taxchart // $first_taxchart;
......
452 449
      . SL::Presenter::Tag::hidden_tag("previous_AR_amount_chart_id_$i", $amount_chart_id);
453 450

  
454 451
    $transaction->{taxchart} =
455
      NTI($cgi->popup_menu('-name' => "taxchart_$i",
456
                           '-id' => "taxchart_$i",
457
                           '-style' => 'width:200px',
458
                           '-values' => \@taxchart_values,
459
                           '-labels' => \%taxchart_labels,
460
                           '-default' => $selected_taxchart));
452
      select_tag("taxchart_$i", \@taxchart_values, id => "taxchart_$i", style => 'width:200px', default => $selected_taxchart);
461 453

  
462 454
    push @transactions, $transaction;
463 455
  }
......
488 480
    $form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form);
489 481

  
490 482
    $payment->{selectAR_paid} =
491
      NTI($cgi->popup_menu('-name' => "AR_paid_$i",
492
                           '-id' => "AR_paid_$i",
493
                           '-values' => \@AR_paid_values,
494
                           '-labels' => \%AR_paid_labels,
495
                           '-default' => $payment->{AR_paid} || $form->{accno_arap}));
483
      select_tag("AR_paid_$i", \@AR_paid_values, id => "AR_paid_$i", default => $payment->{AR_paid} || $form->{accno_arap});
496 484

  
497 485

  
498 486

  
......
556 544
  my $form     = $main::form;
557 545
  my %myconfig = %main::myconfig;
558 546
  my $locale   = $main::locale;
559
  my $cgi      = $::request->{cgi};
560 547

  
561 548
  if ( $form->{id} ) {
562 549
    my $follow_ups = FU->follow_ups('trans_id' => $form->{id}, 'not_done' => 1);
......
944 931
  my $form     = $main::form;
945 932
  my %myconfig = %main::myconfig;
946 933
  my $locale   = $main::locale;
947
  my $cgi      = $::request->{cgi};
948 934

  
949 935
  $form->{title} = $locale->text('Invoices, Credit Notes & AR Transactions');
950 936

  
bin/mozilla/common.pl
202 202
  return $main::form->escape($_[0]);
203 203
}
204 204

  
205
sub NTI {
206
  my ($element) = @_;
207

  
208
  $element =~ s/tabindex\s*=\s*"\d+"//;
209
  return $element;
210
}
211

  
212 205
sub format_dates {
213 206
  return $::form->format_dates(@_);
214 207
}
bin/mozilla/dn.pl
38 38
use SL::DN;
39 39
use SL::DB::Department;
40 40
use SL::DB::Dunning;
41
use SL::Presenter::Tag qw(hidden_tag checkbox_tag);
41 42
use SL::Helper::Flash qw(flash);
42 43
use SL::Locale::String qw(t8);
43 44
use SL::ReportGenerator;
......
331 332
  my $form     = $main::form;
332 333
  my %myconfig = %main::myconfig;
333 334
  my $locale   = $main::locale;
334
  my $cgi      = $::request->{cgi};
335 335

  
336 336
  $main::auth->assert('dunning_edit');
337 337

  
......
431 431
    }
432 432

  
433 433
    $row->{checkbox} = !$first_row_for_dunning ? { } : {
434
      'raw_data' =>   $cgi->hidden('-name' => "dunning_id_$i", '-value' => $ref->{dunning_id})
435
                    . $cgi->checkbox('-name' => "selected_$i", '-value' => 1, '-label' => ''),
434
      'raw_data' =>   hidden_tag("dunning_id_$i", $ref->{dunning_id})
435
                    . checkbox_tag("selected_$i", value => 1),
436 436
      'valign'   => 'center',
437 437
      'align'    => 'center',
438 438
    };
439 439

  
440 440
    if ($first_row_for_dunning) {
441
      $row->{language} = {'raw_data' => $cgi->hidden('-name' => "language_id_$i", '-value' => $ref->{language_id})
442
                                        . " $ref->{language}" };
441
      $row->{language} = {'raw_data' => hidden_tag("language_id_$i", $ref->{language_id}) . " $ref->{language}" };
443 442
    } else {
444 443
      $row->{language} = { };
445 444
    }
bin/mozilla/do.pl
44 44
use SL::ReportGenerator;
45 45
use SL::WH;
46 46
use SL::YAML;
47
use SL::Presenter::Tag qw(hidden_tag checkbox_tag);
47 48
use Sort::Naturally ();
48 49
require "bin/mozilla/common.pl";
49 50
require "bin/mozilla/io.pl";
......
678 679
  my $form     = $main::form;
679 680
  my %myconfig = %main::myconfig;
680 681
  my $locale   = $main::locale;
681
  my $cgi      = $::request->{cgi};
682 682

  
683 683
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.MassDeliveryOrderPrint kivi.SalesPurchase));
684 684
  ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
......
862 862

  
863 863
    my $ord_id = $dord->{id};
864 864
    $row->{ids}  = {
865
      'raw_data' =>   $cgi->hidden('-name' => "trans_id_${idx}", '-value' => $ord_id)
866
                    . $cgi->checkbox('-name' => "multi_id_${idx}",' id' => "multi_id_id_".$ord_id, '-value' => 1, 'data-checkall' => 1, '-label' => ''),
865
      'raw_data' =>   hidden_tag("trans_id_${idx}", $ord_id)
866
                    . checkbox_tag("multi_id_${idx}", value => 1, id => "multi_id_id_".$ord_id, 'data-checkall' => 1),
867 867
      'valign'   => 'center',
868 868
      'align'    => 'center',
869 869
    };
bin/mozilla/fu.pl
3 3
use SL::FU;
4 4
use SL::Locale::String qw(t8);
5 5
use SL::ReportGenerator;
6
use SL::Presenter::Tag qw(hidden_tag checkbox_tag);
6 7

  
7 8
require "bin/mozilla/reportgenerator.pl";
8 9

  
......
250 251
  my $form     = $main::form;
251 252
  my %myconfig = %main::myconfig;
252 253
  my $locale   = $main::locale;
253
  my $cgi      = $::request->{cgi};
254 254

  
255 255
  my @report_params = qw(created_for subject body reference follow_up_date_from follow_up_date_to itime_from itime_to due_only all_users done not_done);
256 256

  
......
333 333
    my $row = { map { $_ => { 'data' => $fu->{$_} } } keys %{ $fu } };
334 334

  
335 335
    $row->{selected} = {
336
      'raw_data' =>   $cgi->hidden('-name' => "follow_up_id_${idx}", '-value' => $fu->{id})
337
                    . $cgi->checkbox('-name' => "selected_${idx}",   '-value' => 1, '-label' => ''),
336
      'raw_data' =>   hidden_tag("follow_up_id_${idx}", $fu->{id})
337
                    . checkbox_tag("selected_${idx}", value => 1),
338 338
      'valign'   => 'center',
339 339
      'align'    => 'center',
340 340
    };
bin/mozilla/gl.pl
50 50
use SL::Webdav;
51 51
use SL::Locale::String qw(t8);
52 52
use SL::Helper::GlAttachments qw(count_gl_attachments);
53
use SL::Presenter::Tag;
53
use SL::Presenter::Tag qw(hidden_tag select_tag);
54 54
use SL::Presenter::Chart;
55 55
require "bin/mozilla/common.pl";
56 56
require "bin/mozilla/reportgenerator.pl";
......
784 784

  
785 785
  my $form     = $main::form;
786 786
  my %myconfig = %main::myconfig;
787
  my $cgi      = $::request->{cgi};
788 787

  
789 788
  my %balances = GL->get_chart_balances(map { $_->{id} } @{ $form->{ALL_CHARTS} });
790 789

  
......
811 810
      <input type="hidden" name="memo_$i" value="$form->{"memo_$i"}" size="16">|;
812 811
    }
813 812

  
814
    my %taxchart_labels = ();
815 813
    my @taxchart_values = ();
816 814

  
817 815
    my $accno_id = $::form->{"accno_id_$i"};
......
831 829
      $default_taxchart   = $item if $item->{is_default};
832 830
      $taxchart_to_use    = $item if $key eq $form->{"taxchart_$i"};
833 831

  
834
      push(@taxchart_values, $key);
835
      $taxchart_labels{$key} = $item->taxkey . " - " . $item->taxdescription . " " . $item->rate * 100 . ' %';
832
      push @taxchart_values, [ $key, $item->taxkey . " - " . $item->taxdescription . " " . $item->rate * 100 . ' %' ];
836 833
    }
837 834

  
838 835
    $taxchart_to_use    //= $default_taxchart // $first_taxchart;
......
842 839
      SL::Presenter::Chart::picker("accno_id_$i", $accno_id, style => "width: 300px") .
843 840
      SL::Presenter::Tag::hidden_tag("previous_accno_id_$i", $accno_id)
844 841
      . qq|</td>|;
845
    my $tax_ddbox = qq|<td>| .
846
      NTI($cgi->popup_menu('-name' => "taxchart_$i",
847
            '-id' => "taxchart_$i",
848
            '-style' => 'width:200px',
849
            '-values' => \@taxchart_values,
850
            '-labels' => \%taxchart_labels,
851
            '-default' => $selected_taxchart))
842
    my $tax_ddbox = qq|<td>|
843
      .  select_tag("taxchart_$i", \@taxchart_values, id => "taxchart_$i", style => 'width:200px', default => $selected_taxchart)
852 844
      . qq|</td>|;
853 845

  
854 846
    my ($fx_transaction, $checked);
......
887 879
      <td><input type=hidden name="fx_transaction_$i" value="$checked">$x</td>
888 880
    |;
889 881
        }
890
        $form->hide_form("accno_$i");
882
        print hidden_tag("accno_$i", $form->{"accno_$i"});
891 883

  
892 884
      } else {
893 885
        if ($form->{transfer}) {
......
946 938
|;
947 939
  }
948 940

  
949
  $form->hide_form(qw(rowcount selectaccno));
941
  print hidden_tag('rowcount',    $form->{rowcount}),
942
        hidden_tag('selectaccno', $form->{selectaccno});
950 943

  
951 944
  $main::lxdebug->leave_sub();
952 945

  
bin/mozilla/io.pl
38 38
#######################################################################
39 39

  
40 40
use Carp;
41
use CGI;
42 41
use List::MoreUtils qw(any uniq apply);
43 42
use List::Util qw(sum min max first);
44 43
use List::UtilsBy qw(sort_by uniq_by);
......
54 53
use SL::File;
55 54
use SL::PriceSource;
56 55
use SL::Presenter::Part;
56
use SL::Presenter::Tag qw(select_tag input_tag hidden_tag button_tag textarea_tag html_tag);
57 57

  
58 58
use SL::DB::Contact;
59 59
use SL::DB::Currency;
......
62 62
use SL::DB::Language;
63 63
use SL::DB::Printer;
64 64
use SL::DB::Vendor;
65
use SL::Helper::Number qw(:ALL);
65 66
use SL::Helper::CreatePDF;
66 67
use SL::Helper::Flash;
67 68
use SL::Helper::PrintOptions;
......
130 131
  my $form     = $main::form;
131 132
  my %myconfig = %main::myconfig;
132 133
  my $locale   = $main::locale;
133
  my $cgi      = $::request->{cgi};
134 134

  
135 135
  my $numrows = shift;
136 136

  
......
224 224
  $form->{sellprice_total}       = 0;
225 225
  $form->{lastcost_total}        = 0;
226 226
  $form->{totalweight}           = 0;
227
  my %projectnumber_labels = ();
228
  my @projectnumber_values = ("");
229

  
230
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
231
    push(@projectnumber_values, $item->{"id"});
232
    $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"};
233
  }
234 227

  
235 228
  _update_part_information();
236 229
  _update_ship() if ($is_s_p_order);
......
273 266
    $this_unit    = $form->{"selected_unit_$i"} if AM->convert_unit($this_unit, $form->{"selected_unit_$i"}, $all_units);
274 267

  
275 268
    if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) {
276
      my @values = ('', map { $_->{id}                      } @{ $form->{ALL_PRICE_FACTORS} });
277
      my %labels =      map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} };
278

  
279
      $column_data{price_factor} =
280
        NTI($cgi->popup_menu('-name'    => "price_factor_id_$i",
281
                             '-default' => $form->{"price_factor_id_$i"},
282
                             '-values'  => \@values,
283
                             '-labels'  => \%labels,
284
                             '-style'   => 'width:90px'));
269
      $column_data{price_factor} = select_tag("price_factor_id_$i", $form->{ALL_PRICE_FACTORS},
270
        title_key => 'description',
271
        default => $form->{"price_factor_id_$i"},
272
        style   => 'width:90px',
273
      );
285 274
    } else {
286 275
      $column_data{price_factor} = '&nbsp;';
287 276
    }
......
303 292
    # quick delete single row
304 293
    $column_data{runningnumber}  = q|<a onclick= "$('#partnumber_| . $i . q|').val(''); $('#update_button').click();">| .
305 294
                                   q|<img height="10px" width="10px" src="image/cross.png" alt="| . $locale->text('Remove') . q|"></a> |;
306
    $column_data{runningnumber} .= $cgi->textfield(-name => "runningnumber_$i", -id => "runningnumber_$i", -size => 5,  -value => $i);    # HuT
295
    $column_data{runningnumber} .= input_tag("runningnumber_$i", $i, id => "runningnumber_$i", size => 4);
307 296

  
308 297

  
309
    $column_data{partnumber}    = $cgi->textfield(-name => "partnumber_$i",    -id => "partnumber_$i",    -size => 12, -value => $form->{"partnumber_$i"});
298
    $column_data{partnumber}    = input_tag("partnumber_$i", $form->{"partnumber_$i"}, id => "partnumber_$i", size => 12);
310 299
    $column_data{type_and_classific} = SL::Presenter::Part::type_abbreviation($form->{"part_type_$i"}).
311 300
                                       SL::Presenter::Part::classification_abbreviation($form->{"classification_id_$i"}) if $form->{"id_$i"};
312 301
    $column_data{description} = (($rows > 1) # if description is too large, use a textbox instead
313
                                ? $cgi->textarea( -name => "description_$i", -id => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30)
314
                                : $cgi->textfield(-name => "description_$i", -id => "description_$i",   -value => $form->{"description_$i"}, -size => 30))
315
                                . $cgi->button(-value => $locale->text('L'), -onClick => "kivi.SalesPurchase.edit_longdescription($i)");
302
                                ? textarea_tag("description_$i", $form->{"description_$i"}, id => "description_$i", rows => $rows, cols => 30)
303
                                : input_tag("description_$i", $form->{"description_$i"}, id => "description_$i", size => 30))
304
                                . button_tag("kivi.SalesPurchase.edit_longdescription($i)", t8('L'), type => "button", title => t8("Long Description"));
316 305

  
317 306
    my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2;
318 307

  
319
    $column_data{qty}  = $cgi->textfield(-name => "qty_$i", -size => 5, -class => "numeric", -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec));
320
    $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_dialog('qty_$i', '', 'formel_$i', '')", -value => $locale->text('*/'))
321
                       . $cgi->hidden(-name => "formel_$i", -value => $form->{"formel_$i"})
308
    $column_data{qty}  = input_tag("qty_$i", _format_number($::form->{"qty_$i"}, $qty_dec), size => 5, class => "numeric");
309
    $column_data{qty} .= button_tag("calculate_qty_selection_dialog('qty_$i', '', 'formel_$i', '')", t8('*/'), onclick => )
310
                       . hidden_tag("formel_$i", $form->{"formel_$i"})
322 311
      if $form->{"formel_$i"};
323 312

  
324 313
    $column_data{ship} = '';
......
328 317
      $ship_qty          /= ( $all_units->{$form->{"unit_$i"}}->{factor} || 1 );
329 318

  
330 319
      $column_data{ship}  = $form->format_amount(\%myconfig, $form->round_amount($ship_qty, 2) * 1) . ' ' . $form->{"unit_$i"}
331
      . $cgi->hidden(-name => "ship_$i", -value => $form->{"ship_$i"}, $qty_dec);
320
        . hidden_tag("ship_$i", _format_number($form->{"ship_$i"}, $qty_dec));
332 321

  
333 322
      my $ship_missing_qty    = $form->{"qty_$i"} - $ship_qty;
334 323
      my $ship_missing_amount = $form->round_amount($ship_missing_qty * $form->{"sellprice_$i"} * (100 - $form->{"discount_$i"}) / 100 / $price_factor, 2);
......
351 340
      my $discount      = $price_source->discount_from_source($::form->{"active_discount_source_$i"});
352 341
      my $best_price    = $price_source->best_price;
353 342
      my $best_discount = $price_source->best_discount;
354
      $column_data{price_source} .= $cgi->button(-value => $price->source_description, -onClick => "kivi.io.price_chooser($i)");
343
      $column_data{price_source} .= button_tag("kivi.io.price_chooser($i)", $price->source_description);
355 344
      if ($price->source) {
356
        $column_data{price_source} .= ' ' . $cgi->img({src => 'image/flag-red.png', alt => $price->invalid, title => $price->invalid }) if $price->invalid;
357
        $column_data{price_source} .= ' ' . $cgi->img({src => 'image/flag-red.png', alt => $price->missing, title => $price->missing }) if $price->missing;
345
        $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/flag-red.png', alt => $price->invalid, title => $price->invalid ) if $price->invalid;
346
        $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/flag-red.png', alt => $price->missing, title => $price->missing ) if $price->missing;
358 347
        if (!$price->missing && !$price->invalid) {
359
          $column_data{price_source} .= ' ' . $cgi->img({src => 'image/up.png',   alt => t8('This price has since gone up'),      title => t8('This price has since gone up' )     }) if $price->price - $record_item->sellprice > 0.01;
360
          $column_data{price_source} .= ' ' . $cgi->img({src => 'image/down.png', alt => t8('This price has since gone down'),    title => t8('This price has since gone down')    }) if $price->price - $record_item->sellprice < -0.01;
361
          $column_data{price_source} .= ' ' . $cgi->img({src => 'image/ok.png',   alt => t8('There is a better price available'), title => t8('There is a better price available') }) if $best_price && $price->source ne $price_source->best_price->source;
348
          $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/up.png',   alt => t8('This price has since gone up'),      title => t8('This price has since gone up' )     ) if $price->price - $record_item->sellprice > 0.01;
349
          $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/down.png', alt => t8('This price has since gone down'),    title => t8('This price has since gone down')    ) if $price->price - $record_item->sellprice < -0.01;
350
          $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/ok.png',   alt => t8('There is a better price available'), title => t8('There is a better price available') ) if $best_price && $price->source ne $price_source->best_price->source;
362 351
        }
363 352
      }
364 353
      if ($discount->source) {
365
        $column_data{discount_source} .= ' ' . $cgi->img({src => 'image/flag-red.png', alt => $discount->invalid, title => $discount->invalid }) if $discount->invalid;
366
        $column_data{discount_source} .= ' ' . $cgi->img({src => 'image/flag-red.png', alt => $discount->missing, title => $discount->missing }) if $discount->missing;
354
        $column_data{discount_source} .= ' ' . html_tag("img", undef, src => 'image/flag-red.png', alt => $discount->invalid, title => $discount->invalid ) if $discount->invalid;
355
        $column_data{discount_source} .= ' ' . html_tag("img", undef, src => 'image/flag-red.png', alt => $discount->missing, title => $discount->missing ) if $discount->missing;
367 356
        if (!$discount->missing && !$discount->invalid) {
368
          $column_data{price_source} .= ' ' . $cgi->img({src => 'image/up.png',   alt => t8('This discount has since gone up'),      title => t8('This discount has since gone up')      }) if $discount->discount * 100 - $record_item->discount > 0.01;
369
          $column_data{price_source} .= ' ' . $cgi->img({src => 'image/down.png', alt => t8('This discount has since gone down'),    title => t8('This discount has since gone down')    }) if $discount->discount * 100 - $record_item->discount < -0.01;
370
          $column_data{price_source} .= ' ' . $cgi->img({src => 'image/ok.png',   alt => t8('There is a better discount available'), title => t8('There is a better discount available') }) if $best_discount && $discount->source ne $price_source->best_discount->source;
357
          $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/up.png',   alt => t8('This discount has since gone up'),      title => t8('This discount has since gone up')      ) if $discount->discount * 100 - $record_item->discount > 0.01;
358
          $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/down.png', alt => t8('This discount has since gone down'),    title => t8('This discount has since gone down')    ) if $discount->discount * 100 - $record_item->discount < -0.01;
359
          $column_data{price_source} .= ' ' . html_tag("img", undef, src => 'image/ok.png',   alt => t8('There is a better discount available'), title => t8('There is a better discount available') ) if $best_discount && $discount->source ne $price_source->best_discount->source;
371 360
        }
372 361
      }
373 362
    }
......
376 365
    my $edit_prices           = $right_to_edit_prices && (!$::form->{"active_price_source_$i"} || !$price || $price->editable);
377 366
    my $edit_discounts        = $right_to_edit_prices && !$::form->{"active_discount_source_$i"};
378 367
    $column_data{sellprice}   = (!$edit_prices)
379
                                ? $cgi->hidden(   -name => "sellprice_$i", -id => "sellprice_$i", -value => $sellprice_value) . $sellprice_value
380
                                : $cgi->textfield(-name => "sellprice_$i", -id => "sellprice_$i", -size => 10, -class => "numeric", -value => $sellprice_value);
368
                                ? hidden_tag("sellprice_$i", $sellprice_value, id => "sellprice_$i") . $sellprice_value
369
                                : input_tag("sellprice_$i", $sellprice_value, id => "sellprice_$i", "data-validate" => "number", size => 10, class => "numeric");
381 370
    $column_data{discount}    = (!$edit_discounts)
382
                                  ? $cgi->hidden(   -name => "discount_$i", -id => "discount_$i", -value => $discount_value) . $discount_value . ' %'
383
                                  : $cgi->textfield(-name => "discount_$i", -id => "discount_$i", -size => 3, -"data-validate" => "number", -class => "numeric", -value => $discount_value);
371
                                  ? hidden_tag("discount_$i", $discount_value, id => "discount_$i") . $discount_value . ' %'
372
                                  : input_tag("discount_$i", $discount_value, id => "discount_$i", size => 3, "data-validate" => "number", class => "numeric");
384 373

  
385 374
    if ($is_delivery_order) {
386 375
      $column_data{stock_in_out} =  calculate_stock_in_out($i);
387 376
    }
388 377

  
389 378
    $column_data{serialnr}  = qq|<input name="serialnumber_$i" size="15" value="$form->{"serialnumber_$i"}">|;
390
    $column_data{projectnr} = NTI($cgi->popup_menu(
391
      '-name' => "project_id_$i",
392
      '-values' => \@projectnumber_values,
393
      '-labels' => \%projectnumber_labels,
394
      '-default' => $form->{"project_id_$i"}
395
    ));
379
    $column_data{projectnr} = select_tag("project_id_$i", $form->{"ALL_PROJECTS"}, default => $form->{"project_id_$i"}, title_key => 'projectnumber', with_empty => 1);
396 380
    $column_data{reqdate}   = qq|<input name="reqdate_$i" size="11" data-validate="date" value="$form->{"reqdate_$i"}">|;
397 381
    $column_data{subtotal}  = sprintf qq|<input type="checkbox" name="subtotal_$i" value="1" %s>|, $form->{"subtotal_$i"} ? 'checked' : '';
398 382

  
......
475 459
    }
476 460

  
477 461
    my @HIDDENS = map { value => $_}, (
478
          $cgi->hidden("-name" => "unit_old_$i", "-value" => $form->{"selected_unit_$i"}),
479
          $cgi->hidden("-name" => "price_new_$i", "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"})),
480
          map { ($cgi->hidden("-name" => $_, "-id" => $_, "-value" => $form->{$_})); } map { $_."_$i" }
462
          hidden_tag("unit_old_$i", => $form->{"selected_unit_$i"}),
463
          hidden_tag("price_new_$i", _format_number($form->{"price_new_$i"})),
464
          map { hidden_tag($_, $form->{$_}, id => $_) } map { $_."_$i" }
481 465
            (qw(bo price_old id inventory_accno bin partsgroup partnotes active_price_source active_discount_source
482 466
                income_accno expense_accno listprice part_type taxaccounts ordnumber donumber transdate cusordnumber
483 467
                longdescription basefactor marge_absolut marge_percent marge_price_factor weight), @hidden_vars)
......
746 730
  $::form->{"id_$::form->{rowcount}"} = $part->id;
747 731

  
748 732
  my $url = build_std_url("script=$::form->{script}", "RESTORE_FORM_FROM_SESSION_ID=" . $::auth->save_form_in_session);
749
  print $::request->{cgi}->redirect($url);
733
  print $::request->cgi->redirect($url);
750 734
}
751 735

  
752 736
sub check_form {
bin/mozilla/ir.pl
42 42
use SL::DB::PurchaseInvoice;
43 43
use SL::DB::Vendor;
44 44
use List::MoreUtils qw(uniq);
45
use SL::Presenter::Tag qw(select_tag);
46
use DateTime;
45 47
use List::Util qw(max sum);
46 48
use List::UtilsBy qw(sort_by);
47 49

  
......
380 382
  my $form     = $main::form;
381 383
  my %myconfig = %main::myconfig;
382 384
  my $locale   = $main::locale;
383
  my $cgi      = $::request->{cgi};
384 385

  
385 386
  my %TMPL_VAR = ();
386 387
  my @custom_hiddens;
......
417 418
  ]);
418 419

  
419 420
  # currencies and exchangerate
420
  my @values = map { $_       } @{ $form->{ALL_CURRENCIES} };
421
  my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
422 421
  $form->{currency}            = $form->{defaultcurrency} unless $form->{currency};
423 422
  # show_exchangerate is also later needed in another template
424 423
  $form->{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
425
  $TMPL_VAR{currencies}        = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
426
                                                      '-values' => \@values, '-labels' => \%labels,
427
                                                      '-onchange' => "document.getElementById('update_button').click();"
428
                                     )) if scalar @values;
424
  $TMPL_VAR{currencies}        = select_tag('currency', $form->{ALL_CURRENCIES},
425
                                   id => 'currency', default => $form->{currency},
426
                                   onchange => "document.getElementById('update_button').click();"
427
                                 ) if @{ $form->{ALL_CURRENCIES} // [] };
429 428
  push @custom_hiddens, "forex";
430 429
  push @custom_hiddens, "exchangerate" if $form->{forex};
431 430

  
bin/mozilla/is.pl
49 49
use SL::DB::Department;
50 50
use SL::DB::Invoice;
51 51
use SL::DB::PaymentTerm;
52
use SL::Presenter::Tag qw(select_tag);
52 53

  
53 54
require "bin/mozilla/common.pl";
54 55
require "bin/mozilla/io.pl";
......
444 445
  my $form     = $main::form;
445 446
  my %myconfig = %main::myconfig;
446 447
  my $locale   = $main::locale;
447
  my $cgi      = $::request->{cgi};
448 448

  
449 449
  my %TMPL_VAR = ();
450 450
  my @custom_hiddens;
......
502 502
  ]);
503 503

  
504 504
  # currencies and exchangerate
505
  my @values = map { $_       } @{ $form->{ALL_CURRENCIES} };
506
  my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
507 505
  $form->{currency}            = $form->{defaultcurrency} unless $form->{currency};
508 506
  $form->{show_exchangerate}   = $form->{currency} ne $form->{defaultcurrency};
509
  $TMPL_VAR{currencies}        = NTI($::request->{cgi}->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
510
                                                      '-values' => \@values, '-labels' => \%labels,
511
                                                      '-onchange' => "document.getElementById('update_button').click();"
512
                                     )) if scalar @values;
507
  $TMPL_VAR{currencies}        = select_tag('currency', $form->{ALL_CURRENCIES},
508
                                   id => 'currency', default => $form->{currency},
509
                                   onchange => "document.getElementById('update_button').click();"
510
                                 ) if @{ $form->{ALL_CURRENCIES} // [] };
513 511
  push @custom_hiddens, "forex";
514 512
  push @custom_hiddens, "exchangerate" if $form->{forex};
515 513

  
bin/mozilla/oe.pl
55 55
use SL::DB::TaxZone;
56 56
use SL::DB::PaymentTerm;
57 57
use SL::DB::Vendor;
58
use SL::Presenter::Tag qw(hidden_tag checkbox_tag);
58 59

  
59 60
require "bin/mozilla/common.pl";
60 61
require "bin/mozilla/io.pl";
......
489 490
  my $form     = $main::form;
490 491
  my %myconfig = %main::myconfig;
491 492
  my $locale   = $main::locale;
492
  my $cgi      = $::request->{cgi};
493 493

  
494 494
  check_oe_access();
495 495

  
......
1004 1004
  my $form     = $main::form;
1005 1005
  my %myconfig = %main::myconfig;
1006 1006
  my $locale   = $main::locale;
1007
  my $cgi      = $::request->{cgi};
1008 1007

  
1009 1008
  check_oe_access();
1010 1009

  
......
1269 1268
    }
1270 1269

  
1271 1270
    $row->{ids} = {
1272
      'raw_data' =>   $cgi->hidden('-name' => "trans_id_${idx}", '-value' => $oe->{id})
1273
                    . $cgi->checkbox('-name' => "multi_id_${idx}", '-value' => 1, '-label' => ''),
1271
      'raw_data' =>   hidden_tag("trans_id_${idx}", $oe->{id})
1272
                    . checkbox_tag("multi_id_${idx}", value => 1, label => ""),
1274 1273
      'valign'   => 'center',
1275 1274
      'align'    => 'center',
1276 1275
    };
bin/mozilla/rp.pl
44 44
use SL::RP;
45 45
use SL::Iconv;
46 46
use SL::Locale::String qw(t8);
47
use SL::Presenter::Tag;
47
use SL::Presenter::Tag qw(hidden_tag);
48 48
use SL::ReportGenerator;
49 49
use Data::Dumper;
50 50
use List::MoreUtils qw(any);
......
1002 1002
  my $form     = $main::form;
1003 1003
  my %myconfig = %main::myconfig;
1004 1004
  my $locale   = $main::locale;
1005
  my $cgi      = $::request->{cgi};
1006 1005

  
1007 1006
  my $report = SL::ReportGenerator->new(\%myconfig, $form);
1008 1007

  
......
1095 1094

  
1096 1095
    if ($previous_ctid != $ref->{ctid}) {
1097 1096
      $row->{statement}->{raw_data} =
1098
          $cgi->hidden('-name' => "customer_id_" . ($row_idx + 1), '-value' => $ref->{ctid})
1099
        . $cgi->checkbox('-name' => "statement_" . ($row_idx + 1), '-value' => 1, '-label' => '', 'checked' => $ref->{checked});
1097
          hidden_tag("customer_id_" . ($row_idx + 1), $ref->{ctid}) .
1098
          checkbox_tag("statement_" . ($row_idx + 1), checked => $ref->{checked}, value => 1, label => '');
1100 1099
      $row->{ct}->{data} = $ref->{name};
1101 1100

  
1102 1101
      $row_idx++;
bin/mozilla/sepa.pl
14 14
use SL::ReportGenerator;
15 15
use SL::SEPA;
16 16
use SL::SEPA::XML;
17
use SL::Presenter::Tag qw(checkbox_tag);
17 18

  
18 19
require "bin/mozilla/common.pl";
19 20
require "bin/mozilla/reportgenerator.pl";
......
227 228

  
228 229
  my $form   = $main::form;
229 230
  my $locale = $main::locale;
230
  my $cgi    = $::request->{cgi};
231 231
  my $vc     = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
232 232

  
233 233
  $form->{title}     = $vc eq 'customer' ? $::locale->text('List of bank collections') : $locale->text('List of bank transfers');
......
259 259
  my $href           = build_std_url('action=bank_transfer_list', @hidden_vars);
260 260

  
261 261
  my %column_defs = (
262
    'selected'    => { 'text' => $cgi->checkbox(-name => 'select_all', -id => 'select_all', -label => ''), },
262
    'selected'    => { 'text' => checkbox_tag('select_all', id => 'select_all'), },
263 263
    'id'          => { 'text' => $locale->text('Number'), },
264 264
    'export_date' => { 'text' => $locale->text('Export date'), },
265 265
    'employee'    => { 'text' => $locale->text('Employee'), },
......
324 324
    $row->{$_}->{data} = $::form->format_amount(\%::myconfig, $row->{$_}->{data}, 2) for qw(sum_amounts);
325 325

  
326 326
    if (!$export->{closed}) {
327
      $row->{selected}->{raw_data} = $cgi->checkbox(-name => "ids[]", -value => $export->{id}, -label => '');
327
      $row->{selected}->{raw_data} = checkbox_tag("ids[]", value => $export->{id});
328 328
    }
329 329

  
330 330
    $report->add_data($row);
......
510 510
  my $form     =  $main::form;
511 511
  my $myconfig = \%main::myconfig;
512 512
  my $locale   =  $main::locale;
513
  my $cgi      =  $::request->{cgi};
514 513
  my $vc       = $form->{vc} eq 'customer' ? 'customer' : 'vendor';
515 514
  my $defaults = SL::DB::Default->get;
516 515

  
......
599 598

  
600 599
  my $xml = $sepa_xml->to_xml();
601 600

  
602
  print $cgi->header('-type'                => 'application/octet-stream',
601
  print $::request->cgi->header('-type'                => 'application/octet-stream',
603 602
                     '-content-disposition' => 'attachment; filename="SEPA_' . $message_id . ($vc eq 'customer' ? '.cdd' : '.cct') . '"',
604 603
                     '-content-length'      => length $xml);
605 604
  print $xml;

Auch abrufbar als: Unified diff