Line # Revision Author
1 8 ahitrov@rambler.ru <& "/contenido/components/title.msn" &>
2 <style>
3 <!--
4 fieldset { font:11px Verdana; }
5 fieldset table { font:11px Verdana; }
6 fieldset table td { padding:1px 4px; }
7 fieldset table th { font:bold 10px Verdana; padding:1px 2px; }
8 div.pad_active { font-weight:bold; padding:3px 4px; border-bottom:2px solid gray; float:left;
9 border-right:1px solid gray; background:#f0f0f0; border-top:1px solid #f0f0f0; border-left:1px solid #f0f0f0; }
10 div.pad_passive { padding:3px 4px; border-bottom:2px solid gray; float:left;
11 border-right:1px solid gray; background:#d0d0d0; border-top:1px solid #f0f0f0; border-left:1px solid #f0f0f0; };
12 -->
13 </style>
14 <script type="text/javascript">
15 <!--
16 function switch_div (sName) {
17 var oDiv = document.getElementById(sName);
18 var oDivPrompt = document.getElementById(sName + '_hidden');
19 if ( oDiv.style.display == 'block' ) {
20 oDiv.style.display = 'none';
21 oDivPrompt.style.display = 'block';
22 } else {
23 oDiv.style.display = 'block';
24 oDivPrompt.style.display = 'none';
25 }
26 }
27 //-->
28 </script>
29 % if ($document) {
30 % if ( @sources ) {
31 % my $show = (@sources && $link_class && grep { $_ eq $link_class } @sources) || ((@sources && @destinations) || !@destinations) ? 1 : 0;
32 % my $lclass = $link_class;
33 % if ( $link_class && grep { $_ eq $link_class } @destinations ) {
34 % $show = 0;
35 % $lclass = undef;
36 % }
37 <fieldset>
38 <legend>&rarr; <a href="javascript:switch_div('div_source')" style="color:white;"
39 onclick="switch_div('div_source'); return false;">Связи, ведущие от этого документа:</a></legend>
40 <div id="div_source" style="display:<% $show ? 'block' : 'none' %>">
41 <& "/contenido/components/document_links_block.msn",
42 document => $document, lclasses => \@sources, class => $lclass, p => $p,
43 link_id_name => 'source_id',
44 275 ahitrov link_class_name => 'source_class',
45 parent_url => $parent_url,
46 8 ahitrov@rambler.ru &>
47 </div>
48 <div id="div_source_hidden" style="display:<% $show ? 'none' : 'block' %>; padding:5px;"><a href="javascript:switch_div('div_source')"
49 onclick="switch_div('div_source'); return false;">Содержимое скрыто</a></div>
50 </fieldset>
51 % }
52 % if ( @destinations ) {
53 % my $show = (@destinations && $link_class && grep { $_ eq $link_class } @destinations ) || !@sources ? 1 : 0;
54 % my $lclass = $link_class;
55 % if ( $link_class && grep { $_ eq $link_class } @sources ) {
56 % $show = 0;
57 % $lclass = undef;
58 % }
59 <fieldset>
60 <legend>&larr; <a href="javascript:switch_div('div_destination')" style="color:white;"
61 onclick="switch_div('div_destination'); return false;">Связи, ведущие к этому документу:</a></legend>
62 <div id="div_destination" style="display:<% $show ? 'block' : 'none' %>">
63 <& "/contenido/components/document_links_block.msn",
64 document => $document, lclasses => \@destinations, class => $lclass, p => $p,
65 link_id_name => 'dest_id',
66 275 ahitrov link_class_name => 'dest_class',
67 parent_url => $parent_url,
68 8 ahitrov@rambler.ru &>
69 </div>
70 <div id="div_destination_hidden" style="display:<% $show ? 'none' : 'block' %>; padding:5px;"><a href="javascript:switch_div('div_destination')"
71 onclick="switch_div('div_destination'); return false;">Содержимое скрыто</a></div>
72 </fieldset>
73 % }
74 % } else {
75 <p><font color="red">Не могу получить документ по данным id=<% $id %> и class=<% $class %></font></p>
76 % }
77 </body>
78 </html>
79
80 <%ARGS>
81
82 $p => 1
83 $class => undef
84 $id => undef
85 $link_class => undef
86 275 ahitrov $parent_url => undef
87 8 ahitrov@rambler.ru
88 </%ARGS>
89
90 <%INIT>
91 275 ahitrov
92 8 ahitrov@rambler.ru return unless ($state->{available_links} and @{$state->{available_links}});
93 275 ahitrov $parent_url ||= $r->header_in("Referer");
94 8 ahitrov@rambler.ru my $document;
95 my (@sources, @destinations);
96 if ($id && ($id !~ /\D/) && ($id > 0)) {
97 $document = $keeper->get_document_by_id($id, class=>$class);
98 }
99 if ( ref $document ) {
100 foreach my $classlink ( @{ $state->{available_links} } ) {
101 my $sources = $classlink->available_sources;
102 if ( ref $sources eq 'ARRAY' && @$sources ) {
103 push @sources, $classlink if grep { $document->class eq $_ } @$sources;
104 }
105 my $dests = $classlink->available_destinations;
106 if ( ref $dests eq 'ARRAY' && @$dests ) {
107 push @destinations, $classlink if grep { $document->class eq $_ } @$dests;
108 }
109 }
110 }
111 </%INIT>
112