From fd8482f50f29a451b5b203b0da7cc2e716100533 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 19 Sep 2007 12:05:45 +0000 Subject: [PATCH] Updated message box git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7327 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/include/focus.js | 3 +++ html/main.php | 16 ++++++++++++---- ihtml/themes/default/msg_dialog.tpl | 2 +- include/class_msg_dialog.inc | 24 ++++++++++++++++++------ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/html/include/focus.js b/html/include/focus.js index 57fbf0006..3f832476f 100644 --- a/html/include/focus.js +++ b/html/include/focus.js @@ -461,6 +461,8 @@ function next_msg_dialog() var cur_id = document.getElementById('current_msg_dialogs').value; if(cur_id != ""){ hide('e_layer2' + cur_id); + document.getElementById('closed_msg_dialogs').value += "," + cur_id; + document.getElementById('current_msg_dialogs').value= ""; } } @@ -478,6 +480,7 @@ function next_msg_dialog() ele.style.display= 'block' ; document.getElementById('pending_msg_dialogs').value= tmp; document.getElementById('current_msg_dialogs').value= i_id; + } } } diff --git a/html/main.php b/html/main.php index 1481915cc..f95af8a5a 100644 --- a/html/main.php +++ b/html/main.php @@ -359,10 +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); +if(isset($_GET['add'])){ +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); @@ -384,6 +386,12 @@ if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){ $focus.= 'document.forms[0].error_accept.focus();'; $focus.= ''; } + + $focus= ''; + + $smarty->assign("focus", $focus); $display= $header.$smarty->fetch(get_template_path('framework.tpl')); diff --git a/ihtml/themes/default/msg_dialog.tpl b/ihtml/themes/default/msg_dialog.tpl index 57c1a7ff3..85246df89 100644 --- a/ihtml/themes/default/msg_dialog.tpl +++ b/ihtml/themes/default/msg_dialog.tpl @@ -57,7 +57,7 @@ {t}Error{/t} {elseif $i_Type == WARNING_DIALOG} {t}Warning{/t} -{elseif $i_Type == INFO_DIALOG} +{elseif $i_Type == INFO_DIALOG || $i_Type == CONFIRM_DIALOG} {t}Information{/t} {/if} diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index 08b536c08..856130496 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -56,18 +56,30 @@ class msg_dialog public static function get_dialogs() { $return =""; - $dialog_ids= ""; + $dialog_ids= ""; + + $seen = ""; + if(isset($_POST['closed_msg_dialogs'])){ + $seen = $_POST['closed_msg_dialogs']; + } + if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs'])){ + foreach($_SESSION['msg_dialogs'] as $key => $dialog){ - $return.= $dialog->execute(); - $dialog_ids= $dialog->get_ID().",".$dialog_ids; + + 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']); $dialog_ids = preg_replace("/,$/","",$dialog_ids); - $return .=""; - $return .=""; + $return .=""; + $return .=""; + $return .=""; return($return); } } -- 2.30.2