Code

Added checkboxes and toggle all to users list
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 Apr 2007 09:16:34 +0000 (09:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 Apr 2007 09:16:34 +0000 (09:16 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6065 594d385d-05f5-0310-b6e9-bd551577e9d8

html/include/focus.js
plugins/admin/users/class_divListUsers.inc
plugins/admin/users/class_userManagement.inc

index 3b86afac8bc4ad3cc8dbb8046340429787b84429..a8c3375f07e9d5bd9943d761c6dd5f6498cc4645 100644 (file)
@@ -27,6 +27,13 @@ function chk_set_all(regex,value)
 }
 
 
+function toggle_all_(regex,state_object)
+{
+               state = document.getElementById(state_object).checked;
+               chk_set_all(regex, state);
+}
+
+
 function scrollDown() {
   document.body.scrollTop = document.body.scrollHeight - document.body.clientHeight;
   timeout= setTimeout("scrollDown()", 500);
index 6924e034b0a11ae335f66cc20be506ea9729be8e..8a257137640957b909c3927ecdf40cb9241aeb22 100644 (file)
@@ -51,8 +51,12 @@ class divListUsers extends MultiSelectWindow
       $action_col_size += 38;
     }
 
+    /* Toggle all selected / deselected */
+    $chk = "<input type='checkbox' id='select_all' name='select_all' 
+               onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
     /* set Page header */
-    $this->AddHeader(array("string"=>"&nbsp;",          "attach"=>"style='width:20px;'"));
+    $this->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
     $this->AddHeader(array("string"=>_("Username")." / "._("Department")));
     $this->AddHeader(array("string"=>_("Properties"),   "attach" => "style='width:166px;'"));
     $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
@@ -287,13 +291,14 @@ class divListUsers extends MultiSelectWindow
       $UseImg = $usrimg2."&nbsp;".$posix."&nbsp;".$enviro."&nbsp;".$maila."&nbsp;".$fonac."&nbsp;".$faxac."&nbsp;".$samba."&nbsp;".$netatalk;
 
       /* Create each field */
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."' >");
       $field1 = array("string" => sprintf($tpl,$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" => $UseImg, "attach" => "style='width:166px;'");
       $field4 = array("string" => $s_img_create_from_template.preg_replace("/%KEY%/", "$key", $action),
                       "attach" => "style='width:".$action_col_size."px;border-right:0px;    text-align:right;'");
       /* Add to list */
-      $add = array($field1,$field2,$field3,$field4);
+      $add = array($field0,$field1,$field2,$field3,$field4);
       $this->AddElement($add);
 
       // Template or User
index 4e7337c8f028b75f5c370ac2a421c976cf61e38c..fc587889bbd36ed6580ce1e718c22120b03ca496 100644 (file)
@@ -674,7 +674,7 @@ class userManagement extends plugin
 
     /* Add departments if subsearch is disabled */
     if(!$this->DivListUsers->SubSearch){
-      $this->DivListUsers->AddDepartments($this->DivListUsers->selectedBase,4);
+      $this->DivListUsers->AddDepartments($this->DivListUsers->selectedBase,4,1);
     }
     $this->reload();
     $this->DivListUsers->setEntries($this->list);