2011-06-26 10:44:28 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copies a given object to create a new one.
|
|
|
|
*
|
|
|
|
* @package phpLDAPadmin
|
|
|
|
* @subpackage Page
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
|
|
|
|
require './common.php';
|
|
|
|
|
|
|
|
# The DN we are working with
|
|
|
|
$request = array();
|
|
|
|
$request['dn'] = get_request('dn','GET');
|
|
|
|
|
|
|
|
# Check if the entry exists.
|
|
|
|
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
2018-03-12 18:08:39 +00:00
|
|
|
error(sprintf(_('The entry (%s) does not exist.'),htmlspecialchars($request['dn'])),'error','index.php');
|
2011-06-26 10:44:28 +00:00
|
|
|
|
|
|
|
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
|
|
|
$request['page']->setDN($request['dn']);
|
|
|
|
$request['page']->accept();
|
|
|
|
|
|
|
|
# Render the form
|
|
|
|
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Copy'),get_rdn($request['dn'])));
|
|
|
|
$request['page']->drawSubTitle();
|
|
|
|
|
|
|
|
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
|
|
|
echo '<div style="text-align: center;">';
|
2011-07-21 17:50:57 +00:00
|
|
|
printf(_('Copy <b>%s</b> to a new object.') . '<br /><br />',get_rdn($request['dn']));
|
2011-06-26 10:44:28 +00:00
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
echo '<form action="cmd.php" method="post" id="copy_form">';
|
|
|
|
echo '<div>';
|
|
|
|
echo '<input type="hidden" name="cmd" value="copy" />';
|
|
|
|
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
|
|
|
printf('<input type="hidden" name="server_id_src" value="%s" />',$app['server']->getIndex());
|
|
|
|
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dn']));
|
|
|
|
echo '</div>';
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
echo '<table border="0" style="border-spacing: 10px; margin-left: auto; margin-right: auto;">';
|
|
|
|
|
|
|
|
echo '<tr>';
|
|
|
|
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
|
|
|
_('The full DN of the new entry to be created when copying the source entry'),_('Destination DN'));
|
|
|
|
echo '<td>';
|
|
|
|
printf('<input type="text" name="dn_dst" size="45" value="%s" />',htmlspecialchars($request['dn']));
|
|
|
|
draw_chooser_link('copy_form','dn_dst','true',get_rdn($request['dn']));
|
|
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
# We search all children, not only the visible children in the tree
|
|
|
|
$request['children'] = $app['server']->getContainerContents($request['dn']);
|
|
|
|
|
|
|
|
if (count($request['children']) > 0) {
|
|
|
|
echo '<tr>';
|
|
|
|
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy'));
|
|
|
|
echo '<td><input type="checkbox" id="recursive" name="recursive" onclick="copy_field_toggle(this)" />';
|
|
|
|
printf('<small>(%s)</small></td>',_('Recursively copy all children of this object as well.'));
|
|
|
|
echo '</tr>';
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
echo '<tr>';
|
|
|
|
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
2011-07-21 17:50:57 +00:00
|
|
|
_('When performing a recursive copy, only copy those entries which match this filter.'),_('Filter'));
|
2011-06-26 10:44:28 +00:00
|
|
|
echo '<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />';
|
|
|
|
echo '</tr>';
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
echo '<tr>';
|
|
|
|
printf('<td>%s</td>',_('Delete after copy (move):'));
|
|
|
|
echo '<td><input type="checkbox" name="remove" value="yes" disabled />';
|
|
|
|
printf('<small>(%s)</small)</td>',_('Make sure your filter (above) will select all child records.'));
|
|
|
|
echo '</tr>';
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
printf('<tr><td>%s</td><td><input type="checkbox" name="remove" value="yes"/></td></tr>',_('Delete after copy (move):'));
|
|
|
|
}
|
|
|
|
echo "\n";
|
|
|
|
|
2011-07-12 19:23:27 +00:00
|
|
|
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" value="%s" /></td></tr>',_('Copy'));
|
2011-06-26 10:44:28 +00:00
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
echo '</table>';
|
|
|
|
echo '</form>';
|
|
|
|
|
|
|
|
# Draw the javascrpt to enable/disable the filter field if this may be a recursive copy
|
|
|
|
if (count($request['children']) > 0)
|
|
|
|
printf('<script type="text/javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
|
|
|
?>
|