From cc628c378a74a57716caa525eecf24dcdd31dabc Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 5 Feb 2014 23:36:01 +0000 Subject: [PATCH] Use egw_framework::message() instead of a label in template, which might stay longer than we want --- addressbook/inc/class.addressbook_ui.inc.php | 11 ++++++++--- calendar/inc/class.calendar_uilist.inc.php | 5 ++++- filemanager/inc/class.filemanager_ui.inc.php | 18 +++++++++++------- infolog/inc/class.infolog_ui.inc.php | 5 +++-- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index d4a8a1e657..e0a6f552b2 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -144,11 +144,14 @@ class addressbook_ui extends addressbook_bo $success,$failed,$action_msg,$content['do_email'] ? 'email' : 'index',$msg,$content['nm']['checkboxes'])) { $msg .= lang('%1 contact(s) %2',$success,$action_msg); + egw_framework::message($msg); } elseif(is_null($msg)) { $msg .= lang('%1 contact(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); + egw_framework::message($msg,'error'); } + $msg = ''; } } if ($content['nm']['rows']['infolog']) @@ -186,9 +189,11 @@ class addressbook_ui extends addressbook_bo 'do_email' => $do_email, ); $to = $content['nm']['to']; - $content = array( - 'msg' => $msg ? $msg : $_GET['msg'], - ); + $content = array(); + if($msg || $_GET['msg']) + { + egw_framework::message($msg ? $msg : $_GET['msg']); + } $content['nm'] = egw_session::appsession($do_email ? 'email' : 'index','addressbook'); if (!is_array($content['nm'])) diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index e7a5ba87ae..fc114ba838 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -144,7 +144,6 @@ class calendar_uilist extends calendar_ui } $content = array( 'nm' => egw_session::appsession('calendar_list','calendar'), - 'msg' => $msg, ); if (!is_array($content['nm'])) { @@ -212,6 +211,10 @@ class calendar_uilist extends calendar_ui 'em; overflow: auto; }}'; } + if($msg) + { + egw_framework::message($msg); + } $html = $etpl->exec('calendar.calendar_uilist.listview',$content,$sel_options,$readonlys,array(),$home ? -1 : 0); // Not sure why this has to be echoed instead of appended, but that's what works. diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 2c8565768e..8bcf6896a8 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -359,13 +359,15 @@ class filemanager_ui require_once EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate.inc.php'; $tpl = new etemplate_new('filemanager.index'); - $content['nm']['msg'] = $msg; + if($msg) egw_framework::message($msg); if (($content['nm']['action'] || $content['nm']['rows']) && (empty($content['button']) || !isset($content['button']))) { if ($content['nm']['action']) { - $content['nm']['msg'] = self::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); + $msg = self::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); + if($msg) egw_framework::message($msg); + // clean up after action unset($content['nm']['selected']); // reset any occasion where action may be stored, as it may be ressurected out of the helpers by etemplate, which is quite unconvenient in case of action delete @@ -377,7 +379,9 @@ class filemanager_ui } elseif($content['nm']['rows']['delete']) { - $content['nm']['msg'] = self::action('delete',array_keys($content['nm']['rows']['delete']),$content['nm']['path']); + $msg = self::action('delete',array_keys($content['nm']['rows']['delete']),$content['nm']['path']); + if($msg) egw_framework::message($msg); + // clean up after action unset($content['nm']['rows']['delete']); // reset any occasion where action may be stored, as we use ['nm']['rows']['delete'] anyhow @@ -408,7 +412,7 @@ class filemanager_ui case 'upload': if (!$content['upload']) { - $content['nm']['msg'] = lang('You need to select some files first!'); + egw_framework::message(lang('You need to select some files first!'),'error'); break; } $upload_success = $upload_failure = array(); @@ -430,12 +434,12 @@ class filemanager_ui $content['nm']['msg'] = ''; if ($upload_success) { - $content['nm']['msg'] = count($upload_success) == 1 && !$upload_failure ? lang('File successful uploaded.') : - lang('%1 successful uploaded.',implode(', ',$upload_success)); + egw_framework::message( count($upload_success) == 1 && !$upload_failure ? lang('File successful uploaded.') : + lang('%1 successful uploaded.',implode(', ',$upload_success))); } if ($upload_failure) { - $content['nm']['msg'] .= ($upload_success ? "\n" : '').lang('Error uploading file!')."\n".etemplate::max_upload_size_message(); + egw_framework::message(lang('Error uploading file!')."\n".etemplate::max_upload_size_message(),'error'); } break; } diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index 8901af1d75..3519b3c931 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -687,19 +687,21 @@ class infolog_ui $success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications'])) { $msg .= lang('%1 entries %2',$success,$action_msg); + egw_framework::message($msg); } elseif(is_null($msg)) { $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); + egw_framework::message($msg,'error'); } elseif($msg) { $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); + egw_framework::message($msg,'error'); } unset($values['nm']['multi_action']); unset($values['nm']['select_all']); } - $values['msg'] = $msg; } if (!$action) { @@ -745,7 +747,6 @@ class infolog_ui if (!$values['nm']['session_for'] && $this->called_by) $values['nm']['session_for'] = $this->called_by; - $values['msg'] = $_GET['msg']; $action_id = $values['action_id'] = $action ? $action_id : $nm['action_id']; $action_title = $values['action_title'] = $action ? $action_title : $nm['action_title']; $action = $values['action'] = $action ? $action : $nm['action'];