From eccf0a8dd97ae71a06e3476eca7501043f2638a4 Mon Sep 17 00:00:00 2001 From: Inosh Perara Date: Thu, 14 Mar 2019 11:02:08 +0000 Subject: [PATCH] UI for COSU policy --- .../public/js/operation-mod.js | 141 ++++- .../public/js/android-policy-edit.js | 113 +++- .../public/templates/android-policy-edit.hbs | 513 ++++++++++++++++++ .../public/templates/android-policy-view.hbs | 507 +++++++++++++++++ .../public/js/android-policy-operations.js | 116 ++++ .../templates/android-policy-operations.hbs | 511 +++++++++++++++++ 6 files changed, 1883 insertions(+), 18 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js index dd11dcaeb6..56482acb64 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js @@ -199,9 +199,55 @@ var androidOperationModule = function () { payload = { "cosuProfileRestrictionStartTime": operationPayload["cosuProfileOperationRestrictionEndTime"], "cosuProfileRestrictionEndTime": operationPayload["cosuProfileOperationRestrictionEndTime"], + "idleMediaURL" : operationPayload["deviceGlobalConfigurations"]["idleMediaURL"], + "kioskBackgroundImage": operationPayload["deviceGlobalConfigurations"]["kioskBackgroundImage"], + "kioskLogoImage" : operationPayload["deviceGlobalConfigurations"]["kioskLogoImage"], + "kioskAppName" : operationPayload["deviceGlobalConfigurations"]["kioskAppName"], + "isIdleGraphicsEnabled" : operationPayload["deviceGlobalConfigurations"]["isIdleGraphicsEnabled"], + "idleTimeout" : operationPayload["deviceGlobalConfigurations"]["idleTimeout"], + "isMultiUserDevice" : operationPayload["deviceGlobalConfigurations"]["isMultiUserDevice"], + "isLoginRequired" : operationPayload["deviceGlobalConfigurations"]["isLoginRequired"], + "displayOrientation" : operationPayload["deviceGlobalConfigurations"]["displayOrientation"], "primaryURL": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["primaryURL"], + "isTopBarEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isTopBarEnabled"], "isAddressBarEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"] - ["isAddressBarEnabled"] + ["isAddressBarEnabled"], + + "showBackController": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["showBackController"], + "isForwardControllerEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isForwardControllerEnabled"], + "isHomeButtonEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isHomeButtonEnabled"], + "isReloadEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isReloadEnabled"], + "lockToPrimaryURL": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["lockToPrimaryURL"], + "isJavascriptEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isJavascriptEnabled"], + "isTextCopyEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isTextCopyEnabled"], + "isDownloadsEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isDownloadsEnabled"], + "isLockedToBrowser": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isLockedToBrowser"], + "isFormAutoFillEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isFormAutoFillEnabled"], + "isContentAccessEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isContentAccessEnabled"], + "isFileAccessAllowed": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isFileAccessAllowed"], + "isAllowedUniversalAccessFromFileURLs": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isAllowedUniversalAccessFromFileURLs"], + "isAllowedFileAccessFromFileURLs": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isAllowedFileAccessFromFileURLs"], + "isAppCacheEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isAppCacheEnabled"], + "appCachePath": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["appCachePath"], + "cacheMode": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["cacheMode"], + "isLoadsImagesAutomatically": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isLoadsImagesAutomatically"], + "isBlockNetworkImage": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isBlockNetworkImage"], + "isBlockNetworkLoads": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isBlockNetworkLoads"], + "isSupportZoomEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isSupportZoomEnabled"], + "isDisplayZoomControls": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isDisplayZoomControls"], + "textZoom": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["textZoom"], + "defaultFontSize": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["defaultFontSize"], + "defaultTextEncodingName": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["defaultTextEncodingName"], + "isDatabaseEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isDatabaseEnabled"], + "isDomStorageEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isDomStorageEnabled"], + "geolocationEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["geolocationEnabled"], + "isJavaScriptCanOpenWindowsAutomatically": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isJavaScriptCanOpenWindowsAutomatically"], + "isMediaPlaybackRequiresUserGesture": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isMediaPlaybackRequiresUserGesture"], + "isSafeBrowsingEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isSafeBrowsingEnabled"], + "isUseWideViewPort": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["isUseWideViewPort"], + "userAgentString": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["userAgentString"], + "mixedContentMode": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["mixedContentMode"] + }; break; case androidOperationConstants["KIOSK_APPS_CODE"]: @@ -398,18 +444,87 @@ var androidOperationModule = function () { break; case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]: operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "cosuProfileRestrictionStartTime": operationData["cosuProfileOperationRestrictionStartTime"], - "cosuProfileRestrictionEndTime": operationData["cosuProfileOperationRestrictionEndTime"], - "deviceGlobalConfigurations" : { - "browserProperties": { - "primaryURL": operationData["primaryURL"], - "isAddressBarEnabled": operationData["isAddressBarEnabled"] - } - } - } - }; + payload = {}; + operation = {}; + operation["cosuProfileRestrictionStartTime"] = + operationData["cosuProfileOperationRestrictionStartTime"]; + operation["cosuProfileRestrictionEndTime"] = operationData["cosuProfileOperationRestrictionEndTime"]; + + deviceGlobalConfigurations = {}; + if (operationData["idleMediaURL"]) { + deviceGlobalConfigurations["idleMediaURL"] = operationData["idleMediaURL"]; + } + if (operationData["kioskBackgroundImage"]) { + deviceGlobalConfigurations["kioskBackgroundImage"] = operationData["kioskBackgroundImage"]; + } + if (operationData["kioskLogoImage"]) { + deviceGlobalConfigurations["kioskLogoImage"] = operationData["kioskLogoImage"]; + } + if (operationData["kioskAppName"]) { + deviceGlobalConfigurations["kioskAppName"] = operationData["kioskAppName"]; + } + deviceGlobalConfigurations["isIdleGraphicsEnabled"] = operationData["isIdleGraphicsEnabled"]; + if (operationData["idleTimeout"]) { + deviceGlobalConfigurations["idleTimeout"] = operationData["idleTimeout"]; + } + deviceGlobalConfigurations["isMultiUserDevice"] = operationData["isMultiUserDevice"]; + deviceGlobalConfigurations["isLoginRequired"] = operationData["isLoginRequired"]; + deviceGlobalConfigurations["displayOrientation"] = operationData["displayOrientation"]; + + browserProperties = {}; + if (operationData["primaryURL"]) { + browserProperties["primaryURL"] = operationData["primaryURL"]; + browserProperties["isTopBarEnabled"] = operationData["isTopBarEnabled"]; + browserProperties["isAddressBarEnabled"] = operationData["isAddressBarEnabled"]; + browserProperties["showBackController"] = operationData["showBackController"]; + browserProperties["isForwardControllerEnabled"] = operationData["isForwardControllerEnabled"]; + browserProperties["isHomeButtonEnabled"] = operationData["isHomeButtonEnabled"]; + browserProperties["isReloadEnabled"] = operationData["isReloadEnabled"]; + browserProperties["lockToPrimaryURL"] = operationData["lockToPrimaryURL"]; + browserProperties["isJavascriptEnabled"] = operationData["isJavascriptEnabled"]; + browserProperties["isTextCopyEnabled"] = operationData["isTextCopyEnabled"]; + browserProperties["isDownloadsEnabled"] = operationData["isDownloadsEnabled"]; + browserProperties["isLockedToBrowser"] = operationData["isLockedToBrowser"]; + browserProperties["isFormAutoFillEnabled"] = operationData["isFormAutoFillEnabled"]; + browserProperties["isContentAccessEnabled"] = operationData["isContentAccessEnabled"]; + browserProperties["isFileAccessAllowed"] = operationData["isFileAccessAllowed"]; + browserProperties["isAllowedUniversalAccessFromFileURLs"] = operationData["isAllowedUniversalAccessFromFileURLs"]; + browserProperties["isAllowedFileAccessFromFileURLs"] = operationData["isAllowedFileAccessFromFileURLs"]; + browserProperties["isAppCacheEnabled"] = operationData["isAppCacheEnabled"]; + if (operationData["isAppCacheEnabled"] && operationData["appCachePath"]) { + browserProperties["appCachePath"] = operationData["appCachePath"]; + } + browserProperties["cacheMode"] = operationData["cacheMode"]; + browserProperties["isLoadsImagesAutomatically"] = operationData["isLoadsImagesAutomatically"]; + browserProperties["isBlockNetworkImage"] = operationData["isBlockNetworkImage"]; + browserProperties["isBlockNetworkLoads"] = operationData["isBlockNetworkLoads"]; + browserProperties["isSupportZoomEnabled"] = operationData["isSupportZoomEnabled"]; + browserProperties["isDisplayZoomControls"] = operationData["isDisplayZoomControls"]; + if (operationData["textZoom"]) { + browserProperties["textZoom"] = operationData["textZoom"]; + } + if (operationData["defaultFontSize"]) { + browserProperties["defaultFontSize"] = operationData["defaultFontSize"]; + } + if (operationData["defaultTextEncodingName"]) { + browserProperties["defaultTextEncodingName"] = operationData["defaultTextEncodingName"]; + } + browserProperties["isDatabaseEnabled"] = operationData["isDatabaseEnabled"]; + browserProperties["isDomStorageEnabled"] = operationData["isDomStorageEnabled"]; + browserProperties["geolocationEnabled"] = operationData["geolocationEnabled"]; + browserProperties["isJavaScriptCanOpenWindowsAutomatically"] = operationData["isJavaScriptCanOpenWindowsAutomatically"]; + browserProperties["isMediaPlaybackRequiresUserGesture"] = operationData["isMediaPlaybackRequiresUserGesture"]; + browserProperties["isSafeBrowsingEnabled"] = operationData["isSafeBrowsingEnabled"]; + browserProperties["isUseWideViewPort"] = operationData["isUseWideViewPort"]; + if (operationData["userAgentString"]) { + browserProperties["userAgentString"] = operationData["userAgentString"]; + } + browserProperties["mixedContentMode"] = operationData["mixedContentMode"]; + deviceGlobalConfigurations.browserProperties = browserProperties; + } + operation.deviceGlobalConfigurations = deviceGlobalConfigurations; + payload.operation = operation; + break; case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]: operationType = operationTypeConstants["PROFILE"]; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js index 17d70b0c85..1f7ed3518e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js @@ -270,11 +270,95 @@ var validatePolicyProfile = function () { } // Validating COSU PROFILE CONFIGURATION if ($.inArray(androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"], configuredOperations) != -1) { - operation = androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION"]; - validationStatus = { - "error": false, - "okFeature": operation - }; + + operation = androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION"]; + var continueToCheckNextInputs = true; + + if (continueToCheckNextInputs) { + var backgroundImage = $("input#cosu-global-config-kiosk-background-image").val(); + if (backgroundImage && !(backgroundImage.endsWith("jpg") || backgroundImage.endsWith("jpeg") + || backgroundImage.endsWith("png"))) { + validationStatus = { + "error": true, + "subErrorMsg": "Launcher background image file types are jpg, jpeg and png", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var kioskLogo = $("input#cosu-global-config-kiosk-logo-image").val(); + if (kioskLogo && !(kioskLogo.endsWith("jpg") || kioskLogo.endsWith("jpeg") + || kioskLogo.endsWith("png"))) { + validationStatus = { + "error": true, + "subErrorMsg": "Company log to display file types are jpg, jpeg and png", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var idleMediaUrl = $("input#cosu-global-config-idle-media-url").val(); + if (idleMediaUrl && !(idleMediaUrl.endsWith("jpg") || idleMediaUrl.endsWith("jpeg") + || idleMediaUrl.endsWith("png") || idleMediaUrl.endsWith("mp4") + || idleMediaUrl.endsWith("3gp") || idleMediaUrl.endsWith("wmv") + || idleMediaUrl.endsWith("mkv"))) { + validationStatus = { + "error": true, + "subErrorMsg": "Idle media url file types are .jpg, .png, .jpeg, .mp4, .3gp, .wmv, .mkv", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var idleTimeout = $("input#cosu-browser-property-idle-timeout").val(); + if (idleTimeout && (!$.isNumeric(idleTimeout) || idleTimeout < 0)) { + validationStatus = { + "error": true, + "subErrorMsg": "Idle timeout must be a positive whole number", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var textZoom = $("input#cosu-browser-property-text-zoom").val(); + if (textZoom && (!$.isNumeric(textZoom) || textZoom < 0)) { + validationStatus = { + "error": true, + "subErrorMsg": "Text zoom must be a positive whole number", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var defaultFontSize = $("input#cosu-browser-property-default-font-size").val(); + if (defaultFontSize) { + if (!$.isNumeric(defaultFontSize) || !inputIsValidAgainstRange(defaultFontSize, 0, 72)) { + validationStatus = { + "error": true, + "subErrorMsg": "Default font size is a number between 0 and 72", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + } + + if (continueToCheckNextInputs) { + validationStatus = { + "error": false, + "okFeature": operation + }; + } validationStatusArray.push(validationStatus); } // Validating ENCRYPT_STORAGE @@ -741,6 +825,25 @@ var changeAndroidWifiPolicyEAP = function (select, superSelect) { } }; +/** + * Pass a div Id and a check box to view or hide div content based on checkbox value + */ +var changeDivVisibility = function (divId, checkbox) { + if (checkbox.checked) { + document.getElementById(divId).style.display= "block" + } else { + document.getElementById(divId).style.display= "none" + inputs = document.getElementById(divId).getElementsByTagName('input'); + for (index = 0; index < inputs.length; ++index) { + if (inputs[index].type == "text") { + inputs[index].value = inputs[index].defaultValue; + } else if (inputs[index].type == "checkbox") { + inputs[index].checked = inputs[index].defaultChecked; + } + } + } +}; + /** * Method to slide down a provided pane upon provided value set. * diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs index b1016204df..78723cbdc7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs @@ -1677,6 +1677,117 @@
+ +
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ + +
+ +
+ + +
+
+
+ +
+
+
+ +
+
+
+ + +
+

@@ -1702,6 +1813,17 @@ class="form-control operationDataKeys" data-key="primaryURL" maxlength="100" placeholder="[ Should be a valid URL ]"/>

+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ + +
+ +
+ + +

@@ -1729,6 +2241,7 @@ + diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs index c28539a233..da08238d81 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/public/templates/android-policy-view.hbs @@ -1281,6 +1281,111 @@
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+ + +
+
+ + +
+ +
+ +
+
+ +
+
+ + +
+

@@ -1306,6 +1411,17 @@ class="form-control operationDataKeys" data-key="primaryURL" maxlength="100" placeholder="[ Should be a valid URL ]" disabled/>

+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ + +
+ +
+ + +

diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js index e8d8574952..cd18e5051b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/js/android-policy-operations.js @@ -52,6 +52,8 @@ var androidOperationConstants = { "APPLICATION_OPERATION_CODE": "APP-RESTRICTION", "KIOSK_APPS_CODE": "KIOSK_APPS", "KIOSK_APPS": "cosu-whitelisted-applications", + "COSU_PROFILE_CONFIGURATION_OPERATION": "cosu-profile-configuration", + "COSU_PROFILE_CONFIGURATION_OPERATION_CODE": "COSU_PROFILE", "ENROLLMENT_APP_INSTALL": "enrollment-app-install", "ENROLLMENT_APP_INSTALL_CODE": "ENROLLMENT_APP_INSTALL" }; @@ -208,6 +210,101 @@ var validatePolicyProfile = function () { // updating validationStatusArray with validationStatus validationStatusArray.push(validationStatus); } + + // Validating COSU PROFILE CONFIGURATION + if ($.inArray(androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"], configuredOperations) != -1) { + + operation = androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION"]; + var continueToCheckNextInputs = true; + + if (continueToCheckNextInputs) { + var backgroundImage = $("input#cosu-global-config-kiosk-background-image").val(); + if (backgroundImage && !(backgroundImage.endsWith("jpg") || backgroundImage.endsWith("jpeg") + || backgroundImage.endsWith("png"))) { + validationStatus = { + "error": true, + "subErrorMsg": "Launcher background image file types are jpg, jpeg and png", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var kioskLogo = $("input#cosu-global-config-kiosk-logo-image").val(); + if (kioskLogo && !(kioskLogo.endsWith("jpg") || kioskLogo.endsWith("jpeg") + || kioskLogo.endsWith("png"))) { + validationStatus = { + "error": true, + "subErrorMsg": "Company log to display file types are jpg, jpeg and png", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var idleMediaUrl = $("input#cosu-global-config-idle-media-url").val(); + if (idleMediaUrl && !(idleMediaUrl.endsWith("jpg") || idleMediaUrl.endsWith("jpeg") + || idleMediaUrl.endsWith("png") || idleMediaUrl.endsWith("mp4") + || idleMediaUrl.endsWith("3gp") || idleMediaUrl.endsWith("wmv") + || idleMediaUrl.endsWith("mkv"))) { + validationStatus = { + "error": true, + "subErrorMsg": "Idle media url file types are .jpg, .png, .jpeg, .mp4, .3gp, .wmv, .mkv", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var idleTimeout = $("input#cosu-browser-property-idle-timeout").val(); + if (idleTimeout && (!$.isNumeric(idleTimeout) || idleTimeout < 0)) { + validationStatus = { + "error": true, + "subErrorMsg": "Idle timeout must be a positive whole number", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var textZoom = $("input#cosu-browser-property-text-zoom").val(); + if (textZoom && (!$.isNumeric(textZoom) || textZoom < 0)) { + validationStatus = { + "error": true, + "subErrorMsg": "Text zoom must be a positive whole number", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + + if (continueToCheckNextInputs) { + var defaultFontSize = $("input#cosu-browser-property-default-font-size").val(); + if (defaultFontSize) { + if (!$.isNumeric(defaultFontSize) || !inputIsValidAgainstRange(defaultFontSize, 0, 72)) { + validationStatus = { + "error": true, + "subErrorMsg": "Default font size is a number between 0 and 72", + "erroneousFeature": operation + }; + continueToCheckNextInputs = false; + } + } + } + + if (continueToCheckNextInputs) { + validationStatus = { + "error": false, + "okFeature": operation + }; + } + validationStatusArray.push(validationStatus); + } + // Validating ENCRYPT_STORAGE if ($.inArray(androidOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"], configuredOperations) != -1) { // if ENCRYPT_STORAGE is configured @@ -705,6 +802,25 @@ var changeAndroidWifiPolicyEAP = function (select, superSelect) { } }; +/** + * Pass a div Id and a check box to view or hide div content based on checkbox value + */ +var changeDivVisibility = function (divId, checkbox) { + if (checkbox.checked) { + document.getElementById(divId).style.display= "block" + } else { + document.getElementById(divId).style.display= "none" + inputs = document.getElementById(divId).getElementsByTagName('input'); + for (index = 0; index < inputs.length; ++index) { + if (inputs[index].type == "text") { + inputs[index].value = inputs[index].defaultValue; + } else if (inputs[index].type == "checkbox") { + inputs[index].checked = inputs[index].defaultChecked; + } + } + } +}; + /** * Method to slide down a provided pane upon provided value set. * diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs index 6f5fce10d6..ddbb83a772 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/public/templates/android-policy-operations.hbs @@ -1408,6 +1408,116 @@
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+
+ + +
+
+ + +
+
+
+ +
+
+
+ +
+
+
+ + +
+

@@ -1433,6 +1543,17 @@ class="form-control operationDataKeys" data-key="primaryURL" maxlength="100" placeholder="[ Should be a valid URL ]"/>

+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
+ + +
+ +
+ + +