| 1 |
8 |
ahitrov@rambler.ru |
<fieldset> |
| 2 |
|
|
<legend>Связи этого документа<sup>1</sup></legend> |
| 3 |
|
|
<table height="400" border=0><tr valign="top"><td> |
| 4 |
|
|
<!-- Добавить новую связь --> |
| 5 |
|
|
<script language="JavaScript"> |
| 6 |
|
|
<!-- |
| 7 |
|
|
function focus_win() |
| 8 |
|
|
{ |
| 9 |
|
|
var newwin; |
| 10 |
|
|
newwin = window.open('link_cookie.html', 'addlink'); |
| 11 |
|
|
newwin.window.focus(); |
| 12 |
|
|
} |
| 13 |
|
|
//--> |
| 14 |
|
|
</script> |
| 15 |
|
|
% if (%source_links) |
| 16 |
|
|
% { |
| 17 |
|
|
<p><b>Добавить связь от данного объекта:</b> |
| 18 |
|
|
<table width="300" border="0" cellpadding="3" cellspacing="0" class="tform"> |
| 19 |
|
|
% foreach my $class (sort keys %source_links) { |
| 20 |
|
|
<tr><td nowrap width="100%"> |
| 21 |
|
|
<a href="link_frame.html?class=<% $class %>&source_class=<% $document->class() %>&source_id=<% $document->id() %>" target="_top"><% $source_links{$class} %> (источник)</a><br> |
| 22 |
|
|
</td></tr> |
| 23 |
|
|
% } |
| 24 |
|
|
</table> |
| 25 |
|
|
</p> |
| 26 |
|
|
% } |
| 27 |
|
|
% if (%dest_links) |
| 28 |
|
|
% { |
| 29 |
|
|
<p><b>Добавить связь к данному объекту:</b> |
| 30 |
|
|
<table width="300" border="0" cellpadding="3" cellspacing="0" class="tform"> |
| 31 |
|
|
% foreach my $class (sort keys %dest_links) { |
| 32 |
|
|
<tr><td nowrap width="100%"> |
| 33 |
|
|
<a href="link_frame.html?class=<% $class %>&dest_class=<% $document->class() %>&dest_id=<% $document->id() %>" target="_top"><% $dest_links{$class} %> (цель)</a><br> |
| 34 |
|
|
</td></tr> |
| 35 |
|
|
% } |
| 36 |
|
|
</table> |
| 37 |
|
|
</p> |
| 38 |
|
|
% } |
| 39 |
|
|
<!-- Связи идущие от этого документа --> |
| 40 |
|
|
%if (@links) { |
| 41 |
|
|
<p><b>Установленные связи:</b> |
| 42 |
|
|
<form name="links" action="store_document_links.html" method="GET"> |
| 43 |
|
|
<table width="300" border="0" cellpadding="0" cellspacing="0" class="tform"> |
| 44 |
|
|
% my $last_class; |
| 45 |
|
|
% foreach my $link (@links) { |
| 46 |
|
|
% if ($link->class() ne $last_class) { |
| 47 |
|
|
<tr><td colspan="2"><b><% $link->class_name() %></b></td></tr> |
| 48 |
|
|
% $last_class = $link->class(); |
| 49 |
|
|
% } |
| 50 |
|
|
% my $ldocument = $keeper->__get_by_id__($link->dest_class, |
| 51 |
|
|
% id=>$link->dest_id, class=>$link->dest_class, light=>1 ); |
| 52 |
|
|
% next unless ($ldocument); |
| 53 |
|
|
<tr><td width="25"><input type="checkbox" name="links" value="link_<% $link->id %>_<% $link->dest_id %>_<% $link->class %>"></td> |
| 54 |
|
|
<td><a href="document.html?id=<% $link->id %>&class=<% $link->class() %>" target=_top><% $ldocument->name || '[без имени]' %></a> (<a href="document.html?id=<% $ldocument->id %>&class=<% $ldocument->class() %>" target=_top><% $ldocument->class_name %></a>)</td></tr> |
| 55 |
|
|
% } |
| 56 |
|
|
</table> |
| 57 |
|
|
<br> |
| 58 |
|
|
<input type="hidden" name="id" value="<% $document->id %>"> |
| 59 |
|
|
<input type="hidden" name="class" value="<% $document->class %>"> |
| 60 |
|
|
<input type="submit" value="Удалить выбранные связи документа" class="input_btn"> |
| 61 |
|
|
</form> |
| 62 |
|
|
</p> |
| 63 |
|
|
%} |
| 64 |
|
|
<!-- Связи идущие к этому документу (readonly) --> |
| 65 |
|
|
%if (@source_links) { |
| 66 |
|
|
<br><b>Связи ведущие к этому документу</b></p> |
| 67 |
|
|
<table width="300" border="0" cellpadding="0" cellspacing="0" class="tform"> |
| 68 |
|
|
% my $last_class; |
| 69 |
|
|
% foreach my $link (@source_links) { |
| 70 |
|
|
% if ($link->class() ne $last_class) { |
| 71 |
|
|
<tr><td colspan="2"><b><% $link->class_name() %></b></td></tr> |
| 72 |
|
|
% $last_class = $link->class(); |
| 73 |
|
|
% } |
| 74 |
|
|
% my $rdocument = $keeper->__get_by_id__($link->source_class, |
| 75 |
|
|
% id=>$link->source_id, class=>$link->source_class, light=>1 ); |
| 76 |
|
|
% next unless ($rdocument); |
| 77 |
|
|
<tr><td width="25"> </td> |
| 78 |
|
|
<td><a href="document.html?id=<% $link->id() %>&class=<% $link->class() %>" target=_top><% $rdocument->name %></a> (<a href="document.html?id=<% $rdocument->id() %>&class=<% $rdocument->class() %>" target=_top><% $rdocument->class_name %></a>)</td></tr> |
| 79 |
|
|
% } |
| 80 |
|
|
</table> |
| 81 |
|
|
%} |
| 82 |
|
|
</td></tr></table> |
| 83 |
|
|
<br> |
| 84 |
|
|
</fieldset> |
| 85 |
|
|
|
| 86 |
|
|
|
| 87 |
|
|
|
| 88 |
|
|
<!-- Примечания --> |
| 89 |
|
|
<fieldset> |
| 90 |
|
|
<legend>Примечания</legend> |
| 91 |
|
|
<table width="100%" cellspacing="5" cellpadding="0" class="tform" height="100"> |
| 92 |
|
|
<tr valign="top"> |
| 93 |
|
|
<th>1)</th> |
| 94 |
|
|
<td width="100%">Выделенные связи будут удалены. Если Вы хотите удалить какую-нибудь связь, установите |
| 95 |
|
|
галочку напротив нее и нажмите кнопку "удалить". |
| 96 |
|
|
</td></tr> |
| 97 |
|
|
</table> |
| 98 |
|
|
</fieldset> |
| 99 |
|
|
|
| 100 |
|
|
<%ARGS> |
| 101 |
|
|
$document => undef |
| 102 |
|
|
</%ARGS> |
| 103 |
|
|
<%INIT> |
| 104 |
|
|
|
| 105 |
|
|
return unless ref($document); |
| 106 |
|
|
## && $document->can('id'); |
| 107 |
|
|
my $options = $project->links(); |
| 108 |
|
|
|
| 109 |
|
|
my %source_links=(); |
| 110 |
|
|
my %dest_links=(); |
| 111 |
|
|
my @source_links; |
| 112 |
|
|
my @links; |
| 113 |
|
|
|
| 114 |
|
|
foreach my $class (@{ $state->{available_links} }) { |
| 115 |
|
|
my $link = $class->new($keeper); |
| 116 |
|
|
my $set = $link->available_sources(); |
| 117 |
|
|
next unless ($set and ref($set) eq 'ARRAY' and @$set); |
| 118 |
|
|
my @avaliable_sources = @$set; |
| 119 |
|
|
my $found = 0; |
| 120 |
|
|
foreach my $source (@avaliable_sources) { |
| 121 |
|
|
if ($source eq $document->class()) { |
| 122 |
|
|
$found=1; |
| 123 |
|
|
last; |
| 124 |
|
|
} |
| 125 |
|
|
} |
| 126 |
|
|
next unless $found; |
| 127 |
|
|
$source_links{$class}=$link->class_name(); |
| 128 |
|
|
push @links, $document->links($class); |
| 129 |
|
|
} |
| 130 |
|
|
|
| 131 |
|
|
foreach my $class (@{ $state->{available_links} }) { |
| 132 |
|
|
my $link = $class->new($keeper); |
| 133 |
|
|
my $set = $link->available_destinations(); |
| 134 |
|
|
next unless ($set and ref($set) eq 'ARRAY' and @$set); |
| 135 |
|
|
my @avaliable_dest = @$set; |
| 136 |
|
|
my $found = 0; |
| 137 |
|
|
foreach my $source (@avaliable_dest) { |
| 138 |
|
|
if ($source eq $document->class()) { |
| 139 |
|
|
$found=1; |
| 140 |
|
|
last; |
| 141 |
|
|
} |
| 142 |
|
|
} |
| 143 |
|
|
next unless $found; |
| 144 |
|
|
$dest_links{$class}=$link->class_name(); |
| 145 |
|
|
push @source_links, $document->links($class,'reverse'); |
| 146 |
|
|
} |
| 147 |
|
|
|
| 148 |
|
|
</%INIT> |
| 149 |
|
|
<%DOC> |
| 150 |
|
|
foreach my $class (@{ $state->{available_links} }) { |
| 151 |
|
|
if (ref( $options->{$class}->{source_id} )) { |
| 152 |
|
|
my @avaliable_sources = @{$options->{$class}->{source_id}}; |
| 153 |
|
|
shift @avaliable_sources; |
| 154 |
|
|
my $found = 0; |
| 155 |
|
|
foreach my $source (@avaliable_sources) { |
| 156 |
|
|
if ($source eq $document->class()) { |
| 157 |
|
|
$found=1; |
| 158 |
|
|
last; |
| 159 |
|
|
} |
| 160 |
|
|
} |
| 161 |
|
|
next unless $found; |
| 162 |
|
|
my $link = $class->new($keeper); |
| 163 |
|
|
$allowed_links{$class}=$link->class_name(); |
| 164 |
|
|
} else { |
| 165 |
|
|
my $link = $class->new($keeper); |
| 166 |
|
|
$allowed_links{$class}=$link->class_name(); |
| 167 |
|
|
} |
| 168 |
|
|
} |
| 169 |
|
|
</%DOC> |
| 170 |
|
|
|