From 17f680822e9a10722014d4b23e0b77da18c3efc1 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 11 Mar 2008 14:56:52 +0000 Subject: [PATCH] Updated tagging -Call save() only once, not twice, same for save_object(). -Remove of tag is not working properly, you have to save twice ....... git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9679 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../departments/class_departmentGeneric.inc | 16 ++++- .../class_departmentManagement.inc | 59 ++++++++++--------- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc index 9703ef320..a7f12d069 100644 --- a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc @@ -57,7 +57,7 @@ class department extends plugin function department (&$config, $dn) { - + echo __FUNCTION__; plugin::plugin($config, $dn); $this->is_account= TRUE; $this->ui= get_userinfo(); @@ -89,6 +89,7 @@ class department extends plugin function execute() { + echo __FUNCTION__."
"; /* Call parent execute */ plugin::execute(); @@ -172,6 +173,7 @@ class department extends plugin function clear_fields() { + echo __FUNCTION__."
"; $this->dn = ""; $this->base = ""; @@ -182,6 +184,7 @@ class department extends plugin function remove_from_parent() { + echo __FUNCTION__."
"; $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->dn); $ldap->recursive_remove(); @@ -196,11 +199,13 @@ class department extends plugin function must_be_tagged() { + echo __FUNCTION__."
"; return $this->must_be_tagged; } function am_i_moved() { + echo __FUNCTION__."
"; return $this->rec_cpy; } @@ -208,6 +213,7 @@ class department extends plugin /* Save data to object */ function save_object() { + echo __FUNCTION__."
"; if (isset($_POST['dep_generic_posted'])){ /* Create a base backup and reset the @@ -240,6 +246,7 @@ class department extends plugin /* Check values */ function check() { + echo __FUNCTION__."
"; /* Call common method to give check the hook */ $message= plugin::check(); @@ -283,6 +290,7 @@ class department extends plugin /* Save to LDAP */ function save() { + echo __FUNCTION__."
"; $ldap= $this->config->get_ldap_link(); /* Add tag objects if needed */ @@ -380,6 +388,7 @@ class department extends plugin function ShowMoveFrame() { + echo __FUNCTION__."
"; $smarty = get_smarty(); $smarty->assign("src","?plug=".$_GET['plug']."&PerformRecMove&no_output_compression"); $smarty->assign("message","As soon as the move operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog."); @@ -389,6 +398,7 @@ class department extends plugin function ShowTagFrame() { + echo __FUNCTION__."
"; $smarty = get_smarty(); $smarty->assign("src","?plug=".$_GET['plug']."&TagDepartment&no_output_compression"); $smarty->assign("message","As soon as the tag operation has finished, you can scroll down to end of the page and press the 'Continue' button to continue with the department management dialog."); @@ -399,6 +409,7 @@ class department extends plugin /* Tag objects to have the gosaAdministrativeUnitTag */ function tag_objects($OnlySetTagFlag = false) { + echo __FUNCTION__."
"; if(!$OnlySetTagFlag){ $smarty= get_smarty(); /* Print out html introduction */ @@ -472,6 +483,7 @@ class department extends plugin /* Move/Rename complete trees */ function recursive_move($src_dn, $dst_dn,$force = false) { + echo __FUNCTION__."
"; /* If force == false prepare to recursive move this object from src to dst on the next call. */ if(!$force){ @@ -572,6 +584,7 @@ class department extends plugin /* Return plugin informations for acl handling */ static function plInfo() { + echo __FUNCTION__."
"; return (array("plShortName" => _("Generic"), "plDescription" => _("Departments"), "plSelfModify" => FALSE, @@ -597,6 +610,7 @@ class department extends plugin function handle_object_tagging($dn= "", $tag= "", $show= false) { + echo __FUNCTION__."
"; /* No dn? Self-operation... */ if ($dn == ""){ $dn= $this->dn; diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc index dc4b55e13..d65c66987 100644 --- a/gosa-core/plugins/admin/departments/class_departmentManagement.inc +++ b/gosa-core/plugins/admin/departments/class_departmentManagement.inc @@ -276,33 +276,35 @@ class departmentManagement extends plugin Edit department finished ***************/ - if ((isset($_POST['edit_finish'])) && (isset($this->deptabs->config)) && !isset($_POST['dep_move_confirm'])){ - $this->deptabs->save_object(); + if ((isset($_POST['edit_finish']) || isset($_POST['dep_move_confirm'])) && (isset($this->deptabs->config))){ + + /* Check tabs, will feed message array. + This call will also initiate a sav_object() call. + So don't move it below the moved check !. + */ + $message= $this->deptabs->check(); $obj = $this->deptabs->by_object['department']; - if($obj->orig_dn != "new"){ + + /************* + 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))); } } - } - - /* Save changes */ - if ((isset($_POST['edit_finish'])|| isset($_POST['dep_move_confirm'])) && (isset($this->deptabs->config))){ - - /* Check tabs, will feed message array */ - $message= $this->deptabs->check(); /* Save, or display error message? */ if (count($message) == 0){ global $config; - $this->deptabs->save(true); + $this->deptabs->save(); $config->get_departments(); $config->make_idepartments(); $this->config = $config; /* This object must be tagged, so set ObjectTaggingRequested to true */ - $this->deptabs->by_object['department']->tag_objects(TRUE); if($this->deptabs->by_object['department']->must_be_tagged()){ $this->ObjectTaggingRequested = true; } @@ -362,26 +364,25 @@ class departmentManagement extends plugin } - /*************** - In case of tagging/moving the object wasn't deleted, do it know - ***************/ + /*************** + In case of tagging/moving the object wasn't deleted, do it know + ***************/ - /* If there is an unsaved object and all operations are done - remove locks & save object tab & unset current object */ - if($this->ObjectInSaveMode && (!$this->RecursiveRemoveRequested) && (!$this->ObjectTaggingRequested)){ - $this->deptabs->save(); - $this->config->get_departments(); - $this->ObjectInSaveMode = false; - if ($this->dn != "new"){ - del_lock ($this->dn); - } - unset ($this->deptabs); - $this->deptabs= NULL; - session::un_set('objectinfo'); - } + /* If there is an unsaved object and all operations are done + remove locks & save object tab & unset current object */ + if($this->ObjectInSaveMode && (!$this->RecursiveRemoveRequested) && (!$this->ObjectTaggingRequested)){ + $this->config->get_departments(); + $this->ObjectInSaveMode = false; + if ($this->dn != "new"){ + del_lock ($this->dn); + } + unset ($this->deptabs); + $this->deptabs= NULL; + session::un_set('objectinfo'); + } - /*************** + /*************** Dialog canceled ***************/ -- 2.30.2