Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1c335e9

Von Moritz Bunkus vor fast 19 Jahren hinzugefügt

  • ID d1c335e9bb0a35d45acd03b29d1e759f26c5664c
  • Vorgänger ff7976ff
  • Nachfolger b0c83ce1

HTML-Vorlagen:

Die globale Konfigurationsvariable $latex in $latex_templates umbenannt. Einige globale Konfigurationsvariablen in allen HTML-Vorlagen unter dem Namen "conf_<variablenname>" bekannt gemacht.

Zwei Variablen lokal zur aktuellen Funktion gemacht.

Automatisch in HTML-Vorlagen die Zugriffsberechtigungen als Variablen der Form "access_menu_name" verfuegbar machen.

Alle Variablen aus %myconfig in HTML-Webseitenvorlagen verfuegbar gemacht. Ausserdem aus das Datumsformat fuer den Javascript-Kalendar aus dem Datenbankdatumsformat ableiten und zur Verfuegung stellen.

Beim Aufruf von $form->show_generic_error() auf jeden Fall $form->header() aufrufen und danach das Script beenden.

[Merge der Revisionen 876 883 902 987 1093 aus dem LINET prog Repo]

Unterschiede anzeigen:

SL/Form.pm
38 38
package Form;
39 39

  
40 40
use HTML::Template;
41
use SL::Menu;
41 42

  
42 43
sub _input_to_hash {
43 44
  $main::lxdebug->enter_sub(2);
......
242 243

  
243 244
  if ($ENV{HTTP_USER_AGENT}) {
244 245
    $msg =~ s/\n/<br>/g;
245

  
246
    $self->header;
247 246
    $self->show_generic_error($msg);
248 247

  
249
    die "Error: $msg\n";
250

  
251 248
  } else {
252 249

  
253 250
    if ($self->{error_function}) {
......
373 370
    }
374 371

  
375 372
    #Set Calendar
376
    $jsscript = "";
373
    my $jsscript = "";
377 374
    if ($self->{jsscript} == 1) {
378 375

  
379 376
      $jsscript = qq|
......
410 407
  $main::lxdebug->leave_sub();
411 408
}
412 409

  
413
use Data::Dumper;
414 410
sub parse_html_template {
415 411
  $main::lxdebug->enter_sub();
416 412

  
......
461 457
      "<br><em>DEBUG INFORMATION:</em><pre>" . $additional_params->{"DEBUG"} . "</pre>";
462 458
  }
463 459

  
460
  if (%main::myconfig) {
461
    map({ $additional_params->{"myconfig_${_}"} = $main::myconfig{$_}; } keys(%main::myconfig));
462
    my $jsc_dateformat = $main::myconfig{"dateformat"};
463
    $jsc_dateformat =~ s/d+/\%d/gi;
464
    $jsc_dateformat =~ s/m+/\%m/gi;
465
    $jsc_dateformat =~ s/y+/\%Y/gi;
466
    $additional_params->{"myconfig_jsc_dateformat"} = $jsc_dateformat;
467
  }
468

  
469
  $additional_params->{"conf_jscalendar"} = $main::jscalendar;
470
  $additional_params->{"conf_lizenzen"} = $main::lizenzen;
471
  $additional_params->{"conf_latex_templates"} = $main::latex;
472
  $additional_params->{"conf_opendocument_templates"} = $main::opendocument_templates;
473

  
474
  my $menu;
475
  if (-f $self->{"login"} . "_menu.ini") {
476
    $menu = Menu->new($self->{"login"} . "_menu.ini");
477
  } else {
478
    $menu = Menu->new("menu.ini");
479
  }
480
  $menu->generate_acl("", $additional_params);
481

  
464 482
  my @additional_param_names = keys(%{$additional_params});
465 483

  
466 484
  foreach my $key ($template->param()) {
......
485 503
  $add_params->{"title"} = $title if ($title);
486 504
  $self->{"label_error"} = $error;
487 505

  
506
  $self->header();
488 507
  print($self->parse_html_template("generic/error", $add_params));
508

  
509
  die("Error: $error\n");
510
}
511

  
512
sub show_generic_information {
513
  my ($self, $error, $title) = @_;
514

  
515
  my $add_params = {};
516
  $add_params->{"title"} = $title if ($title);
517
  $self->{"label_information"} = $error;
518

  
519
  $self->header();
520
  print($self->parse_html_template("generic/information", $add_params));
521

  
522
  die("Information: $error\n");
489 523
}
490 524

  
491 525
# write Trigger JavaScript-Code ($qty = quantity of Triggers)
......
536 570
      );
537 571
       |;
538 572
  }
