From: Moritz Bunkus
Date: Wed, 31 Oct 2007 14:30:43 +0000 (+0000)
Subject: Umstellung der Vorlagen in templates/webpages/am von HTML::Template auf Template.
X-Git-Tag: release-2.6.0beta1~453
X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b9882bee823f393f2071c790c1d73407c7d8ea51;p=kivitendo-erp.git
Umstellung der Vorlagen in templates/webpages/am von HTML::Template auf Template.
---
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index d11f16113..ac973cff9 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -339,7 +339,7 @@ sub account_header {
};
# Ausgabe des Templates
- print($form->parse_html_template('am/edit_accounts', $parameters_ref));
+ print($form->parse_html_template2('am/edit_accounts', $parameters_ref));
$lxdebug->leave_sub();
@@ -398,18 +398,10 @@ sub save_account {
sub list_account {
$lxdebug->enter_sub();
- CA->all_accounts(\%myconfig, \%$form);
-
- $form->{title} = $locale->text('Chart of Accounts');
-
- # construct callback
- $callback =
- "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
-
+ $form->{callback} = build_std_url('action=list_account');
+ my $link_edit_account = build_std_url('action=edit_account', 'callback');
-
- # escape callback
- $callback = $form->escape($callback);
+ CA->all_accounts(\%myconfig, \%$form);
foreach $ca (@{ $form->{CA} }) {
@@ -423,19 +415,11 @@ sub list_account {
$ca->{debit} = $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2);
}
$ca->{heading} = ( $ca->{charttype} eq 'H' ) ? 1:'';
- $ca->{link_edit_account} =
- qq|$form->{script}?action=edit_account&id=$ca->{id}|
- .qq|&login=$form->{login}|
- .qq|&password=$form->{password}&callback=$callback|;
+ $ca->{link_edit_account} = $link_edit_account . '&id=' . E($ca->{id});
}
# Ajax
- my $list_account_details_url =
- "$form->{script}?login=$form->{login}"
- ."&password=$form->{password}&action=list_account_details&";
-
-
- my $pjx = new CGI::Ajax('list_account_details' => $list_account_details_url);
+ my $pjx = new CGI::Ajax('list_account_details' => build_std_url('action=list_account_details'));
# Eneable AJAX debuging
#$pjx->DEBUG(1);
@@ -444,6 +428,7 @@ sub list_account {
push(@ { $form->{AJAX} }, $pjx);
$form->{stylesheets} = "list_accounts.css";
+ $form->{title} = $locale->text('Chart of Accounts');
$form->header;
@@ -461,23 +446,12 @@ sub list_account {
sub list_account_details {
-# Ajax Funktion aus list_account_details
+# Ajax Funktion aus list_account_details
$lxdebug->enter_sub();
my $chart_id = $form->{args};
-
- CA->all_accounts(\%myconfig, \%$form, $chart_id);
-
- $form->{title} = $locale->text('Chart of Accounts');
-
- # construct callback
- $callback =
- "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
- $form->header;
-
- # escape callback
- $callback = $form->escape($callback);
+ CA->all_accounts(\%myconfig, \%$form, $chart_id);
foreach $ca (@{ $form->{CA} }) {
@@ -494,11 +468,11 @@ sub list_account_details {
}
my @links = split( q{:}, $ca->{link});
-
+
$ca->{link} = q{};
-
+
foreach my $link (@links){
- $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
+ $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
: ( $link eq 'AP') ? $locale->text('Account Link AP')
: ( $link eq 'IC') ? $locale->text('Account Link IC')
: ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount')
@@ -515,16 +489,8 @@ sub list_account_details {
: ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
# : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax')
: $locale->text('Unknown Link') . ': ' . $link;
-
$ca->{link} .= ($link ne '') ? "[$link] ":'';
}
-
- $ca->{startdate} =~ s/,/
/og;
- $ca->{tk_ustva} =~ s/,/
/og;
- $ca->{taxkey} =~ s/,/
/og;
- $ca->{taxaccount} =~ s/,/
/og;
- $ca->{taxdescription} =~ s/,/
/og;
- $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):$locale->text('Off');
$ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
: ($ca->{category} eq 'E') ? $locale->text('Account Category E')
@@ -534,29 +500,13 @@ sub list_account_details {
: ($ca->{category} eq 'C') ? $locale->text('Account Category C')
: ($ca->{category} eq 'G') ? $locale->text('Account Category G')
: $locale->text('Unknown Category') . ': ' . $ca->{category};
-
- $ca->{link_edit_account} =
- qq|$form->{script}?action=edit_account&id=$ca->{id}|
- .qq|&login=$form->{login}|
- .qq|&password=$form->{password}&callback=$callback|;
}
+ $form->{title} = $locale->text('Chart of Accounts');
+ $form->header();
+ print $form->parse_html_template2('am/list_account_details');
-
- my $parameters_ref = {
-
-
- # hidden_variables => $_hidden_variables_ref,
- };
-
- # Ausgabe des Templates
- #my $q = CGI->new();
- my $result = $form->parse_html_template('am/list_account_details', $parameters_ref);
-
- print $result;
-# print "chart_id:$chart_id, form->chartid:$form->{chart_id}, rest=$rest";
-
$lxdebug->leave_sub();
}
@@ -2609,11 +2559,11 @@ sub edit_units {
$form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
$form->header();
- print($form->parse_html_template("am/edit_units",
- { "UNITS" => \@unit_list,
- "NEW_BASE_UNIT_DDBOX" => $ddbox,
- "LANGUAGES" => \@languages,
- "updownlink" => $updownlink }));
+ print($form->parse_html_template2("am/edit_units",
+ { "UNITS" => \@unit_list,
+ "NEW_BASE_UNIT_DDBOX" => $ddbox,
+ "LANGUAGES" => \@languages,
+ "updownlink" => $updownlink }));
$lxdebug->leave_sub();
}
diff --git a/bin/mozilla/amtemplates.pl b/bin/mozilla/amtemplates.pl
index 73e7e9b82..61877259a 100644
--- a/bin/mozilla/amtemplates.pl
+++ b/bin/mozilla/amtemplates.pl
@@ -145,8 +145,7 @@ sub display_template_form {
push(@values,
{ "value" => $file,
- "label" => ref($setup) ? $setup->{"translation"} : $setup,
- "default" => $file eq $form->{"formname"} });
+ "label" => ref($setup) ? $setup->{"translation"} : $setup });
}
# "zahlungserinnerung" => $locale->text('Payment Reminder'),
@@ -155,54 +154,45 @@ sub display_template_form {
next if !$ref->{"template"};
push(@values,
- { "value" => $ref->{"template"},
- "label" => $locale->text('Payment Reminder') . ": " . $ref->{"dunning_description"},
- "default" => $ref->{"template"} eq $form->{"formname"} });
+ { "value" => $ref->{"template"},
+ "label" => $locale->text('Payment Reminder') . ": " . $ref->{"dunning_description"} });
}
@values = sort({ $a->{"label"} cmp $b->{"label"} } @values);
- $options{"FORMNAME"} = [ @values ];
+ $options{FORMNAME} = [ @values ];
#
# Setup "language" selection
#
- @values = ( { "value" => "", "label" => "", "default" => 0 } );
+ @values = ();
foreach my $item (@{ $form->{"ALL_LANGUAGES"} }) {
next unless ($item->{"template_code"});
- my $key = "$item->{id}--$item->{template_code}";
-
push(@values,
- { "value" => $key,
- "label" => $item->{"description"},
- "default" => $key eq $form->{"language"} });
+ { "value" => "$item->{id}--$item->{template_code}",
+ "label" => $item->{"description"} });
}
- $options{"LANGUAGE"} = [ @values ];
- $options{"SHOW_LANGUAGE"} = scalar(@values) > 1;
-
- @values = ( { "value" => "", "label" => "", "default" => 0 } );
+ $options{LANGUAGE} = [ @values ];
#
# Setup "printer" selection
#
+ @values = ();
+
foreach my $item (@{ $form->{"ALL_PRINTERS"} }) {
next unless ($item->{"template_code"});
- my $key = "$item->{id}--$item->{template_code}";
-
push(@values,
- { "value" => $key,
- "label" => $item->{"printer_description"},
- "default" => $key eq $form->{"printer"} });
+ { "value" => "$item->{id}--$item->{template_code}",
+ "label" => $item->{"printer_description"} });
}
- $options{"PRINTER"} = [ @values ];
- $options{"SHOW_PRINTER"} = scalar(@values) > 1;
+ $options{PRINTER} = [ @values ];
} else {
push(@hidden, qw(formname language printer));
@@ -231,7 +221,7 @@ sub display_template_form {
$options{"HIDDEN"} = [ map(+{ "name" => $_, "value" => $form->{$_} }, @hidden) ];
$form->header;
- print($form->parse_html_template("am/edit_templates", \%options));
+ print($form->parse_html_template2("am/edit_templates", \%options));
$lxdebug->leave_sub();
}
diff --git a/locale/de/am b/locale/de/am
index 876d6966d..0d3936765 100644
--- a/locale/de/am
+++ b/locale/de/am
@@ -161,8 +161,6 @@ $self->{texts} = {
'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
'None' => 'Kein',
'Number Format' => 'Zahlenformat',
- 'Off' => 'Aus',
- 'On' => 'An',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'PAYMENT POSTED' => 'Rechung gebucht',
'PDF' => 'PDF',
diff --git a/templates/webpages/am/edit_accounts_de.html b/templates/webpages/am/edit_accounts_de.html
index 12a61d09d..08829fcca 100644
--- a/templates/webpages/am/edit_accounts_de.html
+++ b/templates/webpages/am/edit_accounts_de.html
@@ -1,4 +1,4 @@
-
-
-
+ [% END %]
-
+ [% IF SHOW_CONTENT %]
- Datei bearbeitenDatei anzeigen
+ [% IF CAN_EDIT %]Datei bearbeiten[% ELSE %]Datei anzeigen[% END %] [% HTML.escape(display_filename) %]
-
-
+ [% IF CAN_EDIT %]
+
+
-
+ [% ELSE %]
-
+ [% HTML.escape(content) %]
-
+ [% IF SHOW_SECOND_EDIT_BUTTON %]
-
+ [% END %]
-
+ [% END %]
-
+ [% END %]
diff --git a/templates/webpages/am/edit_templates_master.html b/templates/webpages/am/edit_templates_master.html
index 3a166ec3a..fcf223c9e 100644
--- a/templates/webpages/am/edit_templates_master.html
+++ b/templates/webpages/am/edit_templates_master.html
@@ -1,31 +1,33 @@
-
+[% USE HTML %]
-
+ [% title %]
diff --git a/templates/webpages/am/edit_units_de.html b/templates/webpages/am/edit_units_de.html
index ca8d4e721..096bfa2d2 100644
--- a/templates/webpages/am/edit_units_de.html
+++ b/templates/webpages/am/edit_units_de.html
@@ -1,22 +1,22 @@
-
+[% USE HTML %]
-
-
+ [% IF saved_message %]
+ [% saved_message %]
-
+ [% END %]
-