Code

Udpated mime acls
[gosa.git] / plugins / admin / systems / class_divListSystem.inc
index d92ffacbe4d3c27b934451217b343857428aba23..fe125e2aa7090e760c6afafae5d23041836084b5 100644 (file)
@@ -47,10 +47,16 @@ class divListSystem 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 += 38;
+    }
+
     /* set Page header */
     $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
     $this->AddHeader(array("string"=>_("System / Department")));
-    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:90px;border-right:0px;'"));
+    $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'"));
 
     /*                  Text        ,Value    ,Name         ,Is selected */
     $this->AddCheckBox("ShowServers",         _("Select to see servers"),            _("Show servers"),          true);
@@ -91,11 +97,9 @@ class divListSystem extends MultiSelectWindow
       " <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_back.png'
-      title='"._("Go up one department")."' alt='"._("Up")."' name='RestoreDeletedSnapShot'>".
-      " <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/select_new_terminal.png'
+      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    $listhead .= $this->get_snapshot_header($this->selectedBase);
+    $listhead .= " <input class='center' type='image' align='middle' src='images/select_new_terminal.png'
       name='newsystem_terminal'    alt='"._("New Terminal template")."' title='"._("New Terminal")."'>".
       " <input class='center' type='image' align='middle' src='images/select_new_workstation.png'
       name='newsystem_workstation' alt='"._("New Workstation template")."' title='"._("New Workstation")."'>".
@@ -122,21 +126,6 @@ class divListSystem extends MultiSelectWindow
   }
 
 
-  function GetSnapShotActions($dn)
-  {
-    $str = "";
-    $str .="<input class='center' type='image' src='images/snapshot.png' 
-      alt='"._("Create snapshot")."' name='CreateSnapShot_".base64_encode($dn)."' title='"._("Create snapshot")."'>&nbsp;";
-
-    if(count($this->parent->Available_SnapsShots($dn))){
-      $str .="<input class='center' type='image' src='images/restore.png' 
-        alt='"._("Restore snapshot")."' name='RestoreSnapShot_".base64_encode($dn)."' title='"._("Restore snapshot")."'>&nbsp;";
-    }else{
-      $str.= "<img src='images/empty.png' style='width:16px;' class='center'>&nbsp;";
-    }
-    return($str);
-  }
-
   function setEntries($terminals)
   {
     $img1  = "<img class='center' src='images/printer.png'            alt='C' title='"._("Cups Server")  ."'>";
@@ -152,14 +141,20 @@ class divListSystem extends MultiSelectWindow
 
     $empty    ="&nbsp;";
 
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 50;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
     // User and Template  Images
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
 
     // Test Every Entry and generate divlist Array
     foreach($terminals as $key => $val){
 
-      $action =  $this->GetSnapShotActions($val['dn']);
-      $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     name='user_edit_%KEY%' title='"._("Edit system")."'>";
+      $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     name='user_edit_%KEY%' title='"._("Edit system")."'>";
+      $action.= $this->GetSnapShotActions($val['dn']);
       $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'   name='user_del_%KEY%' title='"._("Delete system")."'>";
 
       /* Generate picture list, which is currently disabled */
@@ -203,7 +198,7 @@ class divListSystem extends MultiSelectWindow
       $img    = $this->parent->convert_list($val);
       $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'");
       $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
-      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:90px;border-right:0px;text-align:right;'");
+      $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
       $this->AddElement( array($field1,$field2,$field3));
     }
 
@@ -222,59 +217,6 @@ class divListSystem extends MultiSelectWindow
     MultiSelectWindow :: save_object();  
 
 
-    /* check for posts */
-    $once = true;
-    foreach($_POST as $name => $value){
-
-      /* Create a new snapshot, display a dialog */
-      if(preg_match("/^CreateSnapShot_/",$name) && $once){
-        $once = false;
-        $entry = preg_replace("/^CreateSnapShot_/","",$name);
-        $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
-        $this->parent->systab = new SnapShotDialog($this->config,$entry,$this->parent); 
-      }
-
-      /* Restore a snapshot, display a dialog with all snapshots of the current object */
-      if(preg_match("/^RestoreSnapShot_/",$name) && $once){
-        $once = false;
-        $entry = preg_replace("/^RestoreSnapShot_/","",$name);
-        $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
-        $this->parent->systab = new SnapShotDialog($this->config,$entry,$this->parent); 
-        $this->parent->systab->Restore = true;
-      }
-
-      /* Restore one of the already deleted objects */
-      if(preg_match("/^RestoreDeletedSnapShot_/",$name) && $once){
-        $once = false;
-        $entry = "ou=systems,".$this->selectedBase;  
-        $this->parent->systab = new SnapShotDialog($this->config,$entry,$this->parent); 
-        $this->parent->systab->Restore      = true;
-        $this->parent->systab->DeletedOnes  = true;
-      }
-    }
-
-    /* Create a new snapshot requested, check 
-       the given attributes and create the snapshot*/
-    if(isset($_POST['CreateSnapshot'])){
-      $this->parent->systab->save_object();
-      $msgs = $this->parent->systab->check();
-      if(count($msgs)){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $this->parent->dn =  $this->parent->systab->dn;
-        $this->parent->create_snapshot("snapshot",$this->parent->systab->CurrentDescription);
-        $this->parent->systab = NULL;
-      }
-    }
-
-    /* Restore is requested, restore the object with the posted dn .*/ 
-    if((isset($_POST['RestoreSnapshot'])) && (isset($_POST['SnapShot']))){
-      $entry = base64_decode($_POST['SnapShot']);
-      $this->parent->restore_snapshot($entry);
-      $this->parent->systab = NULL;
-    }
   }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: