1 |
3 |
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 |
|
|
style="width:100%; color:blue; text-decoration:underline;" readonly> |
14 |
|
|
</td><td width="1%" class="td"><a href="#top" |
15 |
|
|
onclick="search_<% $name %>();"> |
16 |
|
|
<img src="/contenido/i/lookup-19x19.gif" width="19" height="19" class="bb gb"></a> |
17 |
|
|
</td></tr> |
18 |
|
|
<tr id="<% $name %>_prev_table" style="display: none;"> |
19 |
|
|
<td id="<% $name %>_prev_value" class="bb undo" style="padding:3px;"><% $check || ' ' %></td> |
20 |
|
|
<td id="<% $name %>_prev_docname" class="bb undo" style="padding:3px;"><% ref $doc ? $doc->name : ' ' | h %></td> |
21 |
|
|
<td style="padding-left: 3px; vertical-align: top;"><a href="#" |
22 |
|
|
onclick="return <% $name %>_undo();" title="�������� ���������"><img |
23 |
|
|
src="/contenido/i/undo-19x19.gif" width="19" height="19" class="bb gb"></a></td> |
24 |
|
|
</tr> |
25 |
|
|
</table> |
26 |
|
|
% } else { |
27 |
|
|
<font color="red"><% $error %></font> |
28 |
|
|
% $m->comp('/contenido/components/inputs/integer.msn', %ARGS); |
29 |
|
|
% } |
30 |
|
|
|
31 |
|
|
<script type="text/javascript"> |
32 |
|
|
var key_flag_<% $name %> = 1; |
33 |
|
|
var <% $name %>_prev_value = document.getElementById('<% $name %>_value').value; |
34 |
|
|
var <% $name %>_prev_docname = document.getElementById('<% $name %>_docname').value; |
35 |
|
|
%# document.getElementById('<% $name %>_prev_value').innerHTML = <% $name %>_prev_value || ' '; |
36 |
|
|
%# document.getElementById('<% $name %>_prev_docname').innerHTML = <% $name %>_prev_docname || ' '; |
37 |
|
|
|
38 |
|
|
function search_<% $name %>() { |
39 |
|
|
document.getElementById('DocFinder').style.height = 470; |
40 |
|
|
document.getElementById('DocFinder').src = '<% $lookup_string %>'; |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
function lookfor_<% $name %>() { |
44 |
|
|
var id = document.getElementById('<% $name %>_value').value; |
45 |
|
|
if (id) { |
46 |
|
|
var Class = '<% $prop->{lookup_opts}->{class} %>'; |
47 |
|
|
var Uri = 'document.html?id=' + id + '&class=' + Class; |
48 |
|
|
var Width = screen.width; |
49 |
|
|
var Height = screen.height; |
50 |
|
|
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'); |
51 |
|
|
} |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
function <% $name %>_changed() { |
55 |
|
|
var t = document.getElementById('<% $name %>_prev_table'); |
56 |
|
|
var v = document.getElementById('<% $name %>_value'); |
57 |
|
|
if (v.value == <% $name %>_prev_value) { |
58 |
|
|
if (t.style.display!='none') { |
59 |
|
|
t.style.display = 'none'; |
60 |
|
|
} |
61 |
|
|
return; |
62 |
|
|
} |
63 |
|
|
if (t.style.display=='none') { |
64 |
|
|
t.style.display = ''; |
65 |
|
|
} |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
function <% $name %>_undo() { |
69 |
|
|
document.getElementById('<% $name %>_value').value = <% $name %>_prev_value; |
70 |
|
|
document.getElementById('<% $name %>_docname').value = <% $name %>_prev_docname; |
71 |
|
|
<% $name %>_changed(); |
72 |
|
|
return false; |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
</script> |
76 |
|
|
<%args> |
77 |
|
|
$object |
78 |
|
|
$name => undef |
79 |
|
|
$check => undef |
80 |
|
|
$prop => {} |
81 |
|
|
</%args> |
82 |
|
|
<%init> |
83 |
|
|
|
84 |
|
|
my ($error, $doc, $lookup_string); |
85 |
|
|
|
86 |
|
|
if ($prop && ref($prop) && ref($prop->{lookup_opts}) eq 'HASH' && exists $prop->{lookup_opts}->{class}) { |
87 |
|
|
if ( $check ) { |
88 |
|
|
$doc = $keeper->get_document_by_id ( $check, %{$prop->{lookup_opts}} ); |
89 |
|
|
} |
90 |
|
|
$lookup_string = '/contenido/find_document.html?nf='.$name.'_docname&vf='.$name.'_value'; |
91 |
37 |
ahitrov@rambler.ru |
if ( exists $prop->{lookup_opts} && ref $prop->{lookup_opts} eq 'HASH' ) { |
92 |
|
|
while ( my ($param, $value) = each %{ $prop->{lookup_opts} } ) { |
93 |
|
|
$lookup_string .= '&'.$param.'='.$value; |
94 |
|
|
} |
95 |
|
|
} |
96 |
3 |
ahitrov@rambler.ru |
} else { |
97 |
|
|
$error = '������ �������� �������� lookup_opts � ���������'; |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
</%init> |