Code

Added gray out for removed snap shot icon in div header
[gosa.git] / plugins / admin / users / class_divListUsers.inc
index e59e5c82dad2da3dd845ed9a4b6de7237e2df27c..af5b0af65076b10bcca3b8b160ed2345e8fe4bd5 100644 (file)
@@ -11,12 +11,12 @@ class divListUsers extends MultiSelectWindow
   var $Regex              = "*";
 
   /* CheckBoxes */
-  var $ShowTemplates        ;
-  var $ShowFunctionalUsers  ;
-  var $ShowUnixUsers        ;
-  var $ShowMailUsers        ;
-  var $ShowSambaUsers       ;
-  var $ShowProxyUsers       ;
+  var $ShowTemplates ;
+  var $ShowFunctionalUsers;
+  var $ShowUnixUsers;
+  var $ShowMailUsers;
+  var $ShowSambaUsers;
+  var $ShowProxyUsers;
 
   /* Subsearch checkbox */
   var $SubSearch              = false;
@@ -31,12 +31,6 @@ class divListUsers extends MultiSelectWindow
     $this->parent       = $parent;
     $this->ui           = get_userinfo();
 
-    /* Set default base */
-    if(!isset($_SESSION['CurrentMainBase'])){
-      $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
-    }
-    $this->selectedBase = $_SESSION['CurrentMainBase'];
-
     /* Set list strings */
     $this->SetTitle(_("List of users"));
     $this->SetSummary(_("List of users"));
@@ -51,18 +45,24 @@ class divListUsers extends MultiSelectWindow
     $this->EnableCloseButton(false);
     $this->EnableSaveButton (false);
 
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 88;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
+    }
+
     /* set Page header */
     $this->AddHeader(array("string"=>" ",          "attach"=>"style='width:20px;'"));
     $this->AddHeader(array("string"=>_("Username")." / "._("Department")));
     $this->AddHeader(array("string"=>_("Properties"),   "attach" => "style='width:152px;'"));
-    $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:102px;border-right:0px;text-align:right;'"));
+    $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
     
-    $this->AddCheckBox("ShowTemplates"      ,_("Select to see template pseudo users")               ,_("Show templates")        ,true);
-    $this->AddCheckBox("ShowFunctionalUsers",_("Select to see users that   have only a GOsa object"),_("Show functional users") ,true);
-    $this->AddCheckBox("ShowUnixUsers"      ,_("Select to see users that have posix settings")      ,_("Show unix users")       ,true);
-    $this->AddCheckBox("ShowMailUsers"      ,_("Select to see users that have mail settings")       ,_("Show mail users")       ,true);
-    $this->AddCheckBox("ShowSambaUsers"     ,_("Select to see users that have samba settings")      ,_("Show samba users")      ,true);
-    $this->AddCheckBox("ShowProxyUsers"     ,_("Select to see users that have proxy settings")      ,_("Show proxy users")      ,true);
+    $this->AddCheckBox("ShowTemplates"      ,_("Select to see template pseudo users")               ,_("Show templates")        , false);
+    $this->AddCheckBox("ShowFunctionalUsers",_("Select to see users that have only a GOsa object"),_("Show functional users") , true);
+    $this->AddCheckBox("ShowUnixUsers"      ,_("Select to see users that have posix settings")      ,_("Show unix users")       , true);
+    $this->AddCheckBox("ShowMailUsers"      ,_("Select to see users that have mail settings")       ,_("Show mail users")       , true);
+    $this->AddCheckBox("ShowSambaUsers"     ,_("Select to see users that have samba settings")      ,_("Show samba users")      , true);
+    $this->AddCheckBox("ShowProxyUsers"     ,_("Select to see users that have proxy settings")      ,_("Show proxy users")      , true);
 
     /* Add SubSearch checkbox */
     $this->AddCheckBox(SEPERATOR);
@@ -72,6 +72,7 @@ class divListUsers extends MultiSelectWindow
     $this->AddRegex   ("Regex",     _("Display users matching"),"*" , true);
   }
 
