1 |
3 |
ahitrov@rambler.ru |
<script type="text/javascript"> |
2 |
|
|
<!-- |
3 |
|
|
var aIDs = new Array (<% scalar @$documents ? join (',', map { $_->id } @$documents) : '' %>); |
4 |
|
|
function delete_check () { |
5 |
|
|
for ( var i = 0; i < aIDs.length; i++ ) { |
6 |
|
|
var sFieldName = 'delete_' + aIDs[i] + '_id'; |
7 |
|
|
var oField = document.forms['section_browse'].elements[sFieldName]; |
8 |
|
|
if ( oField.checked ) { |
9 |
|
|
oField.checked = 0; |
10 |
|
|
} else { |
11 |
|
|
oField.checked = 1; |
12 |
|
|
} |
13 |
|
|
} |
14 |
|
|
} |
15 |
|
|
//--> |
16 |
|
|
</script> |
17 |
|
|
<form name="section_browse" action="sections.html" method="POST"> |
18 |
|
|
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="tlistdocs"> |
19 |
|
|
<tr bgcolor="#efefef"> |
20 |
|
|
<th><a href="javascript:delete_check()" onclick="delete_check(); return false;"><img src="/contenido/i/actions/delete.gif" width="14" height="17" alt="�������� ����������" align="absmiddle" border="0" hspace="1"></a></th> |
21 |
|
|
% |
22 |
|
|
% foreach (@$columns) { |
23 |
|
|
<th><% $_->{shortname} || $_->{rusname} %></th> |
24 |
|
|
% } |
25 |
|
|
% |
26 |
|
|
</tr> |
27 |
|
|
% |
28 |
|
|
% unless (@$documents) { |
29 |
|
|
<tr><td align="center" colspan="<% scalar @$columns %>">��������� �� �������</td></tr> |
30 |
|
|
% } |
31 |
|
|
% foreach my $document (@$documents) { |
32 |
|
|
% |
33 |
|
|
% next unless ref($document); |
34 |
|
|
% my $document_access = $user->section_accesses($user, $document->section); |
35 |
|
|
% |
36 |
|
|
<tr valign="top"> |
37 |
|
|
<td nowrap>\ |
38 |
|
|
% if ($document_access == 2) { |
39 |
|
|
% $delete_status = 1; |
40 |
|
|
<input type="checkbox" name="<% 'delete_'.$document->id.'_id' %>"> |
41 |
|
|
% } else { |
42 |
|
|
|
43 |
|
|
% } |
44 |
|
|
</td> |
45 |
|
|
% |
46 |
|
|
% for my $col (@$columns) { |
47 |
|
|
% if ($col->{attr} eq '_sort_') { |
48 |
|
|
% |
49 |
|
|
<td width="20px"><% $document->{sorder} %> <a |
50 |
|
|
href="document_move.html?id=<% $document->{id} %>&move=up&s=<% $id %><% $params_unsection ? '&'.$params_unsection : '' %>"><img |
51 |
|
|
src="/contenido/i/ico-up-9x10.gif" border=0 alt="����������� �������� �� ��� �����"></a> <a |
52 |
|
|
href="document_move.html?id=<% $document->{id} %>&move=down&s=<% $id %><% $params_unsection ? '&'.$params_unsection : '' %>"><img |
53 |
|
|
src="/contenido/i/ico-down-9x10.gif" border=0 alt="����������� �������� �� ��� ����"></a>\ |
54 |
|
|
% |
55 |
|
|
% } elsif ($col->{attr} eq 'dtime') { |
56 |
|
|
% |
57 |
|
|
<td nowrap><& "/contenido/components/show_dtime.msn", dtime=>$document->{dtime} &>\ |
58 |
|
|
% |
59 |
|
|
% if ($document->{ctime} ne $document->{mtime}) { |
60 |
|
|
% my $colortime = '#c66'; |
61 |
|
|
% |
62 |
|
|
<div style="color:<% $colortime %>;"><& "/contenido/components/show_dtime.msn", dtime=>$document->{mtime} &></div>\ |
63 |
|
|
% |
64 |
|
|
% } |
65 |
|
|
% |
66 |
|
|
% } elsif ($col->{attr} eq 'name') { |
67 |
|
|
% |
68 |
|
|
<td><span<% $document->contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> class="<% $document->status ? '':'hiddensect' %>">\ |
69 |
|
|
% |
70 |
|
|
% my $name=$document->name ? $document->name : '���������� �������� N'.$document->id; |
71 |
|
|
% if ($document_access == 2) { |
72 |
|
|
% |
73 |
|
|
<a<% $document->contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $name | h %> </a>\ |
74 |
|
|
% |
75 |
|
|
% } else { |
76 |
|
|
% |
77 |
|
|
<% $name | h %> \ |
78 |
|
|
% |
79 |
|
|
% } |
80 |
|
|
% |
81 |
|
|
</span>\ |
82 |
|
|
% |
83 |
|
|
% } elsif ($col->{attr} eq 'id') { |
84 |
|
|
% |
85 |
|
|
<td><span class="<% $document->status ? '':'hiddensect' %>">\ |
86 |
|
|
% if ($document_access == 2) { |
87 |
|
|
<a href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $document->id %> </a>\ |
88 |
|
|
% } else { |
89 |
|
|
<% $document->id %> \ |
90 |
|
|
% } |
91 |
|
|
</span>\ |
92 |
|
|
% |
93 |
|
|
% } elsif ( exists $col->{inline} && $col->{inline} ) { |
94 |
|
|
% $inline_status = 1; |
95 |
|
|
% my $attr = $col->{attr}; |
96 |
|
|
% if ( $col->{type} =~ /^(string|integer|float)$/ && $col->{inline} ) { |
97 |
|
|
% my $style = $col->{inline_style} ? $col->{inline_style} : ($col->{type} =~ /^(integer|float)$/ ? 'text-align:right; ' : '' ); |
98 |
|
|
<td><input type="text" name="<% 'update_'.$document->id.'_'.$attr %>" value="<% $document->$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : 'width:65px; ' %> <% $col->{inline_style} || '' %>"> |
99 |
|
|
% } elsif ($col->{type} eq 'checkbox') { |
100 |
|
|
% my $checked = $document->$attr ? ' checked' : ''; |
101 |
|
|
<td align="center"><input type="checkbox" name="<% 'update_'.$document->id.'_'.$attr %>"<% $checked %>> |
102 |
|
|
% } elsif ($col->{type} eq 'select') { |
103 |
|
|
% my $options = {}; |
104 |
|
|
% if ($toopi && (ref($toopi) eq 'HASH') && (exists($toopi->{$document->class}))) { |
105 |
|
|
% %{ $options } = %{ $toopi->{$document->class} }; |
106 |
|
|
% } |
107 |
|
|
% my $values = $options->{$col->{attr}}; |
108 |
|
|
<td><select name="<% 'update_'.$document->id.'_'.$attr %>"> |
109 |
|
|
% if ( ref $values eq 'ARRAY' ) { |
110 |
|
|
% foreach my $val ( @$values ) { |
111 |
|
|
% my $selected = $val eq $document->$attr ? ' selected' : ''; |
112 |
|
|
<option value="<% $val %>"<% $selected %>><% $val %> |
113 |
|
|
% } |
114 |
|
|
% } |
115 |
|
|
</select> |
116 |
|
|
% } elsif ($col->{type} eq 'status') { |
117 |
|
|
% my $cases = $col->{cases}; |
118 |
|
|
% if ( ref $cases eq 'ARRAY' ) { |
119 |
|
|
<td><select name="<% 'update_'.$document->id.'_'.$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : '' %> <% $col->{inline_style} || '' %>"> |
120 |
|
|
% foreach my $case ( @$cases ) { |
121 |
|
|
% my $selected = $case->[0] eq $document->$attr ? ' selected' : ''; |
122 |
|
|
<option value="<% $case->[0] %>"<% $selected %>><% $case->[1] %> |
123 |
|
|
% } |
124 |
|
|
</select> |
125 |
|
|
% } |
126 |
|
|
% } |
127 |
|
|
% |
128 |
|
|
% } elsif ($col->{attr} eq 'class') { |
129 |
|
|
% |
130 |
|
|
<td><% $document->class_name %> <font color="#999999">(<% $document->class %>)</font>\ |
131 |
|
|
% |
132 |
|
|
% } elsif ($col->{type} eq 'datetime') { |
133 |
|
|
% |
134 |
|
|
<td nowrap><& "/contenido/components/show_dtime.msn", dtime=>$document->{$col->{attr}} &>\ |
135 |
|
|
% |
136 |
|
|
% } elsif ($col->{attr} eq '_act_') { |
137 |
|
|
% |
138 |
|
|
<td nowrap>\ |
139 |
|
|
% if ($document_access == 2) { |
140 |
|
|
% |
141 |
|
|
<a href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="������������� ��������"><img |
142 |
|
|
src="/contenido/i/actions/edit.gif" width="15" height="17" alt="������������� ��������" align="absmiddle" border="0" hspace="1"></a>\ |
143 |
|
|
<a href="document.html?clone=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="���������� ��������"><img |
144 |
|
|
src="/contenido/i/actions/copy.gif" width="15" height="17" alt="���������� ��������" align="absmiddle" border="0" hspace="1"></a>\ |
145 |
|
|
<a href="confirm.html?id=<% $document->id %>&action=documents_deletion&from=<% $section->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="������� ��������"><img |
146 |
|
|
src="/contenido/i/actions/delete.gif" width="14" height="17" alt="������� ��������" align="absmiddle" border="0" hspace="1"></a>\ |
147 |
|
|
% if ( $document->status != 0 ) { |
148 |
|
|
<a href="document.html?deactivate=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="������/�������������� ��������"><img |
149 |
|
|
src="/contenido/i/actions/deactivate.gif" width="14" height="17" alt="������/�������������� ��������" align="absmiddle" border="0" hspace="1"></a>\ |
150 |
|
|
% } |
151 |
|
|
% if ( $document->status != 1 ) { |
152 |
|
|
<a href="document.html?activate=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="��������� ��������� ������=1"><img |
153 |
|
|
src="/contenido/i/actions/activate.gif" width="14" height="17" alt="��������� ��������� ������=1" align="absmiddle" border="0" hspace="1"></a>\ |
154 |
|
|
% } |
155 |
|
|
<br>\ |
156 |
|
|
% |
157 |
|
|
% } else { |
158 |
|
|
\ |
159 |
|
|
% } |
160 |
|
|
% if ( $inline_status ) { |
161 |
|
|
<input type="hidden" name="update_<% $document->id %>_class" value="<% $document->class %>"> |
162 |
|
|
% } |
163 |
|
|
% if ( $delete_status ) { |
164 |
|
|
<input type="hidden" name="delete_<% $document->id %>_class" value="<% $document->class %>"> |
165 |
|
|
% } |
166 |
|
|
% |
167 |
|
|
% } else { |
168 |
|
|
% |
169 |
|
|
% if ($col->{type} eq 'date') { |
170 |
|
|
% my $date=$document->{$col->{attr}}; |
171 |
|
|
% $date=~/(\d{4}-\d{2}-\d{2})/; |
172 |
|
|
<td nowrap align="right"><% $1 || ' ' %>\ |
173 |
|
|
% } elsif ($col->{type} eq 'datetime') { |
174 |
|
|
<td nowrap align="right"><% $document->{$col->{attr}} || ' ' %>\ |
175 |
|
|
% } elsif ($col->{type} eq 'integer') { |
176 |
|
|
<td align="right"><% $document->{$col->{attr}} %> \ |
177 |
132 |
ahitrov |
% } elsif ($col->{type} eq 'lookup' || $col->{type} eq 'pickup') { |
178 |
3 |
ahitrov@rambler.ru |
<td align="left">\ |
179 |
|
|
% my $id = $document->{$col->{attr}}; |
180 |
|
|
% if ($id) { |
181 |
|
|
% my ($doc)=$keeper->get_documents( ( ref($col->{lookup_opts}) ? %{$col->{lookup_opts}} : () ), id=>$id); |
182 |
|
|
% if ($doc) { |
183 |
|
|
<a href="document.html?id=<% $doc->id %>&class=<% $doc->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $doc->name || $doc->id %></a> \ |
184 |
|
|
% } else { |
185 |
|
|
<span class="hiddensect"><% $document->{$col->{attr}} %>???</span>\ |
186 |
|
|
% } |
187 |
|
|
% } else { |
188 |
|
|
<span class="hiddensect">NULL</span>\ |
189 |
|
|
% } |
190 |
|
|
% } elsif ($col->{type} eq 'status') { |
191 |
|
|
% my $status_map = ref $col->{cases} eq 'ARRAY' ? $col->{cases} : $keeper->default_status(); |
192 |
|
|
% my ($doc_status) = grep { $_->[0] eq $document->{$col->{attr}} } @$status_map; |
193 |
|
|
% $doc_status ||= [$document->{$col->{attr}}, '�����������']; |
194 |
|
|
<td nowrap><% $doc_status->[1].'('.$doc_status->[0].')' %>\ |
195 |
|
|
% } else { |
196 |
|
|
<td><% defined($document->{$col->{attr}}) ? $document->{$col->{attr}} : ' ' %>\ |
197 |
|
|
% } |
198 |
|
|
% } |
199 |
|
|
</td> |
200 |
|
|
% |
201 |
|
|
% } #- for @columns |
202 |
|
|
% |
203 |
|
|
</tr> |
204 |
|
|
% } #- foreach @documents |
205 |
|
|
</table> |
206 |
|
|
<input type="hidden" name="id" value="<% $section->id %>"> |
207 |
|
|
% if ( ref $filter eq 'HASH' ) { |
208 |
|
|
% while ( my ($key, $value) = each %$filter ) { |
209 |
|
|
% next if $key eq 's'; |
210 |
|
|
<input type="hidden" name="<% $key %>" value="<% $value |h %>"> |
211 |
|
|
% } |
212 |
|
|
% } |
213 |
|
|
% if ( $inline_status || $delete_status ) { |
214 |
|
|
<div style="text-align:right; padding:10px 0;"> |
215 |
|
|
% if ( $inline_status ) { |
216 |
|
|
<input type="submit" name="update" value="��������� ���������" class="input_btn"> |
217 |
|
|
% } |
218 |
|
|
% if ( $delete_status ) { |
219 |
|
|
<input type="submit" name="delete" value="������� ���������" class="input_btn" onclick="return confirm('��� ���������� ������� ����� �������');"> |
220 |
|
|
% } |
221 |
|
|
</div> |
222 |
|
|
% } |
223 |
|
|
</form> |
224 |
|
|
<%args> |
225 |
|
|
|
226 |
|
|
$section => undef |
227 |
|
|
$documents => undef |
228 |
|
|
$columns => undef |
229 |
|
|
$id => undef |
230 |
|
|
$filter => undef |
231 |
|
|
|
232 |
|
|
</%args> |
233 |
|
|
<%init> |
234 |
|
|
|
235 |
|
|
return unless ref $documents eq 'ARRAY'; |
236 |
|
|
return unless ref $columns eq 'ARRAY'; |
237 |
|
|
return unless ref $section; |
238 |
|
|
|
239 |
|
|
my $toopi = $project->documents(); |
240 |
|
|
my $inline_status = 0; |
241 |
|
|
my $delete_status = 0; |
242 |
|
|
my $params = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } keys %$filter ) : ''; |
243 |
|
|
my $params_unclassed = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 'class' } keys %$filter ) : ''; |
244 |
|
|
my $params_unsection = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 's' } keys %$filter ) : ''; |
245 |
|
|
|
246 |
|
|
|
247 |
|
|
</%init> |