From 87fc81936416bd3851c8327a8fad87d930f1183c Mon Sep 17 00:00:00 2001 From: inoshperera Date: Wed, 26 Oct 2016 15:17:52 +0530 Subject: [PATCH] fixing EMM-1788 calDAV policy validation issue --- .../public/js/policy-create.js | 37 ++++++++---------- .../templates/hidden-operations-ios.hbs | 2 +- .../mdm.unit.policy.edit/public/js/edit.js | 39 ++++++++----------- .../templates/hidden-operations-ios-edit.hbs | 2 +- 4 files changed, 35 insertions(+), 45 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js index bcef26ec8..9c7079260 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/js/policy-create.js @@ -1843,28 +1843,23 @@ validateStep["policy-profile"] = function () { if (continueToCheckNextInputs) { var calendarAccountPort = $("input#calendar-account-port").val(); - if (!calendarAccountPort) { - validationStatus = { - "error": true, - "subErrorMsg": "Account Port is empty. You cannot proceed.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!$.isNumeric(calendarAccountPort)) { - validationStatus = { - "error": true, - "subErrorMsg": "Account Port requires a number input.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!inputIsValidAgainstRange(calendarAccountPort, 0, 65535)) { - validationStatus = { - "error": true, - "subErrorMsg": "Account Port is not within the range " + + if (calendarAccountPort) { + if (!$.isNumeric(calendarAccountPort)) { + validationStatus = { + "error": true, + "subErrorMsg": "Account Port requires a number input.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } else if (!inputIsValidAgainstRange(calendarAccountPort, 0, 65535)) { + validationStatus = { + "error": true, + "subErrorMsg": "Account Port is not within the range " + "of valid port numbers.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } } } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-ios.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-ios.hbs index 761bd4847..162582c6f 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-ios.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-ios.hbs @@ -3236,7 +3236,7 @@ + placeholder="[ Optional field which requires Number Input ]"/>
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js index 3e2728ca1..49841cefc 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/js/edit.js @@ -1603,28 +1603,23 @@ validateStep["policy-profile"] = function () { if (continueToCheckNextInputs) { var calendarAccountPort = $("input#calendar-account-port").val(); - if (!calendarAccountPort) { - validationStatus = { - "error": true, - "subErrorMsg": "Account Port is empty. You cannot proceed.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!$.isNumeric(calendarAccountPort)) { - validationStatus = { - "error": true, - "subErrorMsg": "Account Port requires a number input.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!inputIsValidAgainstRange(calendarAccountPort, 0, 65535)) { - validationStatus = { - "error": true, - "subErrorMsg": "Account Port is not within the range " + - "of valid port numbers.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; + if (calendarAccountPort) { + if (!$.isNumeric(calendarAccountPort)) { + validationStatus = { + "error": true, + "subErrorMsg": "Account Port requires a number input.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } else if (!inputIsValidAgainstRange(calendarAccountPort, 0, 65535)) { + validationStatus = { + "error": true, + "subErrorMsg": "Account Port is not within the range " + + "of valid port numbers.", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } } } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-ios-edit.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-ios-edit.hbs index 3359b8c21..657ad4893 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-ios-edit.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.edit/public/templates/hidden-operations-ios-edit.hbs @@ -3339,7 +3339,7 @@ + placeholder="[ Optional field which requires Number Input ]"/>