summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d4b56c)
raw | patch | inline | side by side (parent: 3d4b56c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Mar 2008 07:36:57 +0000 (07:36 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Mar 2008 07:36:57 +0000 (07:36 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9694 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc
index f4344bc956f406d872946a4071c1d462d733f18e..467765e432f021916b5a639f5e86f4c9983a5615 100644 (file)
var $is_administrational_unit= false;
var $gosaUnitTag= "";
var $view_logged = FALSE;
- var $rec_dst=false; // Destination for recursive move
- var $rec_src=false; // Source for recursive move
- var $rec_cpy=false; // Is recursive move requested ?
/* Headpage attributes */
var $last_dep_sorting= "invalid";
var $departments= array();
-
var $must_be_tagged = false;
/* attribute list for save action */
return $this->must_be_tagged;
}
- function am_i_moved()
- {
- return $this->rec_cpy;
- }
-
-
/* Save data to object */
function save_object()
{
$ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn'));
if ($this->orig_dn == "new" && $ldap->count()){
$message[]= msgPool::duplicated(_("Name"));
- } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){
+ } elseif ($this->orig_dn != $this->dn && $ldap->count()){
$message[]= msgPool::duplicated(_("Name"));
}
/* Move/Rename complete trees */
function recursive_move($src_dn, $dst_dn,$force = false)
{
- /* If force == false prepare to recursive move this object from src to dst
- on the next call. */
- if(!$force){
- $this->rec_cpy = true;
- $this->rec_src = $src_dn;
- $this->rec_dst = $dst_dn;
- }else{
-
- /* If this is called, but not wanted, abort */
- if(!$this->rec_cpy){
- return;
- }
-
- $src_dn = $this->rec_src;
- $dst_dn = $this->rec_dst;
-
- /* Print header to have styles included */
- $smarty= get_smarty();
-
- echo ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
- <html>
- <head>
- <title></title>
- <style type="text/css">@import url("themes/default/style.css");</style>
- <script language="javascript" src="include/focus.js" type="text/javascript"></script>
- </head>
- <body style="background: none; margin:4px;" id="body" >
- ';
- echo "<h3>".sprintf(_("Moving '%s' to '%s'"),"<i>".@LDAP::fix($src_dn)."</i>","<i>".@LDAP::fix($dst_dn)."</i>")."</h3>";
-
-
- /* Check if the destination entry exists */
- $ldap= $this->config->get_ldap_link();
+ /* Print header to have styles included */
+ $smarty= get_smarty();
+
+ echo ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+ <html>
+ <head>
+ <title></title>
+ <style type="text/css">@import url("themes/default/style.css");</style>
+ <script language="javascript" src="include/focus.js" type="text/javascript"></script>
+ </head>
+ <body style="background: none; margin:4px;" id="body" >
+ ';
+ echo "<h3>".sprintf(_("Moving '%s' to '%s'"),"<i>".@LDAP::fix($src_dn)."</i>","<i>".@LDAP::fix($dst_dn)."</i>")."</h3>";
+
+
+ /* Check if the destination entry exists */
+ $ldap= $this->config->get_ldap_link();
- /* Check if destination exists - abort */
- $ldap->cat($dst_dn, array('dn'));
- if ($ldap->fetch()){
- trigger_error("Recursive_move ".@LDAP::fix($dst_dn)." already exists.",
- E_USER_WARNING);
- echo sprintf("Recursive_move: '%s' already exists", @LDAP::fix($dst_dn))."<br>";
- return (FALSE);
- }
+ /* Check if destination exists - abort */
+ $ldap->cat($dst_dn, array('dn'));
+ if ($ldap->fetch()){
+ trigger_error("Recursive_move ".@LDAP::fix($dst_dn)." already exists.",
+ E_USER_WARNING);
+ echo sprintf("Recursive_move: '%s' already exists", @LDAP::fix($dst_dn))."<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);
- }
+ /* 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);
+ /* 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){
+ /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
+ foreach ($objects as $object => $len){
- $src= str_replace("\\","\\\\",$object);
- $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object);
- $dst= str_replace($src_dn,$dst_dn,$object);
+ $src= str_replace("\\","\\\\",$object);
+ $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object);
+ $dst= str_replace($src_dn,$dst_dn,$object);
- echo "<b>"._("Object").":</b> ".@LDAP::fix($src)."<br>";
+ echo "<b>"._("Object").":</b> ".@LDAP::fix($src)."<br>";
- $this->update_acls($object, $dst,TRUE);
+ $this->update_acls($object, $dst,TRUE);
- if (!$this->copy($src, $dst)){
- echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"),@LDAP::fix($src))."</font>";
- return (FALSE);
- }
- echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
- flush();
- }
+ if (!$this->copy($src, $dst)){
+ echo "<font color='#FF0000'><br>".sprintf(_("FAILED to copy %s, aborting operation"),@LDAP::fix($src))."</font>";
+ return (FALSE);
+ }
+ echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+ flush();
+ }
- /* Remove src_dn */
- $ldap->cd($src_dn);
- $ldap->recursive_remove();
- $this->dn = $this->rec_dst;
- $this->rec_src = $this->rec_dst = "";
- $this->rec_cpy =false;
+ /* Remove src_dn */
+ $ldap->cd($src_dn);
+ $ldap->recursive_remove();
+ $this->orig_dn = $this->dn = $dst_dn;
+ $this->orig_base= $this->base;
- echo '<p class="seperator"> </p>';
+ echo '<p class="seperator"> </p>';
- echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
- <br><input type='submit' name='back' value='"._("Continue")."'>
- </form></div>";
+ echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
+ <br><input type='submit' name='back' value='"._("Continue")."'>
+ </form></div>";
- echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
- echo "</body></html>";
+ echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
+ echo "</body></html>";
- return (TRUE);
- }
- }
+ return (TRUE);
+ }
/* Return plugin informations for acl handling */
diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc
index d65c66987c5ab9f532fcc20ef53a0bfecdd7926c..5d306e3c8837a1027314a0e38e02b39dbe34680c 100644 (file)
}
+ /***************
+ Handle recursive move (Return output for an iframe)
+ ***************/
+
+
+ /* initiate recursive remove (Is called from iframe, generates output)*/
+ if(isset($_GET['PerformRecMove'])){
+ $this->deptabs->move_me();
+ $this->DivListDepartment->selectedBase = $this->deptabs->by_object['department']->dn;
+ exit();
+ }
+
+
/***************
Edit department finished
***************/
- if ((isset($_POST['edit_finish']) || isset($_POST['dep_move_confirm'])) && (isset($this->deptabs->config))){
+ if (is_object($this->deptabs) &&
+ (isset($_POST['edit_finish']) || isset($_POST['dep_move_confirm']) || $this->deptabs->move_done())){
/* Check tabs, will feed message array.
This call will also initiate a sav_object() call.
MOVED ?
Check if this department is moved
*************/
- if(!isset($_POST['dep_move_confirm']) && $obj->orig_dn != "new"){
- if($obj->orig_ou != $obj->ou || $obj->base != $obj->orig_base){
- return($smarty->fetch(get_template_path("dep_move_confirm.tpl",TRUE)));
- }
+ if(!isset($_POST['dep_move_confirm']) && $this->deptabs->am_i_moved()){
+ return($smarty->fetch(get_template_path("dep_move_confirm.tpl",TRUE)));
+ }elseif(isset($_POST['dep_move_confirm']) && $this->deptabs->am_i_moved()){
+ return($this->deptabs->by_object['department']->ShowMoveFrame());
+ }
+
+ if($this->deptabs->am_i_moved()){
+ echo "stop";
+ exit();
}
/* Save, or display error message? */
$this->ObjectTaggingRequested = true;
}
- /* Get recursive move is required, set RecursiveRemoveRequested to true */
- if($this->deptabs->by_object['department']->am_i_moved()){
- $this->RecursiveRemoveRequested = true;
- }
-
/* This var indicated that there is an object which isn't saved right now. */
$this->ObjectInSaveMode = true;
}
- /***************
- Handle recursive move (Return output for an iframe)
- ***************/
-
- /* initiate recursive remove (Is called from iframe, generates output)*/
- if(isset($_GET['PerformRecMove'])){
- $this->deptabs->by_object['department']->recursive_move("","",true);
- $this->DivListDepartment->selectedBase = $this->deptabs->by_object['department']->dn;
- exit();
- }
-
-
/***************
Return iframes, which call tagging / recusrsive move
***************/
diff --git a/gosa-core/plugins/admin/departments/tabs_department.inc b/gosa-core/plugins/admin/departments/tabs_department.inc
index 235f3212d9bde13c853269346624dd554ec2b261..4788b8accb42d7532e918e4295dceaca5fd6d0f6 100644 (file)
class deptabs extends tabs
{
var $base= "";
+ var $moved = FALSE;
function deptabs($config, $data, $dn,$category)
{
}
- function save($ignore_account= FALSE)
+ function am_i_moved()
{
+ if($this->moved) return(FALSE);
$baseobject= &$this->by_object['department'];
- $ou= preg_replace('/,/', '\,', $baseobject->ou);
- $new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base);
-
- if($ignore_account){
- 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)){
- msg_dialog::display(_("LDAP error"), _("Moving LDAP tree failed: destination tree is a subtree of the source!"), ERROR_DIALOG);
- }else{
- /* Prepare to be moved */
- $baseobject->recursive_move($this->dn, $new_dn);
- return;
- }
- }
+ $ou = preg_replace('/,/', '\,', $baseobject->ou);
+ $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base);
+ $old_ou = preg_replace('/,/', '\,', $baseobject->orig_ou);
+ $old_dn = @LDAP::convert('ou='.$ou.','.$baseobject->orig_base);
+ if ($this->dn != $new_dn && $this->dn != "new"){
+ return(TRUE);
}
+ return(FALSE);
+ }
+
+
+ function move_done()
+ {
+ return($this->moved);
+ }
+
+
+ function move_me()
+ {
+ if(!$this->am_i_moved()) return;
+ $baseobject= &$this->by_object['department'];
+ $ou = preg_replace('/,/', '\,', $baseobject->ou);
+ $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base);
+ $old_ou = preg_replace('/,/', '\,', $baseobject->orig_ou);
+ $old_dn = @LDAP::convert('ou='.$ou.','.$baseobject->orig_base);
+ if ($this->dn != $new_dn && $this->dn != "new"){
+ $baseobject->recursive_move($this->dn, $new_dn);
+ $this->moved= TRUE;
+ }
+ }
+
+
+ function save($ignore_account= FALSE)
+ {
+ $baseobject= &$this->by_object['department'];
+ $ou = preg_replace('/,/', '\,', $baseobject->ou);
+ $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base);
$this->dn= $new_dn;
$baseobject->dn= $this->dn;
if (!$ignore_account){