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