539
  $jsscript = qq|
573
  my $jsscript = qq|
540 574
       <script type="text/javascript">
541 575
       <!--| . join("", @triggers) . qq|//-->
542 576
        </script>
......
715 749
  my ($current_page, $current_line, $current_row) = (1, 1, 0);
716 750
  my $pagebreak = "";
717 751
  my $sum       = 0;
718

  
719 752
  # } Moritz Bunkus
720 753

  
721 754
  # Make sure that all *notes* (intnotes, partnotes_*, notes etc) are converted to markup correctly.
......
1073 1106
      close(IN);
1074 1107
    }
1075 1108

  
1076
    $self->cleanup;
1077

  
1078 1109
  }
1079 1110

  
1111
  $self->cleanup;
1112

  
1080 1113
  chdir("$self->{cwd}");
1081 1114
  $main::lxdebug->leave_sub();
1082 1115
}
......
1730 1763
    $query = qq| SELECT * FROM tax t|;
1731 1764
    $sth   = $dbh->prepare($query);
1732 1765
    $sth->execute || $self->dberror($query);
1733
    $form->{TAX} = ();
1766
    $self->{TAX} = ();
1734 1767
    while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
1735 1768
      push @{ $self->{TAX} }, $ref;
1736 1769
    }
......
2105 2138

  
2106 2139
  $query = qq|UPDATE defaults
2107 2140
              SET $fld = '$var'|;
2108
  $dbh->do($query) || $form->dberror($query);
2141
  $dbh->do($query) || $self->dberror($query);
2109 2142

  
2110 2143
  $dbh->commit;
2111 2144
  $dbh->disconnect;
......
2133 2166
  }
2134 2167
  $query = qq|UPDATE business
2135 2168
              SET customernumberinit = '$var' WHERE id=$business_id|;
2136
  $dbh->do($query) || $form->dberror($query);
2169
  $dbh->do($query) || $self->dberror($query);
2137 2170

  
2138 2171
  $dbh->commit;
2139 2172
  $dbh->disconnect;
bin/mozilla/cp.pl
443 443
  $media = qq|
444 444
          <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
