From: hickert Date: Wed, 14 Jun 2006 04:28:15 +0000 (+0000) Subject: Added snapshot to deps X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3174f0e39701cf413f6e1befbade42624140f4ef;p=gosa.git Added snapshot to deps git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3802 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_plugin.inc b/include/class_plugin.inc index a80b8511b..dda58a731 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -1165,8 +1165,12 @@ class plugin $ui = get_userinfo(); $tmp = array(); $ldap_to->cd($new_base); - $ldap_to->search("(&(objectClass=gosaSnapshotObject))",array("gosaSnapshotType","gosaSnapshotTimestamp","gosaSnapshotDN","description")); + $ldap_to->ls("(&(objectClass=gosaSnapshotObject))",$new_base,array("gosaSnapshotType","gosaSnapshotTimestamp","gosaSnapshotDN","description")); while($entry = $ldap_to->fetch()){ + + $chk = str_replace($base,"",$entry['gosaSnapshotDN'][0]); + if(preg_match("/,ou=/",$chk)) continue; + if(!isset($entry['description'][0])){ $entry['description'][0] = ""; } @@ -1181,6 +1185,8 @@ class plugin } } + + /* Format result as requested */ if($raw) { return($tmp); diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index b095805fb..eeb9d53ea 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -120,6 +120,7 @@ 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)) != ""){ @@ -147,6 +148,7 @@ 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 */ @@ -302,6 +304,12 @@ class departmentManagement extends plugin } return ($display); }else{ + + /* Check if there is a snapshot dialog open */ + if($str = $this->showSnapshotDialog($this->DivListDepartment->selectedBase,"")){ + return($str); + } + /* Display dialog with group list */ $this->DivListDepartment->parent = $this; $this->DivListDepartment->execute(); @@ -344,24 +352,21 @@ 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; } - $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]; - } + $this->departments[base64_encode($value['dn'])]= $value; } - 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 4eaea028b..cda30ee7f 100755 --- a/plugins/admin/departments/class_divListDepartment.inc +++ b/plugins/admin/departments/class_divListDepartment.inc @@ -39,8 +39,7 @@ class divListDepartment extends MultiSelectWindow /* 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:60px;border-right:0px;text-align:right;'")); - + $this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:80px;border-right:0px;text-align:right;'")); /* Add SubSearch checkbox */ $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false); @@ -65,17 +64,30 @@ class divListDepartment extends MultiSelectWindow } /* Generate list head */ - $listhead = "
". - "  ". - "  ". - "  ". - "  ". - "  ". - "   ". - "  ". - _("Base")." ". - "  ". - "
"; + $listhead = "
". + "  ". + "  ". + "  ". + "  ". + "  "; + + if($this->parent->snapshotEnabled()){ + $listhead .= " ". + "  "; + } + + $listhead .= "   ". + "  ". + _("Base")." ". + "  ". + "
"; $this->SetListHeader($listhead); } @@ -88,14 +100,24 @@ class divListDepartment extends MultiSelectWindow function setEntries($list) { - $actions= ""; - $actions.= ""; $linkopen = "%s"; 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 = $this->GetSnapShotActions($val['dn']); + $actions.= ""; + $actions.= ""; + if(!isset($this->config->departments[trim($key)])){ $this->config->departments[trim($key)]=""; } @@ -110,8 +132,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($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: + $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:80px;border-right:0px;text-align: right;'"); $this->AddElement( array($field0,$field1,$field2)); diff --git a/plugins/admin/ogroups/class_divListOGroup.inc b/plugins/admin/ogroups/class_divListOGroup.inc index 9fc480e26..eda23fd01 100755 --- a/plugins/admin/ogroups/class_divListOGroup.inc +++ b/plugins/admin/ogroups/class_divListOGroup.inc @@ -51,7 +51,7 @@ class divListOGroup extends MultiSelectWindow $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'")); $this->AddHeader(array("string" => _("Name of object groups")." / "._("Departments"), "attach" => "style=''")); $this->AddHeader(array("string" => _("Properties"), "attach" => "style='width:136px;'")); - $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:107px;border-right:0px;text-align:right;'")); + $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:130px;border-right:0px;text-align:right;'")); /* Text ,Value ,Name ,Is selected */ $this->AddCheckBox("UserGroups" , _("Select to see groups containing users") , _("Show groups containing users"), true); @@ -96,23 +96,31 @@ class divListOGroup extends MultiSelectWindow // Managment $listhead = "
". "  ". + title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ". "  ". + title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ". "  ". - "  ". - "  ". - " ". + title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ". + "  ". + "  "; + + if($this->parent->snapshotEnabled()){ + $listhead .= " ". + "  "; + } + + + $listhead .=" ". $Copy_Paste. "  ". _("Base")." ". "  ". + title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ". "
"; - + $this->SetListHeader($listhead); } @@ -126,19 +134,6 @@ class divListOGroup extends MultiSelectWindow { /* Add Copy & Paste buttons if copy&paste is enabled */ - /* Create action icons */ - $actions = ""; - if($this->parent->CopyPasteHandler){ - $actions.= " "; - $actions.= " "; - } - $actions.= ""; - $actions.= ""; - // Defining Links $linkopen = "%s"; $editlink = "%s"; @@ -149,6 +144,20 @@ class divListOGroup extends MultiSelectWindow // Assigning ogroups foreach($list as $key => $val){ + /* Create action icons */ + $actions = $this->GetSnapShotActions($val['dn']); + if($this->parent->CopyPasteHandler){ + $actions.= " "; + $actions.= " "; + } + $actions.= ""; + $actions.= ""; + + if(isset($val['mail'])){ $mail = $mailimg; }else{ @@ -163,7 +172,7 @@ class divListOGroup extends MultiSelectWindow $field1 = array("string" => ""._("Object group")."", "attach" => "style='text-align:center;width: 20px;'"); $field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)), "attach" => "style='' ".$title); $field3 = array("string" => preg_replace("/%KEY/", $key, $this->parent->convert_list($val))." ".$mail, "attach" => "style='width:136px;'"); - $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:107px;border-right:0px;text-align:right;'"); + $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "attach" => "style='width:130px;border-right:0px;text-align:right;'"); $this->AddElement(array($field1,$field2,$field3,$field4)); } diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index ced638067..3142979c0 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -346,6 +346,11 @@ class ogroupManagement extends plugin Display list ****************/ + /* Check if there is a snapshot dialog open */ + if($str = $this->showSnapshotDialog($this->DivListOGroup->selectedBase,get_groups_ou())){ + return($str); + } + /* Display dialog with group list */ $this->DivListOGroup->parent = $this; $this->DivListOGroup->execute();