Line # Revision Author
1 677 ahitrov <a style="display:block; text-align:right; width:95%; margin-top:5px;" id="string_multi_anchor_<% $name %>"
2 href="javascript:void(0)" onclick="pairset_element_add_<% $name %>(); return false;">[+] Добавить значение</a>
3 551 ahitrov <script type="text/javascript">
4 <!--
5 var sFirstIndex_<% $name %> = 1;
6 var sLastIndex_<% $name %> = <% $i %>;
7 677 ahitrov function pairset_element_add_<% $name %>() {
8 var sInput = '<tr valign="top">';
9 sInput = sInput + '<td><input type="text" name="<% $name.'_num_' %>'+ sLastIndex_<% $name %> +'" value="'+ sLastIndex_<% $name %> +'" size="2" maxlength="3"></td>';
10 sInput = sInput + '<td><input type="text" name="<% $name.'_name_' %>'+ sLastIndex_<% $name %> +'" value="" style="width:97%"></td>';
11 sInput = sInput + '<td><textarea class="textarea" name="<% $name.'_value_' %>'+ sLastIndex_<% $name %> +'" rows="2" style="width:97%;"></textarea></td>';
12 sInput = sInput + '</tr>';
13
14 $(sInput).appendTo('#pairset-table-<% $name %>');
15 sLastIndex_<% $name %>++;
16 }
17 551 ahitrov //-->
18 </script>
19 <%args>
20
21 $name => undef
22 $rusname => undef
23 $check => undef
24 $object => undef
25
26 </%args>
27 <%init>
28
29 return unless ref $object;
30
31 my $fields = ref $object->$name ? $object->$name : $object->get_image($name);
32 $fields = [] unless $fields && ref $fields eq 'ARRAY';
33
34 $m->out('');
35 677 ahitrov $m->out('<table width="95%" style="margin:5px 0;padding:5 6 5 6;border:1px solid #ccc;font-size:70%;font-family:Tahoma;background-color:#f5f5f5;color:#000;" id="pairset-table-'.$name.'">');
36 551 ahitrov $m->out('<tr><th width="1%"><h5 style="margin:0; padding:4px; font-size:11px; color:blue; background:silver;">#</h5></th>');
37 $m->out('<th width="33%"><h5 style="margin:0; padding:4px; font-size:11px; color:blue; background:silver;">Параметр:</h5></th>');
38 $m->out('<th width="66%"><h5 style="margin:0; padding:4px; font-size:11px; color:blue; background:silver;">Значение:</h5></th></tr>');
39 my $i = 1;
40 foreach my $field (@$fields) {
41 my $rusname = "$rusname N$i";
42 $m->comp('.field',
43 name => $name,
44 fname => $field->{name},
45 value => $field->{value},
46 number => $i);
47 $i++;
48 }
49 $rusname = "$rusname N$i";
50 for (1..5) {
51 $m->comp('.field', name => $name, fname => '', value => '', number => $i++);
52 }
53 $m->out('</table>');
54 </%init>
55
56 <%def .field>
57 <%args>
58
59 $name => undef
60 $fname => undef
61 $value => undef
62 $number => undef
63
64 </%args>
65 <%init>
66
67 $value =~ s/&/&amp;/g;
68
69 </%init>
70 <tr valign="top">
71 <td><input type="text" name="<% $name.'_num_'.$number %>" value="<% $number %>" size="2" maxlength="3"></td>
72 <td><input type="text" name="<% $name.'_name_'.$number %>" value="<% $fname %>" style="width:97%"></td>
73 <td><textarea class="textarea" name="<% $name.'_value_'.$number %>" rows="2" style="width:97%;"><% $value %></textarea></td>
74 </tr>
75 </%def>