From 0adce7a3311960627bfa0340a7ea1f78a0665aaf Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Tue, 19 Feb 2019 16:08:43 +0530 Subject: [PATCH] Add kiosk browser properties policy config UI --- .../public/js/operation-mod.js | 16 +- .../public/js/android-policy-edit.js | 157 +++++++++--------- .../public/templates/android-policy-edit.hbs | 65 ++++++++ .../public/js/android-policy-view.js | 15 +- .../public/templates/android-policy-view.hbs | 65 ++++++++ .../public/js/android-policy-operations.js | 157 +++++++++--------- .../templates/android-policy-operations.hbs | 65 ++++++++ 7 files changed, 377 insertions(+), 163 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 556dbb03dc..9731a0ddbd 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 @@ -200,8 +200,12 @@ var androidOperationModule = function () { case androidOperationConstants["COSU_PROFILE_CONFIGURATION_OPERATION_CODE"]: payload = { "cosuProfileRestrictionStartTime": operationPayload["cosuProfileOperationRestrictionEndTime"], - "cosuProfileRestrictionEndTime": operationPayload["cosuProfileOperationRestrictionEndTime"] - } + "cosuProfileRestrictionEndTime": operationPayload["cosuProfileOperationRestrictionEndTime"], + "primaryURL": operationPayload["deviceGlobalConfigurations"]["browserProperties"]["primaryURL"], + "isAddressBarEnabled": operationPayload["deviceGlobalConfigurations"]["browserProperties"] + ["isAddressBarEnabled"] + }; + break; case androidOperationConstants["KIOSK_APPS_CODE"]: payload = { "cosuWhitelistedApplications": operationPayload["whitelistedApplications"] @@ -401,7 +405,13 @@ var androidOperationModule = function () { payload = { "operation": { "cosuProfileRestrictionStartTime": operationData["cosuProfileOperationRestrictionStartTime"], - "cosuProfileRestrictionEndTime": operationData["cosuProfileOperationRestrictionEndTime"] + "cosuProfileRestrictionEndTime": operationData["cosuProfileOperationRestrictionEndTime"], + "deviceGlobalConfigurations" : { + "browserProperties": { + "primaryURL": operationData["primaryURL"], + "isAddressBarEnabled": operationData["isAddressBarEnabled"] + } + } } }; break; 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 b19525b04a..7f0560a36a 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 @@ -919,89 +919,92 @@ $(document).ready(function () { var operationDataWrapper = $(this).data("target"); // prevents event bubbling by figuring out what element it's being called from. if (event.target.tagName == "INPUT") { - var featureConfiguredIcon; - if ($("input[type='checkbox']", this).is(":checked")) { - configuredOperations.push(operationCode); - // when a feature is enabled, if "zero-configured-features" msg is available, hide that. - var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; - if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { - $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); - } - // add configured-state-icon to the feature - featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); - } - } else { - //splicing the array if operation is present. - var index = $.inArray(operationCode, configuredOperations); - if (index != -1) { - configuredOperations.splice(index, 1); - } - // when a feature is disabled, clearing all its current configured, error or success states - var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; - var subErrorIcon = "#" + operation + "-error"; - var subOkIcon = "#" + operation + "-ok"; - featureConfiguredIcon = "#" + operation + "-configured"; + var isNonAdvanceOperation = $("input[type='checkbox']", this).hasClass("non-advance-operation"); + if (!isNonAdvanceOperation) { + var featureConfiguredIcon; + if ($("input[type='checkbox']", this).is(":checked")) { + configuredOperations.push(operationCode); + // when a feature is enabled, if "zero-configured-features" msg is available, hide that. + var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; + if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { + $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); + } + // add configured-state-icon to the feature + featureConfiguredIcon = "#" + operation + "-configured"; + if ($(featureConfiguredIcon).hasClass("hidden")) { + $(featureConfiguredIcon).removeClass("hidden"); + } + } else { + //splicing the array if operation is present. + var index = $.inArray(operationCode, configuredOperations); + if (index != -1) { + configuredOperations.splice(index, 1); + } + // when a feature is disabled, clearing all its current configured, error or success states + var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; + var subErrorIcon = "#" + operation + "-error"; + var subOkIcon = "#" + operation + "-ok"; + featureConfiguredIcon = "#" + operation + "-configured"; - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // reinitializing input fields into the defaults - $(operationDataWrapper + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } + if (!$(subErrorMsgWrapper).hasClass("hidden")) { + $(subErrorMsgWrapper).addClass("hidden"); } - ); - // reinitializing select fields into the defaults - $(operationDataWrapper + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); + if (!$(subErrorIcon).hasClass("hidden")) { + $(subErrorIcon).addClass("hidden"); } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(operationDataWrapper + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); + if (!$(subOkIcon).hasClass("hidden")) { + $(subOkIcon).addClass("hidden"); } - ); - // removing all entries of grid-input elements if exist - $(operationDataWrapper + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); + if (!$(featureConfiguredIcon).hasClass("hidden")) { + $(featureConfiguredIcon).addClass("hidden"); + } + // reinitializing input fields into the defaults + $(operationDataWrapper + " input").each( + function () { + if ($(this).is("input:text")) { + $(this).val($(this).data("default")); + } else if ($(this).is("input:password")) { + $(this).val(""); + } else if ($(this).is("input:checkbox")) { + $(this).prop("checked", $(this).data("default")); + // if this checkbox is the parent input of a grouped-input + if ($(this).hasClass("parent-input")) { + var groupedInput = $(this).parent().parent().parent(); + updateGroupedInputVisibility(groupedInput); + } + } } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); + ); + // reinitializing select fields into the defaults + $(operationDataWrapper + " select").each( + function () { + var defaultOption = $(this).data("default"); + $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); } - } - ); + ); + // collapsing expanded-panes (upon the selection of html-select-options) if any + $(operationDataWrapper + " .expanded").each( + function () { + if ($(this).hasClass("expanded")) { + $(this).removeClass("expanded"); + } + $(this).slideUp(); + } + ); + // removing all entries of grid-input elements if exist + $(operationDataWrapper + " .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(); + } + } + ); + } } } }); 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 df8ca218c4..b6193123d9 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 @@ -1683,6 +1683,71 @@ +
+
+

+ Device Global Configuration + +

+
+
+ +
+

+ Browser Properties + +

+
+
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ 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/js/android-policy-view.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-view/public/js/android-policy-view.js index cd53522833..cc532de13d 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/js/android-policy-view.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-view/public/js/android-policy-view.js @@ -241,12 +241,15 @@ $(document).ready(function () { var operation = $(this).parents(".operation-data").data("operation"); // prevents event bubbling by figuring out what element it's being called from. if (event.target.tagName == "INPUT") { - var featureConfiguredIcon; - if ($("input[type='checkbox']", this).is(":checked")) { - // add configured-state-icon to the feature - featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); + var isNonAdvanceOperation = $("input[type='checkbox']", this).hasClass("non-advance-operation"); + if (!isNonAdvanceOperation) { + var featureConfiguredIcon; + if ($("input[type='checkbox']", this).is(":checked")) { + // add configured-state-icon to the feature + featureConfiguredIcon = "#" + operation + "-configured"; + if ($(featureConfiguredIcon).hasClass("hidden")) { + $(featureConfiguredIcon).removeClass("hidden"); + } } } } 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 f87c25873c..65cd1255fa 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 @@ -1265,6 +1265,71 @@ +
+
+

+ Device Global Configuration + +

+
+
+ +
+

+ Browser Properties + +

+
+
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ 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 27dedfa2e3..6fb6d1a45e 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 @@ -884,89 +884,92 @@ $(document).ready(function () { var operationDataWrapper = $(this).data("target"); // prevents event bubbling by figuring out what element it's being called from. if (event.target.tagName == "INPUT") { - var featureConfiguredIcon; - if ($("input[type='checkbox']", this).is(":checked")) { - configuredOperations.push(operationCode); - // when a feature is enabled, if "zero-configured-features" msg is available, hide that. - var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; - if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { - $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); - } - // add configured-state-icon to the feature - featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); - } - } else { - //splicing the array if operation is present. - var index = $.inArray(operationCode, configuredOperations); - if (index != -1) { - configuredOperations.splice(index, 1); - } - // when a feature is disabled, clearing all its current configured, error or success states - var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; - var subErrorIcon = "#" + operation + "-error"; - var subOkIcon = "#" + operation + "-ok"; - featureConfiguredIcon = "#" + operation + "-configured"; + var isNonAdvanceOperation = $("input[type='checkbox']", this).hasClass("non-advance-operation"); + if (!isNonAdvanceOperation) { + var featureConfiguredIcon; + if ($("input[type='checkbox']", this).is(":checked")) { + configuredOperations.push(operationCode); + // when a feature is enabled, if "zero-configured-features" msg is available, hide that. + var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; + if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { + $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); + } + // add configured-state-icon to the feature + featureConfiguredIcon = "#" + operation + "-configured"; + if ($(featureConfiguredIcon).hasClass("hidden")) { + $(featureConfiguredIcon).removeClass("hidden"); + } + } else { + //splicing the array if operation is present. + var index = $.inArray(operationCode, configuredOperations); + if (index != -1) { + configuredOperations.splice(index, 1); + } + // when a feature is disabled, clearing all its current configured, error or success states + var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; + var subErrorIcon = "#" + operation + "-error"; + var subOkIcon = "#" + operation + "-ok"; + featureConfiguredIcon = "#" + operation + "-configured"; - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // reinitializing input fields into the defaults - $(operationDataWrapper + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } + if (!$(subErrorMsgWrapper).hasClass("hidden")) { + $(subErrorMsgWrapper).addClass("hidden"); } - ); - // reinitializing select fields into the defaults - $(operationDataWrapper + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); + if (!$(subErrorIcon).hasClass("hidden")) { + $(subErrorIcon).addClass("hidden"); } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(operationDataWrapper + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); + if (!$(subOkIcon).hasClass("hidden")) { + $(subOkIcon).addClass("hidden"); } - ); - // removing all entries of grid-input elements if exist - $(operationDataWrapper + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); + if (!$(featureConfiguredIcon).hasClass("hidden")) { + $(featureConfiguredIcon).addClass("hidden"); + } + // reinitializing input fields into the defaults + $(operationDataWrapper + " input").each( + function () { + if ($(this).is("input:text")) { + $(this).val($(this).data("default")); + } else if ($(this).is("input:password")) { + $(this).val(""); + } else if ($(this).is("input:checkbox")) { + $(this).prop("checked", $(this).data("default")); + // if this checkbox is the parent input of a grouped-input + if ($(this).hasClass("parent-input")) { + var groupedInput = $(this).parent().parent().parent(); + updateGroupedInputVisibility(groupedInput); + } + } } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); + ); + // reinitializing select fields into the defaults + $(operationDataWrapper + " select").each( + function () { + var defaultOption = $(this).data("default"); + $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); } - } - ); + ); + // collapsing expanded-panes (upon the selection of html-select-options) if any + $(operationDataWrapper + " .expanded").each( + function () { + if ($(this).hasClass("expanded")) { + $(this).removeClass("expanded"); + } + $(this).slideUp(); + } + ); + // removing all entries of grid-input elements if exist + $(operationDataWrapper + " .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(); + } + } + ); + } } } }); 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 466e486fc4..6acebef025 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 @@ -1392,6 +1392,71 @@ +
+
+

+ Device Global Configuration + +

+
+
+ +
+

+ Browser Properties + +

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