+
   function GenHeader()
   {
     /* Prepare departments,
@@ -103,8 +104,9 @@ class divListUsers extends MultiSelectWindow
       title='"._("Go to users department")."' alt='"._("Home")."'            name='dep_home'> ".
       " <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_user.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/list_new_user.png' 
       title='"._("Create new user")."' alt='"._("New user")."'           name='user_new'>&nbsp;".
       " <input class='center' type='image' align='middle' src='images/list_new.png' 
       title='"._("Create new template")."' alt='"._("New template")."'        name='user_tplnew'>&nbsp;".
@@ -138,34 +140,25 @@ class divListUsers extends MultiSelectWindow
     $tplimg     = "<img class='center' src='images/select_template.png' alt='Template' title='%s'>";
     $editlink   = "<a href='?plug=".validate($_GET['plug'])."&amp;id=%s&amp;act=edit_entry'>%s</a>";
 
-    /* Create action icons */
-    $action = "";
-    if($this->parent->CopyPasteHandler){
-      $action .= "<input class='center' type='image'
-        src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-      $action.= "<input class='center' type='image'
-        src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 88;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 38;
     }
-    $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
-      name='user_edit_%KEY%' title='"._("Edit user")."'>";
-    $action.= "<input class='center' type='image' src='images/list_password.png' alt='"._("password")."'
-      name='user_chgpw_%KEY%' title='"._("Change password")."'>";
-    $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
-      name='user_del_%KEY%' title='"._("Delete user")."'>";
-    
+
     /* Possilbe objectClass image combinations */  
     $possibleAccounts = array(
             "posixAccount"    => array("VAR"=>"posix"     ,"IMG"=>"posiximg"),
-            "gotoEnvironment" => array("VAR"=>"enviro"    ,"IMG"=>"enviro"),
+            "gotoEnvironment" => array("VAR"=>"enviro"    ,"IMG"=>"eviroimg"),
             "gosaMailAccount" => array("VAR"=>"maila"     ,"IMG"=>"mailimg"),
             "goFaxAccount"    => array("VAR"=>"faxac"     ,"IMG"=>"faximg"),
             "sambaSamAccount" => array("VAR"=>"samba"     ,"IMG"=>"sambaimg"),
             "apple-user"      => array("VAR"=>"netatalk"  ,"IMG"=>"netatalkimg"));
 
      /* Pictures for Extensions */
-    $usrimg   ="<input class='center' type='image' src='images/penguin.png' alt='"._("GOsa")."'
+    $usrimg   ="<input class='center' type='image' src='images/select_user.png' alt='"._("GOsa")."'
                     name='user_edit_%KEY%-user' title='"._("Edit generic properties")."'>";
-    $posiximg = "<input class='center' type='image' src='images/select_user.png' alt='"._("Posix")."'
+    $posiximg = "<input class='center' type='image' src='images/penguin.png' alt='"._("Posix")."'
                     name='user_edit_%KEY%-posixAccount' title='"._("Edit UNIX properties")."'>";
     $eviroimg = "<input class='center' type='image' src='images/smallenv.png' alt='"._("Environment")."'
                     name='user_edit_%KEY%-environment' title='"._("Edit environment properties")."'>";
@@ -217,6 +210,22 @@ class divListUsers extends MultiSelectWindow
     // Test Every Entry and generate divlist Array
     foreach($list as $key => $val){
 
+      /* Create action icons */
+      $action = $this->GetSnapShotActions($val['dn']);
+      if($this->parent->CopyPasteHandler){
+        $action .= "<input class='center' type='image'
+          src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        $action.= "<input class='center' type='image'
+          src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+      }
+      $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
+        name='user_edit_%KEY%' title='"._("Edit user")."'>";
+      $action.= "<input class='center' type='image' src='images/list_password.png' alt='"._("password")."'
+        name='user_chgpw_%KEY%' title='"._("Change password")."'>";
+      $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
+        name='user_del_%KEY%' title='"._("Delete user")."'>";
+
+
       /* Create phonaccopunt informationm, if conencted && is phoneAccount */ 
       $connected  = ""; // This string represents timestamp or offline status
       $ip_port    = ""; // String that will represent ip : port of the connected phone
@@ -284,10 +293,10 @@ class divListUsers extends MultiSelectWindow
 
       /* Create each field */
       $field1 = array("string" => sprintf($tpl,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
-      $field2 = array("string" => sprintf($editlink,$key,$display).$ip_port, "attach" => "style='' title='dn:&nbsp;".@LDAP::fix($val['dn'])."'");
+      $field2 = array("string" => sprintf($editlink,$key,$display).$ip_port, "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
       $field3 = array("string" => $UseImg, "attach" => "style='width:152px;'");
       $field4 = array("string" => $s_img_create_from_template.preg_replace("/%KEY%/", "$key", $action),
-                      "attach" => "style='width:102px;border-right:0px;    text-align:right;'");
+                      "attach" => "style='width:".$action_col_size."px;border-right:0px;    text-align:right;'");
       /* Add to list */
       $add = array($field1,$field2,$field3,$field4);
       $this->AddElement($add);
@@ -318,54 +327,6 @@ class divListUsers extends MultiSelectWindow
   {
     /* Save automatic created POSTs like regex, checkboxes */
     MultiSelectWindow::save_object();   
-
-    $s_action ="";
-    foreach($_POST as $key => $value){
-      if(preg_match("/^dep_back.*/i",$key)){
-        $s_action="back";
-      }elseif(preg_match("/^dep_root.*/",$key)){
-        $s_action="root";
-      }elseif(preg_match("/^dep_home.*/i",$key)){
-        $s_action="home";
-      }
-    }
-   
-    /* Save base selection from headpage selectbox*/ 
-    if(isset($_POST['CurrentMainBase'])){
-      $this->selectedBase = $_POST['CurrentMainBase'];
-    }
-
-    /* Homebutton is posted */
-    if($s_action=="home"){
-      $ui= get_userinfo();
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
-      $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
-    }
-
-    /* Open selected department 
-       this is posted by the parent class MultiSelectWindow */
-    if(isset($_GET['act'])&& ($_GET['act'] == "dep_open")){
-      $s_entry = base64_decode($_GET['dep_id']);
-      $this->selectedBase = $this->config->departments[trim($s_entry)];
-    }
-
-    /* back to the roots ^^ */
-    if($s_action=="root"){
-      $this->selectedBase=($this->config->current['BASE']);
-    }
-
-    /* If Backbutton is Posted */
-    if($s_action=="back"){
-      $base_back          = preg_replace("/^[^,]+,/","",$this->selectedBase);
-      $base_back          = convert_department_dn($base_back);
-      if(isset($this->config->departments[trim($base_back)])){
-        $this->selectedBase= $this->config->departments[trim($base_back)];
-      }else{
-        $this->selectedBase= $this->config->departments["/"];
-      }
-    }
-
-    $_SESSION['CurrentMainBase']  = $this->selectedBase;
   }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: