From: hickert Date: Wed, 19 Sep 2007 12:27:03 +0000 (+0000) Subject: Added msg to user deletion for testing X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8897673ff02c721ffc073919840facceab2a04cb;p=gosa.git Added msg to user deletion for testing git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7328 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index 856130496..2006c58e8 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -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() diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index 8623b53fc..dd471f8ea 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -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. */