Line # Revision Author
1 196 ahitrov <& "/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 function DeleteSource ()
16 {
17 oSelect = document.forms['sourceform'].elements[0];
18 for (j = 0; j < oSelect.options.length; j++) {
19 if (!oSelect.options[j].selected) {
20 oSelect.options[j] = null;
21 }
22 }
23 return true;
24 }
25
26 function SelectAllSources ()
27 {
28 oSelect = document.forms['sourceform'].elements[0];
29 // oSelect.setExpression('multiple', true);
30 // document.recalc(true);
31 for (j = 0; j < oSelect.options.length; j++) {
32 oSelect.options[j].selected = true;
33 }
34 return true;
35 }
36
37 function CheckSource ()
38 {
39 oSelect = document.forms['sourceform'].elements[0];
40 if ( oSelect.options.length ) {
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 <table class="tform" width="100%">
75 <tr><td>
76 <form action="link_add.html" name="sourceform" target="_top" method="post" onsubmit="return CheckSource();">
77 <select multiple name="sources" size="20" style="width:100%">
78 </select>
79 <p>К данной цели будут привязаны только выделенные документы.</p>
80 <input type="hidden" name="class" value="<% $class %>">
81 <input type="hidden" name="dest_id" value="<% $dest_id %>">
82 <input type="hidden" name="dest_class" value="<% $dest_class %>">
83 <input type="button" value="Выделить все" onclick="SelectAllSources();">
84 <input type="button" value="Удалить лишнее" onclick="DeleteSource();">
85 <input type="submit" value="Связать выбранное">
86 </form>
87 </td></tr>
88 </table>
89 </fieldset>
90
91 </td></tr></table>
92
93
94 % }else{
95 % ### Destination is not available
96 % ######################################################
97 %
98
99 <script language="JavaScript">
100 <!--
101 function AddDest (Value, Name)
102 {
103 // alert (Name);
104
105 var oSelect = parent.frames.sourcefrm.document.forms['destform'].elements[0];
106 var Found = 0;
107 for(j=0; j < oSelect.options.length; j++) {
108 if (oSelect.options[j].value == Value) {
109 Found = 1;
110 }
111 }
112 if (!Found) {
113 var oOption = document.createElement("OPTION");
114 oOption.text=Name;
115 oOption.value=Value;
116 oOption.selected=true;
117 oSelect.options.add(oOption);
118 }
119 return false;
120 }
121 //-->
122 </script>
123
124 <& /contenido/components/link_browse.msn,
125 class => $class,
126 dest_class => $dest_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
142 $class => ''
143 $source_class => ''
144 $source_id => ''
145 $dest_class => ''
146 $dest_id => ''
147 $save => 0
148 $status => 0
149
150 $p => 1
151 $restrict_class => undef
152 $use_section => undef
153 $alpha => undef
154 $alpha_search => undef
155 $search_by => undef
156 $search => undef
157
158 </%args>
159 <%init>
160
161 my $document;
162
163 if ($dest_id) {
164 $document = $keeper->get_document_by_id ($dest_id,
165 class => $dest_class,
166 );
167 } else {
168 $dest_class = $class->available_destinations;
169 }
170
171 </%init>