Code

Added msg to user deletion for testing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Sep 2007 12:27:03 +0000 (12:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Sep 2007 12:27:03 +0000 (12:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7328 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_msg_dialog.inc
plugins/admin/users/class_userManagement.inc

index 8561304962b674f39e64f6c6ded33c63bce4aaf9..2006c58e8d91646691a267e3d68d7aaca4e3012c 100644 (file)
@@ -14,6 +14,11 @@ class msg_dialog
 
        public function __construct($s_title,$s_message,$i_type)
        {
+               if(!in_array($i_type,array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG))){
+                       trigger_error("Invalid msg_dialog type.");
+                       $i_type = INFO_DIALOG;
+               }
+
                $this->i_ID      = preg_replace("/[^0-9]*/","",microtime()); 
                $this->s_Title   = $s_title;
                $this->s_Message = $s_message;
@@ -29,13 +34,6 @@ class msg_dialog
                $box = new msg_dialog($s_title,$s_message,$i_type);     
        }
 
-       public function is_confirmed()
-       {
-               if($this->i_Type == CONFIRM_DIALOG && isset($_POST['MSG_OK'])){
-                       return(TRUE);
-               }
-       }
-
        public function get_ID()
        {
                return($this->i_ID);
@@ -51,6 +49,16 @@ class msg_dialog
                $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']));
                return($smarty->fetch(get_template_path('msg_dialog.tpl')));
        }
+
+       
+       public function is_confirmed()
+       {
+               if(isset($_POST['MSG_OK'.$this->i_ID])){
+                       return(TRUE);
+               }else{
+                       return(FALSE);
+               }
+       }
        
 
        public static function get_dialogs()
index 8623b53fc68acf2036ae053f7f96db632f43b379..dd471f8ea63865558854bb31ff5e3f21732dd00a 100644 (file)
@@ -41,6 +41,8 @@ class userManagement extends plugin
 
   var $start_pasting_copied_objects = FALSE;
 
+  var $msg_dialog= NULL;
+  
   function userManagement(&$config, $ui)
   {
     /* Save configuration for internal use */
@@ -458,11 +460,13 @@ class userManagement extends plugin
         return(gen_locked_message ($user, $this->dn));
       }
 
+  
       /* Lock the current entry, so nobody will edit it during deletion */
-      add_lock ($this->dn, $this->ui->dn);
-      $smarty->assign("info", sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)));
-      $smarty->assign("multiple", false);
-      return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+#      add_lock ($this->dn, $this->ui->dn);
+#      $smarty->assign("info", sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)));
+#      $smarty->assign("multiple", false);
+#      return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      $this->msg_dialog = new msg_dialog(_("Delete user"),sprintf(_("You're about to delete the user %s."), @LDAP::fix($this->dn)),CONFIRM_DIALOG);
     }
 
 
@@ -471,7 +475,7 @@ class userManagement extends plugin
      ********************/
 
     /* Confirmation for deletion has been passed. User should be deleted. */
-    if (isset($_POST['delete_user_confirm'])){
+    if (is_object($this->msg_dialog) && $this->msg_dialog->is_confirmed()){
 
       /* Some nice guy may send this as POST, so we've to check
          for the permissions again. */