Line # Revision Author
1 8 ahitrov@rambler.ru <style>
2 <!--
3 .tab { font:9pt Verdana; padding:1px 5px 2px 5px;
4 border-top:1px solid silver; border-left:1px solid silver; border-right:2px solid silver; }
5 .tab a { text-decoration:none; }
6 .tabi { font:9pt Verdana; padding:1px 5px 1px 5px; background: #d0d0d0;
7 border-top:1px solid #f0f0f0; border-left:1px solid #f0f0f0; border-right:2px solid silver; }
8 .tabi a { text-decoration:none; }
9 -->
10 </style>
11 <script language="javascript">
12 <!--
13 var Controls = [\
14 % if ( ref $links eq 'ARRAY' && scalar @$links ) {
15 % for ( 0 .. (scalar(@$links)-1) ) {
16 % if ( $_ ) { $m->out(',') }
17 'tab_<% $_ %>'\
18 % }
19 % }
20 ];
21 function SetActive ( sControl ) {
22 836 ahitrov var oControl;
23 for (sC in Controls) {
24 oControl = document.getElementById(Controls[sC]);
25 if ( Controls[sC] == sControl ) {
26 oControl.className = "tab";
27 } else {
28 oControl.className = "tabi";
29 }
30 }
31 8 ahitrov@rambler.ru }
32 //-->
33 </script>
34 % if ( ref $links eq 'ARRAY' && scalar @$links ) {
35 % my $deflink = $links->[0];
36 188 ahitrov % my $id = exists $deflink->{source_field} ? $deflink->{source_field} : 'id';
37 8 ahitrov@rambler.ru % my $auto = '';
38 % if ( exists $deflink->{auto} && ref $deflink->{auto} eq 'HASH' ) {
39 % while ( my ($from, $to) = each %{ $deflink->{auto} } ) {
40 % $auto .= '&from='.$from.'&to='.$document->$to;
41 % }
42 % }
43 <fieldset style="width:97%;">
44 <legend>Зависимости этого документа</legend>
45 <div style="border-bottom:2px solid gray; padding:1px 0 2px;">
46 % my $i = 0;
47 % foreach my $link ( @$links ) {
48 836 ahitrov % my $tab_class = 'tabi';
49 % if ( $link->{name} eq $default ) {
50 % $deflink = $link;
51 % $tab_class = 'tab';
52 % } elsif ( $default eq '' && $i == 0 ) {
53 % $tab_class = 'tab';
54 % }
55 188 ahitrov % my $id = exists $link->{source_field} ? $link->{source_field} : 'id';
56 8 ahitrov@rambler.ru % my $auto = '';
57 % if ( exists $link->{auto} && ref $link->{auto} eq 'HASH' ) {
58 % while ( my ($from, $to) = each %{ $link->{auto} } ) {
59 % $auto .= '&from='.$from.'&to='.$document->$to;
60 % }
61 % }
62 516 ahitrov % my $class_param;
63 % if ( ref $link->{class} eq 'ARRAY' ) {
64 % $class_param = join '&', map { 'class='.$_ } @{$link->{class}};
65 % } else {
66 % $class_param = 'class='.$link->{class};
67 % }
68 836 ahitrov %
69 <span id="tab_<% $i %>" class="<% $tab_class %>"><a onclick="SetActive('tab_<% $i %>')"
70 516 ahitrov href="/contenido/document_filter_list.html?<% $class_param %>&filter=<% $link->{filter} %>&field=<% $link->{field} %><% $auto %>&id=<% $document->$id %><% exists $link->{order_by} ? '&order_by='.$link->{order_by} : '' %>"
71 8 ahitrov@rambler.ru target="filtered"><% $link->{name} %></a></span>\
72 % $i++;
73 % }
74 </div>
75 337 ahitrov <iframe id="filtered" name="filtered" src="/contenido/document_filter_list.html?class=<% $deflink->{class} %>&filter=<% $deflink->{filter} %>&field=<% $deflink->{field} %><% $auto %>&id=<% $document->$id %><% exists $deflink->{order_by} ? '&order_by='.$deflink->{order_by} : '' %>"
76 8 ahitrov@rambler.ru width="100%" height="470" frameborder="0"></iframe>
77 </fieldset>
78 % }
79 <%args>
80
81 $document => undef
82 836 ahitrov $default => ''
83 8 ahitrov@rambler.ru
84 </%args>
85 <%init>
86
87 return unless ref $document;
88 my $links = $document->table_links;
89
90 </%init>