1 |
3 |
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 |
25 |
ahitrov@rambler.ru |
% if ( @props ) { |
8 |
|
|
% foreach my $prop ( @props ) { |
9 |
|
|
<th><% $prop->{shortname} || $prop->{rusname} %></th> |
10 |
|
|
% } |
11 |
|
|
% } |
12 |
3 |
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 |
25 |
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 |
3 |
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 |
25 |
ahitrov@rambler.ru |
<td>!!!������� �����!!!</td> |
25 |
3 |
ahitrov@rambler.ru |
% } |
26 |
25 |
ahitrov@rambler.ru |
% if ( @props ) { |
27 |
|
|
% foreach my $prop ( @props ) { |
28 |
|
|
% my $field = $prop->{attr}; |
29 |
33 |
ahitrov@rambler.ru |
% if ( exists $prop->{inline} ) { |
30 |
|
|
% $inline_status = 1; |
31 |
|
|
% if ( $prop->{type} =~ /^(string|integer|float)$/ ) { |
32 |
|
|
<td><input type="text" name="<% 'update_'.$link->id.'_'.$field %>" value="<% $link->$field |h %>" style="<% $prop->{inline_width} ? 'width:'.$prop->{inline_width}.'px;' : 'width:65px; ' %> <% $prop->{inline_style} || '' %>"></td> |
33 |
|
|
% } elsif ($prop->{type} eq 'checkbox') { |
34 |
|
|
% my $checked = $link->$field ? ' checked' : ''; |
35 |
|
|
<td align="center"><input type="checkbox" name="<% 'update_'.$link->id.'_'.$field %>"<% $checked %>> |
36 |
|
|
% } elsif ($prop->{type} eq 'select') { |
37 |
|
|
% my $options = {}; |
38 |
|
|
% if ($toopi && (ref($toopi) eq 'HASH') && (exists($toopi->{$link->class}))) { |
39 |
|
|
% %{ $options } = %{ $toopi->{$link->class} }; |
40 |
|
|
% } |
41 |
|
|
% my $values = $options->{$prop->{attr}}; |
42 |
|
|
<td><select name="<% 'update_'.$link->id.'_'.$field %>"> |
43 |
|
|
% if ( ref $values eq 'ARRAY' ) { |
44 |
|
|
% foreach my $val ( @$values ) { |
45 |
|
|
% my $selected = $val eq $link->$field ? ' selected' : ''; |
46 |
|
|
<option value="<% $val %>"<% $selected %>><% $val %> |
47 |
|
|
% } |
48 |
|
|
% } |
49 |
|
|
</select> |
50 |
|
|
% } elsif ($prop->{type} eq 'status') { |
51 |
|
|
% my $cases = $prop->{cases}; |
52 |
|
|
% if ( ref $cases eq 'ARRAY' ) { |
53 |
|
|
<td><select name="<% 'update_'.$link->id.'_'.$field %>" style="<% $prop->{inline_width} ? 'width:'.$prop->{inline_width}.'px;' : '' %> <% $prop->{inline_style} || '' %>"> |
54 |
|
|
% foreach my $case ( @$cases ) { |
55 |
|
|
% my $selected = $case->[0] eq $link->$field ? ' selected' : ''; |
56 |
|
|
<option value="<% $case->[0] %>"<% $selected %>><% $case->[1] %> |
57 |
|
|
% } |
58 |
|
|
</select> |
59 |
|
|
% } |
60 |
|
|
|
61 |
|
|
% } |
62 |
|
|
% } else { |
63 |
25 |
ahitrov@rambler.ru |
<td><% $link->$field %></td> |
64 |
33 |
ahitrov@rambler.ru |
% } |
65 |
25 |
ahitrov@rambler.ru |
% } |
66 |
|
|
% } |
67 |
33 |
ahitrov@rambler.ru |
<td><a href="link.html?class=<% $link->class %>&id=<% $link->id %>" target="_blank">�������������</a> |
68 |
|
|
% if ( $inline_status ) { |
69 |
|
|
<input type="hidden" name="update_<% $link->id %>_class" value="<% $link->class %>"> |
70 |
|
|
% } |
71 |
|
|
</td></tr> |
72 |
3 |
ahitrov@rambler.ru |
% } |
73 |
|
|
</table> |
74 |
|
|
% if ( @$links ) { |
75 |
|
|
<div style="padding:2px; text-align:right"> |
76 |
|
|
<input type="hidden" name="id" value="<% $document->id %>"> |
77 |
|
|
<input type="hidden" name="class" value="<% $document->class %>"> |
78 |
|
|
% if ( ref $destination ) { |
79 |
|
|
<input type="hidden" name="source_class" value="<% $links->[0]->class %>"> |
80 |
|
|
% } else { |
81 |
|
|
<input type="hidden" name="dest_class" value="<% $links->[0]->class %>"> |
82 |
|
|
% } |
83 |
33 |
ahitrov@rambler.ru |
% if ( $inline_status ) { |
84 |
|
|
<input type="submit" name="update" value="��������� ���������" class="input_btn"> |
85 |
|
|
% } |
86 |
3 |
ahitrov@rambler.ru |
<input type="submit" value="������� ��������� ����� ���������" class="input_btn"></div> |
87 |
|
|
% } |
88 |
|
|
</form> |
89 |
|
|
<%args> |
90 |
|
|
|
91 |
|
|
$links => undef |
92 |
|
|
$docs => undef |
93 |
|
|
$destination => undef |
94 |
|
|
$source => undef |
95 |
|
|
|
96 |
|
|
</%args> |
97 |
|
|
<%init> |
98 |
|
|
|
99 |
|
|
return if !ref $destination && !ref $source; |
100 |
|
|
return unless ref $docs; |
101 |
|
|
return unless ref $links eq 'ARRAY' && @$links; |
102 |
|
|
|
103 |
33 |
ahitrov@rambler.ru |
my $inline_status = 0; |
104 |
3 |
ahitrov@rambler.ru |
my $document = $destination || $source; |
105 |
25 |
ahitrov@rambler.ru |
my @props = $links->[0]->structure; |
106 |
|
|
@props = sort { $a->{column} <=> $b->{column} } grep { $_->{attr} ne 'class' && $_->{type} =~ /string|integer/ } grep { $_->{column} } @props; |
107 |
33 |
ahitrov@rambler.ru |
my $toopi = $project->links(); |
108 |
3 |
ahitrov@rambler.ru |
|
109 |
|
|
</%init> |