1 |
8 |
ahitrov@rambler.ru |
% unless ($error) { |
2 |
|
|
<style> |
3 |
|
|
.td { font:11px Verdana; padding:2px 4px; } |
4 |
|
|
</style> |
5 |
|
|
<a name="<% $name %>_anc"></a> |
6 |
|
|
<table width="100%" cellspacing="1" cellpadding="0" border="0"> |
7 |
|
|
<tr><td width="5%"> |
8 |
|
|
<input type="text" name="<% $name %>" id="<% $name %>_value" |
9 |
|
|
value="<% $check %>" style="width:100px;" onkeyup="<% $name %>_changed();"> |
10 |
|
|
</td><td width="94%" class="td"> |
11 |
|
|
<input type="text" name="<% $name %>_docname" id="<% $name %>_docname" |
12 |
|
|
value="<% ref $doc ? $doc->name : '' | h %>" onclick="lookfor_<% $name %>()" |
13 |
818 |
ahitrov |
data-id="<% ref $doc ? $doc->id : '' %>" data-class="<% ref $doc ? $doc->class : '' %>" |
14 |
8 |
ahitrov@rambler.ru |
style="width:100%; color:blue; text-decoration:underline;" readonly> |
15 |
|
|
</td><td width="1%" class="td"><a href="#top" |
16 |
|
|
onclick="search_<% $name %>();"> |
17 |
|
|
<img src="/contenido/i/lookup-19x19.gif" width="19" height="19" class="bb gb"></a> |
18 |
|
|
</td></tr> |
19 |
|
|
<tr id="<% $name %>_prev_table" style="display: none;"> |
20 |
|
|
<td id="<% $name %>_prev_value" class="bb undo" style="padding:3px;"><% $check || ' ' %></td> |
21 |
|
|
<td id="<% $name %>_prev_docname" class="bb undo" style="padding:3px;"><% ref $doc ? $doc->name : ' ' | h %></td> |
22 |
|
|
<td style="padding-left: 3px; vertical-align: top;"><a href="#" |
23 |
|
|
onclick="return <% $name %>_undo();" title="Отменить изменения"><img |
24 |
|
|
src="/contenido/i/undo-19x19.gif" width="19" height="19" class="bb gb"></a></td> |
25 |
|
|
</tr> |
26 |
|
|
</table> |
27 |
|
|
% } else { |
28 |
|
|
<font color="red"><% $error %></font> |
29 |
|
|
% $m->comp('/contenido/components/inputs/integer.msn', %ARGS); |
30 |
|
|
% } |
31 |
|
|
|
32 |
|
|
<script type="text/javascript"> |
33 |
|
|
var key_flag_<% $name %> = 1; |
34 |
|
|
var <% $name %>_prev_value = document.getElementById('<% $name %>_value').value; |
35 |
|
|
var <% $name %>_prev_docname = document.getElementById('<% $name %>_docname').value; |
36 |
|
|
%# document.getElementById('<% $name %>_prev_value').innerHTML = <% $name %>_prev_value || ' '; |
37 |
|
|
%# document.getElementById('<% $name %>_prev_docname').innerHTML = <% $name %>_prev_docname || ' '; |
38 |
|
|
|
39 |
|
|
function search_<% $name %>() { |
40 |
|
|
document.getElementById('DocFinder').style.height = 470; |
41 |
|
|
document.getElementById('DocFinder').src = '<% $lookup_string %>'; |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
function lookfor_<% $name %>() { |
45 |
818 |
ahitrov |
var $doc = $('#<% $name %>_docname'); |
46 |
|
|
var id = $doc.data('id'); |
47 |
|
|
var Class = $doc.data('class'); |
48 |
8 |
ahitrov@rambler.ru |
if (id) { |
49 |
|
|
var Uri = 'document.html?id=' + id + '&class=' + Class; |
50 |
|
|
var Width = screen.width; |
51 |
|
|
var Height = screen.height; |
52 |
|
|
window.open(Uri,'Interface','width='+Width+',height='+Height+',top=0,left=0,location=1,menubar=1,resizable=0,scrollbars=1,status=1,titlebar=1,toolbar=1,directories=1,hotkeys=1'); |
53 |
|
|
} |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
function <% $name %>_changed() { |
57 |
|
|
var t = document.getElementById('<% $name %>_prev_table'); |
58 |
|
|
var v = document.getElementById('<% $name %>_value'); |
59 |
|
|
if (v.value == <% $name %>_prev_value) { |
60 |
|
|
if (t.style.display!='none') { |
61 |
|
|
t.style.display = 'none'; |
62 |
|
|
} |
63 |
|
|
return; |
64 |
|
|
} |
65 |
|
|
if (t.style.display=='none') { |
66 |
|
|
t.style.display = ''; |
67 |
|
|
} |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
function <% $name %>_undo() { |
71 |
|
|
document.getElementById('<% $name %>_value').value = <% $name %>_prev_value; |
72 |
|
|
document.getElementById('<% $name %>_docname').value = <% $name %>_prev_docname; |
73 |
|
|
<% $name %>_changed(); |
74 |
|
|
return false; |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
</script> |
78 |
|
|
<%args> |
79 |
818 |
ahitrov |
|
80 |
8 |
ahitrov@rambler.ru |
$object |
81 |
|
|
$name => undef |
82 |
|
|
$check => undef |
83 |
|
|
$prop => {} |
84 |
818 |
ahitrov |
|
85 |
8 |
ahitrov@rambler.ru |
</%args> |
86 |
|
|
<%init> |
87 |
|
|
|
88 |
|
|
my ($error, $doc, $lookup_string); |
89 |
|
|
|
90 |
386 |
ahitrov |
if ($prop && ref($prop) && exists $prop->{lookup_opts} && ref $prop->{lookup_opts} eq 'HASH' ) { |
91 |
8 |
ahitrov@rambler.ru |
if ( $check ) { |
92 |
|
|
$doc = $keeper->get_document_by_id ( $check, %{$prop->{lookup_opts}} ); |
93 |
|
|
} |
94 |
|
|
$lookup_string = '/contenido/find_document.html?nf='.$name.'_docname&vf='.$name.'_value'; |
95 |
386 |
ahitrov |
while ( my ($param, $value) = each %{ $prop->{lookup_opts} } ) { |
96 |
818 |
ahitrov |
if ( ref $value eq 'ARRAY' ) { |
97 |
|
|
$lookup_string .= '&'.join('&', map{ $param.'='.$_ } @$value); |
98 |
|
|
} else { |
99 |
|
|
$lookup_string .= '&'.$param.'='.$value; |
100 |
|
|
} |
101 |
36 |
ahitrov@rambler.ru |
} |
102 |
8 |
ahitrov@rambler.ru |
} else { |
103 |
|
|
$error = 'Похоже неверное описание lookup_opts в документе'; |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
</%init> |