use SL::DB::Default;
use SL::AM;
use SL::Form;
+use SL::Locale::String qw(t8);
use Data::Dumper;
$options{"CAN_EDIT"} = $form->{"edit"};
if (!$form->{edit}) {
- $options{"content"} = "\n\n" if (!$options{"content"});
- $options{"SHOW_SECOND_EDIT_BUTTON"} = $options{"lines"} > 25;
+ $options{"content"} = "\n\n" if (!$options{"content"});
}
}
$options{"HIDDEN"} = [ map(+{ "name" => $_, "value" => $form->{$_} }, @hidden) ];
+ setup_amtemplates_display_form_action_bar(
+ mode => $form->{edit} ? 'edit' : 'show',
+ template_selected => $options{SHOW_CONTENT},
+ );
+
$form->header;
print($form->parse_html_template("am/edit_templates", \%options));
$main::lxdebug->leave_sub();
}
+sub setup_amtemplates_display_form_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Edit'),
+ submit => [ '#form', { action => 'edit_template' } ],
+ accesskey => 'enter',
+ only_if => $params{mode} eq 'show',
+ disabled => !$params{template_selected} ? t8('No template has been selected yet.') : undef,
+ ],
+
+ action => [
+ t8('Save'),
+ submit => [ '#form', { action => 'save_template' } ],
+ accesskey => 'enter',
+ only_if => $params{mode} eq 'edit',
+ ],
+
+ action => [
+ t8('Abort'),
+ call => [ 'kivi.history_back' ],
+ only_if => $params{mode} eq 'edit',
+ ],
+ );
+ }
+}
+
1;
'No start date given, setting to #1' => 'Kein Startdatum gegeben, setze Startdatum auf #1',
'No such job #1 in the database.' => 'Hintergrund-Job #1 existiert nicht mehr.',
'No summary account' => 'Kein Sammelkonto',
+ 'No template has been selected yet.' => 'Es wurde noch keine Vorlage ausgewählt.',
'No template was found.' => 'Es wurde keine Vorlage gefunden.',
'No text blocks have been created for this position.' => 'Für diese Position wurden noch keine Textblöcke angelegt.',
'No text has been entered yet.' => 'Es wurde noch kein Text eingegeben.',
'report_generator_dispatch_to is not defined.' => 'report_generator_dispatch_to ist nicht definiert.',
'report_generator_nextsub is not defined.' => 'report_generator_nextsub ist nicht definiert.',
'request_quotation' => 'Angebotsanforderung',
- 'reset' => 'zurücksetzen',
'return_material' => 'Materialrückgabe',
'rfq_list' => 'anfragenliste',
'running' => 'läuft',
'start upload' => 'Hochladen beginnt',
'stock' => 'Einlagerung',
'stock_br' => 'Eingel.',
- 'submit' => 'abschicken',
'succeeded' => 'erfolgreich',
'sum' => 'Summe',
'tax_chartaccno' => 'Automatikkonto',
<p style="text-align: right;">[<a href="doc/html/ch03s03.html" target="_blank" title="[% 'Open in new window' | $T8 %]">[% 'Help Template Variables' | $T8 %]</a>]</p>
[% END %]
- <form method="post" name="Form" action="amtemplates.pl">
+ <form method="post" name="Form" action="amtemplates.pl" id="form">
[% FOREACH var = HIDDEN %]<input type="hidden" name="[% HTML.escape(var.name) %]" value="[% HTML.escape(var.value) %]">[% END %]
<hr>
[% END %]
-
-
[% IF SHOW_CONTENT %]
<h2>
[% IF CAN_EDIT %][% 'Edit file' | $T8 %][% ELSE %][% 'Display file' | $T8 %][% END %] [% HTML.escape(display_filename) %]
[% IF CAN_EDIT %]
<p><textarea name="content" id="edit_content" cols="100" rows="25"[% IF edit %] class="initial_focus"[% END %]>[% HTML.escape(content) %]</textarea></p>
- <p>
- <input type="hidden" name="save_nextsub" value="save_template">
- <input type="submit" name="action" value="[% 'Save' | $T8 %]">
- <input type="button" onclick="history.back()" value="[% 'Back' | $T8 %]">
- </p>
-
[% ELSE %]
- <input type="hidden" name="edit_nextsub" value="edit_template">
-
- <p><input name="action" type="submit" class="submit" value="[% 'Edit' | $T8 %]"></p>
-
<p><pre class="filecontent">[% HTML.escape(content) %]</pre></p>
- [% IF SHOW_SECOND_EDIT_BUTTON %]
- <p><input name="action" type="submit" class="submit" value="[% 'Edit' | $T8 %]"></p>
- [% END %]
-
[% END %] <!-- CAN_EDIT -->
[% END %] <!-- SHOW_CONTENT -->