From 4cab0b745055e422ff7f55c0560fdc934409a791 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 13 May 2013 10:58:12 +0200 Subject: [PATCH] =?utf8?q?Pflichtenheftvorlage:=20Maske=20zur=20Auswahl=20?= =?utf8?q?des=20Einzuf=C3=BCgenden?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/RequirementSpec.pm | 12 +++- js/locale/de.js | 1 + js/requirement_spec.js | 28 +++++--- locale/de/all | 9 +++ .../select_template_to_paste.html | 72 +++++++++++++++++++ 5 files changed, 110 insertions(+), 12 deletions(-) create mode 100644 templates/webpages/requirement_spec/select_template_to_paste.html diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index 75d80341f..a90152608 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -148,10 +148,11 @@ sub action_ajax_save_time_and_cost_estimate { sub action_show { my ($self) = @_; - my $item = $::form->{requirement_spec_item_id} ? SL::DB::RequirementSpecItem->new(id => $::form->{requirement_spec_item_id})->load : @{ $self->requirement_spec->sections }[0]; + my $title = $self->requirement_spec->is_template ? t8('Show requirement spec template') : t8('Show requirement spec'); + my $item = $::form->{requirement_spec_item_id} ? SL::DB::RequirementSpecItem->new(id => $::form->{requirement_spec_item_id})->load : @{ $self->requirement_spec->sections }[0]; $self->requirement_spec_item($item); - $self->render('requirement_spec/show', title => t8('Show requirement spec')); + $self->render('requirement_spec/show', title => $title); } sub action_create { @@ -210,6 +211,13 @@ sub action_create_pdf { unlink $result{file_name}; } +sub action_select_template_to_paste { + my ($self) = @_; + + my @templates = grep { @{ $_->sections } || @{ $_->text_blocks } } @{ SL::DB::Manager::RequirementSpec->get_all(where => [ is_template => 1 ], sort_by => 'lower(title)') }; + $self->render('requirement_spec/select_template_to_paste', { layout => 0 }, TEMPLATES => \@templates); +} + # # filters # diff --git a/js/locale/de.js b/js/locale/de.js index b6ad2006d..495a6a4e9 100644 --- a/js/locale/de.js +++ b/js/locale/de.js @@ -25,6 +25,7 @@ namespace("kivi").setupLocale({ "Map":"Karte", "Part picker":"Artikelauswahl", "Paste":"Einfügen", +"Paste template":"Vorlage einfügen", "Requirement spec actions":"Pflichtenheftaktionen", "Requirement spec template actions":"Pflichtenheftvorlagen-Aktionen", "Revert to version":"Auf Version zurücksetzen", diff --git a/js/requirement_spec.js b/js/requirement_spec.js index 7773575b2..3bfa69d6e 100644 --- a/js/requirement_spec.js +++ b/js/requirement_spec.js @@ -206,9 +206,9 @@ ns.standard_item_ajax_call = function(key, opt, other_data) { current_content_id: $('#current_content_id').val() }; - // console.log("I would normally POST the following now:"); - // console.log(data); - $.post("controller.pl", $.extend(data, other_data || {}), kivi.eval_json_result); + console.log("I would normally POST the following now:"); + console.log(data); + // $.post("controller.pl", $.extend(data, other_data || {}), kivi.eval_json_result); return true; }; @@ -269,6 +269,10 @@ ns.item_popup_menu_hidden = function(opt) { return ns.handle_item_popup_menu_markings(opt, false); }; +ns.paste_template = function(key, opt, other_data) { + open_jqm_window({ url: 'controller.pl?action=RequirementSpec/select_template_to_paste' }); +}; + // ------------------------------------------------------------------------- // -------------------------- time/cost estimate --------------------------- // ------------------------------------------------------------------------- @@ -384,13 +388,14 @@ ns.create_context_menus = function(is_template) { } else { // if (is_template) var general_actions = { - sep98: "---------" - , general_actions: { name: kivi.t8('Requirement spec actions'), className: 'context-menu-heading' } - // , sep99: "---------" - , create_pdf: { name: kivi.t8('Create PDF'), icon: "pdf", callback: kivi.requirement_spec.create_reqspec_pdf } - , create_version: { name: kivi.t8('Create new version'), icon: "new", callback: kivi.requirement_spec.create_version, disabled: kivi.requirement_spec.disable_commands } - , copy_reqspec: { name: kivi.t8('Copy requirement spec'), icon: "copy", callback: kivi.requirement_spec.copy_reqspec } - , delete_reqspec: { name: kivi.t8('Delete requirement spec'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec } + sep98: "---------" + , general_actions: { name: kivi.t8('Requirement spec actions'), className: 'context-menu-heading' } + , create_pdf: { name: kivi.t8('Create PDF'), icon: "pdf", callback: kivi.requirement_spec.create_reqspec_pdf } + , create_version: { name: kivi.t8('Create new version'), icon: "new", callback: kivi.requirement_spec.create_version, disabled: kivi.requirement_spec.disable_commands } + , copy_reqspec: { name: kivi.t8('Copy requirement spec'), icon: "copy", callback: kivi.requirement_spec.copy_reqspec } + , delete_reqspec: { name: kivi.t8('Delete requirement spec'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec } + , sep_paste_template: "---------" + , paste_template: { name: kivi.t8('Paste template'), icon: "paste", callback: kivi.requirement_spec.paste_template } }; $.contextMenu({ @@ -410,6 +415,9 @@ ns.create_context_menus = function(is_template) { , revert_to_version: { name: kivi.t8('Revert to version'), icon: "revert", callback: kivi.requirement_spec.revert_to_versioned_copy_ajax_call, disabled: kivi.requirement_spec.disable_versioned_copy_item_commands } }, general_actions) }); + + var paste_template_actions = { + }; } // if (is_template) ... else ... var events = { diff --git a/locale/de/all b/locale/de/all index b9c589b67..8f9bf87ce 100755 --- a/locale/de/all +++ b/locale/de/all @@ -19,6 +19,9 @@ $self->{texts} = { '#1 h' => '#1 h', '#1 of #2 importable objects were imported.' => '#1 von #2 importierbaren Objekten wurden importiert.', '#1 prices were updated.' => '#1 Preise wurden aktualisiert.', + '#1 section(s)' => '#1 Abschnitt(e)', + '#1 text block(s) back' => '#1 Textlock/-blöcke vorne', + '#1 text block(s) front' => '#1 Textblock/-blöcke hinten', '%' => '%', '(recommended) Insert the used currencies in the system. You can simply change the name of the currencies by editing the textfields above. Do not use a name of a currency that is already in use.' => '(empfohlen) Fügen Sie die verwaisten Währungen in Ihr System ein. Sie können den Namen der Währung einfach ändern, indem Sie die Felder oben bearbeiten. Benutzen Sie keine Namen von Währungen, die Sie bereits benutzen.', '*/' => '*/', @@ -771,6 +774,7 @@ $self->{texts} = { 'Destination bin' => 'Ziellagerplatz', 'Destination warehouse' => 'Ziellager', 'Destination warehouse and bin' => 'Ziellager und -lagerplatz', + 'Detail view' => 'Detailanzeige', 'Details (one letter abbreviation)' => 'D', 'Difference' => 'Differenz', 'Directory' => 'Verzeichnis', @@ -1485,6 +1489,7 @@ $self->{texts} = { 'No project type has been created yet.' => 'Es wurden noch keine Projekttypen angelegt.', 'No report with id #1' => 'Es gibt keinen Report mit der Id #1', 'No requirement spec statuses has been created yet.' => 'Es wurden noch keine Pflichtenheftstatus angelegt.', + 'No requirement spec templates have been created yet.' => 'Es wurden noch keine Pflichtenheftvorlangen angelegt.', 'No requirement spec type has been created yet.' => 'Es wurden noch keine Pflichtenhefttypen angelegt.', 'No risks level has been created yet.' => 'Es wurden noch keine Risikograde angelegt.', 'No sections created yet' => 'Keine Abschnitte erstellt', @@ -1627,6 +1632,7 @@ $self->{texts} = { 'Partsgroup (name)' => 'Warengruppe (Name)', 'Password' => 'Passwort', 'Paste' => 'Einfügen', + 'Paste template' => 'Vorlage einfügen', 'Payables' => 'Verbindlichkeiten', 'Payment' => 'Zahlungsausgang', 'Payment / Delivery Options' => 'Zahlungs- und Lieferoptionen', @@ -1987,6 +1993,7 @@ $self->{texts} = { 'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte', 'Select postscript or PDF!' => 'Postscript oder PDF auswählen!', 'Select tax office...' => 'Finanzamt auswählen...', + 'Select template to paste' => 'Einzufügende Vorlage auswählen', 'Select type of removal' => 'Grund der Entnahme auswählen', 'Select type of transfer' => 'Grund der Umlagerung auswählen', 'Selected' => 'Ausgewählt', @@ -2064,6 +2071,7 @@ $self->{texts} = { 'Show overdue sales quotations and requests for quotations...' => 'Überfällige Angebote und Preisanfragen anzeigen...', 'Show parts' => 'Artikel anzeigen', 'Show requirement spec' => 'Pflichtenheft anzeigen', + 'Show requirement spec template' => 'Pflichtenheftvorlage anzeigen', 'Show settings' => 'Einstellungen anzeigen', 'Show the picture in the part form' => 'Bild in Warenmaske anzeigen', 'Show the pictures in the result for search parts' => 'Bilder in Suchergebnis für Stammdaten -> Berichte -> Waren anzeigen', @@ -2684,6 +2692,7 @@ $self->{texts} = { 'Weight' => 'Gewicht', 'Weight unit' => 'Gewichtseinheit', 'What term you are looking for?' => 'Nach welchem Begriff wollen Sie suchen?', + 'What this template contains' => 'Was diese Vorlage enthält', 'What type of item is this?' => 'Was ist dieser Artikel?', 'Which is located at doc/kivitendo-Dokumentation.pdf. Click here: ' => 'Diese befindet sich unter doc/kivitendo-Dokumentation.pdf. Klicken Sie hier:', 'With Extension Of Time' => 'mit Dauerfristverlängerung', diff --git a/templates/webpages/requirement_spec/select_template_to_paste.html b/templates/webpages/requirement_spec/select_template_to_paste.html new file mode 100644 index 000000000..ff2eea7a3 --- /dev/null +++ b/templates/webpages/requirement_spec/select_template_to_paste.html @@ -0,0 +1,72 @@ +[%- USE LxERP -%][%- USE HTML -%][%- USE L -%] +[%- BLOCK text_blocks %] + [%- IF blocks.size %] +
  • + [%- title %]: +
      + [%- FOREACH block = blocks %] +
    1. [%- HTML.escape(block.title) %]
    2. + [%- END %] +
    +
  • + [%- END %] +[%- END %] + +

    [%- LxERP.t8("Select template to paste") %]

    + +[%- IF !TEMPLATES.size %] +

    [%- LxERP.t8("No requirement spec templates have been created yet.") %]

    + +

    [%- LxERP.t8("Abort") %]

    + +[%- ELSE %] + + + + + + + + + +[%- FOREACH template = TEMPLATES %] + + + + + + + + + [% SET front = template.text_blocks_sorted(output_position=0) %] + [% SET sections = template.sections_sorted %] + [% SET back = template.text_blocks_sorted(output_position=1) %] + + +[%- END %] +
    [%- LxERP.t8("Detail view") %][%- LxERP.t8("Paste template") %][%- LxERP.t8("Title") %][%- LxERP.t8("Last modification") %]
    + + [+] + [-] + + [%- LxERP.t8("Paste template") %][%- HTML.escape(template.title) %][% template.mtime ? template.mtime.to_kivitendo(precision='minute') : template.itime.to_kivitendo(precision='minute') %]
    + +

    [%- LxERP.t8("Abort") %]

    +[%- END %] -- 2.20.1