X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=templates%2Fwebpages%2Frequirement_spec%2Fshow.html;h=3cd23ef75a8a0cd72bbee8d28a17397d9a587c22;hb=2bc2e21bb970197e0b4151d19648e7bb5ce21b18;hp=d8221e567f9abf27ff96d23e3b54498c7bdd71de;hpb=322af7b59df6607bb328963ecde2a1d8813e26b2;p=kivitendo-erp.git diff --git a/templates/webpages/requirement_spec/show.html b/templates/webpages/requirement_spec/show.html index d8221e567..3cd23ef75 100644 --- a/templates/webpages/requirement_spec/show.html +++ b/templates/webpages/requirement_spec/show.html @@ -1,33 +1,48 @@ -[%- USE JSON -%][%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE P -%] +[%- USE JSON -%][%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE P -%][%- USE JavaScript -%] +[% SET sections = SELF.requirement_spec.sections_sorted || [] %] [%- INCLUDE 'common/flash.html' %] -

[%- HTML.escape(SELF.requirement_spec.displayable_name('format', 'with_customer')) %] - [% LxERP.t8("for") %] - [% HTML.escape(SELF.requirement_spec.customer.displayable_name) -%] -

- -[%- L.hidden_tag('requirement_spec_id', SELF.requirement_spec.id) -%] - -
- [%- INCLUDE 'requirement_spec/_version.html' requirement_spec=SELF.requirement_spec -%] -
- -
-
-
-
- -
- [% L.hidden_tag('current_content_type', SELF.requirement_spec_item.id ? 'section' : '') %] - [% L.hidden_tag('current_content_id', SELF.requirement_spec_item.id) %] - -
- [%- IF SELF.requirement_spec_item -%] - [%- INCLUDE 'requirement_spec_item/_section.html' requirement_spec_item=SELF.requirement_spec_item -%] - [%- ELSE -%] - [%- INCLUDE 'requirement_spec_item/_no_section.html' -%] - [%- END -%] +[%- INCLUDE 'requirement_spec/_header.html' %] + +[%- L.hidden_tag('requirement_spec_id', SELF.requirement_spec.id, 'data-is-template'=(SELF.requirement_spec.is_template ? 1 : 0)) -%] + +
+ + +
+ [%- UNLESS SELF.requirement_spec.is_template %] +
+ [%- INCLUDE 'requirement_spec/_version.html' requirement_spec=SELF.requirement_spec -%] +
+ [%- END %] + +
+
+
+
+ +
+ [% L.hidden_tag('current_content_type', SELF.requirement_spec_item.id ? 'section' : '') %] + [% L.hidden_tag('current_content_id', SELF.requirement_spec_item.id) %] + +
+ [%- IF SELF.requirement_spec_item -%] + [%- INCLUDE 'requirement_spec_item/_section.html' requirement_spec_item=SELF.requirement_spec_item -%] + [%- ELSE -%] + [%- INCLUDE 'requirement_spec_item/_no_section.html' -%] + [%- END -%] +
+
@@ -40,8 +55,8 @@ $(function() { metadata: { type: "text-blocks-front" }, attr: { id: "tb-front", class: "text-block-context-menu" }, children: [ -[% FOREACH tb = SELF.requirement_spec.text_blocks_for_position(0) %] - [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %] +[% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=0) %] + [% tb.presenter.jstree_data.json %][% IF !loop.last %],[% END %] [% END %] ]}, @@ -49,8 +64,8 @@ $(function() { metadata: { type: "sections" }, attr: { id: "sections", class: "section-context-menu" }, children: [ -[% FOREACH section = SELF.requirement_spec.sections %] - [% P.requirement_spec_item_jstree_data(section).json %][% IF !loop.last %],[% END %] +[% FOREACH section = sections %] + [% section.presenter.jstree_data.json %][% IF !loop.last %],[% END %] [% END %] ]}, @@ -58,126 +73,36 @@ $(function() { metadata: { type: "text-blocks-back" }, attr: { id: "tb-back", class: "text-block-context-menu" }, children: [ -[% FOREACH tb = SELF.requirement_spec.text_blocks_for_position(1) %] - [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %] +[% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=1) %] + [% tb.presenter.jstree_data.json %][% IF !loop.last %],[% END %] [% END %] - ]}]; + ]} + ]; - $('#tree').jstree({ - core: { - animation: 0, - initially_open: [ "tb-front", "tb-back", "sections" -[%- FOREACH section = SELF.requirement_spec.sections -%] + var initially_open = ['tb-front', 'tb-back', 'sections' +[%- FOREACH section = sections -%] , "fb-[% section.id %]" [%- FOREACH function_block = section.children -%] , "fb-[% function_block.id -%]" [%- END -%] [%- END -%] - ]}, - json_data: { - data: tree_data - }, - crrm: { - move: { - check_move: requirement_spec_tree_check_move, - open_move: true - } - }, - themes: { - theme: "requirement-spec" - }, - plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ] - }) - .bind("move_node.jstree", requirement_spec_tree_node_moved) - .bind("click.jstree", requirement_spec_tree_node_clicked); + ]; + + kivi.requirement_spec.initialize_requirement_spec({ + initially_open: initially_open + , tree_data: tree_data + , is_template: [% SELF.requirement_spec.is_template ? 'true' : 'false' %] + , html_template_exists: [% SELF.html_template ? 'true' : 'false' %] [% IF SELF.requirement_spec_item %] - $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true); + , initially_selected_node: '#fb-[% SELF.requirement_spec_item.id %]' [% END %] -}); - -function ask_delete_text_block(key, opt) { - if (confirm("[% LxERP.t8("Are you sure?") %]")) - standard_text_block_ajax_call(key, opt); - return true; -} - -function ask_delete_item(key, opt) { - if (confirm("[% LxERP.t8("Are you sure?") %]")) - standard_item_ajax_call(key, opt); - return true; -} - -$(function(){ - $.contextMenu({ - selector: '.text-block-context-menu', - items: { - add: { name: "[% LxERP.t8('Add text block') %]", icon: "add", callback: standard_text_block_ajax_call }, - edit: { name: "[% LxERP.t8('Edit text block') %]", icon: "edit", callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands }, - delete: { name: "[% LxERP.t8('Delete text block') %]", icon: "delete", callback: ask_delete_text_block, disabled: disable_edit_text_block_commands }, - sep1: "---------", - copy: { name: "[% LxERP.t8('Copy') %]", icon: "copy", disabled: disable_edit_text_block_commands }, - paste: { name: "[% LxERP.t8('Paste') %]", icon: "paste", disabled: disable_edit_text_block_commands } - } - }); - - - $.contextMenu({ - selector: '.section-context-menu', - items: { - add_section: { name: "[% LxERP.t8('Add section') %]", icon: "add", callback: standard_item_ajax_call }, - add_function_block: { name: "[% LxERP.t8('Add function block') %]", icon: "add", callback: standard_text_block_ajax_call, disabled: disable_edit_item_commands }, - sep1: "---------", - edit: { name: "[% LxERP.t8('Edit') %]", icon: "edit", callback: standard_item_ajax_call, disabled: disable_edit_item_commands }, - delete: { name: "[% LxERP.t8('Delete') %]", icon: "delete", callback: ask_delete_item, disabled: disable_edit_item_commands }, - sep2: "---------", - copy: { name: "[% LxERP.t8('Copy') %]", icon: "copy", disabled: disable_edit_item_commands }, - paste: { name: "[% LxERP.t8('Paste') %]", icon: "paste", disabled: disable_edit_item_commands } - } - }); - - $.contextMenu({ - selector: '.function-block-context-menu,.sub-function-block-context-menu', - items: { - new_item: { name: "[% LxERP.t8('Add function block') %]", icon: "add", callback: standard_item_ajax_call }, - new_sub_item: { name: "[% LxERP.t8('Add sub function block') %]", icon: "add", callback: standard_item_ajax_call }, - sep1: "---------", - edit: { name: "[% LxERP.t8('Edit') %]", icon: "edit", callback: standard_item_ajax_call, disabled: disable_edit_item_commands }, - delete: { name: "[% LxERP.t8('Delete') %]", icon: "delete", callback: ask_delete_item, disabled: disable_edit_item_commands }, - sep2: "---------", - copy: { name: "[% LxERP.t8('Copy') %]", icon: "copy", disabled: disable_edit_item_commands }, - paste: { name: "[% LxERP.t8('Paste') %]", icon: "paste", disabled: disable_edit_item_commands } + , time_based_units: { + [% FOREACH unit = SELF.time_based_units %] + [% UNLESS loop.first %], [% END %] "[% JavaScript.escape(unit.name) %]": true + [% END %] } }); }); -function edit_section_header() { - $.post("controller.pl?action=RequirementSpecItem/edit_section&id=" + encodeURIComponent($('#active_section_id').val()), function(data) { - var header = $('#section-header'); - header.data('old-elements', header.children().detach()); - header.html(data); - }); -} - -function submit_section_form() { - $.post("controller.pl?action=RequirementSpecItem/update_section&id=" + $('#section-form form').serialize(), function(data) { - var header = $('#section-header'); - header.removeData('old-elements'); - header.html(data['header_html']); - $('#tree').jstree('rename_node', '#fb-' + data['id'], data['node_name']); - }); -} - -function cancel_section_form() { - var header = $('#section-header'); - header.empty(); - header.append(header.data('old-elements')); - header.removeData('old-elements'); -} - - - - - - -->