From 6ebacae90e52d35ce729638490a015060f12fee3 Mon Sep 17 00:00:00 2001
From: Moritz Bunkus
Date: Thu, 26 Jan 2017 14:53:43 +0100
Subject: [PATCH] ActionBar: Verwendung bei Wiedervorlagen
---
bin/mozilla/fu.pl | 80 +++++++++++++++++++
locale/de/all | 1 +
templates/webpages/fu/add_edit.html | 7 +-
templates/webpages/fu/edit_access_rights.html | 8 +-
templates/webpages/fu/report_bottom.html | 7 --
templates/webpages/fu/report_top.html | 3 +-
templates/webpages/fu/search.html | 9 +--
7 files changed, 86 insertions(+), 29 deletions(-)
diff --git a/bin/mozilla/fu.pl b/bin/mozilla/fu.pl
index 660e98283..9b19ba8d7 100644
--- a/bin/mozilla/fu.pl
+++ b/bin/mozilla/fu.pl
@@ -1,6 +1,7 @@
use POSIX qw(strftime);
use SL::FU;
+use SL::Locale::String qw(t8);
use SL::ReportGenerator;
require "bin/mozilla/reportgenerator.pl";
@@ -99,6 +100,8 @@ sub display_form {
$params{trans_id} = $form->{LINKS}->[0]->{trans_id} if (@{ $form->{LINKS} });
$form->{FOLLOW_UPS} = FU->follow_ups(%params);
+ setup_fu_display_form_action_bar() unless $::form->{POPUP_MODE};
+
$form->header(no_layout => $::form->{POPUP_MODE});
print $form->parse_html_template('fu/add_edit');
@@ -232,6 +235,7 @@ sub search {
$form->{title} = $locale->text('Follow-Ups');
+ setup_fu_search_action_bar();
$form->header();
print $form->parse_html_template('fu/search');
@@ -347,6 +351,7 @@ sub report {
$report->add_data($row);
}
+ setup_fu_report_action_bar();
$report->generate_with_headers();
$main::lxdebug->leave_sub();
@@ -409,6 +414,8 @@ sub edit_access_rights {
$form->{title} = $locale->text('Edit Access Rights for Follow-Ups');
+ setup_fu_edit_access_rights_action_bar();
+
$form->header();
print $form->parse_html_template('fu/edit_access_rights');
@@ -475,4 +482,77 @@ sub dispatcher {
$form->error($locale->text('No action defined.'));
}
+sub setup_fu_search_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Show'),
+ submit => [ '#form', { action => "report" } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
+sub setup_fu_display_form_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Save'),
+ submit => [ '#form', { action => "save" } ],
+ accesskey => 'enter',
+ ],
+ action => [
+ t8('Finish'),
+ submit => [ '#form', { action => "finish" } ],
+ disabled => !$::form->{id} ? t8('The object has not been saved yet.') : undef,
+ ],
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => "delete" } ],
+ disabled => !$::form->{id} ? t8('The object has not been saved yet.') : undef,
+ confirm => t8('Do you really want to delete this object?'),
+ ],
+ );
+ }
+}
+
+sub setup_fu_report_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Finish'),
+ submit => [ '#form', { action => "finish" } ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name^=selected_]' ] ],
+ ],
+ action => [
+ t8('Delete'),
+ submit => [ '#form', { action => "delete" } ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name^=selected_]' ] ],
+ confirm => t8('Do you really want to delete the selected objects?'),
+ ],
+ );
+ }
+}
+
+sub setup_fu_edit_access_rights_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Save'),
+ submit => [ '#form', { action => "save_access_rights" } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
1;
diff --git a/locale/de/all b/locale/de/all
index 664669f5f..280e2b905 100755
--- a/locale/de/all
+++ b/locale/de/all
@@ -989,6 +989,7 @@ $self->{texts} = {
'Do you really want to delete GL transaction #1?' => 'Wollen Sie wirklich die Dialogbuchung #1 löschen?',
'Do you really want to delete the selected documents?' => 'Wollen Sie wirklich diese Dateien löschen?',
'Do you really want to delete the selected links?' => 'Wollen Sie wirklich die ausgewählten Verknüpfungen löschen?',
+ 'Do you really want to delete the selected objects?' => 'Wollen Sie die ausgewählten Objekte wirklich löschen?',
'Do you really want to delete this draft?' => 'Wollen Sie diesen Entwurf wirklich löschen?',
'Do you really want to delete this object?' => 'Wollen Sie dieses Objekt wirklich löschen?',
'Do you really want to delete this record template?' => 'Wollen Sie diese Belegvorlage wirklich löschen?',
diff --git a/templates/webpages/fu/add_edit.html b/templates/webpages/fu/add_edit.html
index e3b3191d2..3db4c4b59 100644
--- a/templates/webpages/fu/add_edit.html
+++ b/templates/webpages/fu/add_edit.html
@@ -7,7 +7,7 @@
$(function(){ document.Form.subject.focus(); });
-
+ [%- IF POPUP_MODE %]
@@ -58,12 +59,9 @@
[%- END %]
- [%- IF POPUP_MODE %]
- [%- END %]
- [%- IF POPUP_MODE %]
[%- IF FOLLOW_UPS.size %]
@@ -99,4 +97,3 @@
-
diff --git a/templates/webpages/fu/edit_access_rights.html b/templates/webpages/fu/edit_access_rights.html
index b2c6536ff..c2389cfa1 100644
--- a/templates/webpages/fu/edit_access_rights.html
+++ b/templates/webpages/fu/edit_access_rights.html
@@ -9,7 +9,7 @@
[% 'Allow the following users access to my follow-ups:' | $T8 %]
-