From: Moritz Bunkus Date: Fri, 17 Dec 2021 14:13:09 +0000 (+0100) Subject: Merge branch 'f-cvar-htmlfield' X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~269 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/2644d2a93d051b4040354c87c0410ebf494a15df?hp=d32410ac096b92aa0d2b5085bbc031aea900b096 Merge branch 'f-cvar-htmlfield' --- diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index 58f1febab..f41135387 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -451,6 +451,7 @@ sub _email_invoice { longdescription => 'html', partnotes => 'html', notes => 'html', + $::form->get_variable_content_types_for_cvars, }, ); diff --git a/SL/CVar.pm b/SL/CVar.pm index a905edee7..637f129c8 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -10,6 +10,7 @@ use Data::Dumper; use SL::DBUtils; use SL::MoreCommon qw(listify); +use SL::Presenter::Text; use SL::Util qw(trim); use SL::DB; @@ -46,7 +47,7 @@ SQL } elsif ($config->{type} eq 'number') { $config->{precision} = $1 if ($config->{options} =~ m/precision=(\d+)/i); - } elsif ($config->{type} eq 'textfield') { + } elsif ($config->{type} =~ m{^(?:html|text)field$}) { $config->{width} = 30; $config->{height} = 5; $config->{width} = $1 if ($config->{options} =~ m/width=(\d+)/i); @@ -112,7 +113,7 @@ sub get_custom_variables { my $custom_variables = $self->get_configs(module => $params{module}); foreach my $cvar (@{ $custom_variables }) { - if ($cvar->{type} eq 'textfield') { + if ($cvar->{type} =~ m{^(?:html|text)field}) { $cvar->{width} = 30; $cvar->{height} = 5; @@ -271,7 +272,7 @@ sub _save_custom_variables { my $value = $params{variables}->{"$params{name_prefix}cvar_$config->{name}$params{name_postfix}"}; - if (($config->{type} eq 'text') || ($config->{type} eq 'textfield') || ($config->{type} eq 'select')) { + if (any { $config->{type} eq $_ } qw(text textfield htmlfield select)) { push @values, undef, undef, $value, undef; } elsif (($config->{type} eq 'date') || ($config->{type} eq 'timestamp')) { @@ -375,7 +376,7 @@ sub build_filter_query { my (@sub_values, @sub_where, $not); - if (($config->{type} eq 'text') || ($config->{type} eq 'textfield')) { + if (any { $config->{type} eq $_ } qw(text textfield htmlfield)) { next unless ($params{filter}->{$name}); push @sub_where, qq|cvar.text_value ILIKE ?|; @@ -525,6 +526,7 @@ sub add_custom_variables_to_report { : $cfg->{type} eq 'vendor' ? (SL::DB::Manager::Vendor->find_by(id => 1*$ref->{number_value}) || SL::DB::Vendor->new)->name : $cfg->{type} eq 'part' ? (SL::DB::Manager::Part->find_by(id => 1*$ref->{number_value}) || SL::DB::Part->new)->partnumber : $cfg->{type} eq 'bool' ? ($ref->{bool_value} ? $locale->text('Yes') : $locale->text('No')) + : $cfg->{type} eq 'htmlfield' ? SL::Presenter::Text::stripped_html($ref->{text_value}) : $ref->{text_value}; } } diff --git a/SL/Controller/CsvImport/Base.pm b/SL/Controller/CsvImport/Base.pm index 0a3ec969d..1aaec79c9 100644 --- a/SL/Controller/CsvImport/Base.pm +++ b/SL/Controller/CsvImport/Base.pm @@ -293,6 +293,7 @@ sub handle_cvars { my %type_to_column = ( text => 'text_value', textfield => 'text_value', + htmlfield => 'text_value', select => 'text_value', date => 'timestamp_value_as_date', timestamp => 'timestamp_value_as_date', diff --git a/SL/Controller/CsvImport/BaseMulti.pm b/SL/Controller/CsvImport/BaseMulti.pm index 2632722ad..9ddb86bea 100644 --- a/SL/Controller/CsvImport/BaseMulti.pm +++ b/SL/Controller/CsvImport/BaseMulti.pm @@ -174,6 +174,7 @@ sub handle_cvars { my %type_to_column = ( text => 'text_value', textfield => 'text_value', + htmlfield => 'text_value', select => 'text_value', date => 'timestamp_value_as_date', timestamp => 'timestamp_value_as_date', diff --git a/SL/Controller/CustomVariableConfig.pm b/SL/Controller/CustomVariableConfig.pm index 0b124e9fb..193523a85 100644 --- a/SL/Controller/CustomVariableConfig.pm +++ b/SL/Controller/CustomVariableConfig.pm @@ -25,6 +25,7 @@ __PACKAGE__->run_before('load_config', only => [ qw(edit update destroy) ]); our %translations = ( text => t8('Free-form text'), textfield => t8('Text field'), + htmlfield => t8('HTML field'), number => t8('Number'), date => t8('Date'), timestamp => t8('Timestamp'), @@ -35,7 +36,7 @@ our %translations = ( part => t8('Part'), ); -our @types = qw(text textfield number date bool select customer vendor part); # timestamp +our @types = qw(text textfield htmlfield number date bool select customer vendor part); # timestamp # # actions diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index f2efeb014..608803abb 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -1205,9 +1205,7 @@ sub _pre_render { $self->{template_args} ||= {}; - $::request->{layout}->add_javascripts('kivi.CustomerVendor.js'); - $::request->{layout}->add_javascripts('kivi.File.js'); - $::request->{layout}->add_javascripts('kivi.CustomerVendorTurnover.js'); + $::request->{layout}->add_javascripts("$_.js") for qw (kivi.CustomerVendor kivi.File kivi.CustomerVendorTurnover ckeditor/ckeditor ckeditor/adapters/jquery); $self->_setup_form_action_bar; } diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 81f15e1d0..759de322b 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -2127,6 +2127,7 @@ sub generate_doc { longdescription => 'html', partnotes => 'html', notes => 'html', + $::form->get_variable_content_types_for_cvars, }, ); 1; diff --git a/SL/Controller/Project.pm b/SL/Controller/Project.pm index 94862e11b..702db8907 100644 --- a/SL/Controller/Project.pm +++ b/SL/Controller/Project.pm @@ -248,7 +248,7 @@ sub display_form { CVar->render_inputs(variables => $params{CUSTOM_VARIABLES}) if @{ $params{CUSTOM_VARIABLES} }; - $::request->layout->use_javascript('kivi.File.js'); + $::request->layout->use_javascript("$_.js") for qw(kivi.File ckeditor/ckeditor ckeditor/adapters/jquery); $self->setup_edit_action_bar(callback => $params{callback}); $self->render('project/form', %params); diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index 6ba1c4e74..afbe2bba6 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -87,6 +87,7 @@ sub action_ajax_edit { $self->js ->hide('#basic_settings') ->after('#basic_settings', $html) + ->reinit_widgets ->render; } @@ -333,7 +334,8 @@ sub setup { $::auth->assert('requirement_spec_edit'); $::request->{layout}->use_stylesheet("${_}.css") for qw(jquery.contextMenu requirement_spec); - $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery kivi.Part kivi.CustomerVendor); + $::request->{layout}->use_javascript("${_}.js") for qw(jquery.jstree jquery/jquery.contextMenu jquery/jquery.hotkeys requirement_spec ckeditor/ckeditor ckeditor/adapters/jquery kivi.Part kivi.CustomerVendor + ckeditor/ckeditor ckeditor/adapters/jquery); $self->init_visible_section; return 1; diff --git a/SL/DB/CustomVariable.pm b/SL/DB/CustomVariable.pm index cb6c83158..eeae39aaf 100644 --- a/SL/DB/CustomVariable.pm +++ b/SL/DB/CustomVariable.pm @@ -52,7 +52,7 @@ sub parse_value { return $self->timestamp_value(!defined($unparsed) ? undef : ref($unparsed) eq 'DateTime' ? $unparsed->clone : DateTime->from_kivitendo($unparsed)); } - # text, textfield, select + # text, textfield, htmlfield and select $self->text_value($unparsed); } @@ -92,7 +92,7 @@ sub value { return $self->timestamp_value ? $self->timestamp_value->clone->truncate(to => 'day') : undef; } - goto &text_value; # text, textfield and select + goto &text_value; # text, textfield, htmlfield and select } sub value_as_text { @@ -116,7 +116,7 @@ sub value_as_text { return $object ? $object->displayable_name : ''; } - goto &text_value; # text, textfield and select + goto &text_value; # text, textfield, htmlfield and select } sub is_valid { diff --git a/SL/DB/CustomVariableConfig.pm b/SL/DB/CustomVariableConfig.pm index f8bf7a168..6ba2238af 100644 --- a/SL/DB/CustomVariableConfig.pm +++ b/SL/DB/CustomVariableConfig.pm @@ -37,8 +37,8 @@ sub validate { use constant OPTION_DEFAULTS => { MAXLENGTH => 75, - WIDTH => 30, - HEIGHT => 5, + WIDTH => 225, + HEIGHT => 90, }; sub processed_options { @@ -117,6 +117,7 @@ sub value_col { customer => 'number_value', vendor => 'number_value', part => 'number_value', + htmlfield => 'text_value', text => 'text_value', textfield => 'text_value', select => 'text_value' diff --git a/SL/DN.pm b/SL/DN.pm index 8224172bf..b3c4d897a 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -1217,6 +1217,7 @@ sub print_original_invoice { longdescription => 'html', partnotes => 'html', notes => 'html', + $print_form->get_variable_content_types_for_cvars, }, ); diff --git a/SL/Form.pm b/SL/Form.pm index a01e9a8c6..29d9d6c13 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -61,6 +61,7 @@ use SL::DBConnect; use SL::DBUtils; use SL::DB::AdditionalBillingAddress; use SL::DB::Customer; +use SL::DB::CustomVariableConfig; use SL::DB::Default; use SL::DB::PaymentTerm; use SL::DB::Vendor; @@ -2713,19 +2714,48 @@ sub lastname_used { } sub get_variable_content_types { - my %html_variables = ( - longdescription => 'html', - partnotes => 'html', - notes => 'html', - orignotes => 'html', - notes1 => 'html', - notes2 => 'html', - notes3 => 'html', - notes4 => 'html', - header_text => 'html', - footer_text => 'html', + my ($self) = @_; + + my %html_variables = ( + longdescription => 'html', + partnotes => 'html', + notes => 'html', + orignotes => 'html', + notes1 => 'html', + notes2 => 'html', + notes3 => 'html', + notes4 => 'html', + header_text => 'html', + footer_text => 'html', ); - return \%html_variables; + + return { + %html_variables, + $self->get_variable_content_types_for_cvars, + }; +} + +sub get_variable_content_types_for_cvars { + my ($self) = @_; + my $html_configs = SL::DB::Manager::CustomVariableConfig->get_all(where => [ type => 'htmlfield' ]); + my %types; + + if (@{ $html_configs }) { + my %prefix_by_module = ( + Contacts => 'cp_cvar_', + CT => 'vc_cvar_', + IC => 'ic_cvar_', + Projects => 'project_cvar_', + ShipTo => 'shiptocvar_', + ); + + foreach my $cfg (@{ $html_configs }) { + my $prefix = $prefix_by_module{$cfg->module}; + $types{$prefix . $cfg->name} = 'html' if $prefix; + } + } + + return %types; } sub current_date { diff --git a/SL/HTML/Util.pm b/SL/HTML/Util.pm index f68fb0a1f..a54425d83 100644 --- a/SL/HTML/Util.pm +++ b/SL/HTML/Util.pm @@ -27,7 +27,7 @@ sub strip { if (!%stripper) { %stripper = ( parser => HTML::Parser->new ); - $stripper{parser}->handler(text => sub { $stripper{text} .= $_[1]; }); + $stripper{parser}->handler(text => sub { $stripper{text} .= ' ' . $_[1]; }); } $stripper{text} = ''; @@ -35,6 +35,8 @@ sub strip { $stripper{parser}->eof; $stripper{text} =~ s{\&([^;]+);}{ $entities{$1} || "\&$1;" }eg; + $stripper{text} =~ s{^ +| +$}{}g; + $stripper{text} =~ s{ {2,}}{ }g; return delete $stripper{text}; } diff --git a/SL/Presenter/Text.pm b/SL/Presenter/Text.pm index dd855fc09..7d56d940b 100644 --- a/SL/Presenter/Text.pm +++ b/SL/Presenter/Text.pm @@ -3,13 +3,17 @@ package SL::Presenter::Text; use strict; use SL::Presenter::EscapedText qw(escape); +use SL::HTML::Restrict; +use SL::HTML::Util; use Exporter qw(import); -our @EXPORT_OK = qw(format_man_days simple_format truncate); +our @EXPORT_OK = qw(format_man_days simple_format truncate restricted_html); our %EXPORT_TAGS = (ALL => \@EXPORT_OK); use Carp; +my $html_cleaner; + sub truncate { my ($text, %params) = @_; @@ -43,6 +47,17 @@ sub format_man_days { escape($output); } +sub restricted_html { + my ($value) = @_; + $html_cleaner //= SL::HTML::Restrict->create; + return $html_cleaner->process($value); +} + +sub stripped_html { + my ($value) = @_; + return SL::HTML::Util::strip($value); +} + 1; __END__ @@ -89,6 +104,16 @@ paragraph change: they close the current paragraph tag and start a new one. Single newlines are converted to line breaks. Carriage returns are removed. +=item C + +Returns HTML code stripped from unwanted/unsupported content. This is +done via the module L. + +=item C + +Returns the raw text with all HTML tags and comments stripped. This is +done via L. + =back =head1 BUGS diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 1beeb0477..abb604693 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -85,6 +85,8 @@ sub date_tag { return _call_presenter('date_tag', sub div_tag { return _call_presenter('div_tag', @_); } sub radio_button_tag { return _call_presenter('radio_button_tag', @_); } sub img_tag { return _call_presenter('img_tag', @_); } +sub restricted_html { return _call_presenter('restricted_html', @_); } +sub stripped_html { return _call_presenter('stripped_html', @_); } sub _set_id_attribute { my ($attributes, $name, $unique) = @_; diff --git a/locale/de/all b/locale/de/all index 5a66718a9..dad9acfcf 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1646,6 +1646,7 @@ $self->{texts} = { 'Groups valid for this client' => 'Für Mandanten gültige Gruppen', 'HTML' => 'HTML', 'HTML Templates' => 'HTML-Vorlagen', + 'HTML field' => 'HTML-Feld', 'Handling of WebDAV' => 'Behandlung von WebDAV', 'Hardcopy' => 'Seite drucken', 'Has item type' => 'Hat Regeltypen', @@ -3371,10 +3372,10 @@ $self->{texts} = { 'Text blocks back' => 'Textblöcke hinten', 'Text blocks front' => 'Textblöcke vorne', 'Text field' => 'Textfeld', - 'Text field variables: \'WIDTH=w HEIGHT=h\' sets the width and height of the text field. They default to 30 and 5 respectively.' => 'Textfelder: \'WIDTH=w HEIGHT=h\' setzen die Breite und die Höhe des Textfeldes. Wenn nicht anders angegeben, so werden sie 30 Zeichen breit und fünf Zeichen hoch dargestellt.', + 'Text field and HTML field variables: \'WIDTH=w HEIGHT=h\' sets the width and height of the field in pixels. They default to 225 and 90 respectively.' => 'Textfelder und HTML-Felder: \'WIDTH=w HEIGHT=h\' setzen die Breite und die Höhe des Feldes in Pixeln. Wenn nicht anders angegeben, so werden sie 225 Pixel breit und 90 Pixel hoch dargestellt.', 'Text in CSV File' => 'Spalte in der CSV Datei', 'Text variables: \'MAXLENGTH=n\' sets the maximum entry length to \'n\'.' => 'Textzeilen: \'MAXLENGTH=n\' setzt eine Maximallänge von n Zeichen.', - 'Text, text field and number variables: The default value will be used as-is.' => 'Textzeilen, Textfelder und Zahlenvariablen: Der Standardwert wird so wie er ist übernommen.', + 'Text, text field, HTML field and number variables: The default value will be used as-is.' => 'Textzeilen, Textfelder, HTML-Felder und Zahlenvariablen: Der Standardwert wird so wie er ist übernommen.', 'Texts for invoices' => 'Texte für Rechnungen', 'Texts for quotations & orders' => 'Texte für Angebote & Aufträge', 'That export does not exist.' => 'Dieser Export existiert nicht.', diff --git a/locale/en/all b/locale/en/all index 4d5c66359..59c78fdbe 100644 --- a/locale/en/all +++ b/locale/en/all @@ -1645,6 +1645,7 @@ $self->{texts} = { 'Groups valid for this client' => '', 'HTML' => '', 'HTML Templates' => '', + 'HTML field' => '', 'Handling of WebDAV' => '', 'Hardcopy' => '', 'Has item type' => '', @@ -3367,10 +3368,10 @@ $self->{texts} = { 'Text blocks back' => '', 'Text blocks front' => '', 'Text field' => '', - 'Text field variables: \'WIDTH=w HEIGHT=h\' sets the width and height of the text field. They default to 30 and 5 respectively.' => '', + 'Text field and HTML field variables: \'WIDTH=w HEIGHT=h\' sets the width and height of the field in pixels. They default to 225 and 90 respectively.' => '', 'Text in CSV File' => '', 'Text variables: \'MAXLENGTH=n\' sets the maximum entry length to \'n\'.' => '', - 'Text, text field and number variables: The default value will be used as-is.' => '', + 'Text, text field, HTML field and number variables: The default value will be used as-is.' => '', 'Texts for invoices' => '', 'Texts for quotations & orders' => '', 'That export does not exist.' => '', diff --git a/sql/Pg-upgrade2/custom_variables_convert_width_height_to_pixels.pl b/sql/Pg-upgrade2/custom_variables_convert_width_height_to_pixels.pl new file mode 100644 index 000000000..45b22f8b3 --- /dev/null +++ b/sql/Pg-upgrade2/custom_variables_convert_width_height_to_pixels.pl @@ -0,0 +1,59 @@ +# @tag: custom_variables_convert_width_height_to_pixels +# @description: Benutzerdefinierte Variablen: Optionen »WIDTH« & »HEIGHT« nach Pixel konvertieren +# @depends: release_3_5_8 +package SL::DBUpgrade2::custom_variables_convert_width_height_to_pixels; + +use strict; +use utf8; + +use parent qw(SL::DBUpgrade2::Base); + +use SL::DBUtils; + +sub find_configs { + my ($self) = @_; + + my $sql = <dbh, $sql); +} + +sub fix_configs { + my ($self, $configs) = @_; + + my $sql = <dbh, $sql); + + # Old defaults: 30 columns, 5 rows + # New defaults: 225px width, 90px height + + foreach my $config (@{ $configs }) { + $config->{options} =~ s{WIDTH=(\d+)}{ int($1 * (225 / 30.0)) }eg; + $config->{options} =~ s{HEIGHT=(\d+)}{ int($1 * ( 90 / 5.0)) }eg; + + $update_h->execute(@{$config}{qw(options id)}) || $self->db_error($sql); + } + + $update_h->finish; +} + +sub run { + my ($self) = @_; + + my $configs = $self->find_configs; + $self->fix_configs($configs) if @{ $configs }; + + return 1; +} + +1; diff --git a/templates/print/marei/requirement_spec.tex b/templates/print/marei/requirement_spec.tex index d8fb2e5dc..bd08dc695 100644 --- a/templates/print/marei/requirement_spec.tex +++ b/templates/print/marei/requirement_spec.tex @@ -59,6 +59,23 @@ $( KiviLatex.required_packages_for_html )$ %\tableofcontents +%%%% Deaktiviertes Beispiel, wie benutzerdefinierte Variablen ausgegeben werden können: %%%% +%% \newpage +%% +%% \section{Benutzerdefinierte Variablen} +%% +%% %$ ( FOREACH cvar = rspec.cvars_by_config ) $ +%% Name: $ ( KiviLatex.filter(cvar.config.name) ) $ +%% +%% Wert:% $ ( IF cvar.config.type == 'htmlfield' ) $ +%% $ ( KiviLatex.filter_html(cvar.value_as_text) ) $ +%% % $ ( ELSE ) $ +%% $ ( KiviLatex.filter(cvar.value_as_text) ) $ +%% % $ ( END ) $ +%% +%% %$ ( END ) $ +%%%% ENDE Beispiel für benutzerdefinierte Variablen %%%% + %% Versionen \newpage diff --git a/templates/webpages/amcvar/render_inputs.html b/templates/webpages/amcvar/render_inputs.html index 880106a99..e269b8e18 100644 --- a/templates/webpages/amcvar/render_inputs.html +++ b/templates/webpages/amcvar/render_inputs.html @@ -19,6 +19,9 @@ [%- ELSIF var.type == 'textfield' %] +[%- ELSIF var.type == 'htmlfield' %] + + [%- ELSIF var.type == 'date' %] [% L.date_tag(var_name, var.value) %] diff --git a/templates/webpages/amcvar/render_inputs_block.html b/templates/webpages/amcvar/render_inputs_block.html index 73731625a..984c589b0 100644 --- a/templates/webpages/amcvar/render_inputs_block.html +++ b/templates/webpages/amcvar/render_inputs_block.html @@ -27,6 +27,10 @@ [% render_cvar_tag_options.import(cols=cvar.var.width, rows=cvar.var.height); L.textarea_tag(cvar_tag_name, cvar.value, render_cvar_tag_options) %] +[%- ELSIF cvar.var.type == 'htmlfield' %] +[% render_cvar_tag_options.import(cols=cvar.var.width, rows=cvar.var.height, class="texteditor"); + L.textarea_tag(cvar_tag_name, L.restricted_html(cvar.value), render_cvar_tag_options) %] + [%- ELSIF cvar.var.type == 'date' %] [%- L.date_tag(cvar_tag_name, cvar.value, render_cvar_tag_options) %] diff --git a/templates/webpages/common/render_cvar_input.html b/templates/webpages/common/render_cvar_input.html index d40037178..2db49e896 100644 --- a/templates/webpages/common/render_cvar_input.html +++ b/templates/webpages/common/render_cvar_input.html @@ -5,6 +5,7 @@ [%- USE LxERP %] [%- DEFAULT var_name = HTML.escape(cvar_name_prefix) _ HTML.escape(var.config.name) _ HTML.escape(cvar_name_postfix) %] +[%- SET style_ = "width: " _ var.config.processed_options.WIDTH _ "px; height: " _ var.config.processed_options.HEIGHT _ "px" %] [%- IF ( hide_non_editable && !var.config.is_flag('editable') ) %] [% L.hidden_tag(var_name, var.value) %] @@ -15,7 +16,9 @@ [%- ELSIF ( var.config .type == 'bool' ) %] [% L.checkbox_tag(var_name, checked = var.value, for_submit = 1) %] [%- ELSIF ( var.config .type == 'textfield' ) %] - [% L.textarea_tag(var_name, var.value, cols = var.config.processed_options.WIDTH, rows = var.config.processed_options.HEIGHT) %] + [% L.textarea_tag(var_name, var.value, style=style_) %] +[%- ELSIF ( var.config .type == 'htmlfield' ) %] + [% L.textarea_tag(var_name, L.restricted_html(var.value), class='texteditor', style=style_) %] [%- ELSIF ( var.config.type == 'date' ) %] [% L.date_tag(var_name, var.value) %] [%- ELSIF ( var.config.type == 'timestamp' ) %] diff --git a/templates/webpages/custom_variable_config/form.html b/templates/webpages/custom_variable_config/form.html index a03bcd26e..c88711a5f 100644 --- a/templates/webpages/custom_variable_config/form.html +++ b/templates/webpages/custom_variable_config/form.html @@ -127,7 +127,7 @@ (4) [% 'The default value depends on the variable type:' | $T8 %]
    -
  • [%- 'Text, text field and number variables: The default value will be used as-is.' | $T8 %]
  • +
  • [%- 'Text, text field, HTML field and number variables: The default value will be used as-is.' | $T8 %]
  • [%- 'Boolean variables: If the default value is non-empty then the checkbox will be checked by default and unchecked otherwise.' | $T8 %]
  • [%- 'Date and timestamp variables: If the default value equals \'NOW\' then the current date/current timestamp will be used. Otherwise the default value is copied as-is.' | $T8 %]
@@ -138,7 +138,7 @@
  • [%- 'Text variables: \'MAXLENGTH=n\' sets the maximum entry length to \'n\'.' | $T8 %]
  • -
  • [%- 'Text field variables: \'WIDTH=w HEIGHT=h\' sets the width and height of the text field. They default to 30 and 5 respectively.' | $T8 %]
  • +
  • [%- 'Text field and HTML field variables: \'WIDTH=w HEIGHT=h\' sets the width and height of the field in pixels. They default to 225 and 90 respectively.' | $T8 %]
  • [%- 'Number variables: \'PRECISION=n\' forces numbers to be shown with exactly n decimal places.' | $T8 %]
  • [%- 'Selection fields: The option field must contain the available options for the selection. Options are separated by \'##\', for example \'Early##Normal##Late\'.' | $T8 %]
diff --git a/templates/webpages/requirement_spec/_show_basic_settings.html b/templates/webpages/requirement_spec/_show_basic_settings.html index af756288c..54166f127 100644 --- a/templates/webpages/requirement_spec/_show_basic_settings.html +++ b/templates/webpages/requirement_spec/_show_basic_settings.html @@ -1,4 +1,4 @@ -[%- USE HTML -%][%- USE LxERP -%] +[%- USE HTML -%][%- USE LxERP -%][%- USE L -%]

[% IF SELF.requirement_spec.is_template %] @@ -41,7 +41,13 @@ [% FOREACH var = cvars %] [% HTML.escape(var.config.description) %] - [% HTML.escape(var.value_as_text) %] + + [%- IF var.config.type == 'htmlfield' -%] + [%- L.restricted_html(var.value_as_text) -%] + [%- ELSE -%] + [%- HTML.escape(var.value_as_text) -%] + [%- END -%] + [% END %]