2009-06-30 08:09:20 +00:00
< ? php
2009-06-30 10:41:18 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.29 2007/03/18 02:18:14 wurley Exp $
2009-06-30 09:22:30 +00:00
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
* Variables that come in via common . php
2009-06-30 08:05:37 +00:00
* - server_id
2009-06-30 09:29:51 +00:00
* Variables that come in via GET variables
* - dn ( rawurlencoded )
*
* @ package phpLDAPadmin
*/
/**
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
2009-06-30 09:29:51 +00:00
if ( $ldapserver -> isReadOnly ())
2009-06-30 10:26:08 +00:00
pla_error ( _ ( 'You cannot perform updates while server is in read-only mode' ));
2009-06-30 09:29:51 +00:00
if ( ! $ldapserver -> haveAuthInfo ())
2009-06-30 10:26:08 +00:00
pla_error ( _ ( 'Not enough information to login to server. Please check your configuration.' ));
2009-06-30 09:29:51 +00:00
2009-06-30 08:09:20 +00:00
$dn = $_GET [ 'dn' ] ;
2009-06-30 10:26:08 +00:00
$rdn = get_rdn ( $dn );
$attrs = $ldapserver -> getDNAttrs ( $dn );
2009-06-30 09:29:51 +00:00
$select_server_html = server_select_list ( $ldapserver -> server_id , true , 'dest_server_id' );
2009-06-30 10:26:08 +00:00
$children = $ldapserver -> getContainerContents ( $dn );
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
include './header.php' ;
2009-06-30 09:22:30 +00:00
2009-06-30 10:26:08 +00:00
# Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
if ( is_array ( $children ) && count ( $children ) > 0 ) { ?>
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
< script type = " text/javascript " language = " javascript " >
2009-06-30 09:29:51 +00:00
//<!--
2009-06-30 10:26:08 +00:00
function toggle_disable_filter_field ( recursive_checkbox )
2009-06-30 09:22:30 +00:00
{
2009-06-30 10:26:08 +00:00
if ( recursive_checkbox . checked ) {
2009-06-30 09:29:51 +00:00
recursive_checkbox . form . remove . disabled = false ;
2009-06-30 09:22:30 +00:00
recursive_checkbox . form . filter . disabled = false ;
} else {
2009-06-30 09:29:51 +00:00
recursive_checkbox . form . remove . disabled = true ;
recursive_checkbox . form . remove . checked = false ;
2009-06-30 09:22:30 +00:00
recursive_checkbox . form . filter . disabled = true ;
}
}
2009-06-30 09:29:51 +00:00
//-->
</ script >
2009-06-30 10:26:08 +00:00
< ? php
}
echo '<body>' ;
2009-06-30 10:40:33 +00:00
printf ( '<h3 class="title">%s %s</h3>' , _ ( 'Copy' ), htmlspecialchars ( $rdn ));
printf ( '<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>' , _ ( 'Server' ), $ldapserver -> name ,
_ ( 'Distinguished Name' ), htmlspecialchars ( $dn ));
echo " \n " ;
2009-06-30 10:26:08 +00:00
echo '<center>' ;
2009-06-30 10:40:33 +00:00
printf ( '%s <b>%s</b> %s:<br /><br />' , _ ( 'Copy' ), htmlspecialchars ( $rdn ), _ ( 'to a new object' ));
2009-06-30 10:26:08 +00:00
echo '<form action="copy.php" method="post" name="copy_form">' ;
2009-06-30 10:40:33 +00:00
printf ( '<input type="hidden" name="old_dn" value="%s" />' , htmlspecialchars ( $dn ));
2009-06-30 10:26:08 +00:00
printf ( '<input type="hidden" name="server_id" value="%s" />' , $ldapserver -> server_id );
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
echo " \n " ;
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' ));
2009-06-30 10:26:08 +00:00
printf ( '<td><input type="text" name="new_dn" size="45" value="%s" />' , htmlspecialchars ( $dn ));
2009-06-30 10:40:33 +00:00
draw_chooser_link ( 'copy_form.new_dn' , 'true' , htmlspecialchars ( $rdn ));
2009-06-30 10:26:08 +00:00
echo '</td></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' ), $select_server_html );
2009-06-30 10:40:33 +00:00
echo " \n " ;
2009-06-30 10:26:08 +00:00
if ( is_array ( $children ) && count ( $children ) > 0 ) {
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.' ));
2009-06-30 10:40:33 +00:00
echo '</tr>' . " \n " ;
echo '<tr>' ;
2009-06-30 10:26:08 +00:00
printf ( '<td><acronym title="%s">%s</acronym>:</td>' , _ ( 'When performing a recursive copy, only copy those entries which match this filter' ), _ ( 'Filter' ));
echo '<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />' ;
2009-06-30 10:40:33 +00:00
echo '</tr>' . " \n " ;
echo '<tr>' ;
2009-06-30 10:26:08 +00:00
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>' ;
} 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></form>' ;
2009-06-30 10:40:33 +00:00
echo " \n " ;
2009-06-30 10:26:08 +00:00
echo '<script type="text/javascript" language="javascript">' ;
echo '<!--' ;
echo '/* If the user uses the back button, this way we draw the filter field properly. */' ;
echo 'toggle_disable_filter_field(document.copy_form.recursive);' ;
echo '//-->' ;
echo '</script>' ;
if ( $config -> GetValue ( 'appearance' , 'show_hints' ))
2009-06-30 10:40:33 +00:00
printf ( '<small><img src="images/light.png" alt="Light" /><span class="hint">%s</span></small>' , _ ( 'Hint: Copying between different servers only works if there are no schema violations' ));
2009-06-30 10:26:08 +00:00
echo '</center></body></html>' ;
?>