Code

Fixed acls & picture settings
[gosa.git] / include / class_MultiSelectWindow.inc
index 00d49d6d57c74d175f18172fc0a8df16cf8f8a19..bbba65eeeaf44d469bd63722a0e49c08779e8171 100644 (file)
@@ -34,6 +34,7 @@ class MultiSelectWindow{
   var $HideFilterPart     = false;
 
   var $SaveAdditionalVars = array();  // Additional Post vars to store 
+  var $module= "";
 
        function ClearElementsList()
        {
@@ -72,9 +73,10 @@ class MultiSelectWindow{
        }
 
        /* Contrucktion */
-       function MultiSelectWindow($config,$filterName)
+       function MultiSelectWindow($config, $filterName, $module)
        {
                $this->config = $config;
+               $this->module = $module;
                $this->SaveButtonString         = _("Save");
                $this->CloseButtonString        = _("Close");
                $this->filterName                       = $filterName;
@@ -273,7 +275,7 @@ class MultiSelectWindow{
                        if($box['default'] == true){
                                $boxes .="<input type='checkbox' name='".$box['name']."' value='1' title='".$box['value']."' checked ".$boxClick.">&nbsp;".$box['string']."<br>";
                        }else{
-                               $boxes .="<input type='checkbox' name='".$box['name']."' value='1' title='".$box['value']."'".$boxClick.";>&nbsp;".$box['string']."<br>";
+                               $boxes .="<input type='checkbox' name='".$box['name']."' value='1' title='".$box['value']."'".$boxClick.">&nbsp;".$box['string']."<br>";
                        }
                }
                $smarty->assign("CheckBoxes", $boxes);
@@ -360,6 +362,11 @@ class MultiSelectWindow{
           Store data also into a session var, to keep the checkboxes check after reload  */
        function save_object()
        {
+    /* Get up to date config */
+    if(isset($this->parent->config)){
+      $this->config = $this->parent->config;
+    }
+
                /* Update current base */
                if($this->DepartmentsAdded){
                        $s_action ="";
@@ -480,9 +487,52 @@ class MultiSelectWindow{
                                }
                        }
                }
-
        }
 
+
+  /* Create header snapshot value */
+  function get_snapshot_header()
+  {
+    $str = "&nbsp;";
+    if($this->parent->snapshotEnabled()){
+      $ok = false;
+      foreach($this->parent->get_used_snapshot_bases() as $base){
+        $ok |= count($this->parent->getAllDeletedSnapshots($base)) >= 1 ;
+      }
+      if($ok){
+        $str = "<input class='center' type='image' align='middle' src='images/restore.png'
+          title='"._("Restore snapshopts of already deleted objects")."' 
+          alt='"._("Restore")."' name='RestoreDeletedSnapShot'>&nbsp;"; 
+      }else{
+        $str = "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
+      }
+
+#      $str .= "<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+    return($str);
+  }
+
+
+  function GetSnapShotActions($dn)
+  {
+    $str= "";
+    if($this->parent->snapshotEnabled()){
+
+      if(count($this->parent->Available_SnapsShots($dn))){
+        $str.= "<input class='center' type='image' src='images/restore.png'
+          alt='"._("Restore snapshot")."' name='RestoreSnapShotDialog_".base64_encode($dn)."' title='"._("Restore snapshot")."'>&nbsp;";
+      } else {
+        $str = "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
+      }
+
+      $str.= "<input class='center' type='image' src='images/snapshot.png'
+        alt='"._("Create snapshot")."' name='CreateSnapShotDialog_".base64_encode($dn)."' title='"._("Create a new snapshot from this object")."'>&nbsp;";
+    }
+
+    return($str);
+  }
+
+
        /* this function adds the sub-departments of the current tree to the list */
        function AddDepartments($base = false,$numtabs = 3)
        {
@@ -504,8 +554,8 @@ class MultiSelectWindow{
                $this->departments = array();
 
                /* Get all departments within this subtree */
-               $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->ui->subtreeACL,
-                               $base, array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
+               $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_CONVERT);
 
                /* Edit delete link for system types
                 */
@@ -524,6 +574,7 @@ class MultiSelectWindow{
 
                /* Add deps to this dialog object list */
                foreach($this->departments as $key=> $val){
+
                        /* Add missing entries ... */
                        if(!isset($this->config->departments[trim($key)])){
                                $this->config->departments[trim($key)]="";