mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merged from branches/2.2
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@72811 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
08a5a7c387
commit
189f0567f8
@ -623,7 +623,7 @@ class i18n extends Object {
|
||||
'lt' => array('Lithuanian', 'lietuviškai'),
|
||||
'lmo' => array('Lombard', 'Lombardo'),
|
||||
'mk' => array('Macedonian', 'македонски'),
|
||||
'mi' => array('Maori', 'Māori'),
|
||||
'mi' => array('Maori', 'Maori'),
|
||||
'ms' => array('Malay', 'Bahasa melayu'),
|
||||
'mt' => array('Maltese', 'Malti'),
|
||||
'mr' => array('Marathi', 'मराठी'),
|
||||
|
@ -31,6 +31,10 @@ class Date extends DBField {
|
||||
if($this->value) return date('d/m/Y', strtotime($this->value));
|
||||
}
|
||||
|
||||
function NiceUS() {
|
||||
if($this->value) return date('m/d/Y', strtotime($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the year from the given date
|
||||
*/
|
||||
|
@ -167,6 +167,7 @@ Behaviour.register({
|
||||
|
||||
var error = hasHadFormError();
|
||||
if(!error && fromAnOnBlur) clearErrorMessage(fromAnOnBlur);
|
||||
if(error && !fromAnOnBlur) focusOnFirstErroredField();
|
||||
|
||||
return !error;
|
||||
},
|
||||
|
@ -1,7 +1,9 @@
|
||||
var _CURRENT_FORM;
|
||||
var _FIRST_ERRORED_FIELD = null;
|
||||
|
||||
function initialiseForm(form, fromAnOnBlur) {
|
||||
_CURRENT_FORM = form;
|
||||
_FIRST_ERRORED_FIELD = null;
|
||||
|
||||
if(fromAnOnBlur) {
|
||||
limitValidationErrorsTo(fromAnOnBlur);
|
||||
@ -17,6 +19,13 @@ function hasHadFormError() {
|
||||
return _HAS_HAD_FORM_ERROR || !_ERROR_CACHE;
|
||||
}
|
||||
|
||||
function focusOnFirstErroredField() {
|
||||
try {
|
||||
_FIRST_ERRORED_FIELD.focus();
|
||||
} catch(er) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns group with the correct classname
|
||||
*/
|
||||
@ -259,6 +268,9 @@ function validationError(field,message, messageClass, cacheError) {
|
||||
// Keep a reference to it
|
||||
field.validationMessage = validationMessage;
|
||||
|
||||
// Keep a reference to the first errored field
|
||||
if(field && !_FIRST_ERRORED_FIELD) _FIRST_ERRORED_FIELD = field;
|
||||
|
||||
// Set the attributes
|
||||
validationMessage.className = "message " + messageClass;
|
||||
validationMessage.innerHTML = message;
|
||||
|
@ -193,7 +193,7 @@ class Security extends Controller {
|
||||
// Audit logging hook
|
||||
if($controller) $controller->extend('permissionDenied', $member);
|
||||
|
||||
Director::redirect("Security/login");
|
||||
Director::redirect("Security/login?BackURL=" . urlencode($_SERVER['REQUEST_URI']));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -442,6 +442,7 @@ class Security extends Controller {
|
||||
$tmpPage = new Page();
|
||||
$tmpPage->Title = _t('Security.LOSTPASSWORDHEADER');
|
||||
$tmpPage->URLSegment = 'Security';
|
||||
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
||||
$controller = new Page_Controller($tmpPage);
|
||||
$controller->init();
|
||||
|
||||
@ -479,6 +480,7 @@ class Security extends Controller {
|
||||
$tmpPage = new Page();
|
||||
$tmpPage->Title = _t('Security.CHANGEPASSWORDHEADER', 'Change your password');
|
||||
$tmpPage->URLSegment = 'Security';
|
||||
$tmpPage->ID = -1; // Set the page ID to -1 so we dont get the top level pages as its children
|
||||
$controller = new Page_Controller($tmpPage);
|
||||
$controller->init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user