Pflichtenhefte: Statischen JavaScript-Code nach js/requirement_spec.js verschieben
[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   create_requirement_spec_context_menus();
104 });
105
106   -->
107 </script>