From d12196e16f47523c04e530a0d408a426ecc6dcf0 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 27 Jun 2006 09:25:25 +0000 Subject: [PATCH] Reverted to 2.5 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3935 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../departments/class_departmentGeneric.inc | 27 ++++---- .../class_departmentManagement.inc | 43 ++++-------- .../departments/class_divListDepartment.inc | 66 ++++++------------- plugins/admin/departments/tabs_department.inc | 10 +-- 4 files changed, 51 insertions(+), 95 deletions(-) diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 6dd6ff7de..5205da944 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -175,13 +175,6 @@ class department extends plugin function must_be_tagged() { - if((isset($this->attrs['gosaUnitTag'][0])) && ($this->is_administrational_unit)){ - $this->must_be_tagged = false; - }elseif((!isset($this->attrs['gosaUnitTag'][0])) && (!$this->is_administrational_unit)){ - $this->must_be_tagged = false; - }else{ - $this->must_be_tagged = true; - } return $this->must_be_tagged; } @@ -228,8 +221,8 @@ class department extends plugin /* Check for presence of this department */ $ldap= $this->config->get_ldap_link(); - $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn')); - if ($this->orig_dn == "new" && $ldap->count()){ + $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn')); + if ($this->orig_dn == "new" && $ldap->count()){ $message[]= _("Department with that 'Name' already exists."); } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){ $message[]= _("Department with that 'Name' already exists."); @@ -270,8 +263,9 @@ class department extends plugin if ($this->is_administrational_unit){ if(!in_array_ics("gosaAdministrativeUnit",$this->objectclasses)){ $this->objectclasses[]= "gosaAdministrativeUnit"; - $this->gosaUnitTag= ""; + $this->gosaUnitTag= ""; } + if ($this->gosaUnitTag == ""){ /* It's unlikely, but check if already used... */ @@ -308,9 +302,9 @@ class department extends plugin if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){ $tmp[]= $oc; } - if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){ - $has_unit_tag= true; - } + if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){ + $has_unit_tag= true; + } } $this->attrs['objectClass']= $tmp; @@ -336,11 +330,15 @@ class department extends plugin } show_ldap_error($ldap->get_error(), _("Saving department failed")); + /* The parameter forces only to set must_be_tagged, and don't touch any objects + This will be done later */ + $this->tag_objects(true); + /* Fix tagging if needed */ if (!$this->is_administrational_unit){ $this->handle_object_tagging(); } - + /* Optionally execute a command after we're done */ $this->postcreate(); return(true); @@ -385,6 +383,7 @@ class department extends plugin } else { $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn')); } + while ($attrs= $ldap->fetch()){ /* Skip self */ diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index c21927f09..9bb51d375 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -120,7 +120,6 @@ class departmentManagement extends plugin * The entry which will be edited is defined in $s_entry */ if (( $s_action=="edit") && (!isset($this->deptabs->config))){ - $s_entry = convert_department_dn(base64_decode($s_entry)); $this->dn= $this->config->departments[trim($s_entry)]; if (($user= get_lock($this->dn)) != ""){ @@ -148,7 +147,6 @@ class departmentManagement extends plugin * The entry which will be deleted is defined in $s_entry */ if ($s_action =="del"){ - $s_entry = convert_department_dn(base64_decode($s_entry)); $this->dn= $this->config->departments[trim($s_entry)]; /* Check locking */ @@ -196,10 +194,7 @@ class departmentManagement extends plugin if (count($message) == 0){ $this->deptabs->save(true); - - if(!$this->deptabs->by_object['department']->am_i_moved()){ - $this->deptabs->save(true); - } + $this->deptabs->by_object['department']->save(); /* This object must be tagged, so set ObjectTaggingRequested to true */ if($this->deptabs->by_object['department']->must_be_tagged()){ @@ -300,20 +295,13 @@ class departmentManagement extends plugin $display= $this->deptabs->execute(); if (!$this->deptabs->by_object[$this->deptabs->current]->dialog){ $display.= "

\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; $display.= "\n"; $display.= "

"; } return ($display); }else{ - - /* Check if there is a snapshot dialog open */ - $base = $this->DivListDepartment->selectedBase; - if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){ - return($str); - } - /* Display dialog with group list */ $this->DivListDepartment->parent = $this; $this->DivListDepartment->execute(); @@ -325,14 +313,6 @@ class departmentManagement extends plugin } - /* Return departments, that will be included within snapshot detection */ - function get_used_snapshot_bases() - { - return(array($this->DivListDepartment->selectedBase)); - } - - - function reload() { /* Vairaible init */ @@ -364,21 +344,24 @@ class departmentManagement extends plugin } $this->departments= array(); - $tmp = array(); foreach ($res as $key => $value){ - #$tmp[get_sub_department(convert_department_dn($value['dn']))] = $key; - $tmp[$key] = get_sub_department(convert_department_dn($value['dn'])); - } - natcasesort($tmp); - foreach($tmp as $key => $q){ - $value = $res [$key]; + /* Don't display base as entry on subsearch */ if(($value['dn'] == $base) && ($this->DivListDepartment->SubSearch)){ continue; } - $this->departments[base64_encode($value['dn'])]= $value; + $cdn= convert_department_dn($value['dn']); + + /* Append to dep list */ + if(isset($value["description"][0])){ + $this->departments[$cdn]= get_sub_department($cdn)." - [".$value["description"][0]."]"; + }else{ + $this->departments[$cdn]= get_sub_department($cdn);//$value["description"][0]; + } } + natcasesort ($this->departments); + reset ($this->departments); } function remove_from_parent() diff --git a/plugins/admin/departments/class_divListDepartment.inc b/plugins/admin/departments/class_divListDepartment.inc index 9d4af1e2d..4eaea028b 100755 --- a/plugins/admin/departments/class_divListDepartment.inc +++ b/plugins/admin/departments/class_divListDepartment.inc @@ -36,16 +36,11 @@ class divListDepartment extends MultiSelectWindow $this->EnableCloseButton(false); $this->EnableSaveButton (false); - /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 50; - if($this->parent->snapshotEnabled()){ - $action_col_size += 20; - } - /* set Page header */ $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'")); $this->AddHeader(array("string"=>_("Department name"), "attach" => "style=''")); - $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'")); + $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'")); + /* Add SubSearch checkbox */ $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false); @@ -70,24 +65,17 @@ class divListDepartment extends MultiSelectWindow } /* Generate list head */ - $listhead = "
". - "  ". - "  ". - "  ". - "  ". - "  "; - $listhead .= $this->get_snapshot_header($this->selectedBase); - $listhead .= "   ". - "  ". - _("Base")." ". - "  ". - "
"; + $listhead = "
". + "  ". + "  ". + "  ". + "  ". + "  ". + "   ". + "  ". + _("Base")." ". + "  ". + "
"; $this->SetListHeader($listhead); } @@ -100,30 +88,14 @@ class divListDepartment extends MultiSelectWindow function setEntries($list) { + $actions= ""; + $actions.= ""; $linkopen = "%s"; - /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 50; - if($this->parent->snapshotEnabled()){ - $action_col_size += 20; - } - foreach($list as $key => $val) { - - $cdn= convert_department_dn($val['dn']); - if(isset($val["description"][0])) { - $disp = get_sub_department($cdn)." - [".$val["description"][0]."]"; - }else{ - $disp = get_sub_department($cdn); - } - - $actions= ""; - $actions.= $this->GetSnapShotActions($val['dn']); - $actions.= ""; - if(!isset($this->config->departments[trim($key)])){ $this->config->departments[trim($key)]=""; } @@ -138,8 +110,8 @@ class divListDepartment extends MultiSelectWindow $title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key])); $field0 = array("string" => "department", "attach" => "style='text-align:center;width:20px;'"); - $field1 = array("string" => sprintf($linkopen,base64_encode($cdn),$disp), "attach" => "style='' title='".$title."'"); - $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align: + $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'"); + $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align: right;'"); $this->AddElement( array($field0,$field1,$field2)); diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc index e1b7b98d0..285b93a79 100644 --- a/plugins/admin/departments/tabs_department.inc +++ b/plugins/admin/departments/tabs_department.inc @@ -21,6 +21,7 @@ class deptabs extends tabs $baseobject= $this->by_object['department']; $ou= preg_replace('/,/', '\,', $baseobject->ou); $new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base); + if($justsave){ if ($this->dn != $new_dn && $this->dn != "new"){ /* if( new_dn is subtree of this->dn ) */ @@ -30,15 +31,16 @@ class deptabs extends tabs print_red(_("Try to move tree failed. Destination tree is subtree of source tree.")); }else{ /* Prepare to be moved */ - $baseobject->recursive_move($this->dn, $new_dn); + $baseobject->recursive_move($this->dn, $new_dn); $this->by_object['department'] = $baseobject; return; } } - }else{ - $this->dn= $new_dn; - return(tabs::save(TRUE)); } + $this->dn= $new_dn; + $baseobject->dn= $this->dn; + $this->by_object['department']= $baseobject; + return(tabs::save(TRUE)); } } -- 2.30.2