add validation on users cache form

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1425378 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-23 00:00:06 +00:00
parent ac4d4bb080
commit faa30809eb
1 changed files with 25 additions and 0 deletions

View File

@ -1409,6 +1409,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
}
saveRedbackRuntimeConfiguration=function(){
var valid = $("#main-content").find("#redback-runtime-general-form-id").valid();
if (valid==false) {
return;
}
$.log("saveRedbackRuntimeConfiguration");
var saveButton = $("#redback-runtime-configuration-save" );
saveButton.button('loading');
@ -1469,6 +1473,26 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
return new UserManagerImplementationInformation(data.beanId,data.descriptionKey,data.readOnly);
}
activateRedbackRuntimeGeneralFormValidation=function(){
var validator = $("#main-content" ).find("#redback-runtime-general-form-id").validate({
rules: {
usersCacheTimeToLiveSeconds : {
digits: true,
min: 1,
required: true
},
usersCacheTimeToIdleSeconds : {
digits: true,
min: 1,
required: true
}
},
showErrors: function(validator, errorMap, errorList) {
customShowError("#main-content #redback-runtime-general-form-id",validator,errorMap,errorMap);
}
});
}
displayRuntimeConfiguration=function(){
$.log("displayRuntimeConfiguration");
var mainContent = $("#main-content");
@ -1489,6 +1513,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
new RedbackRuntimeConfigurationViewModel(window.redbackRuntimeConfiguration,userManagerImplementationInformations);
mainContent.html( $("#redback-runtime-configuration-main" ).tmpl() );
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#redback-runtime-configuration-content" ).get(0));
activateRedbackRuntimeGeneralFormValidation();
}
});