X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_msg_dialog.inc;h=8d6d633347b7cea789f70a363d993329ca047acc;hb=97422459b78af5cde7f4359d803f564dafc01507;hp=08b536c087407109a927cfb6753adab0824db0d0;hpb=0159adcf213142c3c728cdb86e97f4d1dff2d685;p=gosa.git diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index 08b536c08..8d6d63334 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -1,9 +1,10 @@ i_ID = preg_replace("/[^0-9]*/","",microtime()); $this->s_Title = $s_title; $this->s_Message = $s_message; $this->i_Type = $i_type; + $this->a_Trace = debug_backtrace(); if(!isset($_SESSION['msg_dialogs'])){ $_SESSION['msg_dialogs'] = array(); } - $_SESSION['msg_dialogs'][] = $this; + if($this->i_Type == FATAL_ERROR_DIALOG){ + restore_error_handler(); + error_reporting(E_ALL); + echo $this->execute(); + }else{ + $_SESSION['msg_dialogs'][] = $this; + } } public static function display($s_title,$s_message,$i_type = INFO_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); - } + new msg_dialog($s_title,$s_message,$i_type); } public function get_ID() @@ -43,31 +50,90 @@ class msg_dialog public function execute() { - $smarty = get_smarty(); - $smarty->assign("i_Type",$this->i_Type); - $smarty->assign("s_Message",$this->s_Message); - $smarty->assign("s_Title",$this->s_Title); - $smarty->assign("i_ID",$this->i_ID); - $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); - return($smarty->fetch(get_template_path('msg_dialog.tpl'))); + if($this->i_Type == FATAL_ERROR_DIALOG) { + $display = + " + + GOsa startup failed + + + +
+ {t}Error{/t} + + Fatal Error - GOsa execution abortet - ".$this->s_Title."
+ ".$this->s_Message."

+ "._("Please fix the above error and reload the page.")." +
"; + return($display);; + }else{ + + $smarty = get_smarty(); + $smarty->assign("s_Trace",print_a($this->a_Trace,TRUE)); + $smarty->assign("i_Type",$this->i_Type); + $smarty->assign("s_Message",$this->s_Message); + $smarty->assign("s_Title",$this->s_Title); + $smarty->assign("i_ID",$this->i_ID); + $smarty->assign("frame",false); + $smarty->assign("JS",$_SESSION['js']); + $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() { $return =""; - $dialog_ids= ""; - if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs'])){ - foreach($_SESSION['msg_dialogs'] as $key => $dialog){ + $dialog_ids= ""; + + $seen = ""; + if(isset($_POST['closed_msg_dialogs'])){ +# $seen = $_POST['closed_msg_dialogs']; + } + + if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs']) && count($_SESSION['msg_dialogs'])){ + + /* Get frame one */ + $smarty = get_smarty(); + $smarty->assign("frame", true); + $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); + $return = $smarty->fetch(get_template_path('msg_dialog.tpl')); + + if(!$_SESSION['js']){ + $dialog = array_pop($_SESSION['msg_dialogs']); $return.= $dialog->execute(); - $dialog_ids= $dialog->get_ID().",".$dialog_ids; + }else{ + foreach($_SESSION['msg_dialogs'] as $key => $dialog){ + + if(preg_match("/".$dialog->get_ID()."/",$seen)){ + unset($_SESSION['msg_dialogs'][$key]); + }else{ + $return.= $dialog->execute(); + $dialog_ids= $dialog->get_ID().",".$dialog_ids; + } + unset($_SESSION['msg_dialogs'][$key]); + } } + $dialog_ids = preg_replace("/,$/","",$dialog_ids); + + $return .= ""; + $return .=""; + $return .=""; + $return .=""; + $return .=""; } - unset($_SESSION['msg_dialogs']); - $dialog_ids = preg_replace("/,$/","",$dialog_ids); - - $return .=""; - $return .=""; return($return); } }