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