445 445

  
446
  if ($myconfig{printer} && $latex) {
446
  if ($myconfig{printer} && $latex_templates) {
447 447
    $media .= qq|
448 448
          <option value=printer $form->{OP}{printer}>|
449 449
      . $locale->text('Printer');
450 450
  }
451
  if ($latex) {
451
  if ($latex_templates) {
452 452
    $media .= qq|
453 453
          <option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
454 454
    $format .= qq|
......
474 474
<input class=submit type=submit name=action value="|
475 475
    . $locale->text('Post') . qq|">|;
476 476

  
477
  if ($latex) {
477
  if ($latex_templates) {
478 478
    print qq|
479 479
<input class=submit type=submit name=action value="|
480 480
      . $locale->text('Print') . qq|">|;
bin/mozilla/io.pl
1326 1326
  } else {
1327 1327
    $media = qq|<select name=media>
1328 1328
	    <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
1329
    if ($myconfig{printer} && $latex) {
1329
    if ($myconfig{printer} && $latex_templates) {
1330 1330
      $media .= qq|
1331 1331
            <option value=printer $form->{OP}{printer}>|
1332 1332
        . $locale->text('Printer');
1333 1333
    }
1334
    if ($latex) {
1334
    if ($latex_templates) {
1335 1335
      $media .= qq|
1336 1336
            <option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
1337 1337
    }
......
1340 1340
  $format = qq|<select name=format>
1341 1341
            <option value=html $form->{DF}{html}>html|;
1342 1342

  
1343
  if ($latex) {
1343
  if ($latex_templates) {
1344 1344
    $format = qq|<select name=format>
1345 1345
            <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF') . qq|
1346 1346
            <option value=html $form->{DF}{html}>html
......
1348 1348
      . $locale->text('Postscript');
1349 1349
  }
1350 1350

  
1351
  $format .= qq|<option value=html $form->{DF}{html}>HTML</option>|;
1352

  
1353
  if ($latex_templates) {
1354
    $format .= qq|<option value=postscript $form->{DF}{postscript}>| .
1355
      $locale->text('Postscript') . qq|</option>|;
1356
  }
1357

  
1351 1358
  $language_select = qq|<select name=language>
1352 1359
                 <option value=""></option>|;
1353 1360
  %lang = (de => "deutsch", en => "englisch", fr => "franz?sisch");
......
1371 1378
	  <td>$media</select></td>
1372 1379
|;
1373 1380

  
1374
  if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
1381
  if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
1375 1382
    print qq|
1376 1383
	  <td>| . $locale->text('Copies') . qq|
1377 1384
	  <input name=copies size=2 value=$form->{copies}></td>
bin/mozilla/rp.pl
1906 1906
  } else {
1907 1907
    $media = qq|
1908 1908
	    <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
1909
    if ($myconfig{printer} && $latex) {
1909
    if ($myconfig{printer} && $latex_templates) {
1910 1910
      $media .= qq|
1911 1911
            <option value=printer $form->{OP}{printer}>|
1912 1912
        . $locale->text('Printer');
1913 1913
    }
1914 1914
  }
1915 1915

  
1916
  if ($latex) {
1916
  if ($latex_templates) {
1917 1917
    $format .= qq|
1918 1918
            <option value=postscript $form->{DF}{postscript}>|
1919 1919
      . $locale->text('Postscript') . qq|
......
1928 1928
    <td><select name=media>$media</select></td>
1929 1929
|;
1930 1930

  
1931
  if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
1931
  if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
1932 1932
    print qq|
1933 1933
      <td>| . $locale->text('Copies') . qq|
1934 1934
      <input name=copies size=2 value=$form->{copies}></td>
......
2729 2729
  } else {
2730 2730
    $media = qq|
2731 2731
	    <option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
2732
    if ($myconfig{printer} && $latex) {
2732
    if ($myconfig{printer} && $latex_templates) {
2733 2733
      $media .= qq|
2734 2734
            <option value=printer $form->{OP}{printer}>|
2735 2735
        . $locale->text('Printer');
2736 2736
    }
2737 2737
  }
2738 2738

  
2739
  if ($latex) {
2739
  if ($latex_templates) {
2740 2740
    $format .= qq|
2741 2741
            <option value=html $form->{DF}{html}>|
2742 2742
      . $locale->text('HTML') . qq|
......
2756 2756
    <td><select name=media>$media</select></td>
2757 2757
|;
2758 2758

  
2759
  if ($myconfig{printer} && $latex && $form->{media} ne 'email') {
2759
  if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
2760 2760
    print qq|
2761 2761
      <td>| . $locale->text('Copies') . qq|
2762 2762
      <input name=copies size=2 value=$form->{copies}></td>
bin/mozilla/ustva.pl
760 760
      qq|       <option value=html selected>|
761 761
    . $locale->text('Vorschau')
762 762
    . qq|</option>|;
763
  if ($latex) {
763
  if ($latex_templates) {
764 764
    $format .=
765 765
        qq|    <option value=pdf>|
766 766
      . $locale->text('UStVA als PDF-Dokument')
lx-erp.conf
26 26
$ENV{"ORACLE_HOME"} = "/usr/local/oracle";
27 27

  
28 28
# if you have latex installed set to 1
29
$latex = 1;
29
$latex_templates = 1;
30 30

  
31 31
# if the server can't find gzip, latex, dvips or pdflatex, add the path
32 32
$ENV{PATH} .= ":/usr/local/bin";

Auch abrufbar als: Unified diff