return;
}
- foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
- $cvar->{valid} = $params{part_id}
- ? CVar->get_custom_variables_validity(config_id => $cvar->{id}, trans_id => $params{part_id})
- : 0;
-
- $cvar->{value} = $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"};
- }
-
- CVar->render_inputs(hide_non_editable => 1,
- variables => $form->{CVAR_CONFIGS}->{IC},
- name_prefix => 'ic_',
- name_postfix => "_$params{row}");
-
my $num_visible_cvars = 0;
foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
+ $cvar->{valid} = $params{part_id} &&
+ CVar->get_custom_variables_validity(config_id => $cvar->{id}, trans_id => $params{part_id});
+
my $description = '';
if ($cvar->{flag_editable} && $cvar->{valid}) {
$num_visible_cvars++;
$description = $cvar->{description} . ' ';
}
- push @{ $params{ROW2} }, { line_break => $num_visible_cvars == 1,
- value => $description . $cvar->{HTML_CODE},
- };
+ push @{ $params{ROW2} }, {
+ line_break => $num_visible_cvars == 1,
+ description => $description,
+ cvar => 1,
+ render_options => {
+ hide_non_editable => 1,
+ var => $cvar,
+ name_prefix => 'ic_',
+ name_postfix => "_$params{row}",
+ valid => $cvar->{valid},
+ value => $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"},
+ }
+ };
}
$main::lxdebug->leave_sub(2);
--- /dev/null
+[%- USE T8 %]
+[%- USE HTML %]
+[%- BLOCK cvar_inputs %]
+[%- var = cvar.var %]
+[%- hide_non_editable = cvar.hide_non_editable, %]
+[%- name_prefix = cvar.name_prefix, %]
+[%- name_postfix = cvar.name_postfix, %]
+[%- valid = cvar.valid, %]
+[%- value = cvar.value, %]
+[%- var_name = HTML.escape(name_prefix) _ "cvar_" _ HTML.escape(var.name) _ HTML.escape(name_postfix) -%]
+[%- %]
+[%- IF hide_non_editable && !var.flag_editable %]
+<input type="hidden" name="[% var_name %]" value="[% HTML.escape(var.value) %]">
+[%- ELSIF !valid %]
+ [%- IF show_disabled_message %]
+<i>[% 'Element disabled' | $T8 %]</i>
+ [%- END %]
+[%- ELSIF var.type == 'bool' %]
+<input type="checkbox" name="[% var_name %]" value="1"[% IF value %] checked[% END %]>
+[%- ELSIF var.type == 'textfield' %]
+<textarea name="[% var_name %]" cols="[% HTML.escape(var.width) %]" rows="[% HTML.escape(var.height) %]">[% HTML.escape(value) %]</textarea>
+[%- ELSIF var.type == 'date' %]
+<input name="[% var_name %]" id="[% var_name %]" size="12" value="[% HTML.escape(value) %]">
+<input name="[% var_name %]_button" id="[% var_name %]_trigger" type="button" value="?">
+<script type="text/javascript">
+ <!--
+ Calendar.setup({ inputField : "[% var_name %]",
+ ifFormat : "[% myconfig_jsc_dateformat %]",
+ align : "BR",
+ button : "[% var_name %]_trigger" });
+ -->
+</script>
+[%- ELSIF var.type == 'timestamp' %]
+<input name="[% var_name %]" value="[% HTML.escape(value) %]">
+[%- ELSIF var.type == 'select' %]
+<select name="[% var_name %]">
+ [%- FOREACH option = var.OPTIONS %]
+ <option[% IF option.value == value %] selected[% END %]>[% HTML.escape(option.value) %]</option>
+ [%- END %]
+</select>
+[%- ELSE %]
+<input name="[% var_name %]" value="[% HTML.escape(value) %]" [%- IF var.maxlength %] maxlength="[% HTML.escape(var.maxlength) %]"[% END -%]>
+[%- END %]
+[%- END %]
[%- USE T8 %]
-[% USE HTML %]
+[%- USE HTML %]
+[%- PROCESS 'amcvar/render_inputs_block.html' %]
<tr>
<td>
<input type="button" id="cb_show_details" name="show_details" value='[% 'Show details' | $T8 %]'>
$('#cb_show_details').click(function(){ $('[id$="row2"]').toggle() });
</script>
<table id='display_row' width="100%">
- <tr class="listheading">[% FOREACH header = HEADER %][% IF header.display %]
- <th align="left" nowrap width="[% header.width %]" class="listheading">[% header.value %]</th>[% END %][% END %]
+ <tr class="listheading">
+[%- FOREACH header = HEADER %]
+ [%- IF header.display %]
+ <th align="left" nowrap width="[% header.width %]" class="listheading">[% header.value %]</th>
+ [%- END %]
+[%- END %]
</tr>
-
- [% FOREACH row = ROWS %]
- <tr valign="top" class="[% IF row.error %]error_message[% ELSE %]listrow[% loop.count % 2 %][% END %]">[% FOREACH row1 = row.ROW1 %]
- <td align="[% row1.align %]"[% IF row1.nowrap %] nowrap[% END %]>[% row1.value %]</td>[% END %]
+[%- FOREACH row = ROWS %]
+ <tr valign="top" class="[% IF row.error %]error_message[% ELSE %]listrow[% loop.count % 2 %][% END %]">
+ [%- FOREACH row1 = row.ROW1 %]
+ <td align="[% row1.align %]"[% IF row1.nowrap %] nowrap[% END %]>[% row1.value %]</td>
+ [%- END %]
</tr>
-
- [% FOREACH hidden = row.HIDDENS %][% hidden.value %]
- [% END %]
-
- <tr class="listrow[% loop.count % 2 %]" id="[% loop.count %].row2" [% UNLESS show_details %]style="display:none;"[% END %]><td colspan="[% row.colspan %]">[% FOREACH row2 = row.ROW2 %]
- [% IF row2.line_break %]<br/>[% END %]
- [% row2.value %][% END %]
- </td></tr>
- [% END %]
+ [%- FOREACH hidden = row.HIDDENS %]
+ [% hidden.value %]
+ [%- END %]
+ <tr class="listrow[% loop.count % 2 %]" id="[% loop.count %].row2" [% UNLESS show_details %]style="display:none;"[% END %]>
+ <td colspan="[% row.colspan %]">
+ [%- FOREACH row2 = row.ROW2 %]
+ [%- IF row2.line_break %]<br/>[%- END %]
+ [%- IF row2.cvar %]
+ [% row2.description %]
+ [% INCLUDE cvar_inputs cvar = row2.render_options %]
+ [%- ELSE %]
+ [% row2.value %]
+ [%- END %]
+ [%- END %]
+ </td>
+ </tr>
+[%- END %]
</table>
</td>