From: hickert Date: Tue, 18 Sep 2007 14:00:56 +0000 (+0000) Subject: Added initial message handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f26ba868f04f17cee7e26921d0fd977a4632bfdb;p=gosa.git Added initial message handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7316 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/html/main.php b/html/main.php index b99ea8ba1..1481915cc 100644 --- a/html/main.php +++ b/html/main.php @@ -359,7 +359,12 @@ if (is_file("$plugin_dir/main.inc")){ /* Print_out last ErrorMessage repeated string. */ +#msg_dialog::display("Error" ,"Kann datei nicht schreiben, bla",ERROR_DIALOG); +#msg_dialog::display("Warning" ,"Kann datei nicht schreiben, bla",WARNING_DIALOG); +#msg_dialog::display("Info" ,"Kann datei nicht schreiben, bla",INFO_DIALOG); +#msg_dialog::display("Confirm" ,"Kann datei nicht schreiben, bla",CONFIRM_DIALOG); +$smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); $smarty->assign("contents", $display); /* Assign erros to smarty */ diff --git a/ihtml/themes/default/framework.tpl b/ihtml/themes/default/framework.tpl index 89be08a55..fd2baefc5 100644 --- a/ihtml/themes/default/framework.tpl +++ b/ihtml/themes/default/framework.tpl @@ -45,6 +45,7 @@ diff --git a/ihtml/themes/default/msg_dialog.tpl b/ihtml/themes/default/msg_dialog.tpl new file mode 100644 index 000000000..2a240615f --- /dev/null +++ b/ihtml/themes/default/msg_dialog.tpl @@ -0,0 +1,160 @@ +{if $IE} + +
+{else} +
+ +{/if} + +{if $i_Type == ERROR_DIALOG} +
+
+ {$msg_dialogs} {$contents}
+ + + + + + + +
+ {t}Error{/t} + + +

{$s_Title}

+ {$s_Message} +
+
+
+ +
+ + +{elseif $i_Type == WARNING_DIALOG} +
+ + + + + + + + +
+ {t}Warning{/t} + +

{$s_Title}

+ {$s_Message} +
+
+
+ +
+
+ +{elseif $i_Type == INFO_DIALOG} +
+ + + + + + + + +
+ {t}Information{/t} + +

{$s_Title}

+ {$s_Message} +
+ +
+
+ +{elseif $i_Type == CONFIRM_DIALOG} +
+ + + + + + + + +
+ {t}Information{/t} + +

{$s_Title}

+ {$s_Message} +
+ + +
+
+ +{/if} diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc new file mode 100644 index 000000000..5e3a7cd28 --- /dev/null +++ b/include/class_msg_dialog.inc @@ -0,0 +1,63 @@ +i_ID = preg_replace("/[^0-9]*/","",microtime()); + $this->s_Title = $s_title; + $this->s_Message = $s_message; + $this->i_Type = $i_type; + if(!isset($_SESSION['msg_dialogs'])){ + $_SESSION['msg_dialogs'] = array(); + } + $_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); + } + } + + 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'))); + } + + + public static function get_dialogs() + { + $return =""; + if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs'])){ + foreach($_SESSION['msg_dialogs'] as $key => $dialog){ + $return.= $dialog->execute(); + } + } + unset($_SESSION['msg_dialogs']); + return($return); + } +} +?>