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 |
484 |
ahitrov |
use Data::Recursive::Encode; |
61 |
478 |
ahitrov |
|
62 |
|
|
</%once> |
63 |
|
|
<%args> |
64 |
|
|
$name => undef |
65 |
|
|
$check => undef |
66 |
|
|
$prop => {} |
67 |
|
|
$object => undef |
68 |
|
|
</%args> |
69 |
|
|
<%init> |
70 |
|
|
|
71 |
|
|
if ( ref $check ) { |
72 |
484 |
ahitrov |
$check = Encode::encode('utf-8', JSON::XS->new->encode( Data::Recursive::Encode->decode_utf8($check) )); |
73 |
478 |
ahitrov |
} |
74 |
484 |
ahitrov |
$check = html_escape($check) unless $prop->{no_escape}; |
75 |
478 |
ahitrov |
|
76 |
|
|
</%init> |