Pflichtenhefte: Textblöcke, Abschnitte und Funktionsblöcke markieren können
[kivitendo-erp.git] / templates / webpages / requirement_spec / show.html
index cb5cda9..e4846f5 100644 (file)
@@ -1,5 +1,7 @@
 [%- USE JSON -%][%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE P -%]
 
+[%- INCLUDE 'common/flash.html' %]
+
 <h1>[%- HTML.escape(SELF.requirement_spec.displayable_name('format', 'with_customer')) %]
   [% LxERP.t8("for") %]
   [% HTML.escape(SELF.requirement_spec.customer.displayable_name) -%]
 </div>
 
 <div id="column-container">
- <div id="tree-column" style="border-right: 1px solid black">
-  <div style="min-height: 32px; height: 32px;">
-   <div style="float: left">
-    [% L.button_tag("new_section_form()", LxERP.t8("New section"), id="new-section-button") %]
-   </div>
-   <div id="spinner" class="clearfix" style="float: right; display: none; background:url('js/themes/requirement-spec/throbber.gif') center center no-repeat !important; min-height: 32px; height: 32px; min-width: 32px; width: 32px;"></div>
-  </div>
-
+ <div id="tree-column">
   <div id="tree"></div>
  </div>
 
 
   <div id="column-content">
    [%- IF SELF.requirement_spec_item -%]
-    [%- INCLUDE 'requirement_spec_item/_single_section.html' requirement_spec_item=SELF.requirement_spec_item -%]
+    [%- INCLUDE 'requirement_spec_item/_section.html' requirement_spec_item=SELF.requirement_spec_item -%]
    [%- ELSE -%]
-    no section
-    [%#- render :partial => 'requirement_spec_items/no_section' -%]
+    [%- INCLUDE 'requirement_spec_item/_no_section.html' -%]
    [%- END -%]
   </div>
  </div>
 
 <script type="text/javascript">
  <!--
-     var tree_data = [
-       { data:     [% JSON.json(LxERP.t8("Text blocks front")) %],
-         metadata: { type: "textblocks-front" },
-         attr:     { id: "tb-front", class: "text-block-context-menu" },
-         children: [
+$(function() {
+  var tree_data = [
+    { data:     [% JSON.json(LxERP.t8("Text blocks front")) %],
+      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 %]
 [% END %]
-         ]
-       },
-
-       { data:     [% JSON.json(LxERP.t8("Sections")) %],
-         metadata: { type: "sections" },
-         attr:     { id: "sections" },
-         children: [
+      ]},
 
+    { data:     [% JSON.json(LxERP.t8("Sections")) %],
+      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 %]
 [% END %]
-         ]
-       },
+      ]},
 
-       { data:     [% JSON.json(LxERP.t8("Text blocks back")) %],
-         metadata: { type: "textblocks-back" },
-         attr:     { id: "tb-back", class: "text-block-context-menu" },
-         children: [
+    { data:     [% JSON.json(LxERP.t8("Text blocks back")) %],
+      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 %]
 [% END %]
-         ]
-       }
-     ];
-
-     $(function() {
-       $('#tree').jstree({
-         core: {
-           animation: 0,
-           initially_open: [ "tb-front", "tb-back", "sections"
+      ]}];
+
+  $('#tree').jstree({
+    core: {
+      animation: 0,
+      initially_open: [ "tb-front", "tb-back", "sections"
 [%- FOREACH section = SELF.requirement_spec.sections -%]
- , "fb-[% section.id %]"
       , "fb-[% section.id %]"
  [%- FOREACH function_block = section.children -%]
-  , "fb-[% function_block.id -%]"
+        , "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);
-[%- IF SELF.requirement_spec_item -%]
-       $.jstree._reference("#tree").select_node('fb-[% SELF.requirement_spec_item.id %]', true);
-[%- 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);
+[% IF SELF.requirement_spec_item %]
+  $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
+[% END %]
+});
 
 function ask_delete_text_block(key, opt) {
   if (confirm("[% LxERP.t8("Are you sure?") %]"))
-    delete_text_block(key, opt);
+    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: add_text_block },
-          edit:   { name: "[% LxERP.t8('Edit text block') %]", icon: "edit", callback: edit_text_block, 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: '.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:   "---------",
+      flag:   { name: "[% LxERP.t8('Toggle marker') %]",     icon: "flag",  callback: standard_text_block_ajax_call, disabled: disable_edit_text_block_commands },
+      sep2:   "---------",
+      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_item_ajax_call, disabled: disable_add_function_block_command },
+      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:                   "---------",
+      flag:               { name: "[% LxERP.t8('Toggle marker') %]", icon: "flag", callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
+      sep3:               "---------",
+      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: {
+      add_function_block:     { name: "[% LxERP.t8('Add function block') %]",     icon: "add", callback: standard_item_ajax_call },
+      add_sub_function_block: { 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:                   "---------",
+      flag:                   { name: "[% LxERP.t8('Toggle marker') %]", icon: "flag", callback: standard_item_ajax_call, disabled: disable_edit_item_commands },
+      sep3:                   "---------",
+      copy:                   { name: "[% LxERP.t8('Copy') %]",  icon: "copy",  disabled: disable_edit_item_commands },
+      paste:                  { name: "[% LxERP.t8('Paste') %]", icon: "paste", disabled: disable_edit_item_commands }
+    }
+  });
 });
 
   -->