]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Pflichtenheftabschnitte/-funktionsblöcke: HTML nutzen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 13 Jan 2014 12:40:05 +0000 (13:40 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:12:25 +0000 (13:12 +0200)
12 files changed:
SL/Controller/RequirementSpecItem.pm
SL/DB/RequirementSpecItem.pm
SL/Presenter/RequirementSpecItem.pm
templates/webpages/requirement_spec/_edit_time_and_cost_estimate_item.html
templates/webpages/requirement_spec/_show_time_and_cost_estimate_item.html
templates/webpages/requirement_spec_item/_function_block_content_top.html
templates/webpages/requirement_spec_item/_function_block_form.html
templates/webpages/requirement_spec_item/_section_form.html
templates/webpages/requirement_spec_item/_section_header.html
templates/webpages/requirement_spec_order/_assignment_form.html
templates/webpages/requirement_spec_order/list.html
templates/webpages/requirement_spec_order/update.html

index ffdf56e7b5b87fbc32a6610759d9d974ad177eb9..9b8f6436bbae18a7b3740d637dd1a9f446992aa8 100644 (file)
@@ -155,6 +155,7 @@ sub action_ajax_add_section {
     ->hide('#column-content > *')
     ->appendTo($html, '#column-content')
     ->focus('#new_section_title')
+    ->reinit_widgets
     ->render($self);
 }
 
@@ -241,9 +242,10 @@ sub action_ajax_edit {
       ->remove("#edit_section_form")
       ->insertAfter($html, '#section-header-' . $self->item->id)
       ->jstree->select_node('#tree', '#fb-' . $self->item->id)
-      ->focus("#edit_section_title")
       ->val('#current_content_type', 'section')
       ->val('#current_content_id',   $self->item->id)
+      ->reinit_widgets
+      ->focus("#edit_section_title")
       ->render($self);
     return;
   }
@@ -262,9 +264,10 @@ sub action_ajax_edit {
     ->insertAfter($html, $content_top_id)
     ->run('kivi.requirement_spec.init_function_block_keypress_events', "${id_base}_form")
     ->jstree->select_node('#tree', '#fb-' . $self->item->id)
-    ->focus("#${id_base}_description")
     ->val('#current_content_type', $self->item->item_type)
     ->val('#current_content_id', $self->item->id)
+    ->reinit_widgets
+    ->focus("#${id_base}_description")
     ->render($self);
 }
 
@@ -559,7 +562,7 @@ sub select_node {
 
 sub create_dependency_item {
   my $self = shift;
-  [ $_[0]->id, $self->presenter->truncate(join(' ', grep { $_ } ($_[1], $_[0]->fb_number, $_[0]->description))) ];
+  [ $_[0]->id, $self->presenter->truncate(join(' ', grep { $_ } ($_[1], $_[0]->fb_number, $_[0]->description_as_stripped_html))) ];
 }
 
 sub create_dependencies {
@@ -611,6 +614,7 @@ sub add_new_item_form {
     ->action($params{insert_position}, $html, $params{display_reference})
     ->action_if($self->item->item_type eq 'sub-function-block', 'show', '#sub-function-block-container-' . $self->item->parent_id)
     ->run('kivi.requirement_spec.init_function_block_keypress_events', "${id_base}_form")
+    ->reinit_widgets
     ->focus("#${id_base}_description");
 }
 
index 433e844e5e6b3b36608bff08e3900ae453f88445..0e35ff9056534fd6b8ff8990b531c1195191c62f 100644 (file)
@@ -12,6 +12,7 @@ use SL::DB::MetaSetup::RequirementSpecItem;
 use SL::DB::Manager::RequirementSpecItem;
 use SL::DB::Helper::ActsAsList;
 use SL::DB::Helper::AttrDuration;
+use SL::DB::Helper::AttrHTML;
 use SL::DB::Default;
 use SL::Locale::String;
 use SL::PrefixedNumber;
@@ -40,6 +41,7 @@ __PACKAGE__->meta->initialize;
 
 __PACKAGE__->configure_acts_as_list(group_by => [qw(requirement_spec_id parent_id)]);
 __PACKAGE__->attr_duration(qw(time_estimation));
+__PACKAGE__->attr_html('description');
 
 __PACKAGE__->before_save(\&_before_save_create_fb_number);
 __PACKAGE__->before_save(\&_before_save_invalidate_requirement_spec_version);
@@ -128,7 +130,7 @@ sub child_type {
 sub content_excerpt {
   my ($self) = @_;
 
-  return Common::truncate($self->description // '', at => 200);
+  return Common::truncate($self->description_as_stripped_html // '', at => 200);
 }
 
 
index 357f8c540c873bb461501de184134730e9b4579a..faafd2685398050ab1b9d3e5373ce2ef135f4575 100644 (file)
@@ -12,7 +12,7 @@ use Carp;
 sub requirement_spec_item_tree_node_title {
   my ($self, $item) = @_;
 
-  return join(' ', map { $_ || '' } ($item->fb_number, $self->truncate($item->parent_id ? $item->description : $item->title, at => 30)));
+  return join(' ', map { $_ || '' } ($item->fb_number, $self->truncate($item->parent_id ? $item->description_as_stripped_html : $item->title, at => 30)));
 }
 
 sub requirement_spec_item_jstree_data {
index 593de9a0cb9e11ea234dac1fcf793d59b24a4932..111dc4972919131e7156ba65f205f6c2685fccad 100644 (file)
@@ -3,7 +3,7 @@
  [% L.hidden_tag("requirement_spec_items[+].id", item.id, id = id_prefix _ '_item_id') %]
 
  <td style="padding-left: [%- level * 50 -%]px">
-  [%- P.simple_format(item.fb_number _ ": " _ item.description) -%]
+  [%- item.fb_number _ ": " _ item.description_as_restricted_html -%]
  </td>
  <td>
   [%- L.select_tag('requirement_spec_items[].complexity_id', SELF.complexities, id=id_prefix _ '_complexity_id_' _ item.id, title_key='description', default=item.complexity_id, style="width: 100%") %]<br>
index 897d50fa590f8c3df143e82bcd01939b61f67dd6..c3d21e3b95c0654e7762942429d7392295ed8462 100644 (file)
@@ -1,7 +1,7 @@
 [%- USE HTML -%][%- USE LxERP -%][%- USE P -%]
 <tr class="listrow">
  <td style="padding-left: [%- level * 50 -%]px">
-  [%- P.simple_format(item.fb_number _ ": " _ item.description) -%]
+  [%- item.fb_number _ ": " _ item.description_as_restricted_html -%]
  </td>
  <td>[%- HTML.escape(item.complexity.description) -%]</td>
  <td>[%- HTML.escape(item.risk.description) -%]</td>
index bf341684246f435937b55fe340ef77f9fdd91452..ac6d31f9575832e16a17c3fea73f661efbe70f09 100644 (file)
@@ -1,4 +1,4 @@
 [%- USE HTML -%][%- USE L -%]<div id="[% id_prefix %]function-block-content-top-[% requirement_spec_item.id %]">
  <div class="function-block-number">[%- HTML.escape(requirement_spec_item.fb_number) -%]</div>
- [%- L.simple_format(requirement_spec_item.description) -%]
+ [%- requirement_spec_item.description_as_restricted_html -%]
 </div>
index dbe5952b087d6ecbb8bc4a32f09ded601cbc7a69..8b227e0a7790833a265cfa3200ca069a3ff9a8ea 100644 (file)
@@ -28,7 +28,7 @@
 [%- ELSE -%]
     [%- LxERP.t8("Add sub function block") %]
 [%- END -%]:<br>
-    [% L.textarea_tag(id_base _ '.description', SELF.item.description, rows=8, style="width: 100%") %]
+    [% L.textarea_tag(id_base _ '.description_as_restricted_html', SELF.item.description_as_restricted_html, id=id_base _ '_description', rows=8, style="width: 100%", class='texteditor') %]
    </div>
 
    <div style="margin-top: 10px">
index c5ee1570df7d8c7961d77fbb5012af7f436440f2..9f65c9aea7653a6b6b06eb92305f7934364843a0 100644 (file)
@@ -27,7 +27,7 @@
 
  <p>
   [%- LxERP.t8("Description") %]:<br>
-  [% L.textarea_tag(id_base _ '.description', SELF.item.description, rows=8, cols=80, style=style) %]
+  [% L.textarea_tag(id_base _ '.description_as_restricted_html', SELF.item.description_as_restricted_html, id=id_base _ '_description', rows=8, cols=80, style=style, class='texteditor') %]
  </p>
 
  <p>
index ab70d9988caf2e3aeced50918ee53c1795b1fd65..4df9892e261657a0bf4354bfb957e14b6c8defde 100644 (file)
@@ -13,7 +13,7 @@
 <div class="section-description" id="section-description">
  <div class="section-description-heading">[%- LxERP.t8("Preamble") %]</div>
  [% IF requirement_spec_item.description %]
-  [%- L.simple_format(requirement_spec_item.description) -%]
+  [%- requirement_spec_item.description_as_restricted_html -%]
  [%- ELSE %]
   <span class="dimmed-text">[%- LxERP.t8("No text has been entered yet.") %]</span>
  [%- END %]
index 28cc667ab99c5967e212e6e5e87ba4a76e059fca..9990c55eafec329d87c00cdfd566f858e6033f29 100644 (file)
@@ -40,7 +40,7 @@
     [% L.hidden_tag("sections[+].id", section.id, no_id=1) %]
     <td>[% HTML.escape(section.fb_number) %]</td>
     <td>[% HTML.escape(section.title) %]</td>
-    <td>[% HTML.escape(P.truncate(section.description)) %]</td>
+    <td>[% HTML.escape(P.truncate(section.description_as_stripped_html)) %]</td>
     <td>[% P.part_picker('sections[].order_part_id', section.order_part_id, convertible_unit=SELF.h_unit_name, id='quotations_and_orders_sections_order_pard_id_' _ loop.count, style=style) %]</td>
    </tr>
    [% END %]
index 775ce18600f275024434b9eea086d8d6d7509f93..b4bef1dfca252aa65bd687a3d153e7c9186d4bce 100644 (file)
@@ -23,7 +23,7 @@
     <tr class="listrow">
      <td>[% HTML.escape(section.fb_number) %]</td>
      <td>[% HTML.escape(section.title) %]</td>
-     <td>[% HTML.escape(P.truncate(section.description)) %]</td>
+     <td>[% HTML.escape(P.truncate(section.description_as_stripped_html)) %]</td>
      <td>
       [% IF section.order_part %]
        [% HTML.escape(section.order_part.partnumber) %] [% HTML.escape(section.order_part.description) %]
index 2230bd21ddf1834fa3324dd191538adf7060ec36..13b37980a5e11145ce8ba8a93a4a257854cad95c 100644 (file)
@@ -31,7 +31,7 @@
     <tr class="listrow">
      [% L.hidden_tag("orderitems[+].id", item.item.id, no_id=1) %]
      <td>[% HTML.escape(item.item.part.partnumber) %]</td>
-     <td>[% HTML.escape(item.item.description) %]</td>
+     <td>[% HTML.escape(item.item.description_as_stripped_html) %]</td>
      <td align="right">[% LxERP.format_amount(item.item.qty * 1) %] [% HTML.escape(item.item.unit) %]</td>
      <td align="right">[% LxERP.format_amount(item.item.qty * 1) %] [% HTML.escape(item.item.unit) %]</td>
      <td>[% L.select_tag('orderitems[].section_id', sections, default=item.section.id, title_sub=\make_section_title, style=style, no_id=1, with_empty=1, empty_title=LxERP.t8('Do not modify this position')) %]</td>