Add type specific units

charithag 9 years ago
parent 60165b1698
commit d538f71744

@ -4,7 +4,7 @@
<DataStore>
<Name>WSO2-BAM</Name>
<Enabled>false</Enabled>
<PublisherClass>org.wso2.carbon.device.mgt.iot.common.datastore.impl.ThriftDataStoreConnector</PublisherClass>
<PublisherClass>org.wso2.carbon.device.mgt.iot.datastore.impl.ThriftDataStoreConnector</PublisherClass>
<ServerURL>tcp://localhost</ServerURL>
<Port>7611</Port>
<Username>admin</Username>
@ -14,7 +14,7 @@
<DataStore>
<Name>WSO2-CEP</Name>
<Enabled>false</Enabled>
<PublisherClass>org.wso2.carbon.device.mgt.iot.common.datastore.impl.ThriftDataStoreConnector</PublisherClass>
<PublisherClass>org.wso2.carbon.device.mgt.iot.datastore.impl.ThriftDataStoreConnector</PublisherClass>
<ServerURL>tcp://localhost</ServerURL>
<Port>7611</Port>
<Username>admin</Username>
@ -26,7 +26,7 @@
<ControlQueue>
<Name>MQTT</Name>
<Enabled>true</Enabled>
<ControlClass>org.wso2.carbon.device.mgt.iot.common.controlqueue.mqtt.MqttControlPublisher</ControlClass>
<ControlClass>org.wso2.carbon.device.mgt.iot.controlqueue.mqtt.MqttControlPublisher</ControlClass>
<Protocol>MQTT</Protocol>
<ServerURL>tcp://204.232.188.214</ServerURL>
<Port>1883</Port>
@ -36,8 +36,8 @@
<ControlQueue>
<Name>XMPP</Name>
<Enabled>true</Enabled>
<ControlClass>org.wso2.carbon.device.mgt.iot.common.controlqueue.xmpp.XmppServerClient</ControlClass>
<Enabled>false</Enabled>
<ControlClass>org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppServerClient</ControlClass>
<Protocol>XMPP</Protocol>
<ServerURL>http://204.232.188.215</ServerURL>
<Port>9090</Port>

