Kiosk Policy UI

revert-dabc3590
Saad Sahibjan 6 years ago committed by Inosh Perara
parent 278fbccff4
commit db44610c11

@ -196,59 +196,93 @@ var androidOperationModule = function () {
};
break;
case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]:
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"],
"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"]
};
payload = {};
payload["isDeviceRestrictOperationTimeEnabled"] =
operationPayload["isDeviceRestrictOperationTimeEnabled"];
payload["isDeviceGlobalConfigEnabled"] = operationPayload["isDeviceGlobalConfigEnabled"];
if (payload["isDeviceRestrictOperationTimeEnabled"] === true) {
payload["cosuProfileRestrictionStartTime"] = operationPayload["cosuProfileRestrictionStartTime"];
payload["cosuProfileRestrictionEndTime"] = operationPayload["cosuProfileRestrictionEndTime"];
}
if (payload["isDeviceGlobalConfigEnabled"] === true) {
var deviceGlobalConfigurations = operationPayload["deviceGlobalConfigurations"];
payload["idleMediaURL"] = deviceGlobalConfigurations["idleMediaURL"];
payload["kioskBackgroundImage"] = deviceGlobalConfigurations["kioskBackgroundImage"];
payload["kioskLogoImage"] = deviceGlobalConfigurations["kioskLogoImage"];
payload["kioskAppName"] = deviceGlobalConfigurations["kioskAppName"];
payload["isIdleGraphicsEnabled"] = deviceGlobalConfigurations["isIdleGraphicsEnabled"];
payload["idleTimeout"] = deviceGlobalConfigurations["idleTimeout"];
payload["isMultiUserDevice"] = deviceGlobalConfigurations["isMultiUserDevice"];
if (payload["isMultiUserDevice"] === true) {
payload["isLoginRequired"] = deviceGlobalConfigurations["isLoginRequired"];
var userAppConfigurations = operationPayload["userAppConfigurations"];
var index;
for (index = 0; index < userAppConfigurations.length; index++) {
userAppConfigurations[index]["visibleAppList"] =
userAppConfigurations[index]["visibleAppList"].map(function (item) {
var packageName = item.trim();
if (packageName && packageName.charAt(0) !== "{") {
var indexValue = packageName.lastIndexOf(":");
if (indexValue > -1) {
packageName = packageName.substring(0, indexValue);
}
}
return packageName;
}).filter(Boolean);
if (userAppConfigurations[index]["username"] === "primaryUser") {
payload["primaryUserApps"] = userAppConfigurations[index]["visibleAppList"];
delete userAppConfigurations[index];
}
}
payload["userAppConfigurations"] = userAppConfigurations.filter(Boolean);
}
payload["displayOrientation"] = deviceGlobalConfigurations["displayOrientation"];
if ("browserProperties" in deviceGlobalConfigurations) {
var browserProperties = deviceGlobalConfigurations["browserProperties"];
payload["isBrowserPropertyEnabled"] = browserProperties["isBrowserPropertyEnabled"];
payload["primaryURL"] = browserProperties["primaryURL"];
payload["isTopBarEnabled"] = browserProperties["isTopBarEnabled"];
payload["isAddressBarEnabled"] = browserProperties["isAddressBarEnabled"];
payload["showBackController"] = browserProperties["showBackController"];
payload["isForwardControllerEnabled"] = browserProperties["isForwardControllerEnabled"];
payload["isHomeButtonEnabled"] = browserProperties["isHomeButtonEnabled"];
payload["isReloadEnabled"] = browserProperties["isReloadEnabled"];
payload["lockToPrimaryURL"] = browserProperties["lockToPrimaryURL"];
payload["isJavascriptEnabled"] = browserProperties["isJavascriptEnabled"];
payload["isTextCopyEnabled"] = browserProperties["isTextCopyEnabled"];
payload["isDownloadsEnabled"] = browserProperties["isDownloadsEnabled"];
payload["isLockedToBrowser"] = browserProperties["isLockedToBrowser"];
payload["isFormAutoFillEnabled"] = browserProperties["isFormAutoFillEnabled"];
payload["isContentAccessEnabled"] = browserProperties["isContentAccessEnabled"];
payload["isFileAccessAllowed"] = browserProperties["isFileAccessAllowed"];
payload["isAllowedUniversalAccessFromFileURLs"] =
browserProperties["isAllowedUniversalAccessFromFileURLs"];
payload["isAllowedFileAccessFromFileURLs"] =
browserProperties["isAllowedFileAccessFromFileURLs"];
payload["isAppCacheEnabled"] = browserProperties["isAppCacheEnabled"];
payload["appCachePath"] = browserProperties["appCachePath"];
payload["cacheMode"] = browserProperties["cacheMode"];
payload["isLoadsImagesAutomatically"] = browserProperties["isLoadsImagesAutomatically"];
payload["isBlockNetworkImage"] = browserProperties["isBlockNetworkImage"];
payload["isBlockNetworkLoads"] = browserProperties["isBlockNetworkLoads"];
payload["isSupportZoomEnabled"] = browserProperties["isSupportZoomEnabled"];
payload["isDisplayZoomControls"] = browserProperties["isDisplayZoomControls"];
payload["textZoom"] = browserProperties["textZoom"];
payload["defaultFontSize"] = browserProperties["defaultFontSize"];
payload["defaultTextEncodingName"] = browserProperties["defaultTextEncodingName"];
payload["isDatabaseEnabled"] = browserProperties["isDatabaseEnabled"];
payload["isDomStorageEnabled"] = browserProperties["isDomStorageEnabled"];
payload["geolocationEnabled"] = browserProperties["geolocationEnabled"];
payload["isJavaScriptCanOpenWindowsAutomatically"] =
browserProperties["isJavaScriptCanOpenWindowsAutomatically"];
payload["isMediaPlaybackRequiresUserGesture"] =
browserProperties["isMediaPlaybackRequiresUserGesture"];
payload["isSafeBrowsingEnabled"] = browserProperties["isSafeBrowsingEnabled"];
payload["isUseWideViewPort"] = browserProperties["isUseWideViewPort"];
payload["userAgentString"] = browserProperties["userAgentString"];
payload["mixedContentMode"] = browserProperties["mixedContentMode"];
}
}
break;
case androidOperationConstants["KIOSK_APPS_CODE"]:
payload = {
@ -445,86 +479,121 @@ var androidOperationModule = function () {
case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]:
operationType = operationTypeConstants["PROFILE"];
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"];
var operation = {};
operation["isDeviceRestrictOperationTimeEnabled"] =
operationData["isDeviceRestrictOperationTimeEnabled"];
operation["isDeviceGlobalConfigEnabled"] = operationData["isDeviceGlobalConfigEnabled"];
if (operation["isDeviceRestrictOperationTimeEnabled"] === true) {
operation["cosuProfileRestrictionStartTime"] = operationData["cosuProfileRestrictionStartTime"];
operation["cosuProfileRestrictionEndTime"] = operationData["cosuProfileRestrictionEndTime"];
}
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"];
if (operationData["isDeviceGlobalConfigEnabled"] === true) {
var deviceGlobalConfigurations = {};
if (operationData["idleMediaURL"]) {
deviceGlobalConfigurations["idleMediaURL"] = operationData["idleMediaURL"];
}
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["kioskBackgroundImage"]) {
deviceGlobalConfigurations["kioskBackgroundImage"] = operationData["kioskBackgroundImage"];
}
if (operationData["defaultFontSize"]) {
browserProperties["defaultFontSize"] = operationData["defaultFontSize"];
if (operationData["kioskLogoImage"]) {
deviceGlobalConfigurations["kioskLogoImage"] = operationData["kioskLogoImage"];
}
if (operationData["defaultTextEncodingName"]) {
browserProperties["defaultTextEncodingName"] = operationData["defaultTextEncodingName"];
if (operationData["kioskAppName"]) {
deviceGlobalConfigurations["kioskAppName"] = operationData["kioskAppName"];
}
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"];
deviceGlobalConfigurations["isIdleGraphicsEnabled"] = operationData["isIdleGraphicsEnabled"];
if (operationData["idleTimeout"]) {
deviceGlobalConfigurations["idleTimeout"] = operationData["idleTimeout"];
}
browserProperties["mixedContentMode"] = operationData["mixedContentMode"];
deviceGlobalConfigurations.browserProperties = browserProperties;
deviceGlobalConfigurations["isMultiUserDevice"] = operationData["isMultiUserDevice"];
deviceGlobalConfigurations["displayOrientation"] = operationData["displayOrientation"];
if (deviceGlobalConfigurations["isMultiUserDevice"] === true) {
deviceGlobalConfigurations["isLoginRequired"] = operationData["isLoginRequired"];
var storeApps = $("#cosu-profile-app-configs-storeapps").data("storeapps");
var primaryUserApps = {
"username" : "primaryUser",
"visibleAppList" : operationData["primaryUserApps"]
};
var userAppConfigurations = operationData["userAppConfigurations"];
userAppConfigurations.push(primaryUserApps);
var index;
for (index = 0; index < userAppConfigurations.length; index++) {
userAppConfigurations[index]["visibleAppList"] =
userAppConfigurations[index]["visibleAppList"].split(/,(?![^{]*})/)
.map(function (item) {
var packageName = item.trim();
if (packageName) {
var i;
for (i=0; i<storeApps.length; i++) {
if (packageName === storeApps[i]["packageName"]) {
packageName += ":" + storeApps[i]["webUrl"];
}
}
}
return packageName;
}).filter(Boolean);
}
operation["userAppConfigurations"] = operationData["userAppConfigurations"];
}
if (operationData["isBrowserPropertyEnabled"] === true) {
var browserProperties = {};
browserProperties["isBrowserPropertyEnabled"] = true;
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;
}
operation.deviceGlobalConfigurations = deviceGlobalConfigurations;
payload.operation = operation;
break;
case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]:
operationType = operationTypeConstants["PROFILE"];
@ -793,6 +862,7 @@ var androidOperationModule = function () {
operationDataObj.val(value);
} else if (operationDataObj.is(":checkbox")) {
operationDataObj.prop("checked", value);
operationDataObj.trigger("change");
} else if (operationDataObj.is(":radio")) {
if (operationDataObj.val() == uiPayload[key]) {
operationDataObj.attr("checked", true);
@ -917,6 +987,7 @@ var androidOperationModule = function () {
var multiColumnKeyValuePair = value[multiColumnKeyValuePairArrayIndex];
var childInputKey = childInput.data("child-key");
var childInputValue = multiColumnKeyValuePair[childInputKey];
// populating extracted value in the UI according to the input type
if (childInput.is(":text") ||
childInput.is("textarea") ||

@ -274,6 +274,18 @@ var validatePolicyProfile = function () {
operation = androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION"];
var continueToCheckNextInputs = true;
var isDeviceGlobalConfigChecked = $("input#cosu-profile-device-global-config").is(":checked");
var isDeviceRestrictOperationChecked = $("input#cosu-profile-device-restrict-operation-time").is(":checked");
if (isDeviceGlobalConfigChecked === false && isDeviceRestrictOperationChecked === false) {
validationStatus = {
"error": true,
"subErrorMsg": "COSU Profile Configuration is empty.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
if (continueToCheckNextInputs) {
var backgroundImage = $("input#cosu-global-config-kiosk-background-image").val();
if (backgroundImage && !(backgroundImage.endsWith("jpg") || backgroundImage.endsWith("jpeg")
@ -353,6 +365,69 @@ var validatePolicyProfile = function () {
}
}
if (continueToCheckNextInputs) {
var isMultiUser = $("input#cosu-global-config-is-multi-user-device").is(":checked");
if (isMultiUser === true) {
var primaryUserApps = $("input#cosu-user-app-config-primary-user").val();
if (!primaryUserApps) {
validationStatus = {
"error": true,
"subErrorMsg": "Primary user apps are not configured.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
if (continueToCheckNextInputs) {
var isEmptyInputValue = false;
var cosuUserAppConfig = $("#cosu-user-app-config .child-input");
if ($(cosuUserAppConfig).length === 0) {
validationStatus = {
"error": true,
"subErrorMsg": "Users and apps are not configured for multi users.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
} else {
var childInputCount = 0;
var userInputArray = [];
var appInputArray = [];
$(cosuUserAppConfig).each(function () {
childInputCount++;
var childInputValue = $(this).val();
if (!childInputValue) {
isEmptyInputValue = true;
return false;
}
if (childInputCount % 2 === 0) {
appInputArray.push(childInputValue);
} else {
userInputArray.push(childInputValue);
}
});
var uniqueUserInputArray = userInputArray.filter(function (value, index, self) {
return self.indexOf(value) === index;
});
if (userInputArray.length !== uniqueUserInputArray.length) {
validationStatus = {
"error": true,
"subErrorMsg": "Duplicate values exist for username in multi user app configuration.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
}
if (isEmptyInputValue === true) {
validationStatus = {
"error": true,
"subErrorMsg": "One or more multi user app configurations are empty.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
}
}
}
if (continueToCheckNextInputs) {
validationStatus = {
"error": false,
@ -830,17 +905,41 @@ var changeAndroidWifiPolicyEAP = function (select, superSelect) {
*/
var changeDivVisibility = function (divId, checkbox) {
if (checkbox.checked) {
document.getElementById(divId).style.display= "block"
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;
document.getElementById(divId).style.display= "none";
$("#" + divId + " input").each(
function () {
if ($(this).is("input:text")) {
$(this).val(this.defaultValue);
} else if ($(this).is("input:checkbox")) {
$(this).prop("checked", this.defaultChecked);
}
}
}
);
$("#" + divId + " select").each(
function () {
$(this).val($(this).data("default"));
}
);
$("#" + divId + " .grouped-array-input").each(
function () {
var gridInputs = $(this).find("[data-add-form-clone]");
if (gridInputs.length > 0) {
gridInputs.remove();
}
var helpTexts = $(this).find("[data-help-text=add-form]");
if (helpTexts.length > 0) {
helpTexts.show();
}
}
);
$("#" + divId + " .collapse-config").each(
function() {
this.style.display = "none";
}
);
}
};

@ -198,6 +198,48 @@ var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPr
};
// End of HTML embedded invoke methods
/**
* 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";
$("#" + divId + " input").each(
function () {
if ($(this).is("input:text")) {
$(this).val(this.defaultValue);
} else if ($(this).is("input:checkbox")) {
$(this).prop("checked", this.defaultChecked);
}
}
);
$("#" + divId + " select").each(
function () {
$(this).val($(this).data("default"));
}
);
$("#" + divId + " .grouped-array-input").each(
function () {
var gridInputs = $(this).find("[data-add-form-clone]");
if (gridInputs.length > 0) {
gridInputs.remove();
}
var helpTexts = $(this).find("[data-help-text=add-form]");
if (helpTexts.length > 0) {
helpTexts.show();
}
}
);
$("#" + divId + " .collapse-config").each(
function() {
this.style.display = "none";
}
);
}
};
/**
* This method will display appropriate fields based on wifi type
* @param {object} wifi type select object
@ -254,4 +296,53 @@ $(document).ready(function () {
}
}
});
// add form entry click function for grid inputs
$(advanceOperations).on("click", "[data-click-event=add-form]", function () {
var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]");
var clonedForm = $("[data-add-form=" + $(this).attr("href") + "]").clone().find("[data-add-form-element=clone]")
.attr("data-add-form-clone", $(this).attr("href"));
// adding class .child-input to capture text-input-array-values
$("input, select", clonedForm).addClass("child-input");
$(addFormContainer).append(clonedForm);
setId(addFormContainer);
showHideHelpText(addFormContainer);
});
// remove form entry click function for grid inputs
$(advanceOperations).on("click", "[data-click-event=remove-form]", function () {
var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]");
$(this).closest("[data-add-form-element=clone]").remove();
setId(addFormContainer);
showHideHelpText(addFormContainer);
});
});
/**
* Method to set count id to cloned elements.
* @param {object} addFormContainer
*/
var setId = function (addFormContainer) {
$(addFormContainer).find("[data-add-form-clone]").each(function (i) {
$(this).attr("id", $(this).attr("data-add-form-clone").slice(1) + "-" + (i + 1));
if ($(this).find(".index").length > 0) {
$(this).find(".index").html(i + 1);
}
});
};
/**
* Method to set count id to cloned elements.
* @param {object} addFormContainer
*/
var showHideHelpText = function (addFormContainer) {
var helpText = "[data-help-text=add-form]";
if ($(addFormContainer).find("[data-add-form-clone]").length > 0) {
$(addFormContainer).find(helpText).hide();
} else {
$(addFormContainer).find(helpText).show();
}
};

@ -217,6 +217,18 @@ var validatePolicyProfile = function () {
operation = androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION"];
var continueToCheckNextInputs = true;
var isDeviceGlobalConfigChecked = $("input#cosu-profile-device-global-config").is(":checked");
var isDeviceRestrictOperationChecked = $("input#cosu-profile-device-restrict-operation-time").is(":checked");
if (isDeviceGlobalConfigChecked === false && isDeviceRestrictOperationChecked === false) {
validationStatus = {
"error": true,
"subErrorMsg": "COSU Profile Configuration is empty.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
if (continueToCheckNextInputs) {
var backgroundImage = $("input#cosu-global-config-kiosk-background-image").val();
if (backgroundImage && !(backgroundImage.endsWith("jpg") || backgroundImage.endsWith("jpeg")
@ -296,6 +308,69 @@ var validatePolicyProfile = function () {
}
}
if (continueToCheckNextInputs) {
var isMultiUser = $("input#cosu-global-config-is-multi-user-device").is(":checked");
if (isMultiUser === true) {
var primaryUserApps = $("input#cosu-user-app-config-primary-user").val();
if (!primaryUserApps) {
validationStatus = {
"error": true,
"subErrorMsg": "Primary user apps are not configured.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
if (continueToCheckNextInputs) {
var isEmptyInputValue = false;
var cosuUserAppConfig = $("#cosu-user-app-config .child-input");
if ($(cosuUserAppConfig).length === 0) {
validationStatus = {
"error": true,
"subErrorMsg": "Users and apps are not configured for multi users.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
} else {
var childInputCount = 0;
var userInputArray = [];
var appInputArray = [];
$(cosuUserAppConfig).each(function () {
childInputCount++;
var childInputValue = $(this).val();
if (!childInputValue) {
isEmptyInputValue = true;
return false;
}
if (childInputCount % 2 === 0) {
appInputArray.push(childInputValue);
} else {
userInputArray.push(childInputValue);
}
});
var uniqueUserInputArray = userInputArray.filter(function (value, index, self) {
return self.indexOf(value) === index;
});
if (userInputArray.length !== uniqueUserInputArray.length) {
validationStatus = {
"error": true,
"subErrorMsg": "Duplicate values exist for username in multi user app configuration.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
}
if (isEmptyInputValue === true) {
validationStatus = {
"error": true,
"subErrorMsg": "One or more multi user app configurations are empty.",
"erroneousFeature": operation
};
continueToCheckNextInputs = false;
}
}
}
}
if (continueToCheckNextInputs) {
validationStatus = {
"error": false,
@ -807,17 +882,40 @@ var changeAndroidWifiPolicyEAP = function (select, superSelect) {
*/
var changeDivVisibility = function (divId, checkbox) {
if (checkbox.checked) {
document.getElementById(divId).style.display= "block"
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;
document.getElementById(divId).style.display= "none";
$("#" + divId + " input").each(
function () {
if ($(this).is("input:text")) {
$(this).val(this.defaultValue);
} else if ($(this).is("input:checkbox")) {
$(this).prop("checked", this.defaultChecked);
}
}
}
);
$("#" + divId + " select").each(
function () {
$(this).val($(this).data("default"));
}
);
$("#" + divId + " .grouped-array-input").each(
function () {
var gridInputs = $(this).find("[data-add-form-clone]");
if (gridInputs.length > 0) {
gridInputs.remove();
}
var helpTexts = $(this).find("[data-help-text=add-form]");
if (helpTexts.length > 0) {
helpTexts.show();
}
}
);
$("#" + divId + " .collapse-config").each(
function() {
this.style.display = "none";
}
);
}
};

Loading…
Cancel
Save