Add msg_type to callWizard to be able to set message type when we call emailadminWizard

This commit is contained in:
Hadi Nategh 2014-08-08 16:23:02 +00:00
parent c8d15f7474
commit c9069a7386
2 changed files with 11 additions and 9 deletions

View File

@ -834,7 +834,7 @@ class emailadmin_wizard
// app is trying to tell something, while redirecting to wizard
if (empty($content) && $_GET['acc_id'] && empty($msg) && !empty( $_GET['msg']))
{
if (stripos($_GET['msg'],'fatal error:')!==false) $msg_type = 'error';
if (stripos($_GET['msg'],'fatal error:')!==false || $_GET['msg_type'] == 'error') $msg_type = 'error';
}
if ($content['acc_id'] || (isset($_GET['acc_id']) && (int)$_GET['acc_id'] > 0) ) emailadmin_imapbase::unsetCachedObjects($content['acc_id']?$content['acc_id']:$_GET['acc_id']);
$tpl = new etemplate_new('emailadmin.account');

View File

@ -142,7 +142,7 @@ class mail_ui
catch (Exception $e)
{
// redirect to mail wizard to handle it (redirect works for ajax too)
self::callWizard($e->getMessage());
self::callWizard($e->getMessage(),true,'error');
}
if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,'',__METHOD__.__LINE__);
}
@ -152,8 +152,9 @@ class mail_ui
*
* @param string $message
* @param boolean $exit If true, will call common::egw_exit() after opening the wizardpopup
* @param string $msg_type = 'success' message type
*/
static function callWizard($message, $exit=true)
static function callWizard($message, $exit=true, $msg_type='success')
{
//error_log(__METHOD__."('$message', $exit) ".function_backtrace());
$linkData=(self::$icServerID ? array(
@ -162,7 +163,8 @@ class mail_ui
) : array(
'menuaction' => 'mail.mail_wizard.add',
)) + array(
'msg' => $message
'msg' => $message,
'msg_type' => $msg_type
);
if (egw_json_response::isJSONResponse())
@ -679,7 +681,7 @@ class mail_ui
}
catch (Exception $e)
{
self::callWizard($e->getMessage());
self::callWizard($e->getMessage(),true, 'error');
}
return $etpl->exec('mail.mail_ui.index',$content,$sel_options,$readonlys,$preserv);
}
@ -807,7 +809,7 @@ class mail_ui
$folderObjects=array();
if ($_popWizard)
{
self::callWizard($e->getMessage(), false);
self::callWizard($e->getMessage(), false, 'error');
}
$c = 1;
}
@ -1573,7 +1575,7 @@ class mail_ui
{
$sortResultwH=array();
$sR=array();
self::callWizard($e->getMessage(), false);
self::callWizard($e->getMessage(), false, 'error');
}
$response = egw_json_response::get();
// unlock immediately after fetching the rows
@ -2299,7 +2301,7 @@ class mail_ui
$sieveServer->retrieveRules();
$vacation = $sieveServer->getVacation();
} catch (PEAR_Exception $ex) {
$this->callWizard($ex->getMessage());
$this->callWizard($ex->getMessage(), true, 'error');
}
}
//error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Vacation retrieved:'.array2string($vacation));
@ -3873,7 +3875,7 @@ class mail_ui
$this->changeProfile($icServerID);
}
catch (Exception $e) {
self::callWizard($e->getMessage(),true);
self::callWizard($e->getMessage(),true, 'error');
}
}