1 |
3 |
ahitrov@rambler.ru |
<style> |
2 |
|
|
.td { font:11px Verdana; padding:2px 4px; } |
3 |
|
|
.th { padding:4px 4px; } |
4 |
|
|
</style> |
5 |
|
|
% unless ($error) { |
6 |
|
|
|
7 |
|
|
% if (@ids) { |
8 |
|
|
<table width="95%" cellpadding="2" cellspacing="1" bgcolor="gray"> |
9 |
|
|
<tr bgcolor="silver"><th width="99%" class="th">��������</th><th width="1%" class="th">�������?</th></tr> |
10 |
|
|
% my $i = 0; |
11 |
|
|
% foreach my $obj_id (@ids) { |
12 |
|
|
% my $obj = ref $objects eq 'HASH' && exists $objects->{$obj_id} ? $objects->{$obj_id} : undef; |
13 |
|
|
<tr bgcolor="<% $i++ % 2 ? '#e0e0e0' : 'white' %>"><td class="td"> |
14 |
|
|
<input type="hidden" name="<% $name %>_<% $obj_id %>_id" value="<% $obj_id %>"> |
15 |
|
|
% if ( ref $obj ) { |
16 |
|
|
% my ($a1, $a2) = $obj->id ? ('<a href="document.html?id='.$obj->id.'&class='.$obj->class.'" target="_blank">','</a>') : ('',''); |
17 |
|
|
<% $a1.($obj->name || '���������� �������� #'.$obj->id).$a2 %></a> |
18 |
|
|
% } else { |
19 |
|
|
<span style="color:red;">�������� ������!!!</span> |
20 |
|
|
% } |
21 |
|
|
</td><td align="center"><input type="checkbox" name="<% $name %>_<% $obj_id %>_delete" value="<% $obj_id %>"/></td></tr> |
22 |
|
|
% } |
23 |
|
|
</table> |
24 |
|
|
% } |
25 |
|
|
|
26 |
|
|
<table width="100%" cellspacing="1" cellpadding="0" border="0"> |
27 |
|
|
<tr><td width="5%"> |
28 |
|
|
<input type="text" name="<% $name %>_addanotheritem" id="<% $name %>_value" |
29 |
|
|
value="" style="width:100px;"> |
30 |
|
|
</td><td width="94%" class="td"> |
31 |
|
|
<input type="text" name="<% $name %>_docname" id="<% $name %>_docname" |
32 |
|
|
value="" style="width:100%;" onclick="lookfor_<% $name %>()" |
33 |
|
|
style="width:100%; color:blue; text-decoration:underline;" readonly> |
34 |
|
|
</td><td width="1%" class="td"><a href="#top" |
35 |
|
|
onclick="search_<% $name %>();"> |
36 |
|
|
<img src="/contenido/i/lookup-19x19.gif" width="19" height="19" class="bb gb"></a> |
37 |
|
|
</td></tr> |
38 |
|
|
<tr id="<% $name %>_prev_table" style="display: none;"> |
39 |
|
|
<td id="<% $name %>_prev_value" class="bb undo" style="padding:3px;"> </td> |
40 |
|
|
<td id="<% $name %>_prev_docname" class="bb undo" style="padding:3px;"> </td> |
41 |
|
|
<td style="padding-left: 3px; vertical-align: top;"><a href="#" |
42 |
|
|
onclick="return <% $name %>_undo();" title="�������� ���������"><img |
43 |
|
|
src="/contenido/i/undo-19x19.gif" width="19" height="19" class="bb gb"></a></td> |
44 |
|
|
</tr> |
45 |
|
|
</table> |
46 |
|
|
|
47 |
|
|
% } else { |
48 |
|
|
<font color="red"><% $error %></font> |
49 |
|
|
% } |
50 |
|
|
|
51 |
|
|
<script type="text/javascript"> |
52 |
|
|
<!-- |
53 |
|
|
var key_flag_<% $name %> = 1; |
54 |
|
|
var <% $name %>_prev_value = document.getElementById('<% $name %>_value').value; |
55 |
|
|
var <% $name %>_prev_docname = document.getElementById('<% $name %>_docname').value; |
56 |
|
|
|
57 |
|
|
function search_<% $name %>() { |
58 |
|
|
document.getElementById('DocFinder').style.height = 470; |
59 |
|
|
document.getElementById('DocFinder').src = '<% $lookup_string %>'; |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
function lookfor_<% $name %>() { |
63 |
|
|
var id = document.getElementById('<% $name %>_value').value; |
64 |
|
|
if (id) { |
65 |
|
|
var Class = '<% $prop->{lookup_opts}->{class} %>'; |
66 |
|
|
var Uri = 'document.html?id=' + id + '&class=' + Class; |
67 |
|
|
var Width = screen.width; |
68 |
|
|
var Height = screen.height; |
69 |
|
|
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'); |
70 |
|
|
} |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
function lookthrough_<% $name %>(id) { |
74 |
|
|
if (id) { |
75 |
|
|
var Class = '<% $prop->{lookup_opts}->{class} %>'; |
76 |
|
|
var Uri = 'document.html?id=' + id + '&class=' + Class; |
77 |
|
|
var Width = screen.width; |
78 |
|
|
var Height = screen.height; |
79 |
|
|
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'); |
80 |
|
|
} |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
function <% $name %>_changed() { |
84 |
|
|
var t = document.getElementById('<% $name %>_prev_table'); |
85 |
|
|
var v = document.getElementById('<% $name %>_value'); |
86 |
|
|
if (v.value == <% $name %>_prev_value) { |
87 |
|
|
if (t.style.display!='none') { |
88 |
|
|
t.style.display = 'none'; |
89 |
|
|
} |
90 |
|
|
return; |
91 |
|
|
} |
92 |
|
|
if (t.style.display=='none') { |
93 |
|
|
t.style.display = ''; |
94 |
|
|
} |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
function <% $name %>_undo() { |
98 |
|
|
document.getElementById('<% $name %>_value').value = <% $name %>_prev_value; |
99 |
|
|
document.getElementById('<% $name %>_docname').value = <% $name %>_prev_docname; |
100 |
|
|
<% $name %>_changed(); |
101 |
|
|
return false; |
102 |
|
|
} |
103 |
|
|
|
104 |
|
|
//--> |
105 |
|
|
</script> |
106 |
|
|
<%args> |
107 |
|
|
$object |
108 |
|
|
$name => undef |
109 |
|
|
$check => undef |
110 |
|
|
$prop => {} |
111 |
|
|
</%args> |
112 |
|
|
<%init> |
113 |
|
|
|
114 |
|
|
my ($objects, $lookup_string, $error); |
115 |
|
|
|
116 |
|
|
# ���� ��� �������� � ���� ���� integer[] �� ��� �������� ������, ���� � data, �� ������ �� ������. |
117 |
|
|
# ��������� ����� |
118 |
|
|
my @ids = ref($object->$name) eq 'ARRAY' ? @{ $object->$name } : $object->$name ? $object->$name : (); |
119 |
|
|
|
120 |
|
|
if ($prop && ref($prop) && ref($prop->{lookup_opts}) eq 'HASH') { |
121 |
|
|
if ( @ids ) { |
122 |
|
|
$objects = $keeper->get_documents ( |
123 |
|
|
in_id => \@ids, |
124 |
|
|
%{$prop->{lookup_opts}}, |
125 |
|
|
return_mode => 'hash_ref', |
126 |
|
|
); |
127 |
|
|
} |
128 |
|
|
$lookup_string = '/contenido/find_document.html?nf='.$name.'_docname&vf='.$name.'_value'; |
129 |
|
|
$lookup_string .= '&class='.$prop->{lookup_opts}->{class} if exists $prop->{lookup_opts}->{class}; |
130 |
|
|
$lookup_string .= '&s='.$prop->{lookup_opts}->{s} if exists $prop->{lookup_opts}->{s}; |
131 |
|
|
$lookup_string .= '&search_by='.$prop->{lookup_opts}->{search_by} if exists $prop->{lookup_opts}->{search_by}; |
132 |
|
|
}else{ |
133 |
|
|
$error = '������ �������� �������� lookup_opts � ���������'; |
134 |
|
|
} |
135 |
|
|
|
136 |
|
|
</%init> |