2014-10-13 13:14:53 -07:00
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
|
|
function load(page, device, capabilities) {
|
|
|
|
|
|
|
|
|
|
if (capabilities.SupportsContentUploading) {
|
2014-10-30 21:57:24 -07:00
|
|
|
|
$('#fldCameraUploadPath', page).show();
|
2014-10-13 13:14:53 -07:00
|
|
|
|
} else {
|
2014-10-30 21:57:24 -07:00
|
|
|
|
$('#fldCameraUploadPath', page).hide();
|
2014-10-13 13:14:53 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#txtCustomName', page).val(device.CustomName || '');
|
2014-11-25 21:12:29 -07:00
|
|
|
|
$('#txtUploadPath', page).val(device.CameraUploadPath || '');
|
2014-10-30 21:57:24 -07:00
|
|
|
|
$('.reportedName', page).html(device.ReportedName || '');
|
2014-10-13 13:14:53 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadData(page) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
|
|
|
|
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', { Id: id }));
|
|
|
|
|
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Capabilities', { Id: id }));
|
|
|
|
|
|
|
|
|
|
$.when(promise1, promise2).done(function (response1, response2) {
|
|
|
|
|
|
|
|
|
|
load(page, response1[0], response2[0]);
|
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function save(page) {
|
|
|
|
|
|
|
|
|
|
var id = getParameterByName('id');
|
|
|
|
|
|
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
|
|
|
|
|
url: ApiClient.getUrl('Devices/Options', { Id: id }),
|
|
|
|
|
type: 'POST',
|
|
|
|
|
data: JSON.stringify({
|
|
|
|
|
|
|
|
|
|
CustomName: $('#txtCustomName', page).val(),
|
|
|
|
|
CameraUploadPath: $('#txtUploadPath', page).val()
|
|
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
contentType: "application/json"
|
|
|
|
|
|
|
|
|
|
}).done(Dashboard.processServerConfigurationUpdateResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('pageinit', "#devicePage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('#btnSelectUploadPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
|
|
|
|
var picker = new DirectoryBrowser(page);
|
|
|
|
|
|
|
|
|
|
picker.show({
|
|
|
|
|
|
|
|
|
|
callback: function (path) {
|
|
|
|
|
|
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtUploadPath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
header: Globalize.translate('HeaderSelectUploadPath')
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).on('pageshow', "#devicePage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
loadData(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
window.DevicePage = {
|
|
|
|
|
|
|
|
|
|
onSubmit: function () {
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
var page = $(form).parents('.page');
|
|
|
|
|
|
|
|
|
|
save(page);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
})();
|