Code

Added new kind of selection dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 10:32:19 +0000 (10:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 10:32:19 +0000 (10:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15360 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc

index 56a01d94c81ad58ecc6202f6ba29d237c035eb9f..9ad9f3b134520387b2a4e952daec3e27a3803533 100644 (file)
@@ -415,17 +415,14 @@ class printgeneric extends plugin
       $smarty->assign("$attr", $this->$attr);
     }
 
+    // Act on add user/grouo requests 
     if(isset($_POST['AddUser'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser",$this->member);
-    }
-    if(isset($_POST['AddGroup'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddGroup",$this->member);
+      $this->userSelect = new userGroupSelect($this->config, get_userinfo());
+      $this->dialog = TRUE;
     }
     if(isset($_POST['AddAdminUser'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminUser",$this->member);
-    }
-    if(isset($_POST['AddAdminGroup'])){
-      $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminGroup",$this->member);
+      $this->adminUserSelect = new userGroupSelect($this->config, get_userinfo());
+      $this->dialog = TRUE;
     }
 
     /* Display ppd configure/select dialog      */
@@ -528,23 +525,34 @@ class printgeneric extends plugin
     }
 
     /* Save selected users / groups */
-    if(isset($_POST['PrinterSave'])){
-      $this->dialog->save_object();
-      if(count($this->dialog->check())){
-        foreach($this->dialog->check() as $msg){
-          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
-        }
-      }else{
-        $data= $new = $this->dialog->save();
-        unset($data['type']);
-        foreach($data as $mem){
-          $this->AddMember($new['type'], $mem['dn']);
-        }
-        unset($this->dialog);
-        $this->dialog=FALSE;
+    if(isset($_POST['userGroupSelect_save'])){
+
+      $users = array();
+      if($this->userSelect instanceOf userGroupSelect){
+        $users = $this->userSelect->save();
+      }elseif($this->adminUserSelect instanceOf userGroupSelect){
+        $users = $this->adminUserSelect->save();
+      }
+      
+      foreach($users as $user){
+
+        print_a($user);
+#       foreach($data as $mem){
+#         $this->AddMember($new['type'], $mem['dn']);
+#       }
       }
+      $this->dialog=FALSE;
+      $this->userSelect = NULL;
+      $this->adminUserSelect = NULL;
+    }
+
+    if($this->userSelect instanceOf userGroupSelect){
+      return($this->userSelect->execute());
+    }elseif($this->adminUserSelect instanceOf userGroupSelect){
+      return($this->adminUserSelect->execute());
     }
 
+
     /* Display dialog, if there is currently one open*/
     if(is_object($this->dialog)){
       $this->dialog->save_object();