Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 64084bfa

Von Sven Schöling vor fast 13 Jahren hinzugefügt

  • ID 64084bfa6ba2c9167ff4a50683606e57fec62167
  • Vorgänger a27dd3ae
  • Nachfolger d0535d47

Vorlagendefault und Vorlagenmetadaten. Siehe Dokumentation.

Unterschiede anzeigen:

bin/mozilla/io.pl
46 46
use SL::IC;
47 47
use SL::IO;
48 48

  
49
use SL::DB::Language;
50
use SL::DB::Printer;
51

  
49 52
require "bin/mozilla/common.pl";
50 53

  
51 54
use strict;
......
1473 1476
    $extension            = 'xls';
1474 1477
  }
1475 1478

  
1476
  my $email_extension = (($form->{media} eq 'email') && (-f "$myconfig{templates}/$form->{formname}_email$form->{language}${printer_code}.${extension}")) ? '_email' : '';
1479
  # search for the template
1480
  my @template_files;
1481
  push @template_files, "$form->{formname}_email$form->{language}$printer_code.$extension" if $form->{media} eq 'email';
1482
  push @template_files, "$form->{formname}$form->{language}$printer_code.$extension";
1483
  push @template_files, "$form->{formname}.$extension";
1484
  push @template_files, "default.$extension";
1477 1485

  
1478
  $form->{IN}         = "$form->{formname}${email_extension}$form->{language}${printer_code}.${extension}";
1486
  $form->{IN} = undef;
1487
  for my $filename (@template_files) {
1488
    if (-f "$myconfig{templates}/$filename") {
1489
      $form->{IN} = $filename;
1490
      last;
1491
    }
1492
  }
1493

  
1494
  if (!defined $form->{IN}) {
1495
    $::form->error($::locale->text('Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.', join ', ', map { "'$_'"} @template_files));
1496
  }
1479 1497

  
1480 1498
  delete $form->{OUT};
1481 1499

  
......
1540 1558
  }
1541 1559
  # /saving the history
1542 1560

  
1561
  # prepare meta information for template introspection
1562
  $form->{template_meta} = {
1563
    formname  => $form->{formname},
1564
    language  => SL::DB::Manager::Language->find_by_or_create(id => $form->{language_id}),
1565
    format    => $form->{format},
1566
    media     => $form->{media},
1567
    extension => $extension,
1568
    printer   => SL::DB::Manager::Printer->find_by_or_create(id => $form->{printer_id}),
1569
  };
1570

  
1543 1571
  $form->parse_template(\%myconfig);
1544 1572

  
1545 1573
  $form->{callback} = "";

Auch abrufbar als: Unified diff