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 275 ahitrov <input type="hidden" name="back" value="<% $back %>">
81 8 ahitrov@rambler.ru <input type="hidden" name="class" value="<% $class %>">
82 <input type="hidden" name="source_id" value="<% $source_id %>">
83 <input type="hidden" name="source_class" value="<% $source_class %>">
84 <input type="submit" value="Связать выбранное">
85 </td></tr>
86 </table>
87 </form>
88 </fieldset>
89
90 </td></tr></table>
91
92 %#<pre><% Dumper(\@properties) %></pre>
93
94 % }else{
95 % ### Source is not available
96 % ######################################################
97 %
98
99 <script language="JavaScript">
100 <!--
101 function AddSource (Value, Name)
102 {
103 // alert (Name);
104
105 var oSelect = parent.frames.destfrm.document.forms['sourceform'].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 //-->
123 </script>
124
125 <& /contenido/components/link_browse.msn,
126 class => $class,
127 source_class => $source_class,
128 p => $p,
129 use_section => $use_section,
130 alpha => $alpha,
131 alpha_search => $alpha_search,
132 search => $search,
133 search_by => $search_by,
134 restrict_class => $restrict_class,
135 &>
136
137 % }
138
139 </body>
140 </html>
141 <%args>
142 $class => ''
143 $source_class => ''
144 $source_id => ''
145 $dest_class => ''
146 $dest_id => ''
147 $save => 0
148 $status => 0
149 275 ahitrov $back => undef
150 8 ahitrov@rambler.ru
151 $p => 1
152 $restrict_class => undef
153 $use_section => undef
154 $alpha => undef
155 $alpha_search => undef
156 $search_by => undef
157 $search => undef
158
159 </%args>
160 <%init>
161
162 my $document;
163
164 if ($source_id) {
165 $document = $keeper->get_document_by_id ($source_id,
166 class => $source_class,
167 );
168 } else {
169 $source_class = $class->available_sources;
170 }
171
172 </%init>