Decoupled substituted ssid & setting new settings locally again

This commit is contained in:
peteruithoven 2014-02-10 15:35:02 +01:00
parent d432c00336
commit 017020194f
3 changed files with 11 additions and 16 deletions

View File

@ -120,8 +120,7 @@ function FormPanel() {
validated = false;
}
});
settings.substituted_ssid = data.substituted_ssid;
if(complete) complete(validated);
if(complete) complete(validated, data);
}, function() {
console.log("Settings:saveSettings: failed");
clearTimeout(_retrySaveSettingsDelay);

View File

@ -24,6 +24,7 @@ function NetworkPanel() {
var _networks = {};
var _currentNetwork; // the ssid of the network the box is on
var _selectedNetwork; // the ssid of the selected network in the client mode settings
var _substituted_ssid; // the substituted ssid (displayed during creation)
var _currentLocalIP = "";
var _currentAP;
var _currentNetworkStatus;
@ -295,7 +296,7 @@ function NetworkPanel() {
break;
case NetworkAPI.STATUS.CREATING:
_btnCreate.attr("disabled", true);
msg = "Creating access point... Reconnect by connecting your device to <b>"+settings.substituted_ssid+"</b> and going to <a href='http://draw.doodle3d.com'>draw.doodle3d.com</a>";
msg = "Creating access point... Reconnect by connecting your device to <b>"+_substituted_ssid+"</b> and going to <a href='http://draw.doodle3d.com'>draw.doodle3d.com</a>";
break;
}
//console.log(" ap display msg: ",msg);
@ -306,7 +307,7 @@ function NetworkPanel() {
//console.log("NetworkPanel:connectToNetwork");
if(_selectedNetwork == undefined) return;
// save network related settings and on complete, connect to network
_form.saveSettings(_form.readForm(),function(validated) {
_form.saveSettings(_form.readForm(),function(validated, data) {
if(!validated) return;
updateClientModeUI(NetworkAPI.STATUS.CONNECTING,"");
_api.associate(_selectedNetwork,_passwordField.val(),true);
@ -321,8 +322,9 @@ function NetworkPanel() {
this.createAP = function() {
//console.log("createAP");
// save network related settings and on complete, create access point
_form.saveSettings(_form.readForm(),function(success) {
if(!success) return;
_form.saveSettings(_form.readForm(),function(validated, data) {
if(!validated) return;
_substituted_ssid = data.substituted_ssid;
updateAPModeUI(NetworkAPI.STATUS.CREATING,"");
_api.openAP();

View File

@ -108,8 +108,10 @@ function SettingsWindow() {
_btnOK.attr("disabled",true);
e.preventDefault();
e.stopPropagation();
_form.saveSettings(_form.readForm(),function(success){
if(success) {
var newSettings = _form.readForm();
_form.saveSettings(newSettings,function(validated, data){
if(validated) {
settings = newSettings; // store new settings in global settings
settingsPopup.close();
self.signin();
}
@ -128,14 +130,6 @@ function SettingsWindow() {
_networkPanel.update();
};
this.saveSettings = function(newSettings,complete) {
settings = newSettings; // store new settings in global settings
_form.saveSettings(newSettings,function(validated) {
//TODO: settings.substituted_ssid = data.substituted_ssid;
if(complete) complete(validated);
});
};
this.resetSettings = function() {
console.log("resetSettings");
self.btnRestoreSettings.attr("disabled", true);