From: Moritz Bunkus Date: Mon, 13 Jan 2014 12:40:05 +0000 (+0100) Subject: Pflichtenheftabschnitte/-funktionsblöcke: HTML nutzen X-Git-Tag: release-3.2.0beta~467^2~50 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3fbb0b9bbc37dbbe10407a858c58148e2d835c2c;p=kivitendo-erp.git Pflichtenheftabschnitte/-funktionsblöcke: HTML nutzen --- diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index ffdf56e7b..9b8f6436b 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -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"); } diff --git a/SL/DB/RequirementSpecItem.pm b/SL/DB/RequirementSpecItem.pm index 433e844e5..0e35ff905 100644 --- a/SL/DB/RequirementSpecItem.pm +++ b/SL/DB/RequirementSpecItem.pm @@ -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); } diff --git a/SL/Presenter/RequirementSpecItem.pm b/SL/Presenter/RequirementSpecItem.pm index 357f8c540..faafd2685 100644 --- a/SL/Presenter/RequirementSpecItem.pm +++ b/SL/Presenter/RequirementSpecItem.pm @@ -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 { diff --git a/templates/webpages/requirement_spec/_edit_time_and_cost_estimate_item.html b/templates/webpages/requirement_spec/_edit_time_and_cost_estimate_item.html index 593de9a0c..111dc4972 100644 --- a/templates/webpages/requirement_spec/_edit_time_and_cost_estimate_item.html +++ b/templates/webpages/requirement_spec/_edit_time_and_cost_estimate_item.html @@ -3,7 +3,7 @@ [% L.hidden_tag("requirement_spec_items[+].id", item.id, id = id_prefix _ '_item_id') %] - [%- P.simple_format(item.fb_number _ ": " _ item.description) -%] + [%- item.fb_number _ ": " _ item.description_as_restricted_html -%] [%- 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%") %]
diff --git a/templates/webpages/requirement_spec/_show_time_and_cost_estimate_item.html b/templates/webpages/requirement_spec/_show_time_and_cost_estimate_item.html index 897d50fa5..c3d21e3b9 100644 --- a/templates/webpages/requirement_spec/_show_time_and_cost_estimate_item.html +++ b/templates/webpages/requirement_spec/_show_time_and_cost_estimate_item.html @@ -1,7 +1,7 @@ [%- USE HTML -%][%- USE LxERP -%][%- USE P -%] - [%- P.simple_format(item.fb_number _ ": " _ item.description) -%] + [%- item.fb_number _ ": " _ item.description_as_restricted_html -%] [%- HTML.escape(item.complexity.description) -%] [%- HTML.escape(item.risk.description) -%] diff --git a/templates/webpages/requirement_spec_item/_function_block_content_top.html b/templates/webpages/requirement_spec_item/_function_block_content_top.html index bf3416842..ac6d31f95 100644 --- a/templates/webpages/requirement_spec_item/_function_block_content_top.html +++ b/templates/webpages/requirement_spec_item/_function_block_content_top.html @@ -1,4 +1,4 @@ [%- USE HTML -%][%- USE L -%]
[%- HTML.escape(requirement_spec_item.fb_number) -%]
- [%- L.simple_format(requirement_spec_item.description) -%] + [%- requirement_spec_item.description_as_restricted_html -%]
diff --git a/templates/webpages/requirement_spec_item/_function_block_form.html b/templates/webpages/requirement_spec_item/_function_block_form.html index dbe5952b0..8b227e0a7 100644 --- a/templates/webpages/requirement_spec_item/_function_block_form.html +++ b/templates/webpages/requirement_spec_item/_function_block_form.html @@ -28,7 +28,7 @@ [%- ELSE -%] [%- LxERP.t8("Add sub function block") %] [%- END -%]:
- [% 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') %]
diff --git a/templates/webpages/requirement_spec_item/_section_form.html b/templates/webpages/requirement_spec_item/_section_form.html index c5ee1570d..9f65c9aea 100644 --- a/templates/webpages/requirement_spec_item/_section_form.html +++ b/templates/webpages/requirement_spec_item/_section_form.html @@ -27,7 +27,7 @@

[%- LxERP.t8("Description") %]:
- [% 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') %]

diff --git a/templates/webpages/requirement_spec_item/_section_header.html b/templates/webpages/requirement_spec_item/_section_header.html index ab70d9988..4df9892e2 100644 --- a/templates/webpages/requirement_spec_item/_section_header.html +++ b/templates/webpages/requirement_spec_item/_section_header.html @@ -13,7 +13,7 @@

[%- LxERP.t8("Preamble") %]
[% IF requirement_spec_item.description %] - [%- L.simple_format(requirement_spec_item.description) -%] + [%- requirement_spec_item.description_as_restricted_html -%] [%- ELSE %] [%- LxERP.t8("No text has been entered yet.") %] [%- END %] diff --git a/templates/webpages/requirement_spec_order/_assignment_form.html b/templates/webpages/requirement_spec_order/_assignment_form.html index 28cc667ab..9990c55ea 100644 --- a/templates/webpages/requirement_spec_order/_assignment_form.html +++ b/templates/webpages/requirement_spec_order/_assignment_form.html @@ -40,7 +40,7 @@ [% L.hidden_tag("sections[+].id", section.id, no_id=1) %] [% HTML.escape(section.fb_number) %] [% HTML.escape(section.title) %] - [% HTML.escape(P.truncate(section.description)) %] + [% HTML.escape(P.truncate(section.description_as_stripped_html)) %] [% 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) %] [% END %] diff --git a/templates/webpages/requirement_spec_order/list.html b/templates/webpages/requirement_spec_order/list.html index 775ce1860..b4bef1dfc 100644 --- a/templates/webpages/requirement_spec_order/list.html +++ b/templates/webpages/requirement_spec_order/list.html @@ -23,7 +23,7 @@ [% HTML.escape(section.fb_number) %] [% HTML.escape(section.title) %] - [% HTML.escape(P.truncate(section.description)) %] + [% HTML.escape(P.truncate(section.description_as_stripped_html)) %] [% IF section.order_part %] [% HTML.escape(section.order_part.partnumber) %] [% HTML.escape(section.order_part.description) %] diff --git a/templates/webpages/requirement_spec_order/update.html b/templates/webpages/requirement_spec_order/update.html index 2230bd21d..13b37980a 100644 --- a/templates/webpages/requirement_spec_order/update.html +++ b/templates/webpages/requirement_spec_order/update.html @@ -31,7 +31,7 @@ [% L.hidden_tag("orderitems[+].id", item.item.id, no_id=1) %] [% HTML.escape(item.item.part.partnumber) %] - [% HTML.escape(item.item.description) %] + [% HTML.escape(item.item.description_as_stripped_html) %] [% LxERP.format_amount(item.item.qty * 1) %] [% HTML.escape(item.item.unit) %] [% LxERP.format_amount(item.item.qty * 1) %] [% HTML.escape(item.item.unit) %] [% 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')) %]