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 |
23 |
ahitrov@rambler.ru |
<div id="link_list"></div> |
80 |
|
|
|
81 |
275 |
ahitrov |
<input type="hidden" name="back" value="<% $back %>"> |
82 |
8 |
ahitrov@rambler.ru |
<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="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 |
|
|
//--> |
123 |
|
|
</script> |
124 |
|
|
|
125 |
|
|
<& /contenido/components/link_browse.msn, |
126 |
|
|
class => $class, |
127 |
|
|
dest_class => $dest_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 |
|
|
|
143 |
|
|
$class => '' |
144 |
|
|
$source_class => '' |
145 |
|
|
$source_id => '' |
146 |
|
|
$dest_class => '' |
147 |
|
|
$dest_id => '' |
148 |
|
|
$save => 0 |
149 |
|
|
$status => 0 |
150 |
275 |
ahitrov |
$back => undef |
151 |
8 |
ahitrov@rambler.ru |
|
152 |
|
|
$p => 1 |
153 |
|
|
$use_section => undef |
154 |
|
|
$alpha => undef |
155 |
|
|
$alpha_search => undef |
156 |
|
|
$search_by => undef |
157 |
|
|
$search => undef |
158 |
|
|
$restrict_class => undef |
159 |
|
|
|
160 |
|
|
</%args> |
161 |
|
|
<%init> |
162 |
|
|
|
163 |
|
|
my $document; |
164 |
|
|
|
165 |
|
|
if ($dest_id) { |
166 |
|
|
$document = $keeper->get_document_by_id ($dest_id, |
167 |
|
|
class => $dest_class, |
168 |
|
|
); |
169 |
|
|
} else { |
170 |
|
|
$dest_class = $class->available_destinations; |
171 |
|
|
} |
172 |
|
|
|
173 |
23 |
ahitrov@rambler.ru |
</%init> |