Use custom message template

This commit is contained in:
Pellaeon Lin 2014-10-21 21:27:02 +08:00
parent f171294953
commit 0c71e30e79
2 changed files with 13 additions and 30 deletions

View File

@ -89,13 +89,9 @@ class RegisterController extends Controller {
\OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.'); \OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.');
return; return;
} }
// TODO: below is not an error, should add "message" template return new TemplateResponse('registration', 'message', array('msgs' =>
return new TemplateResponse('', 'error', array( $this->l10n->t('Verification email successfully sent.')
'errors' => array(array( ));
'error' => $this->l10n->t('Verification email successfully sent.'),
'hint' => ''
))
), 'error');
} }
/** /**
@ -150,15 +146,9 @@ class RegisterController extends Controller {
)) ))
), 'error'); ), 'error');
} }
// TODO: below is not an error, should add "message" template return new TemplateResponse('registration', 'message', array('msgs' =>
return new TemplateResponse('', 'error', array( $this->l10n->t('Your account has been successfully created, you can <a href="{link}">log in now</a>.')
'errors' => array(array( ));
'error' => str_replace('{link}',
$this->urlgenerator->getAbsoluteUrl('/'),
$this->l10n->t('Your account has been successfully created, you can <a href="{link}">log in now</a>.')),
'hint' => ''
))
), 'error');
} }
} }
} }

View File

@ -1,14 +1,7 @@
<?php if ( $_['errors'] ) { <ul class="error-wide">
echo '<ul class="error">'; <?php foreach($_["msgs"] as $msg):?>
foreach ( $_['errors'] as $error ) { ?> <li class='msg'>
<li><?php echo $error; ?></li> <?php print_unesacped($msg) ?><br/>
<?php } </li>
echo '</ul>'; <?php endforeach ?>
} </ul>
if ( $_['messages'] ) {
echo '<ul class="success">';
foreach ($_['messages'] as $message ) {?>
<li><?php echo $message; ?></li>
<?php }
echo '</ul>';
}?>