@ -0,0 +1,5 @@
{{unit "cdmf.unit.ui.title" pageTitle="Platform Configuration"}}
{{#zone "content"}}
{{unit "cdmf.unit.platform.configuration"}}
{{/zone}}

@ -0,0 +1,7 @@
<div class="wr-operations"></div>
{{#zone "bottomJs"}}
<script id="operations-bar" src="{{@unit.publicUri}}/templates/operations.hbs"
type="text/x-handlebars-template"></script>
{{js "js/operation-bar.js"}}
{{/zone}}

@ -0,0 +1,298 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Setting-up global variables.
*/
var operations = '.wr-operations',
modalPopup = '.wr-modalpopup',
modalPopupContainer = modalPopup + ' .modalpopup-container',
modalPopupContent = modalPopup + ' .modalpopup-content',
// deviceCheckbox = '#ast-container .ctrl-wr-asset .itm-select input[type="checkbox"]',
// showOperationsBtn = '#showOperationsBtn',
navHeight = $('#nav').height(),
headerHeight = $('header').height(),
offset = (headerHeight + navHeight),
// maxOperationsLimit = 15,
// hiddenOperation = '.wr-hidden-operations-content > div',
deviceSelection = '.device-select',
dataTableSelection = '.DTTT_selected',
currentOperationList = [];
/*
* On window resize functions.
*/
//$(window).resize(function(){
// toggleMoreOperationsHeight();
//});
/*
* On main div.container resize functions.
* @required jquery.resize.js
*/
//$('.container').resize(function(){
// toggleMoreOperationsHeight();
//});
/*
* On Show Operations click operation show toggling function.
*/
//function showOperations(){
// $(operations).toggle('slide');
//}
/*
* Function to get selected devices ID's
*/
function getSelectedDeviceIds() {
var deviceIdentifierList = [];
$(deviceSelection).each(function (index) {
var device = $(this);
var deviceId = device.data('deviceid');
var deviceType = device.data('type');
deviceIdentifierList.push({
"id" : deviceId,
"type" : deviceType
});
});
if(deviceIdentifierList.length == 0) {
var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable();
thisTable.api().rows().every(function () {
if ($(this.node()).hasClass('DTTT_selected')) {
var deviceId = $(thisTable.api().row(this).node()).data('deviceid');
var deviceType = $(thisTable.api().row(this).node()).data('devicetype');
deviceIdentifierList.push({
"id": deviceId,
"type": deviceType
});
}
});
}
return deviceIdentifierList;
}
/*
* On operation click function.
* @param selection: Selected operation
*/
function operationSelect (selection) {
var deviceIdList = getSelectedDeviceIds();
if (deviceIdList == 0) {
$(modalPopupContent).html($("#errorOperations").html());
} else {
$(modalPopupContent).addClass("operation-data");
$(modalPopupContent).html($(operations + " .operation[data-operation-code=" + selection + "]").html());
$(modalPopupContent).data("operation-code", selection);
}
showPopup();
}
/*
* Function to open hidden device operations list
*/
//function toggleMoreOperations(){
// $('.wr-hidden-operations, .wr-page-content').toggleClass('toggled');
// $(showOperationsBtn).toggleClass('selected');
// //$('.footer').toggleClass('wr-hidden-operations-toggled');
//}
/*
* Function to fit hidden device operation window height with the screen
*/
//function toggleMoreOperationsHeight(){
// $('.wr-hidden-operations').css('min-height', $('html').height() - (offset+140));
//}
/*
* Advance operations sub categories show/hide toggle function
*/
//function showAdvanceOperation(operation, button){
// $(button).addClass('selected');
// $(button).siblings().removeClass('selected');
// $(hiddenOperation + '[data-operation-code="' + operation + '"]').show();
// $(hiddenOperation + '[data-operation-code="' + operation + '"]').siblings().hide();
//}
function getDevicesByTypes (deviceList) {
var deviceTypes = {};
$.each(deviceList, function (index, item) {
deviceTypes[item.type] = [];
if (item.type == "android" || item.type == "ios" || item.type == "windows") {
deviceTypes[item.type].push(item.id);
}
// if(item.type == "TemperatureController"){
// deviceTypes[item.type].push(item.id);
// }
});
return deviceTypes;
}
function unloadOperationBar(){
$("#showOperationsBtn").addClass("hidden");
$(".wr-operations").html("");
}
function loadOperationBar (deviceType) {
var operationBar = $("#operations-bar");
var operationBarSrc = operationBar.attr("src");
var platformType = deviceType;
$.template("operations-bar", operationBarSrc, function (template) {
var serviceURL = "/devicemgt_admin/features/" + platformType;
// if (deviceType == "TemperatureController") {
// serviceURL = "/devicemgt_admin/features/android";
// }
var successCallback = function (data) {
var viewModel = {};
// var iconMap = {};
// if (deviceType == "TemperatureController") {
// data = [{
// "id": 0,
// "code": "BUZZER",
// "name": "Buzz",
// "description": "Buzz the device",
// "deviceType": "TemperatureController",
// "metadataEntries": null
// }];
// currentOperationList = viewModel.features = data.reduce(function (total, current) {
// total[current.code] = current;
// return total;
// }, {});
// }
data = JSON.parse(data).filter(function (current) {
var iconName;
if (deviceType == "android"){
iconName = operationModule.getAndroidIconForFeature(current.code);
current.type = deviceType;
} if (deviceType == "windows"){
iconName = operationModule.getWindowsIconForFeature(current.code);
} else if (deviceType == "ios"){
iconName = operationModule.getIOSIconForFeature(current.code);
}
if (iconName){
current.icon = iconName;
return current;
}
});
viewModel.features = data;
var content = template(viewModel);
$(".wr-operations").html(content);
};
invokerUtil.get(serviceURL,
successCallback, function(message){
console.log(message);
});
});
// var hiddenOperationBar = $("#hidden-operations-bar-" + deviceType);
// var hiddenOperationBarSrc = hiddenOperationBar.attr("src");
// if (hiddenOperationBarSrc){
// $.template("hidden-operations-bar-" + deviceType, hiddenOperationBarSrc, function (template) {
// var serviceURL = "/devicemgt_admin/features/" + platformType;
// var successCallback = function (data) {
// var viewModel = {};
// viewModel.features = data.reduce(function (total, current) {
// total[current.code] = current;
// return total;
// }, {});
// currentOperationList = viewModel.features;
// var content = template(viewModel);
// $(".wr-hidden-operations").html(content);
// };
// invokerUtil.get(serviceURL,
// successCallback, function(message){
// console.log(message);
// });
// });
// $("#showOperationsBtn").removeClass("hidden");
// }
}
function runOperation (operationName) {
var deviceIdList = getSelectedDeviceIds();
var list = getDevicesByTypes(deviceIdList);
var notificationBubble = ".wr-notification-bubble";
var successCallback = function (data) {
console.log(data);
// $(".wr-notification-bar").append('<div class="wr-notification-desc new"><div ' +
// 'class="wr-notification-operation">' + currentOperationList[operationName].name +
// '- Operation Successful!</div><hr /></div>');
/*var notificationCount = parseInt($(notificationBubble).html());
notificationCount++;
$(notificationBubble).html(notificationCount);*/
if(operationName == "NOTIFICATION"){
$(modalPopupContent).html($("#messageSuccess").html());
}else {
$(modalPopupContent).html($("#operationSuccess").html());
}
showPopup();
};
var payload, serviceEndPoint;
if(list["ios"]){
payload = operationModule.generatePayload("ios", operationName, list["ios"]);
serviceEndPoint = operationModule.getIOSServiceEndpoint(operationName);
}
if(list["android"]){
payload = operationModule.generatePayload("android", operationName, list["android"]);
serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName);
}
if(list["windows"]){
payload = operationModule.generatePayload("windows", operationName, list["windows"]);
serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName);
}
// if(list["TemperatureController"]){
// payload = operationModule.generatePayload("TemperatureController", operationName, list["TemperatureController"]);
// serviceEndPoint = operationModule.getTemperatureControllerServiceEndpoint(operationName);
// }
console.log(payload);
invokerUtil.post(serviceEndPoint, payload,
successCallback, function(jqXHR, textStatus, errorThrown){
console.log(textStatus);
});
$(modalPopupContent).removeData();
hidePopup();
}
/*
* DOM ready functions.
*/
$(document).ready(function(){
// if($(operations + "> a").length > maxOperationsLimit){
// $(showOperationsBtn).show();
// }
// else{
// $(operations).show();
// }
$(operations).show();
// toggleMoreOperationsHeight();
//loadOperationBar("ios");
/**
* Android App type javascript
*/
// $(".wr-modalpopup").on("click", ".appTypesInput", function(){
// var appType = $(".appTypesInput").val();
// if (appType == "Public") {
// $('.appURLInput').prop( "disabled", true );
// }else if (appType == "Enterprise"){
// $('.appURLInput').prop( "disabled", false );
// }
// }).trigger("change");
});

@ -0,0 +1,366 @@
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.WIFI.code}}', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-wifi fw-stack-2x"></i>
</span>
Wi-fi
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('application', this)" >
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-padlock fw-stack-2x"></i>
</span>
Applications
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.RESTRICTION.code}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
Restrictions
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('mail', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-message fw-stack-2x"></i>
</span>
Mail
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.AIR_PLAY.code}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-service-provider fw-stack-2x"></i>
</span>
Air Play
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- application -->
<div class="wr-hidden-operation" data-operation="application" style="display: block">
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_STORE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installPublicAppiOS" aria-expanded="true" aria-controls="installPublicAppiOS">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install Public App
</a>
</h2>
</div>
<div id="installPublicAppiOS" class="panel-collapse panel-body collapse in" role="tabpanel" aria-labelledby="installPublicAppiOS">
<label class="wr-input-label" for="appIdentifier">App identifier</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="appIdentifier" data-key="appIdentifier" placeholder="Enter App Identifier">
</div>
<label class="wr-input-label col-sm-4" for="ituneID">iTunes store ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ituneID" data-key="ituneID" placeholder="Enter iTunes store ID">
</div>
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="appRemoval" data-key="appRemoval" checked />
<span class="helper" title="Remove App upon dis-enrollment">Remove App upon dis-enrollment<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="backupData" data-key="backupData" checked />
<span class="helper" title="Prevent backup of App data">Prevent backup of App data<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<a href="javascript:runOperation('{{features.INSTALL_STORE_APPLICATION.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_ENTERPRISE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installEnterpriseAppiOS" aria-expanded="true" aria-controls="installPublicAppiOS" class="collapsed">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install Enterprise App
</a>
</h2>
</div>
<div id="installEnterpriseAppiOS" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="installEnterpriseAppiOS">
<label class="wr-input-label" for="appIdentifier">App identifier</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="appIdentifier" data-key="appIdentifier" placeholder="Enter App Identifier">
</div>
<label class="wr-input-label col-sm-4" for="manifestURL">Manifest URL</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="manifestURL" data-key="manifestURL" placeholder="Enter manifest URL">
</div>
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="appRemoval" data-key="appRemoval" checked />
<span class="helper" title="Remove App upon dis-enrollment">Remove App upon dis-enrollment<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="backupData" data-key="backupData" checked />
<span class="helper" title="Prevent backup of App data">Prevent backup of App data<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<a href="javascript:runOperation('{{features.INSTALL_ENTERPRISE_APPLICATION.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.REMOVE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#removeApplication" aria-expanded="true" aria-controls="removeApplication" class="collapsed">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Uninstall App
</a>
</h2>
</div>
<div id="removeApplication" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="removeApplication">
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<a href="javascript:runOperation('{{features.REMOVE_APPLICATION.code}}')" class="btn-operations">Uninstall</a>
</div>
</div>
</div>
<!-- /application -->
<!-- wi-fi -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.WIFI.code}}">
<label class="wr-input-label" title="Identification of the wireless network to connect to">Service Set Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ssid" data-key="ssid" placeholder="Enter SSID" />
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="hiddenNetwork" data-key="hiddenNetwork" checked />
<span class="helper" title="Enable if target network is not open or broadcasting">Hidden Network<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="autoJoin" data-key="autoJoin" checked />
<span class="helper" title="Automatically join this wireless network">Auto Join<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Automatically join this wireless network</span-->
</div>
<label class="wr-input-label" title="Configures proxies to be used with this network">Proxy Setup<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures proxies to be used with this network</span-->
<div class="wr-input-control">
<select class="form-control">
<option>None</option>
</select>
</div>
<label class="wr-input-label" title="Wireless network encryption to use when connecting">Security Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Wireless network encryption to use when connecting</span-->
<div class="wr-input-control">
<select class="form-control operationDataKeys" id="encryptionType" data-key="encryptionType">
<option data-id="WPA">WPA/WPA2 Personal</option>
</select>
</div>
<label class="wr-input-label" title="Password for the wireless network">Password<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Password for the wireless network</span-->
<div class="wr-input-control">
<input type="password" value="" class="operationDataKeys" id="password" data-key="password" placeholder="input text"/>
</div>
<label class="wr-input-label" title="Configures network to appear as legacy or Passport">Network Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures network to appear as legacy or Passport</span-->
<div class="wr-input-control">
<select class="form-control">
<option>Standard</option>
</select>
</div>
<a href="javascript:runOperation('{{features.WIFI.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /wi-fi -->
<!-- mail -->
<div class="wr-hidden-operation panel-body" data-operation="mail">
<label class="wr-input-label" title="The display name of the account">Account Description<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The protocol for accessing the email account">Account Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures proxies to be used with this network</span-->
<div class="wr-input-control">
<div class="cus-col-25">
<select class="form-control">
<option>IMAP</option>
</select>
</div>
<div class="cus-col-50">
<span>Path Prefix</span> <input type="text" value="" placeholder="input text" />
</div>
<br class="c-both" />
</div>
<label class="wr-input-label" title="The display name of the user">User Display Name<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The address of the account">Email Address<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Messages can be moved from this account to another">Allow user to move messages from this account<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Include this account in recent address syncing">Allow Recent Address syncing<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Send outgoing mail from this account only from Mail app">Use Only in Mail<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Send outgoing mail from this account only from Mail app</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Support S/MIME for this account">Enable S/MIME<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Support S/MIME for this account</span-->
</div>
<label class="wr-input-label" title="The protocol for accessing the email account">Mail Server and Port<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The protocol for accessing the email account</span-->
<div class="wr-input-control">
<div class="cus-col-70">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="cus-col-25">
<span> : </span><input type="text" value="993" placeholder="input text" />
</div>
<br class="c-both" />
</div>
<label class="wr-input-label" title="The username used to connect to the server for incoming mail">Username<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The Username used to connect to the server for incoming mail</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The autyentication method for the incoming mail server">Authentication Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Wireless network encryption to use when connecting</span-->
<div class="wr-input-control">
<select class="form-control">
<option>Password</option>
</select>
</div>
<label class="wr-input-label" title="The password for the incoming mail server">Password<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The Username used to connect to the server for incoming mail</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Retrieve incoming mail through secure socket layer">Use SSL<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
</div>
<!-- /mail -->
<!-- general -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.RESTRICTION.code}}">
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowCamera" data-key="allowCamera" checked />
<span class="helper" title="Allow Camera">Allow Camera<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowCloudBackup" data-key="allowCloudBackup" checked/>
<span class="helper" title="Allow Cloud Backup">Allow Cloud Backup<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowScreenShot" data-key="allowScreenShot" checked/>
<span class="helper" title="Allow Screenshots">Allow Screenshots<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowSafari" data-key="allowSafari" checked />
<span class="helper" title="Allow Safari Browser">Allow Safari Browser<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowAirDrop" data-key="allowAirDrop" checked />
<span class="helper" title="Allow AirDrop">Allow AirDrop<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<a href="javascript:runOperation('{{features.RESTRICTION.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /general -->
<!-- air play -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.AIR_PLAY.code}}">
<label class="wr-input-label col-sm-4" for="airPlayLocation">Location</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="airPlayLocation" data-key="location" placeholder="Enter location" />
</div>
<label class="wr-input-label col-sm-4" for="airPlayDeviceName">Device Name</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="airPlayDeviceName" data-key="deviceName" placeholder="Enter Device Name" />
</div
<label class="wr-input-label col-sm-4" for="airPlayPassword">AirPlay password</label>
<div class="wr-input-control">
<input type="password" class="form-control operationDataKeys" id="airPlayPassword" data-key="password" placeholder="Password" />
</div>
<a href="javascript:runOperation('{{features.AIR_PLAY.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /air play -->
</div>
</div>

