c4819fe2f07a0c8f0628d539310f3d75760e7c58
[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, 'data-is-template'=(SELF.requirement_spec.is_template ? 1 : 0)) -%]
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   [%- UNLESS SELF.requirement_spec.is_template %]
14    <li><a href="controller.pl?action=RequirementSpec/ajax_show_time_and_cost_estimate&id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Time and cost estimate") %]</a></li>
15    <li><a href="controller.pl?action=RequirementSpecVersion/list&requirement_spec_id=[% HTML.url(SELF.requirement_spec.id) %]">[%- LxERP.t8("Versions") %]</a></li>
16   [%- END %]
17  </ul>
18
19  <div id="function-blocks-tab">
20   [%- UNLESS SELF.requirement_spec.is_template %]
21    <div id="requirement_spec_version">
22     [%- INCLUDE 'requirement_spec/_version.html' requirement_spec=SELF.requirement_spec -%]
23    </div>
24   [%- END %]
25
26   <div id="column-container" class="clearfix">
27    <div id="tree-column">
28     <div id="tree"></div>
29    </div>
30
31    <div id="content-column" class="clearfix">
32     [% L.hidden_tag('current_content_type', SELF.requirement_spec_item.id ? 'section' : '') %]
33     [% L.hidden_tag('current_content_id',   SELF.requirement_spec_item.id) %]
34
35     <div id="column-content">
36      [%- IF SELF.requirement_spec_item -%]
37       [%- INCLUDE 'requirement_spec_item/_section.html' requirement_spec_item=SELF.requirement_spec_item -%]
38      [%- ELSE -%]
39       [%- INCLUDE 'requirement_spec_item/_no_section.html' -%]
40      [%- END -%]
41     </div>
42    </div>
43   </div>
44  </div>
45 </div>
46
47 <script type="text/javascript">
48  <!--
49 $(function() {
50   var initially_open = ['sections'
51 [%- FOREACH section = SELF.requirement_spec.sections -%]
52         , "fb-[% section.id %]"
53  [%- FOREACH function_block = section.children -%]
54         , "fb-[% function_block.id -%]"
55  [%- END -%]
56 [%- END -%]
57   ];
58
59   var tree_data = [{
60       data:     [% JSON.json(LxERP.t8("Sections")) %],
61       metadata: { type: "sections" },
62       attr:     { id: "sections", class: "section-context-menu" },
63       children: [
64 [% FOREACH section = SELF.requirement_spec.sections %]
65  [% P.requirement_spec_item_jstree_data(section).json %][% IF !loop.last %],[% END %]
66 [% END %]
67       ]}];
68
69 [% UNLESS SELF.requirement_spec.is_template %]
70   tree_data.unshift({
71       data:     [% JSON.json(LxERP.t8("Text blocks front")) %],
72       metadata: { type: "text-blocks-front" },
73       attr:     { id: "tb-front", class: "text-block-context-menu" },
74       children: [
75 [% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=0) %]
76  [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
77 [% END %]
78       ]});
79
80   tree_data.push({
81       data:     [% JSON.json(LxERP.t8("Text blocks back")) %],
82       metadata: { type: "text-blocks-back" },
83       attr:     { id: "tb-back", class: "text-block-context-menu" },
84       children: [
85 [% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=1) %]
86  [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
87 [% END %]
88       ]});
89
90   initially_open = initially_open.concat(['tb-front', 'tb-back']);
91 [% END %]
92
93   $('#tree').jstree({
94     core: {
95       animation: 0,
96       initially_open: initially_open,
97     },
98     json_data: {
99       data: tree_data
100     },
101     crrm: {
102       move: {
103         check_move: kivi.requirement_spec.tree_check_move,
104         open_move:  true
105       }
106     },
107     themes: {
108       theme: "requirement-spec"
109     },
110     plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ]
111   })
112   .bind("move_node.jstree", kivi.requirement_spec.tree_node_moved)
113   .bind("click.jstree",     kivi.requirement_spec.tree_node_clicked);
114 [% IF SELF.requirement_spec_item %]
115   $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
116 [% END %]
117
118   kivi.requirement_spec.create_context_menus([% SELF.requirement_spec.is_template ? 'true' : 'false' %]);
119 });
120
121   -->
122 </script>