2016-03-18 21:26:17 -07:00
|
|
|
|
define(['jQuery'], function ($) {
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
|
|
|
|
function loadPage(page, config) {
|
|
|
|
|
|
|
|
|
|
$('#txtPortNumber', page).val(config.HttpServerPortNumber);
|
|
|
|
|
$('#txtPublicPort', page).val(config.PublicPort);
|
2015-01-18 21:53:28 -07:00
|
|
|
|
$('#txtPublicHttpsPort', page).val(config.PublicHttpsPort);
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
2015-08-19 09:43:23 -07:00
|
|
|
|
$('#chkEnableHttps', page).checked(config.EnableHttps);
|
2015-01-18 21:29:57 -07:00
|
|
|
|
$('#txtHttpsPort', page).val(config.HttpsPortNumber);
|
|
|
|
|
|
|
|
|
|
$('#txtDdns', page).val(config.WanDdns || '');
|
2015-01-22 23:15:15 -07:00
|
|
|
|
$('#txtCertificatePath', page).val(config.CertificatePath || '');
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
2015-08-19 09:43:23 -07:00
|
|
|
|
$('#chkEnableUpnp', page).checked(config.EnableUPnP);
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-14 10:16:29 -07:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
2015-05-14 10:16:29 -07:00
|
|
|
|
|
|
|
|
|
config.HttpServerPortNumber = $('#txtPortNumber', form).val();
|
|
|
|
|
config.PublicPort = $('#txtPublicPort', form).val();
|
|
|
|
|
config.PublicHttpsPort = $('#txtPublicHttpsPort', form).val();
|
|
|
|
|
config.EnableHttps = $('#chkEnableHttps', form).checked();
|
|
|
|
|
config.HttpsPortNumber = $('#txtHttpsPort', form).val();
|
|
|
|
|
config.EnableUPnP = $('#chkEnableUpnp', form).checked();
|
|
|
|
|
config.WanDdns = $('#txtDdns', form).val();
|
|
|
|
|
config.CertificatePath = $('#txtCertificatePath', form).val();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
2015-05-14 10:16:29 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
$(document).on('pageshow', "#dashboardHostingPage", function () {
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
|
|
|
|
loadPage(page, config);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
}).on('pageinit', "#dashboardHostingPage", function () {
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
2015-01-22 23:15:15 -07:00
|
|
|
|
|
|
|
|
|
$('#btnSelectCertPath', page).on("click.selectDirectory", function () {
|
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
require(['directorybrowser'], function (directoryBrowser) {
|
2015-01-22 23:15:15 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
var picker = new directoryBrowser();
|
2015-01-22 23:15:15 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
picker.show({
|
2015-01-22 23:15:15 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
includeFiles: true,
|
|
|
|
|
includeDirectories: true,
|
2015-01-22 23:15:15 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
callback: function (path) {
|
2015-01-22 23:15:15 -07:00
|
|
|
|
|
2015-10-13 12:22:45 -07:00
|
|
|
|
if (path) {
|
|
|
|
|
$('#txtCertificatePath', page).val(path);
|
|
|
|
|
}
|
|
|
|
|
picker.close();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
header: Globalize.translate('HeaderSelectCertificatePath')
|
|
|
|
|
});
|
2015-01-22 23:15:15 -07:00
|
|
|
|
});
|
|
|
|
|
});
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
2015-05-14 10:16:29 -07:00
|
|
|
|
$('.dashboardHostingForm').off('submit', onSubmit).on('submit', onSubmit);
|
|
|
|
|
});
|
2015-01-18 21:29:57 -07:00
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|