Code

Added new style user add dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 08:44:48 +0000 (08:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 08:44:48 +0000 (08:44 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15348 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/groups/class_groupGeneric.inc
gosa-core/plugins/admin/groups/group_objects.tpl [deleted file]
gosa-core/plugins/admin/groups/userSelect/user-filter.xml
gosa-core/plugins/admin/groups/userSelect/user-list.tpl

index 184b27ae74a4e84e964a31b2700a5d5a43e253ab..c53844ae674d74a5290da7f68b5f21f906390a29 100644 (file)
@@ -49,7 +49,7 @@ class group extends plugin
   var $orig_cn= "";
   var $orig_base= "";
   var $has_mailAccount= FALSE;
-  var $group_dialog= FALSE;
+  var $userSelect= FALSE;
   var $nagios_group =FALSE;
   var $sambaGroupType;
   var $dialog;
@@ -255,24 +255,32 @@ class group extends plugin
 
     /* Add objects? */
     if (isset($_POST["edit_membership"]) && preg_match("/w/",$this->getacl("memberUid"))){
-      $this->group_dialog= TRUE;
+      $this->userSelect= new userSelect($this->config, get_userinfo());
       $this->dialog= TRUE;
     }
 
     /* Add objects finished? */
-    if (isset($_POST["add_users_finish"]) || isset($_POST["add_users_cancel"])){
-      $this->group_dialog= FALSE;
+    if (isset($_POST["add_users_cancel"])){
+      $this->userSelect= NULL;
       $this->dialog= FALSE;
     }
 
     /* Add user to group */
-    if (isset($_POST['add_users_finish']) && isset($_POST['users'])){
-      foreach ($_POST['users'] as $value){
-        $this->members["$value"]= $this->allusers[$value];
-        asort($this->members);
-        $this->addUser($value);
+    if (isset($_POST['add_users_finish']) && $this->userSelect){
+  
+      $users = $this->userSelect->detectPostActions();
+      if(isset($users['targets'])){
+        $headpage = $this->userSelect->getHeadpage();
+        foreach($users['targets'] as $dn){
+          $attrs = $headpage->getEntry($dn);
+          $value = $attrs['uid'][0];
+          $this->addUser($value);
+          $this->members["$value"]= $this->allusers[$value];
+          $this->reload();
+        }
       }
-      $this->reload();
+      $this->userSelect= NULL;
+      $this->dialog= FALSE;
     }
 
     /* Base select dialog */
@@ -377,56 +385,8 @@ class group extends plugin
     }
 
     /* Manage object add dialog */
-    if ($this->group_dialog){
-
-      /* Save data */
-      $gufilter= session::get("gufilter");
-      foreach( array("dselect", "regex") as $type){
-        if (isset($_POST[$type])){
-          $gufilter[$type]= $_POST[$type];
-        }
-      }
-      if(isset($_POST['regex'])){
-        if(isset($_POST['SubSearchGroup'])){
-          $gufilter['SubSearchGroup'] = true;
-        }else{
-          $gufilter['SubSearchGroup'] = false;
-        }
-      }
-
-      if (isset($_GET['search'])){
-        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
-        if ($s == "**"){
-          $s= "*";
-        }
-        $gufilter['regex']= $s;
-      }
-      session::set("gufilter", $gufilter);
-      $this->reload();
-
-      /* Show dialog */
-      $smarty->assign("search_image", get_template_path('images/lists/search.png'));
-      $smarty->assign("launchimage", get_template_path('images/lists/action.png'));
-      $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
-      $ui = get_userinfo();
-      $tmp = $ui->get_module_departments("users");
-      $deps = array();
-      foreach($this->config->idepartments as $dn => $name){
-        if(in_array($dn,$tmp)){
-          $deps[$dn] = $name;
-        }
-      }  
-      $smarty->assign("deplist", $deps);
-      $smarty->assign("alphabet", generate_alphabet());
-      foreach( array("dselect", "regex","SubSearchGroup") as $type){
-        $smarty->assign("$type", $gufilter[$type]);
-      }
-      $smarty->assign("hint", print_sizelimit_warning());
-      $smarty->assign("users", $this->displayUsers);
-      $smarty->assign("apply", apply_filter());
-      $display= $smarty->fetch (get_template_path('group_objects.tpl', TRUE, dirname(__FILE__)));
-      return ($display);
+    if ($this->userSelect){
+      return($this->userSelect->execute());
     }
 
     $smarty->assign("bases", $this->get_allowed_bases());
diff --git a/gosa-core/plugins/admin/groups/group_objects.tpl b/gosa-core/plugins/admin/groups/group_objects.tpl
deleted file mode 100644 (file)
index ce65168..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top; width:600px">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b><LABEL for="users">{t}Select users to add{/t}</LABEL> {$hint}</b>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select id="users" style="width:600px; height:450px; margin-top:4px;" name="users[]" size="15" multiple>
-      {html_options options=$users}
-     </select>
-     <input type=hidden name="edit_helper">
-    </p>
-   </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]"><b>{t}Filters{/t}</b></p>
-   </div>
-   <div class="contentboxb">
-     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-      {$alphabet}
-     </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-               <tr>
-                       <td>
-                               <input type=checkbox name="SubSearchGroup"  value="1" {if $SubSearchGroup == 1} checked {/if} 
-                                        onClick="mainform.submit()" title="{t}Select to see servers{/t}">{t}Search within subtree{/t}<br>
-                       </td>
-               </tr>   
-       </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-               <tr>
-                       <td>
-                               <img alt="" src="{$tree_image}" align=middle title="{t}Display users of department{/t}">
-                               &nbsp;
-                               <select name="dselect" id="dselect" size=1 onChange="mainform.submit()" 
-                                       title="{t}Choose the department the search will be based on{/t}">
-                               {html_options options=$deplist selected=$dselect}
-                       </select>
-                       </td>
-               </tr>
-       </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td style="width:18px"><img alt="" src="{$search_image}" align=middle title="{t}Display users matching{/t}"></td>
-    <td><input type='text' name='regex' maxlength='20' style='width:99%' value='{$regex}' title='{t}Regular expression for matching user names{/t}' onChange="mainform.submit()"></td></tr></table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_users_finish" value="{msgPool type=addButton}">
-  &nbsp;
-  <input type=submit name="add_users_cancel" value="{msgPool type=cancelButton}">
-</p>
-
index c082efc121846bb474e412e987a2cb6e66f4cb24..5fbe4393bc6541ea9702a2c14614a21b652c5855 100644 (file)
@@ -16,6 +16,7 @@
       <attribute>cn</attribute>
       <attribute>sn</attribute>
       <attribute>givenName</attribute>
+      <attribute>uid</attribute>
       <attribute>description</attribute>
     </query>
     <scope>auto</scope>
index f72a06a90ac3ffcdfaffc841408b228b641f032f..e461d4affda80cee78488d626546f344d8a173db 100644 (file)
   </tr>
 </table>
 
-<input type="hidden" value="1" name="PosixGroupDialogPosted">
 <p class="plugbottom">
-  <input type=submit name="add_groups_finish" value="{msgPool type=addButton}">
+  <input type=submit name="add_users_finish" value="{msgPool type=addButton}">
   &nbsp;
-  <input type=submit name="add_groups_cancel" value="{msgPool type=cancelButton}">
+  <input type=submit name="add_users_cancel" value="{msgPool type=cancelButton}">
 </p>
 
-
 <input type="hidden" name="ignore">