phpldapadmin/htdocs/copy_form.php

116 lines
4.0 KiB
PHP
Raw Normal View History

2009-06-30 08:09:20 +00:00
<?php
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
* Copies a given object to create a new one.
*
2009-06-30 09:29:51 +00:00
* @package phpLDAPadmin
* @subpackage Page
2009-06-30 09:29:51 +00:00
*/
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 08:05:37 +00:00
# The DN we are working with
$request = array();
$request['dn'] = get_request('dn','GET');
2009-06-30 09:29:51 +00:00
# Check if the entry exists.
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
2009-06-30 09:29:51 +00:00
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
$request['page']->setDN($request['dn']);
$request['page']->accept();
2009-06-30 10:26:08 +00:00
# Render the form
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Copy'),get_rdn($request['dn'])));
$request['page']->drawSubTitle();
2009-06-30 10:26:08 +00:00
echo '<center>';
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),get_rdn($request['dn']),_('to a new object'));
2009-06-30 10:26:08 +00:00
2009-06-30 10:46:00 +00:00
echo '<form action="cmd.php" method="post" name="copy_form">';
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']));
2009-06-30 10:40:33 +00:00
echo "\n";
2009-06-30 10:26:08 +00:00
echo '<table style="border-spacing: 10px">';
2009-06-30 10:40:33 +00:00
2009-06-30 10:26:08 +00:00
echo '<tr>';
2009-06-30 10:40:33 +00:00
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>';
2009-06-30 10:40:33 +00:00
echo "\n";
2009-06-30 10:26:08 +00:00
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),server_select_list($app['server']->getIndex(),true,'server_id_dst'));
2009-06-30 10:40:33 +00:00
echo "\n";
2009-06-30 10:26:08 +00:00
# We search all children, not only the visible children in the tree
$request['children'] = $app['server']->getContainerContents($request['dn']);
if (count($request['children']) > 0) {
2009-06-30 10:26:08 +00:00
echo '<tr>';
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy'));
echo '<td><input type="checkbox" id="recursive" name="recursive" onClick="toggle_disable_filter_field(this)" />';
printf('<small>(%s)</small></td>',_('Recursively copy all children of this object as well.'));
echo '</tr>';
echo "\n";
2009-06-30 10:40:33 +00:00
echo '<tr>';
printf('<td><acronym title="%s">%s</acronym>:</td>',
_('When performing a recursive copy, only copy those entries which match this filter'),_('Filter'));
2009-06-30 10:26:08 +00:00
echo '<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />';
echo '</tr>';
echo "\n";
2009-06-30 10:40:33 +00:00
echo '<tr>';
2009-06-30 10:26:08 +00:00
printf('<td>%s</td>',_('Delete after copy (move):'));
2009-06-30 10:46:00 +00:00
echo '<td><input type="checkbox" name="remove" value="yes" disabled />';
2009-06-30 10:26:08 +00:00
printf('<small>(%s)</small)</td>',_('Make sure your filter (above) will select all child records.'));
echo '</tr>';
echo "\n";
2009-06-30 10:26:08 +00:00
} else {
printf('<tr><td>%s</td><td><input type="checkbox" name="remove" value="yes"/></td></tr>',_('Delete after copy (move):'));
}
2009-06-30 10:40:33 +00:00
echo "\n";
2009-06-30 10:26:08 +00:00
printf('<tr><td colspan="2" align="right"><input type="submit" value="%s" /></td></tr>',_('Copy '));
2009-06-30 10:40:33 +00:00
echo "\n";
2009-06-30 10:26:08 +00:00
echo '</table>';
echo '</form>';
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
printf('<small><img src="%s/light.png" alt="Light" /><span class="hint">%s</span></small>',
IMGDIR,_('Hint: Copying between different servers only works if there are no schema violations'));
2009-06-30 10:26:08 +00:00
2009-06-30 10:46:00 +00:00
echo '</center>';
# Draw the javascrpt to enable/disable the filter field if this may be a recursive copy
if (count($request['children']) > 0) {
?>
<script type="text/javascript" language="javascript">
function toggle_disable_filter_field(recursive_checkbox)
{
if (recursive_checkbox.checked) {
recursive_checkbox.form.remove.disabled = false;
recursive_checkbox.form.filter.disabled = false;
} else {
recursive_checkbox.form.remove.disabled = true;
recursive_checkbox.form.remove.checked = false;
recursive_checkbox.form.filter.disabled = true;
}
}
</script>
<?php
}
2009-06-30 10:26:08 +00:00
?>