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 |
|
|
% if ( exists $prop->{rem} && $prop->{rem} ) { |
15 |
|
|
<div style="color:gray; font-size:85%; padding:4px">» <% $prop->{rem} %></div> |
16 |
|
|
% } |
17 |
|
|
<textarea id="<% $name %>_prev_value" style="display: none;"><% $check %></textarea> |
18 |
|
|
|
19 |
|
|
<script type="text/javascript"> |
20 |
|
|
var <% $name %>_show_modified = false; |
21 |
|
|
var <% $name %>_show_modified_text = "Прежнее значение не показано. Нажмите кнопку '<b>Показать/спрятать</b>' для просмотра."; |
22 |
|
|
|
23 |
|
|
function <% $name %>_changed() { |
24 |
|
|
var t = document.getElementById('<% $name %>_prev_table'); |
25 |
|
|
if (document.getElementById('<% $name %>_textarea').value==document.getElementById('<% $name %>_prev_value').value) { |
26 |
|
|
if (t.style.display!='none') { |
27 |
|
|
t.style.display = 'none'; |
28 |
|
|
} |
29 |
|
|
return; |
30 |
|
|
} |
31 |
|
|
if (t.style.display=='none') { |
32 |
|
|
document.getElementById('<% $name %>_prev_text').innerHTML = <% $name %>_show_modified_text; |
33 |
|
|
t.style.display = ''; |
34 |
|
|
} |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
function <% $name %>_undo() { |
38 |
|
|
document.getElementById('<% $name %>_textarea').value = document.getElementById('<% $name %>_prev_value').value; |
39 |
|
|
<% $name %>_changed(); |
40 |
|
|
return false; |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
function <% $name %>_show() { |
44 |
|
|
if (<% $name %>_show_modified) { |
45 |
|
|
document.getElementById('<% $name %>_prev_text').innerHTML = <% $name %>_show_modified_text; |
46 |
|
|
} else { |
47 |
|
|
if (document.all) { // IE |
48 |
|
|
document.getElementById('<% $name %>_prev_text').innerText = document.getElementById('<% $name %>_prev_value').innerText || ' '; |
49 |
|
|
} else { |
50 |
|
|
document.getElementById('<% $name %>_prev_text').innerHTML = document.getElementById('<% $name %>_prev_value').innerHTML || ' '; |
51 |
|
|
} |
52 |
|
|
} |
53 |
|
|
<% $name %>_show_modified = !<% $name %>_show_modified; |
54 |
|
|
return false; |
55 |
|
|
} |
56 |
|
|
</script> |
57 |
|
|
<%once> |
58 |
|
|
|
59 |
|
|
use JSON::XS; |
60 |
|
|
|
61 |
|
|
</%once> |
62 |
|
|
<%args> |
63 |
|
|
$name => undef |
64 |
|
|
$check => undef |
65 |
|
|
$prop => {} |
66 |
|
|
$object => undef |
67 |
|
|
</%args> |
68 |
|
|
<%init> |
69 |
|
|
|
70 |
|
|
$check = html_escape($check) unless $prop->{no_escape}; |
71 |
|
|
|
72 |
|
|
if ( ref $check ) { |
73 |
|
|
$check = Encode::encode('utf-8', JSON::XS->new->utf8->encode( $check )); |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
</%init> |