Revision 371 (by ahitrov, 2013/07/24 17:13:31) Some links bug fixes
<& "/contenido/components/title.msn", title=>'�������� ������' &>
<style>
<!--
body {margin:5px;}
-->
</style>


% if (ref $document) {
% ### Destination is available
% ######################################################

<script language="JavaScript">
<!--
var arrLinks = new Array ();

function DeleteSource ()
{
 oSelect = document.forms['sourceform'].elements[0];
 for (j = 0; j < oSelect.options.length; j++) {
	if (!oSelect.options[j].selected) {
		oSelect.options[j] = null;
	}
 }
 return true;
}

function SelectAllSources ()
{
 oSelect = document.forms['sourceform'].elements[0];
// oSelect.setExpression('multiple', true);
// document.recalc(true);
 for (j = 0; j < oSelect.options.length; j++) {
        oSelect.options[j].selected = true;
 }
 return true;
}

function CheckSource ()
{
 oSelect = document.forms['sourceform'].elements[0];
 if ( oSelect.options.length ) {
        return true;
 } else {
        alert ('�� ������ �� ���� ��������');
        return false;
 }
}

//-->
</script>

%
% my @properties = $document->structure();
% my ($prop) = grep { $_->{'attr'} eq 'status' } @properties;
% my ($status) = grep { $_->[0] == $document->status } @{ $m->comp( '/contenido/components/inputs/status.msn', prop => $prop, object=>$document, name => $prop->{attr}, mode => 'get') };
% $status = $status->[1];
<table width="100%" border="0" align="center"><tr><td>
<fieldset>
<legend>����</legend>
<table class="tform" width="100%">
<tr valign="top"><td><b>��������:</b>
</td><td><a href="/contenido/document.html?id=<% $document->id %>&class=<% $document->class %>" target="_top"><% $document->name %></a>
</td></tr>
<tr valign="top"><td><b>�����:</b>
</td><td><% $document->class %>
</td></tr>
<tr valign="top"><td><b>������:</b>
</td><td><% $status %>
</td></tr>
</table>
</fieldset>

<fieldset>
<legend>������ ������</legend>
<table class="tform" width="100%">
<tr><td>
<form action="link_add.html" name="sourceform" target="_top" method="post" onsubmit="return CheckSource();">
<div id="link_list"></div>

<input type="hidden" name="back" value="<% $back %>">
<input type="hidden" name="class" value="<% $class %>">
<input type="hidden" name="dest_id" value="<% $dest_id %>">
<input type="hidden" name="dest_class" value="<% $dest_class %>">
<input type="submit" value="������� ���������">
</form>
</td></tr>
</table>
</fieldset>

</td></tr></table>


% }else{
% ### Destination is not available
% ######################################################
%

<script language="JavaScript">
<!--
function AddDest (Value, Name)
{
// alert (Name);

 var oSelect = parent.frames.sourcefrm.document.forms['destform'].elements[0];
 var Found = 0;
 for(j=0; j < oSelect.options.length; j++) {
	if (oSelect.options[j].value == Value) {
		Found = 1;
	}
 }
 if (!Found) {
	var oOption = document.createElement("OPTION");
	oOption.text=Name;
	oOption.value=Value;
	oOption.selected=true;
	oSelect.options.add(oOption);
 }
 return false;
}

//-->
</script>

<& /contenido/components/link_browse.msn,
	class		=> $class,
	dest_class	=> $dest_class,
	p		=> $p,
	use_section	=> $use_section,
	alpha		=> $alpha,
	alpha_search	=> $alpha_search,
	search		=> $search,
	search_by	=> $search_by,
	restrict_class	=> $restrict_class,
&>

% }

</body>
</html>
<%args>

	$class          => ''
	$source_class   => ''
	$source_id      => ''
	$dest_class     => ''
	$dest_id        => ''
	$save           => 0
	$status         => 0
	$back		=> undef

	$p		=> 1
	$use_section	=> undef
	$alpha		=> undef
	$alpha_search	=> undef
	$search_by	=> undef
	$search		=> undef
	$restrict_class	=> undef

</%args>
<%init>

  my $document;

  if ($dest_id) {
        $document = $keeper->get_document_by_id ($dest_id,
			class	=> $dest_class,
		);
  } else {
	$dest_class = $class->available_destinations;
  }

</%init>