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 24 ahitrov@rambler.ru % if ( @props ) {
8 % foreach my $prop ( @props ) {
9 <th><% $prop->{shortname} || $prop->{rusname} %></th>
10 % }
11 % }
12 8 ahitrov@rambler.ru <th>Связь</th>
13 </tr>
14 % my $i = 0;
15 % foreach my $link ( @$links ) {
16 % my $doc = ref $destination ? $docs->{$link->source_id} : $docs->{$link->dest_id};
17 <tr bgcolor="<% $i++ % 2 ? 'white' : '#f0f0f0' %>">
18 % if ( ref $doc ) {
19 % my $style = $link->status ? '' : ' color:#606060;';
20 24 ahitrov@rambler.ru <td style="width:40px; text-align:center;"><input type="checkbox" name="links" value="link_<% $link->id %>_<% $doc->id %>_<% $link->class %>"></td>
21 8 ahitrov@rambler.ru <td><a href="document.html?class=<% $doc->class %>&id=<% $doc->id %>" target="_blank" style="<% $style %>"><% $doc->name %></a></td>
22 % } else {
23 <td><input type="checkbox" name="links" value="link_<% $link->id %>_<% ref $destination ? $link->source_id : $link->dest_id %>_<% $link->class %>"></td>
24 24 ahitrov@rambler.ru <td>!!!висячая связь!!!</td>
25 8 ahitrov@rambler.ru % }
26 24 ahitrov@rambler.ru % if ( @props ) {
27 % foreach my $prop ( @props ) {
28 % my $field = $prop->{attr};
29 <td><% $link->$field %></td>
30 % }
31 % }
32 8 ahitrov@rambler.ru <td><a href="link.html?class=<% $link->class %>&id=<% $link->id %>" target="_blank">редактировать</a></td>
33 </tr>
34 % }
35 </table>
36 % if ( @$links ) {
37 <div style="padding:2px; text-align:right">
38 <input type="hidden" name="id" value="<% $document->id %>">
39 <input type="hidden" name="class" value="<% $document->class %>">
40 % if ( ref $destination ) {
41 <input type="hidden" name="source_class" value="<% $links->[0]->class %>">
42 % } else {
43 <input type="hidden" name="dest_class" value="<% $links->[0]->class %>">
44 % }
45 <input type="submit" value="Удалить выбранные связи документа" class="input_btn"></div>
46 % }
47 </form>
48 <%args>
49
50 $links => undef
51 $docs => undef
52 $destination => undef
53 $source => undef
54
55 </%args>
56 <%init>
57
58 return if !ref $destination && !ref $source;
59 return unless ref $docs;
60 return unless ref $links eq 'ARRAY' && @$links;
61
62 my $document = $destination || $source;
63 24 ahitrov@rambler.ru my @props = $links->[0]->structure;
64 @props = sort { $a->{column} <=> $b->{column} } grep { $_->{attr} ne 'class' && $_->{type} =~ /string|integer/ } grep { $_->{column} } @props;
65 8 ahitrov@rambler.ru
66 </%init>