Line # Revision Author
1 478 ahitrov <textarea \
2 % if ($request->{images_staff_printed}) {
3 onclick="storeCaret(this)" onkeyup="storeCaret(this)" onselect="storeCaret(this)" \
4 % }
5 <% $prop->{readonly} ? 'readonly ' : '' %> name="<% $name %>" id="<% $name %>_textarea" rows="<% $prop->{rows} || 8 %>" cols="<% $prop->{cols} || 8 %>" style="width: 95%;" onkeyup="<% $name %>_changed();"><% $check %></textarea>
6
7 <table id="<% $name %>_prev_table" style="width: 95%; display: none;" cellspacing="0" cellpadding="0" border="0">
8 <tr>
9 <td width="100%" id="<% $name %>_prev_text" class="bb undo" style="padding: 3px;"></td>
10 <td style="padding-left: 3px; vertical-align: top;"><a href="#" onclick="return <% $name %>_show();" title="Показать/спрятать прежнее значение"><img src="/contenido/i/modified-19x19.gif" width="19" height="19" class="bb gb"></a></td>
11 <td style="padding-left: 3px; vertical-align: top;"><a href="#" onclick="return <% $name %>_undo();" title="Отменить изменения"><img src="/contenido/i/undo-19x19.gif" width="19" height="19" class="bb gb"></a></td>
12 </tr>
13 </table>
14 <textarea id="<% $name %>_prev_value" style="display: none;"><% $check %></textarea>
15
16 <script type="text/javascript">
17 var <% $name %>_show_modified = false;
18 var <% $name %>_show_modified_text = "Прежнее значение не показано. Нажмите кнопку '<b>Показать/спрятать</b>' для просмотра.";
19
20 function <% $name %>_changed() {
21 var t = document.getElementById('<% $name %>_prev_table');
22 if (document.getElementById('<% $name %>_textarea').value==document.getElementById('<% $name %>_prev_value').value) {
23 if (t.style.display!='none') {
24 t.style.display = 'none';
25 }
26 return;
27 }
28 if (t.style.display=='none') {
29 document.getElementById('<% $name %>_prev_text').innerHTML = <% $name %>_show_modified_text;
30 t.style.display = '';
31 }
32 }
33
34 function <% $name %>_undo() {
35 document.getElementById('<% $name %>_textarea').value = document.getElementById('<% $name %>_prev_value').value;
36 <% $name %>_changed();
37 return false;
38 }
39
40 function <% $name %>_show() {
41 if (<% $name %>_show_modified) {
42 document.getElementById('<% $name %>_prev_text').innerHTML = <% $name %>_show_modified_text;
43 } else {
44 if (document.all) { // IE
45 document.getElementById('<% $name %>_prev_text').innerText = document.getElementById('<% $name %>_prev_value').innerText || ' ';
46 } else {
47 document.getElementById('<% $name %>_prev_text').innerHTML = document.getElementById('<% $name %>_prev_value').innerHTML || '&nbsp;';
48 }
49 }
50 <% $name %>_show_modified = !<% $name %>_show_modified;
51 return false;
52 }
53 </script>
54 <%once>
55
56 use JSON::XS;
57 484 ahitrov use Data::Recursive::Encode;
58 478 ahitrov
59 </%once>
60 <%args>
61 $name => undef
62 $check => undef
63 $prop => {}
64 $object => undef
65 </%args>
66 <%init>
67
68 if ( ref $check ) {
69 484 ahitrov $check = Encode::encode('utf-8', JSON::XS->new->encode( Data::Recursive::Encode->decode_utf8($check) ));
70 478 ahitrov }
71 484 ahitrov $check = html_escape($check) unless $prop->{no_escape};
72 478 ahitrov
73 </%init>