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.');
return;
}
// TODO: below is not an error, should add "message" template
return new TemplateResponse('', 'error', array(
'errors' => array(array(
'error' => $this->l10n->t('Verification email successfully sent.'),
'hint' => ''
))
), 'error');
return new TemplateResponse('registration', 'message', array('msgs' =>
$this->l10n->t('Verification email successfully sent.')
));
}
/**
@ -150,15 +146,9 @@ class RegisterController extends Controller {
))
), 'error');
}
// TODO: below is not an error, should add "message" template
return new TemplateResponse('', 'error', array(
'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');
return new TemplateResponse('registration', 'message', array('msgs' =>
$this->l10n->t('Your account has been successfully created, you can <a href="{link}">log in now</a>.')
));
}
}
}

View File

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