Line # Revision Author
1 8 ahitrov@rambler.ru <% spacer(h=>5) %>
2 <form action="store_document_links.html" method="POST">
3 <table bgcolor="silver" cellpadding="0" cellspacing="1" width="100%">
4 <tr>
5 <th>Удалить</th>
6 <th>Документ</th>
7 <th>Связь</th>
8 </tr>
9 % my $i = 0;
10 % foreach my $link ( @$links ) {
11 % my $doc = ref $destination ? $docs->{$link->source_id} : $docs->{$link->dest_id};
12 <tr bgcolor="<% $i++ % 2 ? 'white' : '#f0f0f0' %>">
13 % if ( ref $doc ) {
14 % my $style = $link->status ? '' : ' color:#606060;';
15 <td><input type="checkbox" name="links" value="link_<% $link->id %>_<% $doc->id %>_<% $link->class %>"></td>
16 <td><a href="document.html?class=<% $doc->class %>&id=<% $doc->id %>" target="_blank" style="<% $style %>"><% $doc->name %></a></td>
17 % } else {
18 <td><input type="checkbox" name="links" value="link_<% $link->id %>_<% ref $destination ? $link->source_id : $link->dest_id %>_<% $link->class %>"></td>
19 <td><% ref $doc ? $doc->name : '!!!висячая связь!!!' %></td>
20 % }
21 <td><a href="link.html?class=<% $link->class %>&id=<% $link->id %>" target="_blank">редактировать</a></td>
22 </tr>
23 % }
24 </table>
25 % if ( @$links ) {
26 <div style="padding:2px; text-align:right">
27 <input type="hidden" name="id" value="<% $document->id %>">
28 <input type="hidden" name="class" value="<% $document->class %>">
29 % if ( ref $destination ) {
30 <input type="hidden" name="source_class" value="<% $links->[0]->class %>">
31 % } else {
32 <input type="hidden" name="dest_class" value="<% $links->[0]->class %>">
33 % }
34 <input type="submit" value="Удалить выбранные связи документа" class="input_btn"></div>
35 % }
36 </form>
37 <%args>
38
39 $links => undef
40 $docs => undef
41 $destination => undef
42 $source => undef
43
44 </%args>
45 <%init>
46
47 return if !ref $destination && !ref $source;
48 return unless ref $docs;
49 return unless ref $links eq 'ARRAY' && @$links;
50
51 my $document = $destination || $source;
52
53 </%init>