Pflichtenheftitems und Abschnitte bearbeiten
[kivitendo-erp.git] / templates / webpages / requirement_spec / show.html
1 [%- USE JSON -%][%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE P -%]
2
3 [%- INCLUDE 'common/flash.html' %]
4
5 <h1>[%- HTML.escape(SELF.requirement_spec.displayable_name('format', 'with_customer')) %]
6   [% LxERP.t8("for") %]
7   [% HTML.escape(SELF.requirement_spec.customer.displayable_name) -%]
8 </h1>
9
10 [%- L.hidden_tag('requirement_spec_id', SELF.requirement_spec.id) -%]
11
12 <div id="requirement_spec_version">
13   [%- INCLUDE 'requirement_spec/_version.html' requirement_spec=SELF.requirement_spec -%]
14 </div>
15
16 <div id="column-container">
17  <div id="tree-column">
18   <div id="tree"></div>
19  </div>
20
21  <div id="content-column" class="clearfix">
22   [% L.hidden_tag('current_content_type', SELF.requirement_spec_item.id ? 'section' : '') %]
23   [% L.hidden_tag('current_content_id',   SELF.requirement_spec_item.id) %]
24
25   <div id="column-content">
26    [%- IF SELF.requirement_spec_item -%]
27     [%- INCLUDE 'requirement_spec_item/_section.html' requirement_spec_item=SELF.requirement_spec_item -%]
28    [%- ELSE -%]
29     [%- INCLUDE 'requirement_spec_item/_no_section.html' -%]
30    [%- END -%]
31   </div>
32  </div>
33 </div>
34
35 <script type="text/javascript">
36  <!--
37 $(function() {
38   var tree_data = [
39     { data:     [% JSON.json(LxERP.t8("Text blocks front")) %],
40       metadata: { type: "text-blocks-front" },
41       attr:     { id: "tb-front", class: "text-block-context-menu" },
42       children: [
43 [% FOREACH tb = SELF.requirement_spec.text_blocks_for_position(0) %]
44  [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
45 [% END %]
46       ]},
47
48     { data:     [% JSON.json(LxERP.t8("Sections")) %],
49       metadata: { type: "sections" },
50       attr:     { id: "sections", class: "section-context-menu" },
51       children: [
52 [% FOREACH section = SELF.requirement_spec.sections %]
53  [% P.requirement_spec_item_jstree_data(section).json %][% IF !loop.last %],[% END %]
54 [% END %]
55       ]},
56
57     { data:     [% JSON.json(LxERP.t8("Text blocks back")) %],
58       metadata: { type: "text-blocks-back" },
59       attr:     { id: "tb-back", class: "text-block-context-menu" },
60       children: [
61 [% FOREACH tb = SELF.requirement_spec.text_blocks_for_position(1) %]
62  [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
63 [% END %]
64       ]}];
65
66   $('#tree').jstree({
67     core: {
68       animation: 0,
69       initially_open: [ "tb-front", "tb-back", "sections"
70 [%- FOREACH section = SELF.requirement_spec.sections -%]
71         , "fb-[% section.id %]"
72  [%- FOREACH function_block = section.children -%]
73         , "fb-[% function_block.id -%]"
74  [%- END -%]
75 [%- END -%]
76     ]},
77     json_data: {
78       data: tree_data
79     },
80     crrm: {
81       move: {
82         check_move: requirement_spec_tree_check_move,
83         open_move:  true
84       }
85     },
86     themes: {
87       theme: "requirement-spec"
88     },
89     plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ]
90   })
91   .bind("move_node.jstree", requirement_spec_tree_node_moved)
92   .bind("click.jstree",     requirement_spec_tree_node_clicked);
93 [% IF SELF.requirement_spec_item %]
94   $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
95 [% END %]
96 });
97
98 function ask_delete_text_block(key, opt) {
99   if (confirm("[% LxERP.t8("Are you sure?") %]"))
100     standard_text_block_ajax_call(key, opt);
101   return true;
102 }
103
104 function ask_delete_item(key, opt) {
105   if (confirm("[% LxERP.t8("Are you sure?") %]"))
106     standard_item_ajax_call(key, opt);
107   return true;
108 }
109
110 $(function(){
111   $.contextMenu({
112     selector: '.text-block-context-menu',
113     items: {
114       add:    { name: "[% LxERP.t8('Add text block') %]",    icon: "add",    callback: standard_text_block_ajax_call },
115       edit:   { name: "[% LxERP.t8('Edit text block') %]",   icon: "edit",   callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands },
116       delete: { name: "[% LxERP.t8('Delete text block') %]", icon: "delete", callback: ask_delete_text_block,         disabled: disable_edit_text_block_commands },
117       sep1:   "---------",
118       copy:   { name: "[% LxERP.t8('Copy') %]",              icon: "copy",  disabled: disable_edit_text_block_commands },
119       paste:  { name: "[% LxERP.t8('Paste') %]",             icon: "paste", disabled: disable_edit_text_block_commands }
120     }
121   });
122
123
124   $.contextMenu({
125     selector: '.section-context-menu',
126     items: {
127       add_section:        { name: "[% LxERP.t8('Add section') %]",        icon: "add",    callback: standard_item_ajax_call },
128       add_function_block: { name: "[% LxERP.t8('Add function block') %]", icon: "add",    callback: standard_text_block_ajax_call, disabled: disable_edit_item_commands },
129       sep1:               "---------",
130       edit:               { name: "[% LxERP.t8('Edit') %]",               icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
131       delete:             { name: "[% LxERP.t8('Delete') %]",             icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands },
132       sep2:               "---------",
133       copy:               { name: "[% LxERP.t8('Copy') %]",               icon: "copy",  disabled: disable_edit_item_commands },
134       paste:              { name: "[% LxERP.t8('Paste') %]",              icon: "paste", disabled: disable_edit_item_commands }
135     }
136   });
137
138   $.contextMenu({
139     selector: '.function-block-context-menu,.sub-function-block-context-menu',
140     items: {
141       new_item:     { name: "[% LxERP.t8('Add function block') %]",     icon: "add", callback: standard_item_ajax_call },
142       new_sub_item: { name: "[% LxERP.t8('Add sub function block') %]", icon: "add", callback: standard_item_ajax_call },
143       sep1:         "---------",
144       edit:         { name: "[% LxERP.t8('Edit') %]",   icon: "edit",   callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
145       delete:       { name: "[% LxERP.t8('Delete') %]", icon: "delete", callback: ask_delete_item,         disabled: disable_edit_item_commands },
146       sep2:         "---------",
147       copy:         { name: "[% LxERP.t8('Copy') %]",  icon: "copy",  disabled: disable_edit_item_commands },
148       paste:        { name: "[% LxERP.t8('Paste') %]", icon: "paste", disabled: disable_edit_item_commands }
149     }
150   });
151 });
152
153   -->
154 </script>