@ -0,0 +1,130 @@
<div id="errorOperations" class="operation">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<h4>
Please select a device or a list of devices to perform an operation.
</h4>
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="operationSuccess" class="operation">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-check fw-stack-1x"></i>
</span>
Operation performed successfully !
</h3>
<h4>
Operation has been queued to be sent to the device.
</h4>
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="messageSuccess" class="operation">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-check fw-stack-1x"></i>
</span>
Message sent successfully !
</h3>
<h4>
Message has been queued to be sent to the device.
</h4>
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
{{#each features}}
<a href="javascript:operationSelect('{{code}}')">
<i class="fw {{icon}}"></i>
<span>{{name}}</span>
</a>
<div class="operation" data-operation-code="{{code}}">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw {{icon}} fw-stack-1x"></i>
</span>
{{name}}
<br>
</h3>
<h4>
{{#equal code "WIPE_DATA"}}
{{#equal type "android"}}
Enter PIN code (Optional - This is required only if the device type is BYOD).
<br><br>
<div>
<input type="password" class="form-control modal-input operationDataKeys" id="pin" data-key="pin"></textarea>
</div>
<br>
{{/equal}}
{{/equal}}
{{#equal code "NOTIFICATION"}}
Type your message below.
<br><br>
<div>
<textarea class="form-control modal-input operationDataKeys" id="message" data-key="message"></textarea>
</div>
<br>
{{/equal}}
{{#equal code "CHANGE_LOCK_CODE"}}
Type new lock-code below.
<br><br>
<input type="text" class="form-control modal-input operationDataKeys" id="lockcode" data-key="lockCode" placeholder="Enter Lockcode" />
<br>
{{/equal}}
Do you want to perform this operation on selected device(s) ?
<br>
</h4>
<div class="buttons">
<a href="javascript:runOperation('{{code}}')" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="javascript:hidePopup()" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
{{/each}}
<br class="c-both" />

@ -0,0 +1,493 @@
<div class="row">
<div class="col-md-12">
<!-- content -->
<div id="config-save-form" class="container col-centered wr-content">
<br>
<h1 class="page-sub-title">
Platform Configurations
</h1>
<br>
General and Platform Specific Server Settings for the Tenant
<br>
<br>
<div class="wr-advance-operations">
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a href="javascript:void(0)" onclick="showAdvanceOperation('general', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
General Configurations
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('android', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-android fw-stack-2x"></i>
</span>
Android Configurations
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('ios', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-apple fw-stack-2x"></i>
</span>
iOS Configurations
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('windows', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-windows fw-stack-2x"></i>
</span>
Windows Configurations
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- general -->
<div class="wr-hidden-operation" data-operation="general" style="display: block">
<div class="panel panel-default">
<div id="general-config-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Policy Monitoring
<hr>
</h2>
</div>
<div id="email-config-body" class="panel-collapse panel-body" role="tabpanel">
<div id="email-config-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="email-config-host">
Monitoring Frequency
<span class="helper" title="SMTP Server Host">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
( Should be in milliseconds )
</label>
<input id="monitoring-config-frequency" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control wr-btn-grp">
<button id="save-general-btn" class="wr-btn">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</div>
</div>
<!--<div id="general-config-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Email Configurations
<hr>
</h2>
</div>-->
<!--<div id="email-config-body" class="panel-collapse panel-body" role="tabpanel">
<div class="wr-input-control">
<label class="wr-input-label" for="email-config-host">
Host
<span class="helper" title="SMTP Server Host">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="email-config-host" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="email-config-port">
Port
<span class="helper" title="SMTP Server Port">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="email-config-port" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="email-config-username">
Username
<span class="helper" title="Email Username">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="email-config-username" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="email-config-password">
Password
<span class="helper" title="Email Password">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="email-config-password" type="password" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="email-config-sender-email">
Sender Email Address
<span class="helper" title="Sender Email Address to be appeared on the email">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="email-config-sender-email" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="email-config-template">
Email Template
<span class="helper" title="Email Template to be used in invitation email">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<textarea id="email-config-template" type="textarea" class="form-control"></textarea>
</div>
</div>-->
</div>
</div>
<!-- general-->
<!-- android -->
<div class="wr-hidden-operation" data-operation="android">
<div class="panel panel-default">
<div id="android-config-body" class="panel-collapse panel-body" role="tabpanel">
<div id="android-config-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="android-config-notifier">
Notifier Type
<span class="helper" title="Notifier type for the agent to contact EMM server">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="android-config-notifier" class="form-control" data-default="0">
<option value="1">LOCAL</option>
<option value="2">GCM</option>
</select>
</div>
<div id="local-inputs">
<div class="wr-input-control">
<label class="wr-input-label" for="android-config-notifier-frequency">
Notifier Frequency
<span class="helper" title="Notifier frequency for the agent to contact EMM server">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
( Should be in milliseconds )
</label>
<input id="android-config-notifier-frequency" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
</div>
<div id="gcm-inputs">
<div class="wr-input-control">
<label class="wr-input-label" for="android-config-gcm-api-key">
API Key
<span class="helper" title="GCM API Key">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="android-config-gcm-api-key" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="android-config-gcm-sender-id">
Sender ID
<span class="helper" title="GCM Sender ID">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="android-config-gcm-sender-id" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
</div>
</div>
<div id="wifi-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
End User License Agreement (EULA)
<hr>
</h2>
</div>
<div id="wifi-body" class="panel-collapse panel-body" role="tabpanel" aria-labelledby="wifi-body">
<div class="wr-input-control">
<textarea id="android-eula" type="text" class="form-control"></textarea>
</div>
<div class="wr-input-control wr-btn-grp">
<button id="save-android-btn" class="wr-btn">&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp;</button>
</div>
</div>
</div>
</div>
<!-- /android -->
<!-- ios -->
<div class="wr-hidden-operation" data-operation="ios">
<div class="panel panel-default operation-data" data-operation="wifi" data-operation-code="WIFI">
<div id="ios-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
iOS SCEP Certificate Configurations
<hr>
</h2>
</div>
<div id="ios-config-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div id="wifi-body" class="panel-collapse panel-body" role="tabpanel" aria-labelledby="ios-body">
<div id="ios-scep-config-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-country">
Country (C)
<span class="helper" title="Country">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-country" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-state">
State (ST)
<span class="helper" title="State">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-state" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-locality">
Locality (L)
<span class="helper" title="Locality">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-locality" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-organization">
Organization (O)
<span class="helper" title="Organization">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-organization" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-organization-unit">
Organization Unit (OU)
<span class="helper" title="Organization Unit">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-organization-unit" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
</div>
<div id="wifi-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
iOS Profile Configurations
<hr>
</h2>
</div>
<div id="wifi-body" class="panel-collapse panel-body" role="tabpanel" aria-labelledby="wifi-body">
<div id="ios-profile-conf-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-org-display-name">
Organization Display Name
<span class="helper" title="Organization">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-org-display-name" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
</div>
<div id="wifi-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
iOS MDM Configurations
<hr>
</h2>
</div>
<div id="wifi-body" class="panel-collapse panel-body" role="tabpanel" aria-labelledby="wifi-body">
<div id="ios-mdm-config-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-mdm-certificate">
MDM Certificate
<span class="helper" title="Upload MDM Certificate">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label><br>
<label class="wr-input-label" id="mdm-cert-file-name">
</label>
<input id="ios-config-mdm-certificate" type="file" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-mdm-certificate-password">
MDM Certificate Password
<span class="helper" title="MDM Certificate Password">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-mdm-certificate-password" type="password" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-mdm-certificate-topic-id">
MDM Certificate Topic ID
<span class="helper" title="MDM Certificate Topic ID">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-mdm-certificate-topic-id" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-mdm-mode">
Mode
<span class="helper" title="Release mode">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="ios-config-mdm-mode" class="form-control" data-default="0">
<option value="1">Production</option>
<option value="2">Developer</option>
</select>
</div>
</div>
<div id="wifi-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
iOS APNS Configurations
<hr>
</h2>
</div>
<div id="wifi-body" class="panel-collapse panel-body" role="tabpanel" aria-labelledby="wifi-body">
<div id="ios-apns-config-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-apns-certificate">
APNS Certificate
<span class="helper" title="Upload APNS Certificate">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label><br>
<label class="wr-input-label" id="apns-cert-file-name">
</label>
<input id="ios-config-apns-certificate" type="file" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-apns-certificate-password">
APNS Certificate Password
<span class="helper" title="MDM Certificate Password">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="ios-config-apns-certificate-password" type="password" class="form-control" placeholder="[ Required Field ]">
</div>
<div class="wr-input-control">
<label class="wr-input-label" for="ios-config-apns-mode">
Mode
<span class="helper" title="Release mode">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<select id="ios-config-apns-mode" class="form-control" data-default="0">
<option value="1">Production</option>
<option value="2">Developer</option>
</select>
</div>
</div>
<div id="wifi-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
End User License Agreement (EULA)
<hr>
</h2>
</div>
<div id="wifi-body" class="panel-collapse panel-body" role="tabpanel" aria-labelledby="wifi-body">
<div class="wr-input-control">
<textarea id="ios-eula" type="text" class="form-control"></textarea>
</div>
<div class="wr-input-control wr-btn-grp">
<button id="save-ios-btn" class="wr-btn">&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp;</button>
</div>
</div>
</div>
</div>
<!-- /ios -->
<!-- windows -->
<div class="wr-hidden-operation" data-operation="windows">
<div class="panel panel-default">
<div id="windows-config-body" class="panel-collapse panel-body" role="tabpanel">
<div id="windows-config-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div id="local-inputs">
<div class="wr-input-control">
<label class="wr-input-label" for="windows-config-notifier-frequency">
Notifier Frequency
<span class="helper" title="Notifier frequency for the agent to contact EMM server">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
<br>
( Should be in minutes )
</label>
<input id="windows-config-notifier-frequency" type="text" class="form-control" placeholder="[ Required Field ]">
</div>
</div>
</div>
<div id="wifi-heading" class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
End User License Agreement (EULA)
<hr>
</h2>
</div>
<div id="wifi-body" class="panel-collapse panel-body" role="tabpanel" aria-labelledby="wifi-body">
<div class="wr-input-control">
<textarea id="windows-eula" type="text" class="form-control"></textarea>
</div>
<div class="wr-input-control wr-btn-grp">
<button id="save-windows-btn" class="wr-btn">&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp;</button>
</div>
</div>
</div>
</div>
<!-- /windows -->
</div>
</div>
</div>
</div>
<div id="record-created-msg" class="container col-centered wr-content hidden">
<div class="wr-form">
<p class="page-sub-title">Configuration was saved successfully.</p>
<br>
<br>Please click <b>"Go back to configurations"</b>, if you wish to save another configuration or click
<b>"Exit"</b> to complete the process and go back to the dashboard.
<hr />
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/platform-configuration'">Go back to configurations</button>
<button class="wr-btn" onclick="window.location.href='{{@app.context}}'">&nbsp;&nbsp;&nbsp;&nbsp;Exit&nbsp;&nbsp;&nbsp;&nbsp;</button>
</div>
</div>
<!-- /content -->
</div>
</div>
{{#zone "bottomJs"}}
{{js "js/platform-configuration.js"}}
{{/zone}}

@ -0,0 +1,856 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Checks if provided input is valid against RegEx input.
*
* @param regExp Regular expression
* @param inputString Input string to check
* @returns {boolean} Returns true if input matches RegEx
*/
function inputIsValid(regExp, inputString) {
return regExp.test(inputString);
}
/**
* Checks if an email address has the valid format or not.
*
* @param email Email address
* @returns {boolean} true if email has the valid format, otherwise false.
*/
function emailIsValid(email) {
var regExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
return regExp.test(email);
}
var notifierTypeConstants = {
"LOCAL": "1",
"GCM": "2"
};
// Constants to define platform types available
var platformTypeConstants = {
"ANDROID": "android",
"IOS": "ios",
"WINDOWS": "windows"
};
var responseCodes = {
"CREATED": "Created",
"SUCCESS": "201",
"INTERNAL_SERVER_ERROR": "Internal Server Error"
};
var configParams = {
"NOTIFIER_TYPE": "notifierType",
"NOTIFIER_FREQUENCY": "notifierFrequency",
"GCM_API_KEY": "gcmAPIKey",
"GCM_SENDER_ID": "gcmSenderId",
"ANDROID_EULA": "androidEula",
"IOS_EULA": "iosEula",
"CONFIG_COUNTRY": "configCountry",
"CONFIG_STATE": "configState",
"CONFIG_LOCALITY": "configLocality",
"CONFIG_ORGANIZATION": "configOrganization",
"CONFIG_ORGANIZATION_UNIT": "configOrganizationUnit",
"MDM_CERT_PASSWORD": "MDMCertPassword",
"MDM_CERT_TOPIC_ID": "MDMCertTopicID",
"APNS_CERT_PASSWORD": "APNSCertPassword",
"MDM_CERT": "MDMCert",
"MDM_CERT_NAME": "MDMCertName",
"APNS_CERT": "APNSCert",
"APNS_CERT_NAME": "APNSCertName",
"ORG_DISPLAY_NAME": "organizationDisplayName",
"GENERAL_EMAIL_HOST": "emailHost",
"GENERAL_EMAIL_PORT": "emailPort",
"GENERAL_EMAIL_USERNAME": "emailUsername",
"GENERAL_EMAIL_PASSWORD": "emailPassword",
"GENERAL_EMAIL_SENDER_ADDRESS": "emailSender",
"GENERAL_EMAIL_TEMPLATE": "emailTemplate",
"COMMON_NAME": "commonName",
"KEYSTORE_PASSWORD": "keystorePassword",
"PRIVATE_KEY_PASSWORD": "privateKeyPassword",
"BEFORE_EXPIRE": "beforeExpire",
"AFTER_EXPIRE": "afterExpire",
"WINDOWS_EULA": "windowsLicense"
};
$(document).ready(function () {
$("#gcm-inputs").hide();
tinymce.init({
selector: "textarea",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime image table contextmenu paste"
],
toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
});
var getAndroidConfigAPI = "/mdm-android-agent/configuration";
var getGeneralConfigAPI = "/devicemgt_admin/configuration";
var getIosConfigAPI = "/ios/configuration";
var getWindowsConfigAPI = "/mdm-windows-agent/services/configuration";
/**
* Following requests would execute
* on page load event of platform configuration page in WSO2 EMM Console.
* Upon receiving the response, the parameters will be set to the fields,
* in case those configurations are already set.
*/
invokerUtil.get(
getAndroidConfigAPI,
function (data) {
data = JSON.parse(data);
if (data != null && data.configuration != null) {
for (var i = 0; i < data.configuration.length; i++) {
var config = data.configuration[i];
if(config.name == configParams["NOTIFIER_TYPE"]){
$("#android-config-notifier").val(config.value);
if(config.value != notifierTypeConstants["GCM"] ) {
$("#gcm-inputs").hide();
}else{
$("#gcm-inputs").show();
}
} else if(config.name == configParams["NOTIFIER_FREQUENCY"]){
$("input#android-config-notifier-frequency").val(config.value);
} else if(config.name == configParams["GCM_API_KEY"]){
$("input#android-config-gcm-api-key").val(config.value);
} else if(config.name == configParams["GCM_SENDER_ID"]){
$("input#android-config-gcm-sender-id").val(config.value);
} else if(config.name == configParams["ANDROID_EULA"]){
$("#android-eula").val(config.value);
}
}
}
}, function () {
}
);
invokerUtil.get(
getGeneralConfigAPI,
function (data) {
data = JSON.parse(data);
if (data != null && data.configuration != null) {
for (var i = 0; i < data.configuration.length; i++) {
var config = data.configuration[i];
if(config.name == configParams["NOTIFIER_FREQUENCY"]){
$("input#monitoring-config-frequency").val(config.value);
}
/*if(config.name == configParams["GENERAL_EMAIL_HOST"]){
$("input#email-config-host").val(config.value);
} else if(config.name == configParams["GENERAL_EMAIL_PORT"]){
$("input#email-config-port").val(config.value);
} else if(config.name == configParams["GENERAL_EMAIL_USERNAME"]){
$("input#email-config-username").val(config.value);
} else if(config.name == configParams["GENERAL_EMAIL_PASSWORD"]){
$("input#email-config-password").val(config.value);
} else if(config.name == configParams["GENERAL_EMAIL_SENDER_ADDRESS"]){
$("input#email-config-sender-email").val(config.value);
} else if(config.name == configParams["GENERAL_EMAIL_TEMPLATE"]){
$("input#email-config-template").val(config.value);
}*/
}
}
}, function () {
}
);
invokerUtil.get(
getIosConfigAPI,
function (data) {
data = JSON.parse(data);
if (data != null && data.configuration != null) {
for (var i = 0; i < data.configuration.length; i++) {
var config = data.configuration[i];
if(config.name == configParams["CONFIG_COUNTRY"]){
$("input#ios-config-country").val(config.value);
} else if(config.name == configParams["CONFIG_STATE"]){
$("input#ios-config-state").val(config.value);
} else if(config.name == configParams["CONFIG_LOCALITY"]){
$("input#ios-config-locality").val(config.value);
} else if(config.name == configParams["CONFIG_ORGANIZATION"]){
$("input#ios-config-organization").val(config.value);
} else if(config.name == configParams["CONFIG_ORGANIZATION_UNIT"]){
$("input#ios-config-organization-unit").val(config.value);
} else if(config.name == configParams["MDM_CERT_PASSWORD"]){
$("input#ios-config-mdm-certificate-password").val(config.value);
} else if(config.name == configParams["MDM_CERT_TOPIC_ID"]){
$("input#ios-config-mdm-certificate-topic-id").val(config.value);
} else if(config.name == configParams["APNS_CERT_PASSWORD"]){
$("input#ios-config-apns-certificate-password").val(config.value);
} else if(config.name == configParams["MDM_CERT_NAME"]){
$("#mdm-cert-file-name").html(config.value);
} else if(config.name == configParams["APNS_CERT_NAME"]){
$("#apns-cert-file-name").html(config.value);
} else if(config.name == configParams["ORG_DISPLAY_NAME"]){
$("input#ios-org-display-name").val(config.value);
} else if(config.name == configParams["IOS_EULA"]){
$("#ios-eula").val(config.value);
}
}
}
}, function () {
}
);
invokerUtil.get(
getWindowsConfigAPI,
function (data) {
data = JSON.parse(data);
if (data != null && data.configuration != null) {
for (var i = 0; i < data.configuration.length; i++) {
var config = data.configuration[i];
if(config.name == configParams["NOTIFIER_FREQUENCY"]) {
$("input#windows-config-notifier-frequency").val(config.value);
} else if(config.name == configParams["WINDOWS_EULA"]) {
$("#windows-eula").val(config.value);
}
}
}
}, function () {
}
);
$("select.select2[multiple=multiple]").select2({
tags : true
});
$("#android-config-notifier").change(function() {
var notifierType = $("#android-config-notifier").find("option:selected").attr("value");
if(notifierType != notifierTypeConstants["GCM"] ) {
$("#gcm-inputs").hide();
$("#local-inputs").show();
}else{
$("#local-inputs").hide();
$("#gcm-inputs").show();
}
});
/**
* Following click function would execute
* when a user clicks on "Save" button
* on Android platform configuration page in WSO2 EMM Console.
*/
$("button#save-android-btn").click(function() {
var notifierType = $("#android-config-notifier").find("option:selected").attr("value");
var notifierFrequency = $("input#android-config-notifier-frequency").val();
var gcmAPIKey = $("input#android-config-gcm-api-key").val();
var gcmSenderId = $("input#android-config-gcm-sender-id").val();
var androidLicense = tinymce.get('android-eula').getContent();
var errorMsgWrapper = "#android-config-error-msg";
var errorMsg = "#android-config-error-msg span";
if (!notifierFrequency) {
$(errorMsg).text("Notifier frequency is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!$.isNumeric(notifierFrequency)) {
$(errorMsg).text("Provided notifier frequency is invalid. Please check.");
$(errorMsgWrapper).removeClass("hidden");
} else if (notifierType == notifierTypeConstants["GCM"] && !gcmAPIKey) {
$(errorMsg).text("GCM API Key is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (notifierType == notifierTypeConstants["GCM"] && !gcmSenderId) {
$(errorMsg).text("GCM Sender ID is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else {
var addConfigFormData = {};
var configList = new Array();
var type = {
"name": configParams["NOTIFIER_TYPE"],
"value": notifierType,
"contentType": "text"
};
var frequency = {
"name": configParams["NOTIFIER_FREQUENCY"],
"value": notifierFrequency,
"contentType": "text"
};
var gcmKey = {
"name": configParams["GCM_API_KEY"],
"value": gcmAPIKey,
"contentType": "text"
};
var gcmId = {
"name": configParams["GCM_SENDER_ID"],
"value": gcmSenderId,
"contentType": "text"
};
var androidEula = {
"name": configParams["ANDROID_EULA"],
"value": androidLicense,
"contentType": "text"
};
configList.push(type);
configList.push(frequency);
configList.push(androidEula);
if (notifierType == notifierTypeConstants["GCM"]) {
configList.push(gcmKey);
configList.push(gcmId);
}
addConfigFormData.type = platformTypeConstants["ANDROID"];
addConfigFormData.configuration = configList;
var addConfigAPI = "/mdm-android-agent/configuration";
invokerUtil.post(
addConfigAPI,
addConfigFormData,
function (data) {
data = JSON.parse(data);
if (data.responseCode == responseCodes["CREATED"]) {
$("#config-save-form").addClass("hidden");
$("#record-created-msg").removeClass("hidden");
} else if (data == 500) {
$(errorMsg).text("Exception occurred at backend.");
} else if (data == 403) {
$(errorMsg).text("Action was not permitted.");
} else {
$(errorMsg).text("An unexpected error occurred.");
}
$(errorMsgWrapper).removeClass("hidden");
}, function () {
$(errorMsg).text("An unexpected error occurred.");
$(errorMsgWrapper).removeClass("hidden");
}
);
}
});
/**
* Following click function would execute
* when a user clicks on "Save" button
* on General platform configuration page in WSO2 EMM Console.
*/
$("button#save-general-btn").click(function() {
var notifierFrequency = $("input#monitoring-config-frequency").val();
/*var emailHost = $("input#email-config-host").val();
var emailPort = $("input#email-config-port").val();
var emailUsername = $("input#email-config-username").val();
var emailPassword = $("input#email-config-password").val();
var emailSenderAddress = $("input#email-config-sender-email").val();
var emailTemplate = $("input#email-config-template").val();*/
var errorMsgWrapper = "#email-config-error-msg";
var errorMsg = "#email-config-error-msg span";
if (!notifierFrequency) {
$(errorMsg).text("Monitoring frequency is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!$.isNumeric(notifierFrequency)) {
$(errorMsg).text("Provided monitoring frequency is invalid. It must be a number.");
$(errorMsgWrapper).removeClass("hidden");
} else {
var addConfigFormData = {};
var configList = new Array();
var monitorFrequency = {
"name": configParams["NOTIFIER_FREQUENCY"],
"value": notifierFrequency,
"contentType": "text"
};
/*if (!emailHost) {
$(errorMsg).text("Email Host is a required field. It cannot be empty.");
//$(errorMsgWrapper).removeClass("hidden");
} else if (!notifierFrequency) {
$(errorMsg).text("Monitoring frequency is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!$.isNumeric(notifierFrequency)) {
$(errorMsg).text("Provided monitoring frequency is invalid. It must be a number.");
$(errorMsgWrapper).removeClass("hidden");
}else if (!emailPort) {
$(errorMsg).text("Email Port is a required field. It cannot be empty.");
//$(errorMsgWrapper).removeClass("hidden");
} else if (!emailUsername) {
$(errorMsg).text("Username is a required field. It cannot be empty.");
//$(errorMsgWrapper).removeClass("hidden");
} else if (!emailPassword) {
$(errorMsg).text("Password is a required field. It cannot be empty.");
//$(errorMsgWrapper).removeClass("hidden");
} else if (!emailSenderAddress) {
$(errorMsg).text("Sender Email Address is a required field. It cannot be empty.");
//$(errorMsgWrapper).removeClass("hidden");
} else if (!emailIsValid(emailSenderAddress)) {
$(errorMsg).text("Provided sender email is invalid. Please check.");
//$(errorMsgWrapper).removeClass("hidden");
} */
/*var host = {
"name": configParams["GENERAL_EMAIL_HOST"],
"value": emailHost,
"contentType": "text"
};
var port = {
"name": configParams["GENERAL_EMAIL_PORT"],
"value": emailPort,
"contentType": "text"
};
var username = {
"name": configParams["GENERAL_EMAIL_USERNAME"],
"value": emailUsername,
"contentType": "text"
};
var password = {
"name": configParams["GENERAL_EMAIL_PASSWORD"],
"value": emailPassword,
"contentType": "text"
};
var sender = {
"name": configParams["GENERAL_EMAIL_SENDER_ADDRESS"],
"value": emailSenderAddress,
"contentType": "text"
};
var template = {
"name": configParams["GENERAL_EMAIL_TEMPLATE"],
"value": emailTemplate,
"contentType": "text"
};*/
configList.push(monitorFrequency);
/*configList.push(host);
configList.push(port);
configList.push(username);
configList.push(password);
configList.push(sender);
configList.push(template);*/
addConfigFormData.configuration = configList;
var addConfigAPI = "/devicemgt_admin/configuration";
invokerUtil.post(
addConfigAPI,
addConfigFormData,
function (data) {
data = JSON.parse(data);
if (data.statusCode == responseCodes["SUCCESS"]) {
$("#config-save-form").addClass("hidden");
$("#record-created-msg").removeClass("hidden");
} else if (data == 500) {
$(errorMsg).text("Exception occurred at backend.");
} else if (data == 403) {
$(errorMsg).text("Action was not permitted.");
} else {
$(errorMsg).text("An unexpected error occurred.");
}
$(errorMsgWrapper).removeClass("hidden");
}, function () {
$(errorMsg).text("An unexpected error occurred.");
$(errorMsgWrapper).removeClass("hidden");
}
);
}
});
var errorMsgWrapper = "#ios-config-error-msg";
var errorMsg = "#ios-config-error-msg span";
var fileTypes = ['pfx'];
var notSupportedError = false;
var base64MDMCert = "";
var fileInputMDMCert = $('#ios-config-mdm-certificate');
var fileNameMDMCert = "";
var invalidFormatMDMCert = false;
var base64APNSCert = "";
var fileInputAPNSCert = $('#ios-config-apns-certificate');
var fileNameAPNSCert = "";
var invalidFormatAPNSCert = false;
$(fileInputMDMCert).change(function() {
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
$(errorMsg).text("The File APIs are not fully supported in this browser.");
$(errorMsgWrapper).removeClass("hidden");
notSupportedError = true;
return;
}
var file = fileInputMDMCert[0].files[0];
fileNameMDMCert = file.name;
var extension = file.name.split('.').pop().toLowerCase(),
isSuccess = fileTypes.indexOf(extension) > -1;
if (isSuccess) {
var fileReader = new FileReader();
fileReader.onload = function(event) {
base64MDMCert = event.target.result;
};
fileReader.readAsDataURL(file);
invalidFormatMDMCert = false;
} else {
base64MDMCert = "";
invalidFormatMDMCert = true;
}
});
$(fileInputAPNSCert).change(function() {
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
$(errorMsg).text("The File APIs are not fully supported in this browser.");
$(errorMsgWrapper).removeClass("hidden");
notSupportedError = true;
return;
}
var file = fileInputAPNSCert[0].files[0];
fileNameAPNSCert = file.name;
var extension = file.name.split('.').pop().toLowerCase(),
isSuccess = fileTypes.indexOf(extension) > -1;
if (isSuccess) {
var fileReader = new FileReader();
fileReader.onload = function(event) {
base64APNSCert = event.target.result;
};
fileReader.readAsDataURL(file);
invalidFormatAPNSCert = false;
} else {
base64MDMCert = "";
invalidFormatAPNSCert = true;
}
});
$("button#save-ios-btn").click(function() {
var configCountry = $("#ios-config-country").val();
var configState = $("#ios-config-state").val();
var configLocality = $("#ios-config-locality").val();
var configOrganization = $("#ios-config-organization").val();
var configOrganizationUnit = $("#ios-config-organization-unit").val();
var MDMCertPassword = $("#ios-config-mdm-certificate-password").val();
var MDMCertTopicID = $("#ios-config-mdm-certificate-topic-id").val();
var APNSCertPassword = $("#ios-config-apns-certificate-password").val();
var configOrgDisplayName = $("#ios-org-display-name").val();
var iosLicense = tinymce.get('ios-eula').getContent();
if (!configCountry) {
$(errorMsg).text("SCEP country is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!configState) {
$(errorMsg).text("SCEP state is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!configLocality) {
$(errorMsg).text("SCEP locality is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!configOrganization) {
$(errorMsg).text("SCEP organization is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!configOrganizationUnit) {
$(errorMsg).text("SCEP organization unit is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!MDMCertPassword) {
$(errorMsg).text("MDM certificate password is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!MDMCertTopicID) {
$(errorMsg).text("MDM certificate topic ID is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!APNSCertPassword) {
$(errorMsg).text("APNS certificate password is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if(notSupportedError) {
$(errorMsg).text("The File APIs are not fully supported in this browser.");
$(errorMsgWrapper).removeClass("hidden");
} else if (invalidFormatMDMCert) {
$(errorMsg).text("MDM certificate needs to be in pfx format.");
$(errorMsgWrapper).removeClass("hidden");
} else if (base64MDMCert == '') {
$(errorMsg).text("MDM certificate is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (invalidFormatAPNSCert) {
$(errorMsg).text("APNS certificate needs to be in pfx format.");
$(errorMsgWrapper).removeClass("hidden");
} else if (base64APNSCert == '') {
$(errorMsg).text("APNS certificate is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!configOrgDisplayName) {
$(errorMsg).text("Organization display name is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
}
var addConfigFormData = {};
var configList = new Array();
var configCountry = {
"name": configParams["CONFIG_COUNTRY"],
"value": configCountry,
"contentType": "text"
};
var configState = {
"name": configParams["CONFIG_STATE"],
"value": configState,
"contentType": "text"
};
var configLocality = {
"name": configParams["CONFIG_LOCALITY"],
"value": configLocality,
"contentType": "text"
};
var configOrganization = {
"name": configParams["CONFIG_ORGANIZATION"],
"value": configOrganization,
"contentType": "text"
};
var configOrganizationUnit = {
"name": configParams["CONFIG_ORGANIZATION_UNIT"],
"value": configOrganizationUnit,
"contentType": "text"
};
var MDMCertPassword = {
"name": configParams["MDM_CERT_PASSWORD"],
"value": MDMCertPassword,
"contentType": "text"
};
var MDMCertTopicID = {
"name": configParams["MDM_CERT_TOPIC_ID"],
"value": MDMCertTopicID,
"contentType": "text"
};
var APNSCertPassword = {
"name": configParams["APNS_CERT_PASSWORD"],
"value": APNSCertPassword,
"contentType": "text"
};
var paramBase64MDMCert = {
"name": configParams["MDM_CERT"],
"value": base64MDMCert,
"contentType": "text"
};
var MDMCertName = {
"name": configParams["MDM_CERT_NAME"],
"value": fileNameMDMCert,
"contentType": "text"
};
var paramBase64APNSCert = {
"name": configParams["APNS_CERT"],
"value": base64APNSCert,
"contentType": "text"
};
var APNSCertName = {
"name": configParams["APNS_CERT_NAME"],
"value": fileNameAPNSCert,
"contentType": "text"
};
var paramOrganizationDisplayName = {
"name": configParams["ORG_DISPLAY_NAME"],
"value": configOrgDisplayName,
"contentType": "text"
};
var iosEula = {
"name": configParams["IOS_EULA"],
"value": iosLicense,
"contentType": "text"
};
configList.push(configCountry);
configList.push(configState);
configList.push(configLocality);
configList.push(configOrganization);
configList.push(configOrganizationUnit);
configList.push(MDMCertPassword);
configList.push(MDMCertTopicID);
configList.push(APNSCertPassword);
configList.push(paramBase64MDMCert);
configList.push(MDMCertName);
configList.push(paramBase64APNSCert);
configList.push(APNSCertName);
configList.push(paramOrganizationDisplayName);
configList.push(iosEula);
addConfigFormData.type = platformTypeConstants["IOS"];
addConfigFormData.configuration = configList;
var addConfigAPI = "/ios/configuration";
invokerUtil.post(
addConfigAPI,
addConfigFormData,
function (data) {
data = JSON.parse(data);
if (data.responseCode == responseCodes["CREATED"]) {
$("#config-save-form").addClass("hidden");
$("#record-created-msg").removeClass("hidden");
} else if (data == 500) {
$(errorMsg).text("Exception occurred at backend.");
} else if (data == 400) {
$(errorMsg).text("Configurations cannot be empty.");
} else {
$(errorMsg).text("An unexpected error occurred.");
}
$(errorMsgWrapper).removeClass("hidden");
}, function () {
$(errorMsg).text("An unexpected error occurred.");
$(errorMsgWrapper).removeClass("hidden");
}
);
});
var errorMsgWrapper = "#windows-config-error-msg";
var errorMsg = "#windows-config-error-msg span";
var fileTypes = ['jks'];
var notSupportedError = false;
var base64WindowsMDMCert = "";
var fileInputWindowsMDMCert = $('#windows-config-mdm-certificate');
var fileNameWindowsMDMCert = "";
var invalidFormatWindowsMDMCert = false;
$(fileInputWindowsMDMCert).change(function() {
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
$(errorMsg).text("The File APIs are not fully supported in this browser.");
$(errorMsgWrapper).removeClass("hidden");
notSupportedError = true;
return;
}
var file = fileInputWindowsMDMCert[0].files[0];
fileNameWindowsMDMCert = file.name;
var extension = file.name.split('.').pop().toLowerCase(),
isSuccess = fileTypes.indexOf(extension) > -1;
if (isSuccess) {
var fileReader = new FileReader();
fileReader.onload = function(event) {
base64WindowsMDMCert = event.target.result;
};
fileReader.readAsDataURL(file);
invalidFormatWindowsMDMCert = false;
} else {
base64MDMCert = "";
invalidFormatWindowsMDMCert = true;
}
});
$("button#save-windows-btn").click(function() {
var notifierFrequency = $("#windows-config-notifier-frequency").val();
var windowsLicense = tinymce.get('windows-eula').getContent();
if (!notifierFrequency) {
$(errorMsg).text("Notifier Frequency is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!windowsLicense) {
$(errorMsg).text("License is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if(!$.isNumeric(notifierFrequency)){
$(errorMsg).text("Provided Notifier frequency is invalid. It must be a number.");
$(errorMsgWrapper).removeClass("hidden");
}
var addConfigFormData = {};
var configList = new Array();
var paramNotifierFrequency = {
"name": configParams["NOTIFIER_FREQUENCY"],
"value": notifierFrequency,
"contentType": "text"
};
var windowsEula = {
"name": configParams["WINDOWS_EULA"],
"value": windowsLicense,
"contentType": "text"
};
configList.push(paramNotifierFrequency);
configList.push(windowsEula);
addConfigFormData.type = platformTypeConstants["WINDOWS"];
addConfigFormData.configuration = configList;
var addConfigAPI = "/mdm-windows-agent/services/configuration";
invokerUtil.post(
addConfigAPI,
addConfigFormData,
function (data) {
data = JSON.parse(data);
if (data.responseCode == responseCodes["CREATED"]) {
$("#config-save-form").addClass("hidden");
$("#record-created-msg").removeClass("hidden");
} else if (data == 500) {
$(errorMsg).text("Exception occurred at backend.");
} else if (data == 400) {
$(errorMsg).text("Configurations cannot be empty.");
} else {
$(errorMsg).text("An unexpected error occurred.");
}
$(errorMsgWrapper).removeClass("hidden");
}, function () {
$(errorMsg).text("An unexpected error occurred.");
$(errorMsgWrapper).removeClass("hidden");
}
);
});
});
// Start of HTML embedded invoke methods
var showAdvanceOperation = function (operation, button) {
$(button).addClass('selected');
$(button).siblings().removeClass('selected');
var hiddenOperation = ".wr-hidden-operations-content > div";
$(hiddenOperation + '[data-operation="' + operation + '"]').show();
$(hiddenOperation + '[data-operation="' + operation + '"]').siblings().hide();
};
Loading…
Cancel
Save