Resolve: System methods prev/nextArea, and prev/nextConf can cause a crash #79
This commit is contained in:
parent
fb737357f5
commit
0a629feeb0
73
core/fse.js
73
core/fse.js
|
@ -5,7 +5,6 @@ const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||||
const ViewController = require('../core/view_controller.js').ViewController;
|
const ViewController = require('../core/view_controller.js').ViewController;
|
||||||
const ansi = require('../core/ansi_term.js');
|
const ansi = require('../core/ansi_term.js');
|
||||||
const theme = require('../core/theme.js');
|
const theme = require('../core/theme.js');
|
||||||
const MultiLineEditTextView = require('../core/multi_line_edit_text_view.js').MultiLineEditTextView;
|
|
||||||
const Message = require('../core/message.js');
|
const Message = require('../core/message.js');
|
||||||
const getMessageAreaByTag = require('../core/message_area.js').getMessageAreaByTag;
|
const getMessageAreaByTag = require('../core/message_area.js').getMessageAreaByTag;
|
||||||
const updateMessageAreaLastReadId = require('../core/message_area.js').updateMessageAreaLastReadId;
|
const updateMessageAreaLastReadId = require('../core/message_area.js').updateMessageAreaLastReadId;
|
||||||
|
@ -694,14 +693,16 @@ function FullScreenEditorModule(options) {
|
||||||
setFooterText(MCICodeIds.ViewModeFooter.MsgTotal, self.messageTotal.toString());
|
setFooterText(MCICodeIds.ViewModeFooter.MsgTotal, self.messageTotal.toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
this.displayHelp = function() {
|
this.displayHelp = function(cb) {
|
||||||
self.client.term.rawWrite(ansi.resetScreen());
|
self.client.term.rawWrite(ansi.resetScreen());
|
||||||
|
|
||||||
theme.displayThemeArt( { name : self.menuConfig.config.art.help, client : self.client },
|
theme.displayThemeArt(
|
||||||
function helpDisplayed(err, artData) {
|
{ name : self.menuConfig.config.art.help, client : self.client },
|
||||||
self.client.waitForKeyPress(function keyPress(ch, key) {
|
() => {
|
||||||
self.redrawScreen(function redrawn(err) {
|
self.client.waitForKeyPress( () => {
|
||||||
|
self.redrawScreen( () => {
|
||||||
self.viewControllers[self.getFooterName()].setFocus(true);
|
self.viewControllers[self.getFooterName()].setFocus(true);
|
||||||
|
return cb(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -867,10 +868,11 @@ function FullScreenEditorModule(options) {
|
||||||
cb(newFocusViewId);
|
cb(newFocusViewId);
|
||||||
},
|
},
|
||||||
|
|
||||||
headerSubmit : function(formData, extraArgs) {
|
headerSubmit : function(formData, extraArgs, cb) {
|
||||||
self.switchToBody();
|
self.switchToBody();
|
||||||
|
return cb(null);
|
||||||
},
|
},
|
||||||
editModeEscPressed : function(formData, extraArgs) {
|
editModeEscPressed : function(formData, extraArgs, cb) {
|
||||||
self.footerMode = 'editor' === self.footerMode ? 'editorMenu' : 'editor';
|
self.footerMode = 'editor' === self.footerMode ? 'editorMenu' : 'editor';
|
||||||
|
|
||||||
self.switchFooter(function next(err) {
|
self.switchFooter(function next(err) {
|
||||||
|
@ -879,38 +881,40 @@ function FullScreenEditorModule(options) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
} else {
|
} else {
|
||||||
switch(self.footerMode) {
|
switch(self.footerMode) {
|
||||||
case 'editor' :
|
case 'editor' :
|
||||||
if(!_.isUndefined(self.viewControllers.footerEditorMenu)) {
|
if(!_.isUndefined(self.viewControllers.footerEditorMenu)) {
|
||||||
//self.viewControllers.footerEditorMenu.setFocus(false);
|
//self.viewControllers.footerEditorMenu.setFocus(false);
|
||||||
self.viewControllers.footerEditorMenu.detachClientEvents();
|
self.viewControllers.footerEditorMenu.detachClientEvents();
|
||||||
}
|
}
|
||||||
self.viewControllers.body.switchFocus(1);
|
self.viewControllers.body.switchFocus(1);
|
||||||
self.observeEditorEvents();
|
self.observeEditorEvents();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'editorMenu' :
|
case 'editorMenu' :
|
||||||
self.viewControllers.body.setFocus(false);
|
self.viewControllers.body.setFocus(false);
|
||||||
self.viewControllers.footerEditorMenu.switchFocus(1);
|
self.viewControllers.footerEditorMenu.switchFocus(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default : throw new Error('Unexpected mode');
|
default : throw new Error('Unexpected mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editModeMenuQuote : function(formData, extraArgs) {
|
editModeMenuQuote : function(formData, extraArgs, cb) {
|
||||||
self.viewControllers.footerEditorMenu.setFocus(false);
|
self.viewControllers.footerEditorMenu.setFocus(false);
|
||||||
self.displayQuoteBuilder();
|
self.displayQuoteBuilder();
|
||||||
|
return cb(null);
|
||||||
},
|
},
|
||||||
appendQuoteEntry: function(formData, extraArgs) {
|
appendQuoteEntry: function(formData, extraArgs, cb) {
|
||||||
// :TODO: Dont' use magic # ID's here
|
// :TODO: Dont' use magic # ID's here
|
||||||
var quoteMsgView = self.viewControllers.quoteBuilder.getView(1);
|
var quoteMsgView = self.viewControllers.quoteBuilder.getView(1);
|
||||||
|
|
||||||
if(self.newQuoteBlock) {
|
if(self.newQuoteBlock) {
|
||||||
self.newQuoteBlock = false;
|
self.newQuoteBlock = false;
|
||||||
|
|
||||||
// :TODO: Make date/time format avail as FSE config
|
// :TODO: Make date/time format avail as FSE config -- also the line itself!
|
||||||
var dtFormat = self.client.currentTheme.helpers.getDateTimeFormat();
|
var dtFormat = self.client.currentTheme.helpers.getDateTimeFormat();
|
||||||
quoteMsgView.addText(
|
quoteMsgView.addText(
|
||||||
'On {0} {1} said...'.format(
|
'On {0} {1} said...'.format(
|
||||||
|
@ -932,9 +936,12 @@ function FullScreenEditorModule(options) {
|
||||||
} else {
|
} else {
|
||||||
self.quoteBuilderFinalize();
|
self.quoteBuilderFinalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
},
|
},
|
||||||
quoteBuilderEscPressed : function(formData, extraArgs) {
|
quoteBuilderEscPressed : function(formData, extraArgs, cb) {
|
||||||
self.quoteBuilderFinalize();
|
self.quoteBuilderFinalize();
|
||||||
|
return cb(null);
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
replyDiscard : function(formData, extraArgs) {
|
replyDiscard : function(formData, extraArgs) {
|
||||||
|
@ -943,22 +950,16 @@ function FullScreenEditorModule(options) {
|
||||||
self.prevMenu();
|
self.prevMenu();
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
editModeMenuHelp : function(formData, extraArgs) {
|
editModeMenuHelp : function(formData, extraArgs, cb) {
|
||||||
self.viewControllers.footerEditorMenu.setFocus(false);
|
self.viewControllers.footerEditorMenu.setFocus(false);
|
||||||
self.displayHelp();
|
return self.displayHelp(cb);
|
||||||
},
|
},
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
// View Mode
|
// View Mode
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
viewModeEscPressed : function(formData, extraArgs) {
|
viewModeMenuHelp : function(formData, extraArgs, cb) {
|
||||||
//
|
|
||||||
// MLTEV won't get key events -- we need to handle them all here?
|
|
||||||
// ...up/down, page up/page down... both should go by pages
|
|
||||||
// ...Next/Prev/Etc. here
|
|
||||||
},
|
|
||||||
viewModeMenuHelp : function(formData, extraArgs) {
|
|
||||||
self.viewControllers.footerView.setFocus(false);
|
self.viewControllers.footerView.setFocus(false);
|
||||||
self.displayHelp();
|
return self.displayHelp(cb);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -125,17 +125,21 @@ function MenuModule(options) {
|
||||||
} else {
|
} else {
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
function finishAndNext(callback) {
|
||||||
|
self.finishedLoading();
|
||||||
|
|
||||||
|
self.autoNextMenu(callback);
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
function complete(err) {
|
function complete(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
// :TODO: what to do exactly?????
|
// :TODO: what to do exactly?????
|
||||||
return self.prevMenu();
|
return self.prevMenu( () => {
|
||||||
|
// dummy
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.finishedLoading();
|
|
||||||
self.autoNextMenu();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -148,16 +152,16 @@ function MenuModule(options) {
|
||||||
return _.isNumber(self.menuConfig.options.nextTimeout);
|
return _.isNumber(self.menuConfig.options.nextTimeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.autoNextMenu = function() {
|
this.autoNextMenu = function(cb) {
|
||||||
function goNext() {
|
function goNext() {
|
||||||
if(_.isString(self.menuConfig.next) || _.isArray(self.menuConfig.next)) {
|
if(_.isString(self.menuConfig.next) || _.isArray(self.menuConfig.next)) {
|
||||||
menuUtil.handleNext(self.client, self.menuConfig.next);
|
return menuUtil.handleNext(self.client, self.menuConfig.next, {}, cb);
|
||||||
} else {
|
} else {
|
||||||
self.prevMenu();
|
return self.prevMenu(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_.has(self.menuConfig, 'runtime.autoNext') && true === self.menuConfig.runtime.autoNext) {
|
if(_.has(self.menuConfig, 'runtime.autoNext') && true === self.menuConfig.runtime.autoNext) {
|
||||||
/*
|
/*
|
||||||
If 'next' is supplied, we'll use it. Otherwise, utlize fallback which
|
If 'next' is supplied, we'll use it. Otherwise, utlize fallback which
|
||||||
may be explicit (supplied) or non-explicit (previous menu)
|
may be explicit (supplied) or non-explicit (previous menu)
|
||||||
|
@ -175,8 +179,8 @@ function MenuModule(options) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if(self.hasNextTimeout()) {
|
if(self.hasNextTimeout()) {
|
||||||
setTimeout(function nextTimeout() {
|
setTimeout( () => {
|
||||||
goNext();
|
return goNext();
|
||||||
}, this.menuConfig.options.nextTimeout);
|
}, this.menuConfig.options.nextTimeout);
|
||||||
} else {
|
} else {
|
||||||
goNext();
|
goNext();
|
||||||
|
@ -208,7 +212,7 @@ MenuModule.prototype.getSaveState = function() {
|
||||||
// nothing in base
|
// nothing in base
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuModule.prototype.restoreSavedState = function(savedState) {
|
MenuModule.prototype.restoreSavedState = function(/*savedState*/) {
|
||||||
// nothing in base
|
// nothing in base
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -217,20 +221,9 @@ MenuModule.prototype.nextMenu = function(cb) {
|
||||||
// If we don't actually have |next|, we'll go previous
|
// If we don't actually have |next|, we'll go previous
|
||||||
//
|
//
|
||||||
if(!this.haveNext()) {
|
if(!this.haveNext()) {
|
||||||
this.prevMenu(cb);
|
return this.prevMenu(cb);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: this, prevMenu(), and gotoMenu() need a default |cb| handler if none is supplied.
|
|
||||||
// ...if the error is that we do not meet ACS requirements and did not get a match, then what?
|
|
||||||
if(!cb) {
|
|
||||||
cb = function(err) {
|
|
||||||
if(err) {
|
|
||||||
// :TODO: Don't console.log() here!
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.client.menuStack.next(cb);
|
this.client.menuStack.next(cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -171,10 +171,6 @@ function handleAction(client, formData, conf, cb) {
|
||||||
assert(_.isObject(conf));
|
assert(_.isObject(conf));
|
||||||
assert(_.isString(conf.action));
|
assert(_.isString(conf.action));
|
||||||
|
|
||||||
cb = function() {
|
|
||||||
// nothing -- remove me!
|
|
||||||
};
|
|
||||||
|
|
||||||
const actionAsset = asset.parseAsset(conf.action);
|
const actionAsset = asset.parseAsset(conf.action);
|
||||||
assert(_.isObject(actionAsset));
|
assert(_.isObject(actionAsset));
|
||||||
|
|
||||||
|
|
|
@ -20,26 +20,25 @@ exports.nextConf = nextConf;
|
||||||
exports.prevArea = prevArea;
|
exports.prevArea = prevArea;
|
||||||
exports.nextArea = nextArea;
|
exports.nextArea = nextArea;
|
||||||
|
|
||||||
function login(callingMenu, formData) {
|
function login(callingMenu, formData, extraArgs, cb) {
|
||||||
|
|
||||||
userLogin(callingMenu.client, formData.value.username, formData.value.password, err => {
|
userLogin(callingMenu.client, formData.value.username, formData.value.password, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
// login failure
|
// login failure
|
||||||
if(err.existingConn && _.has(callingMenu, 'menuConfig.config.tooNodeMenu')) {
|
if(err.existingConn && _.has(callingMenu, 'menuConfig.config.tooNodeMenu')) {
|
||||||
callingMenu.gotoMenu(callingMenu.menuConfig.config.tooNodeMenu);
|
return callingMenu.gotoMenu(callingMenu.menuConfig.config.tooNodeMenu, cb);
|
||||||
} else {
|
} else {
|
||||||
// Other error
|
// Other error
|
||||||
callingMenu.prevMenu();
|
return callingMenu.prevMenu(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
// success!
|
|
||||||
callingMenu.nextMenu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// success!
|
||||||
|
return callingMenu.nextMenu(cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function logoff(callingMenu) {
|
function logoff(callingMenu, formData, extraArgs, cb) {
|
||||||
//
|
//
|
||||||
// Simple logoff. Note that recording of @ logoff properties/stats
|
// Simple logoff. Note that recording of @ logoff properties/stats
|
||||||
// occurs elsewhere!
|
// occurs elsewhere!
|
||||||
|
@ -56,49 +55,52 @@ function logoff(callingMenu) {
|
||||||
'NO CARRIER', null, () => {
|
'NO CARRIER', null, () => {
|
||||||
|
|
||||||
// after data is written, disconnect & remove the client
|
// after data is written, disconnect & remove the client
|
||||||
return removeClient(client);
|
removeClient(client);
|
||||||
|
return cb(null);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function prevMenu(callingMenu) {
|
function prevMenu(callingMenu, formData, extraArgs, cb) {
|
||||||
callingMenu.prevMenu( err => {
|
callingMenu.prevMenu( err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
callingMenu.client.log.error( { error : err.toString() }, 'Error attempting to fallback!');
|
callingMenu.client.log.error( { error : err.toString() }, 'Error attempting to fallback!');
|
||||||
}
|
}
|
||||||
|
return cb(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextMenu(callingMenu) {
|
function nextMenu(callingMenu, formData, extraArgs, cb) {
|
||||||
callingMenu.nextMenu( err => {
|
callingMenu.nextMenu( err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
callingMenu.client.log.error( { error : err.toString() }, 'Error attempting to go to next menu!');
|
callingMenu.client.log.error( { error : err.toString() }, 'Error attempting to go to next menu!');
|
||||||
}
|
}
|
||||||
|
return cb(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: prev/nextConf, prev/nextArea should use a NYI MenuModule.redraw() or such -- avoid pop/goto() hack!
|
// :TODO: prev/nextConf, prev/nextArea should use a NYI MenuModule.redraw() or such -- avoid pop/goto() hack!
|
||||||
function reloadMenu(menu) {
|
function reloadMenu(menu, cb) {
|
||||||
const prevMenu = menu.client.menuStack.pop();
|
const prevMenu = menu.client.menuStack.pop();
|
||||||
prevMenu.instance.leave();
|
prevMenu.instance.leave();
|
||||||
menu.client.menuStack.goto(prevMenu.name);
|
menu.client.menuStack.goto(prevMenu.name, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
function prevConf(callingMenu) {
|
function prevConf(callingMenu, formData, extraArgs, cb) {
|
||||||
const confs = messageArea.getSortedAvailMessageConferences(callingMenu.client);
|
const confs = messageArea.getSortedAvailMessageConferences(callingMenu.client);
|
||||||
const currIndex = confs.findIndex( e => e.confTag === callingMenu.client.user.properties.message_conf_tag) || confs.length;
|
const currIndex = confs.findIndex( e => e.confTag === callingMenu.client.user.properties.message_conf_tag) || confs.length;
|
||||||
|
|
||||||
messageArea.changeMessageConference(callingMenu.client, confs[currIndex - 1].confTag, err => {
|
messageArea.changeMessageConference(callingMenu.client, confs[currIndex - 1].confTag, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return; // logged within changeMessageConference()
|
return cb(err); // logged within changeMessageConference()
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadMenu(callingMenu);
|
return reloadMenu(callingMenu, cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextConf(callingMenu) {
|
function nextConf(callingMenu, formData, extraArgs, cb) {
|
||||||
const confs = messageArea.getSortedAvailMessageConferences(callingMenu.client);
|
const confs = messageArea.getSortedAvailMessageConferences(callingMenu.client);
|
||||||
let currIndex = confs.findIndex( e => e.confTag === callingMenu.client.user.properties.message_conf_tag);
|
let currIndex = confs.findIndex( e => e.confTag === callingMenu.client.user.properties.message_conf_tag);
|
||||||
|
|
||||||
|
@ -108,27 +110,27 @@ function nextConf(callingMenu) {
|
||||||
|
|
||||||
messageArea.changeMessageConference(callingMenu.client, confs[currIndex + 1].confTag, err => {
|
messageArea.changeMessageConference(callingMenu.client, confs[currIndex + 1].confTag, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return; // logged within changeMessageConference()
|
return cb(err); // logged within changeMessageConference()
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadMenu(callingMenu);
|
return reloadMenu(callingMenu, cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function prevArea(callingMenu) {
|
function prevArea(callingMenu, formData, extraArgs, cb) {
|
||||||
const areas = messageArea.getSortedAvailMessageAreasByConfTag(callingMenu.client.user.properties.message_conf_tag);
|
const areas = messageArea.getSortedAvailMessageAreasByConfTag(callingMenu.client.user.properties.message_conf_tag);
|
||||||
const currIndex = areas.findIndex( e => e.areaTag === callingMenu.client.user.properties.message_area_tag) || areas.length;
|
const currIndex = areas.findIndex( e => e.areaTag === callingMenu.client.user.properties.message_area_tag) || areas.length;
|
||||||
|
|
||||||
messageArea.changeMessageArea(callingMenu.client, areas[currIndex - 1].areaTag, err => {
|
messageArea.changeMessageArea(callingMenu.client, areas[currIndex - 1].areaTag, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return; // logged within changeMessageArea()
|
return cb(err); // logged within changeMessageArea()
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadMenu(callingMenu);
|
return reloadMenu(callingMenu, cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextArea(callingMenu) {
|
function nextArea(callingMenu, formData, extraArgs, cb) {
|
||||||
const areas = messageArea.getSortedAvailMessageAreasByConfTag(callingMenu.client.user.properties.message_conf_tag);
|
const areas = messageArea.getSortedAvailMessageAreasByConfTag(callingMenu.client.user.properties.message_conf_tag);
|
||||||
let currIndex = areas.findIndex( e => e.areaTag === callingMenu.client.user.properties.message_area_tag);
|
let currIndex = areas.findIndex( e => e.areaTag === callingMenu.client.user.properties.message_area_tag);
|
||||||
|
|
||||||
|
@ -138,9 +140,9 @@ function nextArea(callingMenu) {
|
||||||
|
|
||||||
messageArea.changeMessageArea(callingMenu.client, areas[currIndex + 1].areaTag, err => {
|
messageArea.changeMessageArea(callingMenu.client, areas[currIndex + 1].areaTag, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return; // logged within changeMessageArea()
|
return cb(err); // logged within changeMessageArea()
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadMenu(callingMenu);
|
return reloadMenu(callingMenu, cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,10 +106,13 @@ function UserConfigModule(options) {
|
||||||
cb(newFocusId);
|
cb(newFocusId);
|
||||||
},
|
},
|
||||||
|
|
||||||
saveChanges : function(formData, extraArgs) {
|
//
|
||||||
|
// Handlers
|
||||||
|
//
|
||||||
|
saveChanges : function(formData, extraArgs, cb) {
|
||||||
assert(formData.value.password === formData.value.passwordConfirm);
|
assert(formData.value.password === formData.value.passwordConfirm);
|
||||||
|
|
||||||
var newProperties = {
|
const newProperties = {
|
||||||
real_name : formData.value.realName,
|
real_name : formData.value.realName,
|
||||||
birthdate : new Date(Date.parse(formData.value.birthdate)).toISOString(),
|
birthdate : new Date(Date.parse(formData.value.birthdate)).toISOString(),
|
||||||
sex : formData.value.sex,
|
sex : formData.value.sex,
|
||||||
|
@ -122,33 +125,31 @@ function UserConfigModule(options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// runtime set theme
|
// runtime set theme
|
||||||
theme.setClientTheme(self.client, newProperties.theme_id);
|
theme.setClientTheme(self.client, newProperties.theme_id);
|
||||||
|
|
||||||
// persist all changes
|
// persist all changes
|
||||||
self.client.user.persistProperties(newProperties, function persisted(err) {
|
self.client.user.persistProperties(newProperties, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
self.client.log.warn( { error : err.toString() }, 'Failed persisting updated properties');
|
self.client.log.warn( { error : err.toString() }, 'Failed persisting updated properties');
|
||||||
// :TODO: warn end user!
|
// :TODO: warn end user!
|
||||||
self.prevMenu();
|
return self.prevMenu(cb);
|
||||||
} else {
|
}
|
||||||
//
|
//
|
||||||
// New password if it's not empty
|
// New password if it's not empty
|
||||||
//
|
//
|
||||||
self.client.log.info('User updated properties');
|
self.client.log.info('User updated properties');
|
||||||
|
|
||||||
if(formData.value.password.length > 0) {
|
if(formData.value.password.length > 0) {
|
||||||
self.client.user.setNewAuthCredentials(formData.value.password, function newAuthStored(err) {
|
self.client.user.setNewAuthCredentials(formData.value.password, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
// :TODO: warn the end user!
|
self.client.log.error( { err : err }, 'Failed storing new authentication credentials');
|
||||||
self.client.log.warn( { error : err.toString() }, 'Failed storing new authentication credentials');
|
} else {
|
||||||
} else {
|
self.client.log.info('User changed authentication credentials');
|
||||||
self.client.log.info('User changed authentication credentials');
|
}
|
||||||
}
|
return self.prevMenu(cb);
|
||||||
self.prevMenu();
|
});
|
||||||
});
|
} else {
|
||||||
} else {
|
return self.prevMenu(cb);
|
||||||
self.prevMenu();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
// ENiGMA½
|
// ENiGMA½
|
||||||
var MCIViewFactory = require('./mci_view_factory.js').MCIViewFactory;
|
var MCIViewFactory = require('./mci_view_factory.js').MCIViewFactory;
|
||||||
var menuUtil = require('./menu_util.js');
|
var menuUtil = require('./menu_util.js');
|
||||||
//var Log = require('./logger.js').log;
|
|
||||||
var Config = require('./config.js').config;
|
|
||||||
var asset = require('./asset.js');
|
var asset = require('./asset.js');
|
||||||
var ansi = require('./ansi_term.js');
|
var ansi = require('./ansi_term.js');
|
||||||
|
|
||||||
|
// deps
|
||||||
var events = require('events');
|
var events = require('events');
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
@ -37,6 +36,26 @@ function ViewController(options) {
|
||||||
|
|
||||||
this.actionKeyMap = {};
|
this.actionKeyMap = {};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Small wrapper/proxy around handleAction() to ensure we do not allow
|
||||||
|
// input/additional actions queued while performing an action
|
||||||
|
//
|
||||||
|
this.handleActionWrapper = function(formData, actionBlock) {
|
||||||
|
if(self.waitActionCompletion) {
|
||||||
|
return; // ignore until this is finished!
|
||||||
|
}
|
||||||
|
|
||||||
|
self.waitActionCompletion = true;
|
||||||
|
menuUtil.handleAction(self.client, formData, actionBlock, (err) => {
|
||||||
|
if(err) {
|
||||||
|
// :TODO: What can we really do here?
|
||||||
|
self.client.log.warn( { err : err }, 'Error during handleAction()');
|
||||||
|
}
|
||||||
|
|
||||||
|
self.waitActionCompletion = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
this.clientKeyPressHandler = function(ch, key) {
|
this.clientKeyPressHandler = function(ch, key) {
|
||||||
//
|
//
|
||||||
// Process key presses treating form submit mapped keys special.
|
// Process key presses treating form submit mapped keys special.
|
||||||
|
@ -51,10 +70,9 @@ function ViewController(options) {
|
||||||
self.switchFocus(actionForKey.viewId);
|
self.switchFocus(actionForKey.viewId);
|
||||||
self.submitForm(key);
|
self.submitForm(key);
|
||||||
} else if(_.isString(actionForKey.action)) {
|
} else if(_.isString(actionForKey.action)) {
|
||||||
menuUtil.handleAction(
|
self.handleActionWrapper(
|
||||||
self.client,
|
{ ch : ch, key : key }, // formData
|
||||||
{ ch : ch, key : key }, // formData
|
actionForKey); // actionBlock
|
||||||
actionForKey); // action block
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(self.focusedView && self.focusedView.acceptsInput) {
|
if(self.focusedView && self.focusedView.acceptsInput) {
|
||||||
|
@ -65,28 +83,28 @@ function ViewController(options) {
|
||||||
|
|
||||||
this.viewActionListener = function(action, key) {
|
this.viewActionListener = function(action, key) {
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case 'next' :
|
case 'next' :
|
||||||
self.emit('action', { view : this, action : action, key : key });
|
self.emit('action', { view : this, action : action, key : key });
|
||||||
self.nextFocus();
|
self.nextFocus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'accept' :
|
case 'accept' :
|
||||||
if(self.focusedView && self.focusedView.submit) {
|
if(self.focusedView && self.focusedView.submit) {
|
||||||
// :TODO: need to do validation here!!!
|
// :TODO: need to do validation here!!!
|
||||||
var focusedView = self.focusedView;
|
var focusedView = self.focusedView;
|
||||||
self.validateView(focusedView, function validated(err, newFocusedViewId) {
|
self.validateView(focusedView, function validated(err, newFocusedViewId) {
|
||||||
if(err) {
|
if(err) {
|
||||||
var newFocusedView = self.getView(newFocusedViewId) || focusedView;
|
var newFocusedView = self.getView(newFocusedViewId) || focusedView;
|
||||||
self.setViewFocusWithEvents(newFocusedView, true);
|
self.setViewFocusWithEvents(newFocusedView, true);
|
||||||
} else {
|
} else {
|
||||||
self.submitForm(key);
|
self.submitForm(key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//self.submitForm(key);
|
//self.submitForm(key);
|
||||||
} else {
|
} else {
|
||||||
self.nextFocus();
|
self.nextFocus();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,48 +177,48 @@ function ViewController(options) {
|
||||||
propAsset = asset.getViewPropertyAsset(conf[propName]);
|
propAsset = asset.getViewPropertyAsset(conf[propName]);
|
||||||
if(propAsset) {
|
if(propAsset) {
|
||||||
switch(propAsset.type) {
|
switch(propAsset.type) {
|
||||||
case 'config' :
|
case 'config' :
|
||||||
propValue = asset.resolveConfigAsset(conf[propName]);
|
propValue = asset.resolveConfigAsset(conf[propName]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// :TODO: handle @art (e.g. text : @art ...)
|
// :TODO: handle @art (e.g. text : @art ...)
|
||||||
|
|
||||||
case 'method' :
|
case 'method' :
|
||||||
case 'systemMethod' :
|
case 'systemMethod' :
|
||||||
if('validate' === propName) {
|
if('validate' === propName) {
|
||||||
// :TODO: handle propAsset.location for @method script specification
|
// :TODO: handle propAsset.location for @method script specification
|
||||||
if('systemMethod' === propAsset.type) {
|
if('systemMethod' === propAsset.type) {
|
||||||
// :TODO: implementation validation @systemMethod handling!
|
// :TODO: implementation validation @systemMethod handling!
|
||||||
var methodModule = require(paths.join(__dirname, 'system_view_validate.js'));
|
var methodModule = require(paths.join(__dirname, 'system_view_validate.js'));
|
||||||
if(_.isFunction(methodModule[propAsset.asset])) {
|
if(_.isFunction(methodModule[propAsset.asset])) {
|
||||||
propValue = methodModule[propAsset.asset];
|
propValue = methodModule[propAsset.asset];
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(_.isFunction(self.client.currentMenuModule.menuMethods[propAsset.asset])) {
|
|
||||||
propValue = self.client.currentMenuModule.menuMethods[propAsset.asset];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(_.isString(propAsset.location)) {
|
if(_.isFunction(self.client.currentMenuModule.menuMethods[propAsset.asset])) {
|
||||||
|
propValue = self.client.currentMenuModule.menuMethods[propAsset.asset];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(_.isString(propAsset.location)) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if('systemMethod' === propAsset.type) {
|
||||||
|
// :TODO:
|
||||||
} else {
|
} else {
|
||||||
if('systemMethod' === propAsset.type) {
|
// local to current module
|
||||||
// :TODO:
|
var currentModule = self.client.currentMenuModule;
|
||||||
} else {
|
if(_.isFunction(currentModule.menuMethods[propAsset.asset])) {
|
||||||
// local to current module
|
// :TODO: Fix formData & extraArgs... this all needs general processing
|
||||||
var currentModule = self.client.currentMenuModule;
|
propValue = currentModule.menuMethods[propAsset.asset]({}, {});//formData, conf.extraArgs);
|
||||||
if(_.isFunction(currentModule.menuMethods[propAsset.asset])) {
|
|
||||||
// :TODO: Fix formData & extraArgs... this all needs general processing
|
|
||||||
propValue = currentModule.menuMethods[propAsset.asset]({}, {});//formData, conf.extraArgs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
propValue = propValue = conf[propName];
|
propValue = propValue = conf[propName];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
propValue = conf[propName];
|
propValue = conf[propName];
|
||||||
|
@ -287,6 +305,13 @@ function ViewController(options) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
|
:TODO: support:
|
||||||
|
value: {
|
||||||
|
someArgName: [ "key1", "key2", ... ],
|
||||||
|
someOtherArg: [ "key1, ... ]
|
||||||
|
}
|
||||||
|
*/
|
||||||
var actionValueKeys = Object.keys(actionValue);
|
var actionValueKeys = Object.keys(actionValue);
|
||||||
for(var i = 0; i < actionValueKeys.length; ++i) {
|
for(var i = 0; i < actionValueKeys.length; ++i) {
|
||||||
var viewId = actionValueKeys[i];
|
var viewId = actionValueKeys[i];
|
||||||
|
@ -510,11 +535,12 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
||||||
},
|
},
|
||||||
function prepareFormSubmission(callback) {
|
function prepareFormSubmission(callback) {
|
||||||
if(false === self.noInput) {
|
if(false === self.noInput) {
|
||||||
|
|
||||||
self.on('submit', function promptSubmit(formData) {
|
self.on('submit', function promptSubmit(formData) {
|
||||||
self.client.log.trace( { formData : self.getLogFriendlyFormData(formData) }, 'Prompt submit');
|
self.client.log.trace( { formData : self.getLogFriendlyFormData(formData) }, 'Prompt submit');
|
||||||
|
|
||||||
if(_.isString(self.client.currentMenuModule.menuConfig.action)) {
|
if(_.isString(self.client.currentMenuModule.menuConfig.action)) {
|
||||||
menuUtil.handleAction(self.client, formData, self.client.currentMenuModule.menuConfig);
|
self.handleActionWrapper(formData, self.client.currentMenuModule.menuConfig);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Menus that reference prompts can have a sepcial "submit" block without the
|
// Menus that reference prompts can have a sepcial "submit" block without the
|
||||||
|
@ -538,7 +564,7 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
||||||
var actionBlock = menuSubmit[c];
|
var actionBlock = menuSubmit[c];
|
||||||
|
|
||||||
if(_.isEqual(formData.value, actionBlock.value, self.actionBlockValueComparator)) {
|
if(_.isEqual(formData.value, actionBlock.value, self.actionBlockValueComparator)) {
|
||||||
menuUtil.handleAction(self.client, formData, actionBlock);
|
self.handleActionWrapper(formData, actionBlock);
|
||||||
break; // there an only be one...
|
break; // there an only be one...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,7 +692,7 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) {
|
||||||
var actionBlock = confForFormId[c];
|
var actionBlock = confForFormId[c];
|
||||||
|
|
||||||
if(_.isEqual(formData.value, actionBlock.value, self.actionBlockValueComparator)) {
|
if(_.isEqual(formData.value, actionBlock.value, self.actionBlockValueComparator)) {
|
||||||
menuUtil.handleAction(self.client, formData, actionBlock);
|
self.handleActionWrapper(formData, actionBlock);
|
||||||
break; // there an only be one...
|
break; // there an only be one...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,23 +325,20 @@ function BBSListModule(options) {
|
||||||
//
|
//
|
||||||
// Key & submit handlers
|
// Key & submit handlers
|
||||||
//
|
//
|
||||||
quitBBSList : function() {
|
addBBS : function(formData, extraArgs, cb) {
|
||||||
self.prevMenu();
|
self.displayAddScreen(cb);
|
||||||
},
|
},
|
||||||
addBBS : function() {
|
deleteBBS : function(formData, extraArgs, cb) {
|
||||||
self.displayAddScreen();
|
|
||||||
},
|
|
||||||
deleteBBS : function() {
|
|
||||||
const entriesView = self.viewControllers.view.getView(MciViewIds.view.BBSList);
|
const entriesView = self.viewControllers.view.getView(MciViewIds.view.BBSList);
|
||||||
|
|
||||||
if(self.entries[self.selectedBBS].submitterUserId !== self.client.user.userId && !self.client.user.isSysOp()) {
|
if(self.entries[self.selectedBBS].submitterUserId !== self.client.user.userId && !self.client.user.isSysOp()) {
|
||||||
// must be owner or +op
|
// must be owner or +op
|
||||||
return;
|
return cb(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry = self.entries[self.selectedBBS];
|
const entry = self.entries[self.selectedBBS];
|
||||||
if(!entry) {
|
if(!entry) {
|
||||||
return;
|
return cb(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.database.run(
|
self.database.run(
|
||||||
|
@ -362,10 +359,12 @@ function BBSListModule(options) {
|
||||||
|
|
||||||
self.viewControllers.view.redrawAll();
|
self.viewControllers.view.redrawAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
submitBBS : function(formData) {
|
submitBBS : function(formData, extraArgs, cb) {
|
||||||
|
|
||||||
let ok = true;
|
let ok = true;
|
||||||
[ 'BBSName', 'Sysop', 'Telnet' ].forEach( mciName => {
|
[ 'BBSName', 'Sysop', 'Telnet' ].forEach( mciName => {
|
||||||
|
@ -375,7 +374,7 @@ function BBSListModule(options) {
|
||||||
});
|
});
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
// validators should prevent this!
|
// validators should prevent this!
|
||||||
return;
|
return cb(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.database.run(
|
self.database.run(
|
||||||
|
@ -388,13 +387,13 @@ function BBSListModule(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.clearAddForm();
|
self.clearAddForm();
|
||||||
self.displayBBSList(true);
|
self.displayBBSList(true, cb);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
cancelSubmit : function() {
|
cancelSubmit : function(formData, extraArgs, cb) {
|
||||||
self.clearAddForm();
|
self.clearAddForm();
|
||||||
self.displayBBSList(true);
|
self.displayBBSList(true, cb);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ function ErcClientModule(options) {
|
||||||
|
|
||||||
|
|
||||||
this.menuMethods = {
|
this.menuMethods = {
|
||||||
inputAreaSubmit : function() {
|
inputAreaSubmit : function(formData, extraArgs, cb) {
|
||||||
const inputAreaView = self.viewControllers.menu.getView(MciViewIds.InputArea);
|
const inputAreaView = self.viewControllers.menu.getView(MciViewIds.InputArea);
|
||||||
const inputData = inputAreaView.getData();
|
const inputData = inputAreaView.getData();
|
||||||
|
|
||||||
|
@ -157,12 +157,15 @@ function ErcClientModule(options) {
|
||||||
}
|
}
|
||||||
inputAreaView.clearText();
|
inputAreaView.clearText();
|
||||||
}
|
}
|
||||||
|
return cb(null);
|
||||||
},
|
},
|
||||||
scrollUp : function(formData) {
|
scrollUp : function(formData, extraArgs, cb) {
|
||||||
self.scrollHandler(formData.key.name);
|
self.scrollHandler(formData.key.name);
|
||||||
|
return cb(null);
|
||||||
},
|
},
|
||||||
scrollDown : function(formData) {
|
scrollDown : function(formData, extraArgs, cb) {
|
||||||
self.scrollHandler(formData.key.name);
|
self.scrollHandler(formData.key.name);
|
||||||
|
return cb(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1198,7 +1198,7 @@
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
keys: [ "q", "escape" ]
|
keys: [ "q", "escape" ]
|
||||||
action: @method:quitBBSList
|
action: @systemMethod:prevMenu
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
/* jslint node: true */
|
/* jslint node: true */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
// ENiGMA½
|
||||||
var ViewController = require('../core/view_controller.js').ViewController;
|
const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||||
var messageArea = require('../core/message_area.js');
|
const ViewController = require('../core/view_controller.js').ViewController;
|
||||||
var strUtil = require('../core/string_util.js');
|
const messageArea = require('../core/message_area.js');
|
||||||
|
|
||||||
var async = require('async');
|
// deps
|
||||||
var assert = require('assert');
|
const async = require('async');
|
||||||
var _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
exports.getModule = MessageAreaListModule;
|
exports.getModule = MessageAreaListModule;
|
||||||
|
|
||||||
|
@ -32,9 +32,8 @@ exports.moduleInfo = {
|
||||||
|TI Current time
|
|TI Current time
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var MciCodesIds = {
|
const MCICodesIDs = {
|
||||||
AreaList : 1,
|
AreaList : 1,
|
||||||
CurrentArea : 2,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function MessageAreaListModule(options) {
|
function MessageAreaListModule(options) {
|
||||||
|
@ -42,27 +41,29 @@ function MessageAreaListModule(options) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.messageAreas = messageArea.getSortedAvailMessageAreasByConfTag(
|
this.messageAreas = messageArea.getSortedAvailMessageAreasByConfTag(
|
||||||
self.client.user.properties.message_conf_tag,
|
self.client.user.properties.message_conf_tag,
|
||||||
{ client : self.client }
|
{ client : self.client }
|
||||||
);
|
);
|
||||||
|
|
||||||
this.menuMethods = {
|
this.menuMethods = {
|
||||||
changeArea : function(formData, extraArgs) {
|
changeArea : function(formData, extraArgs, cb) {
|
||||||
if(1 === formData.submitId) {
|
if(1 === formData.submitId) {
|
||||||
const areaTag = self.messageAreas[formData.value.area].areaTag;
|
const areaTag = self.messageAreas[formData.value.area].areaTag;
|
||||||
|
|
||||||
messageArea.changeMessageArea(self.client, areaTag, function areaChanged(err) {
|
messageArea.changeMessageArea(self.client, areaTag, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
self.client.term.pipeWrite('\n|00Cannot change area: ' + err.message + '\n');
|
self.client.term.pipeWrite(`\n|00Cannot change area: ${err.message}\n`);
|
||||||
|
|
||||||
setTimeout(function timeout() {
|
setTimeout( () => {
|
||||||
self.prevMenu();
|
return self.prevMenu(cb);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
self.prevMenu();
|
return self.prevMenu(cb);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return cb(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -79,7 +80,7 @@ function MessageAreaListModule(options) {
|
||||||
require('util').inherits(MessageAreaListModule, MenuModule);
|
require('util').inherits(MessageAreaListModule, MenuModule);
|
||||||
|
|
||||||
MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
|
MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
var self = this;
|
const self = this;
|
||||||
const vc = self.viewControllers.areaList = new ViewController( { client : self.client } );
|
const vc = self.viewControllers.areaList = new ViewController( { client : self.client } );
|
||||||
|
|
||||||
async.series(
|
async.series(
|
||||||
|
@ -90,7 +91,7 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function loadFromConfig(callback) {
|
function loadFromConfig(callback) {
|
||||||
var loadOpts = {
|
const loadOpts = {
|
||||||
callingMenu : self,
|
callingMenu : self,
|
||||||
mciMap : mciData.menu,
|
mciMap : mciData.menu,
|
||||||
formId : 0,
|
formId : 0,
|
||||||
|
@ -104,40 +105,34 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
const listFormat = self.menuConfig.config.listFormat || '{index} ) - {name}';
|
const listFormat = self.menuConfig.config.listFormat || '{index} ) - {name}';
|
||||||
const focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
|
const focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
|
||||||
|
|
||||||
const areaListView = vc.getView(1);
|
const areaListView = vc.getView(MCICodesIDs.AreaList);
|
||||||
let i = 1;
|
let i = 1;
|
||||||
areaListView.setItems(_.map(self.messageAreas, v => {
|
areaListView.setItems(_.map(self.messageAreas, v => {
|
||||||
return listFormat.format({
|
return listFormat.format({
|
||||||
index : i++,
|
index : i++,
|
||||||
areaTag : v.area.areaTag,
|
areaTag : v.area.areaTag,
|
||||||
name : v.area.name,
|
name : v.area.name,
|
||||||
desc : v.area.desc,
|
desc : v.area.desc,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
areaListView.setFocusItems(_.map(self.messageAreas, v => {
|
areaListView.setFocusItems(_.map(self.messageAreas, v => {
|
||||||
return focusListFormat.format({
|
return focusListFormat.format({
|
||||||
index : i++,
|
index : i++,
|
||||||
areaTag : v.area.areaTag,
|
areaTag : v.area.areaTag,
|
||||||
name : v.area.name,
|
name : v.area.name,
|
||||||
desc : v.area.desc,
|
desc : v.area.desc,
|
||||||
})
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
areaListView.redraw();
|
areaListView.redraw();
|
||||||
|
|
||||||
callback(null);
|
|
||||||
},
|
|
||||||
function populateTextViews(callback) {
|
|
||||||
// :TODO: populate current message area desc!
|
|
||||||
//self.setViewText(MciCodesIds.CurrentArea,
|
|
||||||
|
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
function complete(err) {
|
function complete(err) {
|
||||||
cb(null);
|
return cb(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
|
@ -25,7 +25,7 @@ function AreaPostFSEModule(options) {
|
||||||
// we're posting, so always start with 'edit' mode
|
// we're posting, so always start with 'edit' mode
|
||||||
this.editorMode = 'edit';
|
this.editorMode = 'edit';
|
||||||
|
|
||||||
this.menuMethods.editModeMenuSave = function() {
|
this.menuMethods.editModeMenuSave = function(formData, extraArgs, cb) {
|
||||||
|
|
||||||
var msg;
|
var msg;
|
||||||
async.series(
|
async.series(
|
||||||
|
@ -33,16 +33,11 @@ function AreaPostFSEModule(options) {
|
||||||
function getMessageObject(callback) {
|
function getMessageObject(callback) {
|
||||||
self.getMessage(function gotMsg(err, msgObj) {
|
self.getMessage(function gotMsg(err, msgObj) {
|
||||||
msg = msgObj;
|
msg = msgObj;
|
||||||
callback(err);
|
return callback(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function saveMessage(callback) {
|
function saveMessage(callback) {
|
||||||
persistMessage(msg, callback);
|
return persistMessage(msg, callback);
|
||||||
/*
|
|
||||||
msg.persist(function persisted(err) {
|
|
||||||
callback(err);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
function complete(err) {
|
function complete(err) {
|
||||||
|
@ -56,7 +51,7 @@ function AreaPostFSEModule(options) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.nextMenu();
|
return self.nextMenu(cb);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
/* jslint node: true */
|
/* jslint node: true */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var FullScreenEditorModule = require('../core/fse.js').FullScreenEditorModule;
|
// ENiGMA½
|
||||||
var Message = require('../core/message.js');
|
const FullScreenEditorModule = require('../core/fse.js').FullScreenEditorModule;
|
||||||
var messageArea = require('../core/message_area.js');
|
const Message = require('../core/message.js');
|
||||||
var user = require('../core/user.js');
|
|
||||||
|
|
||||||
var _ = require('lodash');
|
// deps
|
||||||
var async = require('async');
|
const _ = require('lodash');
|
||||||
var assert = require('assert');
|
|
||||||
|
|
||||||
exports.getModule = AreaViewFSEModule;
|
exports.getModule = AreaViewFSEModule;
|
||||||
|
|
||||||
|
@ -21,8 +19,7 @@ exports.moduleInfo = {
|
||||||
function AreaViewFSEModule(options) {
|
function AreaViewFSEModule(options) {
|
||||||
FullScreenEditorModule.call(this, options);
|
FullScreenEditorModule.call(this, options);
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
var config = this.menuConfig.config;
|
|
||||||
|
|
||||||
this.editorType = 'area';
|
this.editorType = 'area';
|
||||||
this.editorMode = 'view';
|
this.editorMode = 'view';
|
||||||
|
@ -36,57 +33,67 @@ function AreaViewFSEModule(options) {
|
||||||
this.messageIndex = this.messageIndex || 0;
|
this.messageIndex = this.messageIndex || 0;
|
||||||
this.messageTotal = this.messageList.length;
|
this.messageTotal = this.messageList.length;
|
||||||
|
|
||||||
this.menuMethods.nextMessage = function(formData, extraArgs) {
|
this.menuMethods.nextMessage = function(formData, extraArgs, cb) {
|
||||||
if(self.messageIndex + 1 < self.messageList.length) {
|
if(self.messageIndex + 1 < self.messageList.length) {
|
||||||
self.messageIndex++;
|
self.messageIndex++;
|
||||||
|
|
||||||
self.loadMessageByUuid(self.messageList[self.messageIndex].messageUuid);
|
return self.loadMessageByUuid(self.messageList[self.messageIndex].messageUuid, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menuMethods.prevMessage = function(formData, extraArgs) {
|
this.menuMethods.prevMessage = function(formData, extraArgs, cb) {
|
||||||
if(self.messageIndex > 0) {
|
if(self.messageIndex > 0) {
|
||||||
self.messageIndex--;
|
self.messageIndex--;
|
||||||
|
|
||||||
self.loadMessageByUuid(self.messageList[self.messageIndex].messageUuid);
|
return self.loadMessageByUuid(self.messageList[self.messageIndex].messageUuid, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menuMethods.movementKeyPressed = function(formData, extraArgs) {
|
this.menuMethods.movementKeyPressed = function(formData, extraArgs, cb) {
|
||||||
var bodyView = self.viewControllers.body.getView(1);
|
const bodyView = self.viewControllers.body.getView(1); // :TODO: use const here vs magic #
|
||||||
|
|
||||||
// :TODO: Create methods for up/down vs using keyPressXXXXX
|
// :TODO: Create methods for up/down vs using keyPressXXXXX
|
||||||
switch(formData.key.name) {
|
switch(formData.key.name) {
|
||||||
case 'down arrow' : bodyView.scrollDocumentUp(); break;
|
case 'down arrow' : bodyView.scrollDocumentUp(); break;
|
||||||
case 'up arrow' : bodyView.scrollDocumentDown(); break;
|
case 'up arrow' : bodyView.scrollDocumentDown(); break;
|
||||||
case 'page up' : bodyView.keyPressPageUp(); break;
|
case 'page up' : bodyView.keyPressPageUp(); break;
|
||||||
case 'page down' : bodyView.keyPressPageDown(); break;
|
case 'page down' : bodyView.keyPressPageDown(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: need to stop down/page down if doing so would push the last
|
// :TODO: need to stop down/page down if doing so would push the last
|
||||||
// visible page off the screen at all
|
// visible page off the screen at all .... this should be handled by MLTEV though...
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menuMethods.replyMessage = function(formData, extraArgs) {
|
this.menuMethods.replyMessage = function(formData, extraArgs, cb) {
|
||||||
if(_.isString(extraArgs.menu)) {
|
if(_.isString(extraArgs.menu)) {
|
||||||
var modOpts = {
|
const modOpts = {
|
||||||
extraArgs : {
|
extraArgs : {
|
||||||
messageAreaTag : self.messageAreaTag,
|
messageAreaTag : self.messageAreaTag,
|
||||||
replyToMessage : self.message,
|
replyToMessage : self.message,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.gotoMenu(extraArgs.menu, modOpts);
|
return self.gotoMenu(extraArgs.menu, modOpts, cb);
|
||||||
} else {
|
|
||||||
self.client.log(extraArgs, 'Missing extraArgs.menu');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.client.log(extraArgs, 'Missing extraArgs.menu');
|
||||||
|
return cb(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.loadMessageByUuid = function(uuid) {
|
this.loadMessageByUuid = function(uuid, cb) {
|
||||||
var msg = new Message();
|
const msg = new Message();
|
||||||
msg.load( { uuid : uuid, user : self.client.user }, function loaded(err) {
|
msg.load( { uuid : uuid, user : self.client.user }, () => {
|
||||||
self.setMessage(msg);
|
self.setMessage(msg);
|
||||||
|
if(cb) {
|
||||||
|
return cb(null);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -106,7 +113,7 @@ AreaViewFSEModule.prototype.getSaveState = function() {
|
||||||
messageList : this.messageList,
|
messageList : this.messageList,
|
||||||
messageIndex : this.messageIndex,
|
messageIndex : this.messageIndex,
|
||||||
messageTotal : this.messageList.length,
|
messageTotal : this.messageList.length,
|
||||||
}
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
AreaViewFSEModule.prototype.restoreSavedState = function(savedState) {
|
AreaViewFSEModule.prototype.restoreSavedState = function(savedState) {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
/* jslint node: true */
|
/* jslint node: true */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
// ENiGMA½
|
||||||
var ViewController = require('../core/view_controller.js').ViewController;
|
const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||||
var messageArea = require('../core/message_area.js');
|
const ViewController = require('../core/view_controller.js').ViewController;
|
||||||
|
const messageArea = require('../core/message_area.js');
|
||||||
|
|
||||||
var async = require('async');
|
// deps
|
||||||
var assert = require('assert');
|
const async = require('async');
|
||||||
var _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
exports.getModule = MessageConfListModule;
|
exports.getModule = MessageConfListModule;
|
||||||
|
|
||||||
|
@ -17,12 +18,11 @@ exports.moduleInfo = {
|
||||||
author : 'NuSkooler',
|
author : 'NuSkooler',
|
||||||
};
|
};
|
||||||
|
|
||||||
var MciCodesIds = {
|
const MCICodeIDs = {
|
||||||
ConfList : 1,
|
ConfList : 1,
|
||||||
CurrentConf : 2,
|
|
||||||
|
|
||||||
// :TODO:
|
// :TODO:
|
||||||
// # areas in con
|
// # areas in conf .... see Obv/2, iNiQ, ...
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ function MessageConfListModule(options) {
|
||||||
this.messageConfs = messageArea.getSortedAvailMessageConferences(self.client);
|
this.messageConfs = messageArea.getSortedAvailMessageConferences(self.client);
|
||||||
|
|
||||||
this.menuMethods = {
|
this.menuMethods = {
|
||||||
changeConference : function(formData, extraArgs) {
|
changeConference : function(formData, extraArgs, cb) {
|
||||||
if(1 === formData.submitId) {
|
if(1 === formData.submitId) {
|
||||||
const confTag = self.messageConfs[formData.value.conf].confTag;
|
const confTag = self.messageConfs[formData.value.conf].confTag;
|
||||||
|
|
||||||
|
@ -42,13 +42,15 @@ function MessageConfListModule(options) {
|
||||||
if(err) {
|
if(err) {
|
||||||
self.client.term.pipeWrite(`\n|00Cannot change conference: ${err.message}\n`);
|
self.client.term.pipeWrite(`\n|00Cannot change conference: ${err.message}\n`);
|
||||||
|
|
||||||
setTimeout(function timeout() {
|
setTimeout( () => {
|
||||||
self.prevMenu();
|
return self.prevMenu(cb);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
self.prevMenu();
|
return self.prevMenu(cb);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
return cb(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -85,26 +87,26 @@ MessageConfListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
const listFormat = self.menuConfig.config.listFormat || '{index} ) - {name}';
|
const listFormat = self.menuConfig.config.listFormat || '{index} ) - {name}';
|
||||||
const focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
|
const focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
|
||||||
|
|
||||||
const confListView = vc.getView(1);
|
const confListView = vc.getView(MCICodeIDs.ConfList);
|
||||||
let i = 1;
|
let i = 1;
|
||||||
confListView.setItems(_.map(self.messageConfs, v => {
|
confListView.setItems(_.map(self.messageConfs, v => {
|
||||||
return listFormat.format({
|
return listFormat.format({
|
||||||
index : i++,
|
index : i++,
|
||||||
confTag : v.conf.confTag,
|
confTag : v.conf.confTag,
|
||||||
name : v.conf.name,
|
name : v.conf.name,
|
||||||
desc : v.conf.desc,
|
desc : v.conf.desc,
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
confListView.setFocusItems(_.map(self.messageConfs, v => {
|
confListView.setFocusItems(_.map(self.messageConfs, v => {
|
||||||
return focusListFormat.format({
|
return focusListFormat.format({
|
||||||
index : i++,
|
index : i++,
|
||||||
confTag : v.conf.confTag,
|
confTag : v.conf.confTag,
|
||||||
name : v.conf.name,
|
name : v.conf.name,
|
||||||
desc : v.conf.desc,
|
desc : v.conf.desc,
|
||||||
})
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
confListView.redraw();
|
confListView.redraw();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ function MessageListModule(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.menuMethods = {
|
this.menuMethods = {
|
||||||
selectMessage : function(formData) {
|
selectMessage : function(formData, extraArgs, cb) {
|
||||||
if(1 === formData.submitId) {
|
if(1 === formData.submitId) {
|
||||||
self.initialFocusIndex = formData.value.message;
|
self.initialFocusIndex = formData.value.message;
|
||||||
|
|
||||||
|
@ -99,7 +99,9 @@ function MessageListModule(options) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
self.gotoMenu(config.menuViewPost || 'messageAreaViewPost', modOpts);
|
return self.gotoMenu(config.menuViewPost || 'messageAreaViewPost', modOpts, cb);
|
||||||
|
} else {
|
||||||
|
return cb(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
57
mods/nua.js
57
mods/nua.js
|
@ -1,13 +1,13 @@
|
||||||
/* jslint node: true */
|
/* jslint node: true */
|
||||||
'use strict';
|
'use strict';
|
||||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
|
||||||
var user = require('../core/user.js');
|
|
||||||
var theme = require('../core/theme.js');
|
|
||||||
var login = require('../core/system_menu_method.js').login;
|
|
||||||
var Config = require('../core/config.js').config;
|
|
||||||
var messageArea = require('../core/message_area.js');
|
|
||||||
|
|
||||||
var async = require('async');
|
// ENiGMA½
|
||||||
|
const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||||
|
const user = require('../core/user.js');
|
||||||
|
const theme = require('../core/theme.js');
|
||||||
|
const login = require('../core/system_menu_method.js').login;
|
||||||
|
const Config = require('../core/config.js').config;
|
||||||
|
const messageArea = require('../core/message_area.js');
|
||||||
|
|
||||||
exports.getModule = NewUserAppModule;
|
exports.getModule = NewUserAppModule;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ exports.moduleInfo = {
|
||||||
desc : 'New User Application',
|
desc : 'New User Application',
|
||||||
};
|
};
|
||||||
|
|
||||||
var MciViewIds = {
|
const MciViewIds = {
|
||||||
userName : 1,
|
userName : 1,
|
||||||
password : 9,
|
password : 9,
|
||||||
confirm : 10,
|
confirm : 10,
|
||||||
|
@ -26,54 +26,54 @@ var MciViewIds = {
|
||||||
function NewUserAppModule(options) {
|
function NewUserAppModule(options) {
|
||||||
MenuModule.call(this, options);
|
MenuModule.call(this, options);
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
|
|
||||||
this.menuMethods = {
|
this.menuMethods = {
|
||||||
//
|
//
|
||||||
// Validation stuff
|
// Validation stuff
|
||||||
//
|
//
|
||||||
validatePassConfirmMatch : function(data, cb) {
|
validatePassConfirmMatch : function(data, cb) {
|
||||||
var passwordView = self.viewControllers.menu.getView(MciViewIds.password);
|
const passwordView = self.viewControllers.menu.getView(MciViewIds.password);
|
||||||
cb(passwordView.getData() === data ? null : new Error('Passwords do not match'));
|
return cb(passwordView.getData() === data ? null : new Error('Passwords do not match'));
|
||||||
},
|
},
|
||||||
|
|
||||||
viewValidationListener : function(err, cb) {
|
viewValidationListener : function(err, cb) {
|
||||||
var errMsgView = self.viewControllers.menu.getView(MciViewIds.errMsg);
|
const errMsgView = self.viewControllers.menu.getView(MciViewIds.errMsg);
|
||||||
var newFocusId;
|
let newFocusId;
|
||||||
|
|
||||||
if(err) {
|
if(err) {
|
||||||
errMsgView.setText(err.message);
|
errMsgView.setText(err.message);
|
||||||
err.view.clearText();
|
err.view.clearText();
|
||||||
|
|
||||||
if(err.view.getId() === MciViewIds.confirm) {
|
if(err.view.getId() === MciViewIds.confirm) {
|
||||||
newFocusId = MciViewIds.password;
|
newFocusId = MciViewIds.password;
|
||||||
var passwordView = self.viewControllers.menu.getView(MciViewIds.password);
|
self.viewControllers.menu.getView(MciViewIds.password).clearText();
|
||||||
passwordView.clearText();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errMsgView.clearText();
|
errMsgView.clearText();
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(newFocusId);
|
return cb(newFocusId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Submit handlers
|
// Submit handlers
|
||||||
//
|
//
|
||||||
submitApplication : function(formData, extraArgs) {
|
submitApplication : function(formData, extraArgs, cb) {
|
||||||
var newUser = new user.User();
|
const newUser = new user.User();
|
||||||
|
|
||||||
newUser.username = formData.value.username;
|
newUser.username = formData.value.username;
|
||||||
|
|
||||||
//
|
//
|
||||||
// We have to disable ACS checks for initial default areas as the user is not yet ready
|
// We have to disable ACS checks for initial default areas as the user is not yet ready
|
||||||
//
|
//
|
||||||
var confTag = messageArea.getDefaultMessageConferenceTag(self.client, true); // true=disableAcsCheck
|
let confTag = messageArea.getDefaultMessageConferenceTag(self.client, true); // true=disableAcsCheck
|
||||||
var areaTag = messageArea.getDefaultMessageAreaTagByConfTag(self.client, confTag, true); // true=disableAcsCheck
|
let areaTag = messageArea.getDefaultMessageAreaTagByConfTag(self.client, confTag, true); // true=disableAcsCheck
|
||||||
|
|
||||||
// can't store undefined!
|
// can't store undefined!
|
||||||
confTag = confTag || '';
|
confTag = confTag || '';
|
||||||
areaTag = areaTag || '';
|
areaTag = areaTag || '';
|
||||||
|
|
||||||
newUser.properties = {
|
newUser.properties = {
|
||||||
real_name : formData.value.realName,
|
real_name : formData.value.realName,
|
||||||
|
@ -102,14 +102,15 @@ function NewUserAppModule(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: User.create() should validate email uniqueness!
|
// :TODO: User.create() should validate email uniqueness!
|
||||||
newUser.create( { password : formData.value.password }, function created(err) {
|
newUser.create( { password : formData.value.password }, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
self.client.log.info( { error : err, username : formData.value.username }, 'New user creation failed');
|
self.client.log.info( { error : err, username : formData.value.username }, 'New user creation failed');
|
||||||
|
|
||||||
self.gotoMenu(extraArgs.error, function result(err) {
|
self.gotoMenu(extraArgs.error, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
self.prevMenu();
|
return self.prevMenu(cb);
|
||||||
}
|
}
|
||||||
|
return cb(null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.client.log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');
|
self.client.log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');
|
||||||
|
@ -124,12 +125,12 @@ function NewUserAppModule(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.User.AccountStatus.inactive === self.client.user.properties.account_status) {
|
if(user.User.AccountStatus.inactive === self.client.user.properties.account_status) {
|
||||||
self.gotoMenu(extraArgs.inactive);
|
return self.gotoMenu(extraArgs.inactive, cb);
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// If active now, we need to call login() to authenticate
|
// If active now, we need to call login() to authenticate
|
||||||
//
|
//
|
||||||
login(self, formData, extraArgs);
|
return login(self, formData, extraArgs, cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -231,11 +231,11 @@ function OnelinerzModule(options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.menuMethods = {
|
this.menuMethods = {
|
||||||
viewAddScreen : function() {
|
viewAddScreen : function(formData, extraArgs, cb) {
|
||||||
self.displayAddScreen();
|
return self.displayAddScreen(cb);
|
||||||
},
|
},
|
||||||
|
|
||||||
addEntry : function(formData) {
|
addEntry : function(formData, extraArgs, cb) {
|
||||||
if(_.isString(formData.value.oneliner) && formData.value.oneliner.length > 0) {
|
if(_.isString(formData.value.oneliner) && formData.value.oneliner.length > 0) {
|
||||||
const oneliner = formData.value.oneliner.trim(); // remove any trailing ws
|
const oneliner = formData.value.oneliner.trim(); // remove any trailing ws
|
||||||
|
|
||||||
|
@ -245,18 +245,18 @@ function OnelinerzModule(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.clearAddForm();
|
self.clearAddForm();
|
||||||
self.displayViewScreen(true); // true=cls
|
return self.displayViewScreen(true, cb); // true=cls
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// empty message - treat as if cancel was hit
|
// empty message - treat as if cancel was hit
|
||||||
self.displayViewScreen(true); // true=cls
|
return self.displayViewScreen(true, cb); // true=cls
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
cancelAdd : function() {
|
cancelAdd : function(formData, extraArgs, cb) {
|
||||||
self.clearAddForm();
|
self.clearAddForm();
|
||||||
self.displayViewScreen(true); // true=cls
|
return self.displayViewScreen(true, cb); // true=cls
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue