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