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 |
8 |
ahitrov@rambler.ru |
<input type="hidden" name="class" value="<% $class %>"> |
82 |
|
|
<input type="hidden" name="dest_id" value="<% $dest_id %>"> |
83 |
|
|
<input type="hidden" name="dest_class" value="<% $dest_class %>"> |
84 |
|
|
<input type="submit" value="Связать выбранное"> |
85 |
|
|
</form> |
86 |
|
|
</td></tr> |
87 |
|
|
</table> |
88 |
|
|
</fieldset> |
89 |
|
|
|
90 |
|
|
</td></tr></table> |
91 |
|
|
|
92 |
|
|
|
93 |
|
|
% }else{ |
94 |
|
|
% ### Destination is not available |
95 |
|
|
% ###################################################### |
96 |
|
|
% |
97 |
|
|
|
98 |
|
|
<script language="JavaScript"> |
99 |
|
|
<!-- |
100 |
|
|
function AddDest (Value, Name) |
101 |
|
|
{ |
102 |
|
|
// alert (Name); |
103 |
|
|
|
104 |
|
|
var oSelect = parent.frames.sourcefrm.document.forms['destform'].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 |
|
|
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 |
|
|
$use_section => undef |
152 |
|
|
$alpha => undef |
153 |
|
|
$alpha_search => undef |
154 |
|
|
$search_by => undef |
155 |
|
|
$search => undef |
156 |
|
|
$restrict_class => 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 |
23 |
ahitrov@rambler.ru |
</%init> |