Code

Added snapshot to deps
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 14 Jun 2006 04:28:15 +0000 (04:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 14 Jun 2006 04:28:15 +0000 (04:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3802 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_plugin.inc
plugins/admin/departments/class_departmentManagement.inc
plugins/admin/departments/class_divListDepartment.inc
plugins/admin/ogroups/class_divListOGroup.inc
plugins/admin/ogroups/class_ogroupManagement.inc

index a80b8511b71063ac86fbf91e4ab637f8354b6bc2..dda58a731aba9b18f6921aae455172fdeb7c8187 100644 (file)
@@ -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);
index b095805fbf705cdd7a464ffbadfd8180f277bd5d..eeb9d53eae2bd18050a6a8c2a828b4a489927d1f 100644 (file)
@@ -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()
index 4eaea028be39dbd20e7ed3a3b0e4a0ef341d1ba0..cda30ee7fd4ecefedbd71e40956c11defa32856b 100755 (executable)
@@ -39,8 +39,7 @@ class divListDepartment extends MultiSelectWindow
     /* set Page header */
     $this->AddHeader(array("string" => "&nbsp;", "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 = "<div style='background:#F0F0F9;padding:5px;'>".
-        " <input type='image' class='center' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='".       _("Root")."'>&nbsp;".
-        " <input type='image' class='center' src='images/list_up.png' align='middle' title='"._("Go up one department")."' name='dep_back' alt='"._("Up").  "'>&nbsp;".
-        " <input type='image' class='center' src='images/list_home.png' align='middle' title='"._("Go to users home department")."' name='dep_home' alt='". _("Home")."'>&nbsp;".
-        " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='".      _("Submit")."'>&nbsp;".
-        " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-        " <input class='center' type='image' src='images/list_new_department.png' align='middle' alt='"._("Create new department")."' name='dep_new'>&nbsp; ".
-        " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-        _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-        " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
-        "</div>";
+    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
+      " <input type='image' class='center' src='images/list_root.png' align='middle' 
+        title='"._("Go to root department")."' name='dep_root' alt='".       _("Root")."'>&nbsp;".
+      " <input type='image' class='center' src='images/list_up.png' align='middle' 
+        title='"._("Go up one department")."' name='dep_back' alt='"._("Up").  "'>&nbsp;".
+      " <input type='image' class='center' src='images/list_home.png' align='middle' 
+        title='"._("Go to users home department")."' name='dep_home' alt='". _("Home")."'>&nbsp;".
+      " <input class='center' type='image' src='images/list_reload.png' align='middle' 
+        title='"._("Reload list")."' name='submit_department' alt='".      _("Submit")."'>&nbsp;".
+      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+
+    if($this->parent->snapshotEnabled()){
+      $listhead .= "  <input class='center' type='image' align='middle' src='images/restore.png'        
+        title='"._("Restore snapshopts of already deleted objects")."' alt='"._("Restore")."' name='RestoreDeletedSnapShot'>".
+        " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+
+    $listhead .=  " <input class='center' type='image' src='images/list_new_department.png' 
+        align='middle' alt='"._("Create new department")."' name='dep_new'>&nbsp; ".
+      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+      _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+      " <input class='center' type='image' src='images/list_submit.png' align='middle' 
+        title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+      "</div>";
 
     $this->SetListHeader($listhead);
   }
@@ -88,14 +100,24 @@ class divListDepartment extends MultiSelectWindow
 
   function setEntries($list)
   {
-    $actions= "<input class='center' type='image' src='images/edit.png'
-      alt='"._("edit")."'   name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
-    $actions.= "<input class='center' type='image' src='images/edittrash.png'
-      alt='"._("delete")."'   name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
 
     $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
 
     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.= "<input class='center' type='image' src='images/edit.png'
+        alt='"._("edit")."'   name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+      $actions.= "<input class='center' type='image' src='images/edittrash.png'
+        alt='"._("delete")."'   name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
+
       if(!isset($this->config->departments[trim($key)])){
         $this->config->departments[trim($key)]="";
       }
@@ -110,8 +132,8 @@ class divListDepartment extends MultiSelectWindow
 
       $title = preg_replace('/ /', '&nbsp;', @LDAP::fix($this->config->departments[$key]));
       $field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='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));
index 9fc480e268aee51c26fa330939e373af705cf2f3..eda23fd0169ad6890eea6e191f9e5a59c194df14 100755 (executable)
@@ -51,7 +51,7 @@ class divListOGroup extends MultiSelectWindow
     $this->AddHeader(array("string" => "&nbsp;", "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 = "<div style='background:#F0F0F9;padding:5px;'>".
       " <input class='center' type='image' src='images/list_root.png' align='middle' 
-          title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
+      title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
       " <input class='center' type='image' align='middle' src='images/list_back.png' 
-          title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
+      title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
       " <input class='center' type='image' align='middle' src='images/list_home.png' 
-          title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
-       " <input class='center' type='image' src='images/list_reload.png' align='middle' 
-          title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-      " <input class='center' type='image' align='middle' src='images/list_new_ogroup.png' 
-          title='"._("Create new object group")."' alt='"._("new")."' name='group_new'>".
+      title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
+      " <input class='center' type='image' src='images/list_reload.png' align='middle' 
+      title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+
+    if($this->parent->snapshotEnabled()){
+      $listhead .= "  <input class='center' type='image' align='middle' src='images/restore.png'
+        title='"._("Restore snapshopts of already deleted objects")."' alt='"._("Restore")."' name='RestoreDeletedSnapShot'>".
+        " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+
+
+    $listhead .=" <input class='center' type='image' align='middle' src='images/list_new_ogroup.png' 
+      title='"._("Create new object group")."' alt='"._("new")."' name='group_new'>".
       $Copy_Paste.
       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
       _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' 
-          title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+      title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
       "</div>";
-  
+
     $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.= "<input class='center' type='image'
-        src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-      $actions.= "<input class='center' type='image'
-        src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-    }
-    $actions.= "<input class='center' type='image'
-      src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
-    $actions.= "<input class='center' type='image'
-      src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
-
     // Defining Links
     $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
@@ -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.= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $actions.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
+      $actions.= "<input class='center' type='image'
+        src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
+
+
       if(isset($val['mail'])){
         $mail = $mailimg;
       }else{
@@ -163,7 +172,7 @@ class divListOGroup extends MultiSelectWindow
       $field1 = array("string" => "<img src='images/list_ogroup.png' alt='"._("Object group")."' ".$title.">", "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))."&nbsp;".$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));
     }
index ced638067314d75935daf0ae0f90306f8cac3d95..3142979c018c07979473ff3530dcfea6820d0668 100644 (file)
@@ -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();