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 // app is trying to tell something, while redirecting to wizard
if (empty($content) && $_GET['acc_id'] && empty($msg) && !empty( $_GET['msg'])) 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']); 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'); $tpl = new etemplate_new('emailadmin.account');

View File

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