mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
add message type to ModuleObject
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8618 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
88d86a973c
commit
de47638d12
2 changed files with 35 additions and 1 deletions
|
|
@ -314,6 +314,7 @@
|
|||
$this->error = $errorMsg;
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = -1;
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE'] = $this->error;
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error';
|
||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = $returnUrl;
|
||||
$this->_setInputValueToSession();
|
||||
return $oModule;
|
||||
|
|
@ -342,11 +343,12 @@
|
|||
{
|
||||
$error = $oModule->getError();
|
||||
$message = $oModule->getMessage();
|
||||
$messageType = $oModule->getMessageType();
|
||||
$redirectUrl = $oModule->getRedirectUrl();
|
||||
|
||||
if (!$procResult)
|
||||
{
|
||||
$this->error = $oModule->getMessage();
|
||||
$this->error = $message;
|
||||
if (!$redirectUrl) $redirectUrl = Context::get('error_return_url')?Context::get('error_return_url'):getUrl();
|
||||
$this->_setInputValueToSession();
|
||||
}
|
||||
|
|
@ -361,6 +363,7 @@
|
|||
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = $error;
|
||||
if ($message != 'success') $_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
|
||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
|
||||
}
|
||||
|
||||
|
|
@ -371,10 +374,12 @@
|
|||
{
|
||||
if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
|
||||
if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
|
||||
if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
|
||||
if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
|
||||
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = '';
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE'] = '';
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = '';
|
||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,35 @@
|
|||
function getRedirectUrl(){
|
||||
return $this->get('redirect_url');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set message
|
||||
* @param $message a message string
|
||||
* @param $type type of message (error, info, update)
|
||||
**/
|
||||
function setMessage($message, $type = null){
|
||||
parent::setMessage($message);
|
||||
$this->setMessageType($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set type of message
|
||||
* @param $type type of message (error, info, update)
|
||||
**/
|
||||
function setMessageType($type){
|
||||
$this->add('message_type', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get type of message
|
||||
**/
|
||||
function getMessageType(){
|
||||
$type = $this->get('message_type');
|
||||
if (!in_array($type, array('error', 'info', 'update'))){
|
||||
$type = $this->getError()?'error':'info';
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief sett to set the template path for refresh.html
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue