Use egw_framework::message() instead of a label in template, which might stay longer than we want

This commit is contained in:
Nathan Gray 2014-02-05 23:36:01 +00:00
parent ea7e1fbae9
commit cc628c378a
4 changed files with 26 additions and 13 deletions

View File

@ -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']))

View File

@ -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; }}</style>';
}
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.

View File

@ -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;
}

View File

@ -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'];