summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 59822b3)
raw | patch | inline | side by side (parent: 59822b3)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 6 Mar 2006 12:00:40 +0000 (12:00 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 6 Mar 2006 12:00:40 +0000 (12:00 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2814 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc
index 3146f8a4c3261c5189fe1132a499ef4fc7e2fa64..e7eb59c681edad82459ec85969c2432145540360 100644 (file)
var $facsimileTelephoneNumber= "";
var $orig_dn= "";
+ var $rec_dst=false; // Destination for recursive move
+ var $rec_src=false; // Source for recursive move
+ var $rec_cpy=false; // Is recursive move requested ?
+
+ function am_i_moved()
+ {
+ return $this->rec_cpy;
+ }
+
/* Headpage attributes */
var $last_dep_sorting= "invalid";
var $departments= array();
$this->postcreate();
}
+ /* Move/Rename complete trees */
+ function recursive_move($src_dn, $dst_dn,$force = false)
+ {
+ if(! $force){
+
+ $this->rec_cpy = true;
+ $this->rec_src = $src_dn;
+ $this->rec_dst = $dst_dn;
+
+ $smarty = get_smarty();
+
+ $smarty->assign("src","?plug=".$_GET['plug']."&PerformRecMove");
+
+ $display = $smarty->fetch(get_template_path("recursive_moce.tpl",TRUE));
+ return($display);
+ exit();
+ }else{
+ if(!$this->rec_cpy){
+ return;
+
+ }
+ $src_dn = $this->rec_src;
+ $dst_dn = $this->rec_dst;
+ echo "<font style='font-size:11px;'><h4>".
+ sprintf(_("Moving %s in %s"),"<br><i>".$src_dn."</i><br>","<br><i>".$dst_dn."</i><br>")."</h4>";
+
+
+ /* Check if the destination entry exists */
+ $ldap= $this->config->get_ldap_link();
+
+ /* Check if destination exists - abort */
+ $ldap->cat($dst_dn);
+ if ($ldap->fetch()){
+ trigger_error("recursive_move $dst_dn already exists.",
+ E_USER_WARNING);
+ echo "recursive_move :$dst_dn already exists.<br>";
+ return (FALSE);
+ }
+
+ /* Perform a search for all objects to be moved */
+ $objects= array();
+ $ldap->cd($src_dn);
+ $ldap->search("(objectClass=*)", array("dn"));
+ while($attrs= $ldap->fetch()){
+ $dn= $attrs['dn'];
+ $objects[$dn]= strlen($dn);
+ }
+
+ /* Sort objects by indent level */
+ asort($objects);
+ reset($objects);
+
+ /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
+ foreach ($objects as $object => $len){
+ $src= $object;
+ $dst= preg_replace("/$src_dn$/", "$dst_dn", $object);
+ echo "Moving <b>".$src."</b> to <b>".$dst."</b><br>";
+ if (!$this->copy($src, $dst)){
+ return (FALSE);
+ }
+ }
+
+ /* Remove src_dn */
+ $ldap->cd($src_dn);
+ $ldap->recursive_remove();
+
+ $this->rec_src = $this->rec_dst = "";
+ $this->rec_cpy =false;
+ echo "</font>";
+ return (TRUE);
+ }
+ }
+
+
}
?>
diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc
index 89178d11324662dc8394d6b34181e4333e1a5547..fc920491e34eda49a673d7199f27eb68b8d0d91c 100644 (file)
/* Edit Complete ...
* Finish request
- */
+ */
+ if((isset($_GET['PerformRecMove'])) &&( $this->deptabs->by_object['department']->am_i_moved())){
+ $this->deptabs->save(true);
+ $this->deptabs->by_object['department']->recursive_move("","",true);
+ $this->reload ();
+ /* Group has been saved successfully, remove lock from
+ LDAP. */
+ if ($this->dn != "new"){
+ del_lock ($this->dn);
+ }
+
+ unset ($this->deptabs);
+ $this->deptabs= NULL;
+ unset ($_SESSION['objectinfo']);
+ exit();
+ }
+
if ((isset($_POST['edit_finish'])) && (isset($this->deptabs->config) ) ){
/* Check tabs, will feed message array */
if (count($message) == 0){
/* Save user data to ldap */
- $this->deptabs->save();
- gosa_log ("Department object'".$this->dn."' has been saved");
-
- /* Group has been saved successfully, remove lock from
- LDAP. */
- if ($this->dn != "new"){
- del_lock ($this->dn);
+ $disp = $this->deptabs->save();
+ if(!$this->deptabs->by_object['department']->am_i_moved()){
+ gosa_log ("Department object'".$this->dn."' has been saved");
+
+ /* Group has been saved successfully, remove lock from
+ LDAP. */
+ if ($this->dn != "new"){
+ del_lock ($this->dn);
+ }
+
+ /* There's no page reload so we have to read new users at
+ this point. */
+ $this->reload ();
+ unset ($this->deptabs);
+ $this->deptabs= NULL;
+ unset ($_SESSION['objectinfo']);
+ }else{
+ return($disp);
}
-
- /* There's no page reload so we have to read new users at
- this point. */
- $this->reload ();
- unset ($this->deptabs);
- $this->deptabs= NULL;
- unset ($_SESSION['objectinfo']);
-
} else {
/* Ok. There seem to be errors regarding to the tab data,
show message and continue as usual. */
diff --git a/plugins/admin/departments/recursive_moce.tpl b/plugins/admin/departments/recursive_moce.tpl
--- /dev/null
@@ -0,0 +1,12 @@
+<h2>{t}Processing requested operation, the status of this operation will be displayed in an iframe below.{/t}</h2>
+<iframe src="{$src}" style="width:100%;height:450px;background-color:#FFFFFF;" name="status">
+ {t}Your browser isn't able to display this iframe ... use the link below intead{/t}<br>
+ <a href="{$src}">{$src}</a>
+</iframe>
+
+<p class="seperator"> </p>
+<div style="text-align:right;">
+ <p>
+ <input type="submit" name="back" value="{t}Back{/t}">
+ </p>
+</div>
diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc
index 88320a3a16ce90a2c824335f7ed2e2817c5aed84..4e8e318aff50761bd4001f24a928c822c947b72c 100644 (file)
}
- function save()
+ function save($justsave = false)
{
- $baseobject= $this->by_object['department'];
- $new_dn= 'ou='.preg_replace('/,/', '\\\\2C', $baseobject->ou).','.$baseobject->base;
- if ($this->dn != $new_dn && $this->dn != "new"){
-
- /* if( new_dn is subtree of this->dn ) */
- $cnt1 = count(split(",",$this->dn));
- $cnt2 = count(split(",",$new_dn));
- if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
- print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
- }else{
- $baseobject->recursive_move($this->dn, $new_dn);
+ if(!$justsave){
+ $baseobject= $this->by_object['department'];
+ $new_dn= 'ou='.preg_replace('/,/', '\\\\2C', $baseobject->ou).','.$baseobject->base;
+ $disp ="";
+ if ($this->dn != $new_dn && $this->dn != "new"){
+
+ /* if( new_dn is subtree of this->dn ) */
+ $cnt1 = count(split(",",$this->dn));
+ $cnt2 = count(split(",",$new_dn));
+ if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+ print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+ }else{
+ $disp = ($baseobject->recursive_move($this->dn, $new_dn));
+ return($disp);
+ }
}
+ $this->dn= $new_dn;
}
- $this->dn= $new_dn;
-
tabs::save(TRUE);
+ return($disp);
}
}