From faa30809eb4f2a747773391012221d2b4b18e1c0 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Sun, 23 Dec 2012 00:00:06 +0000 Subject: [PATCH] add validation on users cache form git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1425378 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/webapp/js/archiva/general-admin.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index 6d3bbca90..377ff9a79 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -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(); } });