X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_msg_dialog.inc;h=6cd25e6d6f4c0bbe45ab5f8e05ac57ed63d30bd4;hb=f43c362c3ff296dd9270bd48f2c7feecf34b7375;hp=eba6b42bf13fb30749e978a38c451a5b5c0c7352;hpb=6b08ffcaafe0d9755aca07c6b9f624c3775c2dd0;p=gosa.git diff --git a/gosa-core/include/class_msg_dialog.inc b/gosa-core/include/class_msg_dialog.inc index eba6b42bf..6cd25e6d6 100644 --- a/gosa-core/include/class_msg_dialog.inc +++ b/gosa-core/include/class_msg_dialog.inc @@ -24,7 +24,8 @@ define("INFO_DIALOG" , 10001); define("WARNING_DIALOG" , 10002); define("ERROR_DIALOG" , 10003); define("CONFIRM_DIALOG" , 10004); -define("FATAL_ERROR_DIALOG" , 10005); +define("OK_CANCEL_DIALOG" , 10005); +define("FATAL_ERROR_DIALOG" , 10006); class msg_dialog { @@ -37,8 +38,10 @@ class msg_dialog public function __construct($s_title,$s_message,$i_type) { global $config; + + if(empty($s_message)) return; - if(!in_array($i_type,array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG))){ + if(!in_array($i_type,array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG,OK_CANCEL_DIALOG))){ trigger_error("Invalid msg_dialog type."); $i_type = INFO_DIALOG; } @@ -63,8 +66,7 @@ class msg_dialog /* Append trace information, only if error messages are enabled */ if( isset($config) && is_object($config) && - isset($config->data['MAIN']['DISPLAYERRORS']) && - preg_match("/^true$/i",$config->data['MAIN']['DISPLAYERRORS'])){ + $config->get_cfg_value("displayerrors") == "true" ){ $this->a_Trace = debug_backtrace(); } if(!session::is_set('msg_dialogs')){ @@ -83,11 +85,22 @@ class msg_dialog session::set('errorsAlreadyPosted',$errorsAlreadyPosted); } + public static function display($s_title,$s_message,$i_type = INFO_DIALOG) { new msg_dialog($s_title,$s_message,$i_type); } + + public static function displayChecks($messages) + { + /* Assemble the message array to a plain string */ + foreach ($messages as $error){ + msg_dialog::display(_("Error"), $error, ERROR_DIALOG); + } + } + + public function get_ID() { return($this->i_ID); @@ -122,7 +135,7 @@ class msg_dialog $smarty->assign("s_Title",$this->s_Title); $smarty->assign("i_ID",$this->i_ID); $smarty->assign("frame",false); - $smarty->assign("JS",session::get('js')); + $smarty->assign("JS",session::global_get('js')); $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); return($smarty->fetch(get_template_path('msg_dialog.tpl'))); } @@ -157,7 +170,7 @@ class msg_dialog $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); $return = $smarty->fetch(get_template_path('msg_dialog.tpl')); - if(!session::get('js')){ + if(!session::global_get('js')){ $dialog = array_pop(session::get('msg_dialogs')); $return.= $dialog->execute(); }else{