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:
Sam Minnee 2009-03-10 22:17:26 +00:00
parent 08a5a7c387
commit 189f0567f8
6 changed files with 23 additions and 4 deletions

View File

@ -230,4 +230,4 @@ class HTTPResponse extends Object {
return $results;
}
}
}

View File

@ -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', 'मराठी'),

View File

@ -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
*/

View File

@ -164,9 +164,10 @@ Behaviour.register({
validate : function(fromAnOnBlur) {
initialiseForm(this, fromAnOnBlur);
$code
var error = hasHadFormError();
if(!error && fromAnOnBlur) clearErrorMessage(fromAnOnBlur);
if(error && !fromAnOnBlur) focusOnFirstErroredField();
return !error;
},

View File

@ -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;

View File

@ -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();