Line # Revision Author
1 8 ahitrov@rambler.ru <& "/contenido/components/title.msn", title=>'Создание связей' &>
2 <style>
3 <!--
4 body {margin:5px;}
5 -->
6 </style>
7
8 % if (ref $document) {
9 % ### Source is available
10 % ######################################################
11
12 <script language="JavaScript">
13 <!--
14 function DeleteDest ()
15 {
16 oSelect = document.forms['destform'].elements[0];
17 for (j = 0; j < oSelect.options.length; j++) {
18 if (!oSelect.options[j].selected) {
19 oSelect.options[j] = null;
20 }
21 }
22 return true;
23 }
24
25 function SelectAllDest ()
26 {
27 oSelect = document.forms['destform'].elements[0];
28 // oSelect.setExpression('multiple', true);
29 // document.recalc(true);
30 for (j = 0; j < oSelect.options.length; j++) {
31 oSelect.options[j].selected = true;
32 }
33 return true;
34 }
35
36 function CheckDest () {
37 var count = 0;
38 var oD = document.getElementById("dest_id_0");
39 var oC = document.getElementById("dest_class_0");
40 if ( oD && oC ) {
41 return true;
42 } else {
43 alert ('Не выбран ни один документ');
44 return false;
45 }
46 }
47
48 //-->
49 </script>
50
51 %
52 % my @properties = $document->structure();
53 % my ($prop) = grep { $_->{'attr'} eq 'status' } @properties;
54 % my ($status) = grep { $_->[0] == $document->status } @{ $m->comp( '/contenido/components/inputs/status.msn', prop => $prop, object=>$document, name => $prop->{attr}, mode => 'get') };
55 % $status = $status->[1];
56 <table width="100%" border="0" align="center"><tr><td>
57 <fieldset>
58 <legend>Источник</legend>
59 <table class="tform" width="100%">
60 <tr valign="top"><td><b>Название:</b>
61 </td><td><a href="/contenido/document.html?id=<% $document->id %>&class=<% $document->class %>" target="_top"><% $document->name %></a>
62 </td></tr>
63 <tr valign="top"><td><b>Класс:</b>
64 </td><td><% $document->class %>
65 </td></tr>
66 <tr valign="top"><td><b>Статус:</b>
67 </td><td><% $status %>
68 </td></tr>
69 </table>
70 </fieldset>
71
72 <fieldset>
73 <legend>Список связей</legend>
74
75 32 ahitrov@rambler.ru <table class="tform" width="100%">
76 <tr><td>
77 8 ahitrov@rambler.ru <form action="link_add.html" name="destform" target="_top" method="post" onsubmit="return CheckDest();">
78 <div id="link_list"></div>
79
80 <input type="hidden" name="class" value="<% $class %>">
81 <input type="hidden" name="source_id" value="<% $source_id %>">
82 <input type="hidden" name="source_class" value="<% $source_class %>">
83 <input type="submit" value="Связать выбранное">
84 </td></tr>
85 </table>
86 </form>
87 </fieldset>
88
89 </td></tr></table>
90
91 %#<pre><% Dumper(\@properties) %></pre>
92
93 % }else{
94 % ### Source is not available
95 % ######################################################
96 %
97
98 <script language="JavaScript">
99 <!--
100 function AddSource (Value, Name)
101 {
102 // alert (Name);
103
104 var oSelect = parent.frames.destfrm.document.forms['sourceform'].elements[0];
105 var Found = 0;
106 for(j=0; j < oSelect.options.length; j++) {
107 if (oSelect.options[j].value == Value) {
108 Found = 1;
109 }
110 }
111 if (!Found) {
112 var oOption = document.createElement("OPTION");
113 oOption.text=Name;
114 oOption.value=Value;
115 oOption.selected=true;
116 oSelect.options.add(oOption);
117 }
118 return false;
119 }
120
121 //-->
122 </script>
123
124 <& /contenido/components/link_browse.msn,
125 class => $class,
126 source_class => $source_class,
127 p => $p,
128 use_section => $use_section,
129 alpha => $alpha,
130 alpha_search => $alpha_search,
131 search => $search,
132 search_by => $search_by,
133 restrict_class => $restrict_class,
134 &>
135
136 % }
137
138 </body>
139 </html>
140 <%args>
141 $class => ''
142 $source_class => ''
143 $source_id => ''
144 $dest_class => ''
145 $dest_id => ''
146 $save => 0
147 $status => 0
148
149 $p => 1
150 $restrict_class => undef
151 $use_section => undef
152 $alpha => undef
153 $alpha_search => undef
154 $search_by => undef
155 $search => undef
156
157 </%args>
158 <%init>
159
160 my $document;
161
162 if ($source_id) {
163 $document = $keeper->get_document_by_id ($source_id,
164 class => $source_class,
165 );
166 } else {
167 $source_class = $class->available_sources;
168 }
169
170 </%init>