* New fallback with default vs explicit working

* New @systemMethod:fallbackMenu working
* Work on NUA flow: added preamble and some work on FSE related stuff
This commit is contained in:
Bryan Ashby 2015-09-23 23:41:06 -06:00
parent d63320e0b7
commit 903db84f23
7 changed files with 60 additions and 56 deletions

View File

@ -474,21 +474,20 @@ Client.prototype.fallbackMenuModule = function(options, cb) {
var modOpts; var modOpts;
if(_.isString(self.currentMenuModule.menuConfig.fallback)()) { if(_.isString(self.currentMenuModule.menuConfig.fallback)) {
modOpts = { modOpts = {
name : self.currentMenuModule.menuConfig.fallback, name : self.currentMenuModule.menuConfig.fallback,
extraArgs : options.extraArgs, extraArgs : options.extraArgs,
}; };
self.gotoMenuModule(modOpts, cb);
} else if(self.lastMenuModuleInfo) { } else if(self.lastMenuModuleInfo) {
modOpts = { modOpts = {
name : self.lastMenuModuleInfo.menuName, name : self.lastMenuModuleInfo.menuName,
extraArgs : self.lastMenuModuleInfo.extraArgs, extraArgs : self.lastMenuModuleInfo.extraArgs,
savedState : self.lastMenuModuleInfo.savedState, savedState : self.lastMenuModuleInfo.savedState,
}; };
}
if(modOpts) {
self.gotoMenuModule(modOpts, cb); self.gotoMenuModule(modOpts, cb);
} else { } else {
cb(new Error('Nothing to fallback to!')); cb(new Error('Nothing to fallback to!'));

View File

@ -809,6 +809,7 @@ function FullScreenEditorModule(options) {
self.switchFromQuoteBuilderToBody(); self.switchFromQuoteBuilderToBody();
}); });
}, },
/*
replyDiscard : function(formData, extraArgs) { replyDiscard : function(formData, extraArgs) {
// :TODO: need to prompt yes/no // :TODO: need to prompt yes/no
// :TODO: @method for fallback would be better // :TODO: @method for fallback would be better
@ -816,6 +817,7 @@ function FullScreenEditorModule(options) {
console.log(err) console.log(err)
}); });
}, },
*/
editModeMenuHelp : function(formData, extraArgs) { editModeMenuHelp : function(formData, extraArgs) {
self.viewControllers.footerEditorMenu.setFocus(false); self.viewControllers.footerEditorMenu.setFocus(false);
self.displayHelp(); self.displayHelp();

View File

@ -172,7 +172,9 @@ function callModuleMenuMethod(client, asset, path, formData, extraArgs) {
} }
try { try {
client.log.trace( { methodName : asset.asset, formData : formData, extraArgs : extraArgs } ); client.log.trace(
{ path : path, methodName : asset.asset, formData : formData, extraArgs : extraArgs },
'Calling menu method');
var methodMod = require(path); var methodMod = require(path);
methodMod[asset.asset](client.currentMenuModule, formData || { }, extraArgs); methodMod[asset.asset](client.currentMenuModule, formData || { }, extraArgs);

View File

@ -25,6 +25,10 @@ function getPredefinedMCIValue(client, code) {
VL : function versionLabel() { return 'ENiGMA½ v' + packageJson.version; }, VL : function versionLabel() { return 'ENiGMA½ v' + packageJson.version; },
VN : function version() { return packageJson.version; }, VN : function version() { return packageJson.version; },
// :TODO: SysOp username
// :TODO: SysOp real name
UN : function userName() { return client.user.username; }, UN : function userName() { return client.user.username; },
UI : function userId() { return client.user.userId.toString(); }, UI : function userId() { return client.user.userId.toString(); },
UG : function groups() { return _.values(client.user.groups).join(', '); }, UG : function groups() { return _.values(client.user.groups).join(', '); },

View File

@ -10,6 +10,7 @@ var async = require('async');
exports.login = login; exports.login = login;
exports.logoff = logoff; exports.logoff = logoff;
exports.fallbackMenu = fallbackMenu;
function login(callingMenu, formData, extraArgs) { function login(callingMenu, formData, extraArgs) {
var client = callingMenu.client; var client = callingMenu.client;
@ -138,7 +139,7 @@ function logoff(callingMenu, formData, extraArgs) {
function fallbackMenu(callingMenu, formData, extraArgs) { function fallbackMenu(callingMenu, formData, extraArgs) {
callingMenu.client.fallbackMenuModule( { extraArgs : extraArgs }, function result(err) { callingMenu.client.fallbackMenuModule( { extraArgs : extraArgs }, function result(err) {
if(err) { if(err) {
callingMenu.client.log.error( { error : err }, 'Error attempting to ') callingMenu.client.log.error( { error : err }, 'Error attempting to fallback!');
} }
}); });
} }

View File

@ -160,7 +160,7 @@
*/ */
newUserApplication: { newUserApplication: {
art: NUA art: NUA
next: newUserFeedbackToSysOp next: newUserFeedbackToSysOpPreamble
form: { form: {
0: { 0: {
mci: { mci: {
@ -242,10 +242,16 @@
} }
} }
newUserFeedbackToSysOpPreamble: {
art: NUAFDBK
options: { pause: true }
next: newUserFeedbackToSysOp
}
newUserFeedbackToSysOp: { newUserFeedbackToSysOp: {
status: Feedback to SysOp status: Feedback to SysOp
module: msg_area_post_fse module: msg_area_post_fse
"fallback" : "messageArea", // :TODO: remove once default fallback is in place fallback: mainMenu
config: { config: {
art: { art: {
header: MSGEHDR header: MSGEHDR
@ -256,9 +262,9 @@
}, },
editorMode: edit editorMode: edit
editorType: area editorType: area
}, }
"form" : { form: {
"0" : { 0: {
mci: { mci: {
TL1: { TL1: {
width: 27 width: 27
@ -268,30 +274,30 @@
width: 27 width: 27
argName: to argName: to
focus: true focus: true
text: All text: @config:general.sysOp.username
// :TODO: @systemMethod:getSysOpUsername
// :TODO: readOnly: true // :TODO: readOnly: true
} }
"ET3" : { ET3: {
"width" : 27, width: 27
"argName" : "subject", argName: subject
"maxLength" : 72, maxLength: 72
"submit" : true submit: true
text: New user feedback
}, },
"MA5" : { "MA5" : {
"width" : 27, "width" : 27,
"textOverflow" : "..." "textOverflow" : "..."
} }
}, }
"submit" : { submit: {
"3" : [ 3: [
{ {
"value" : { "subject" : null }, "value" : { "subject" : null },
"action" : "@method:headerSubmit" "action" : "@method:headerSubmit"
} }
] ]
} }
}, }
"1" : { "1" : {
"mci" : { "mci" : {
MT1: { MT1: {
@ -323,36 +329,31 @@
} }
} }
} }
}, }
"3" : { 3: {
"HM" : { HM: {
"mci" : { mci: {
"HM1" : { HM1: {
// :TODO: Continue, Save, Discard, Clear, Quote, Help items: [ "Save", "Discard", "Help" ]
"items" : [ "Save", "Discard", "Quote", "Help" ]
} }
}, }
"submit" : { submit: {
"*" : [ *: [
{ {
"value" : { "1" : 0 }, value: { 1: 0 }
"action" : "@method:editModeMenuSave" action: @method:editModeMenuSave
}, }
{ {
"value" : { "1" : 1 }, value: { 1: 1 }
"action" : "@menu:messageArea" action: @systemMethod:fallbackMenu
}, }
{ {
value: { 1: 2 }, value: { 1: 2 }
action: @method:editModeQuote action: @method:editModeMenuHelp
},
{
"value" : { "1" : 3 },
"action" : "@method:editModeMenuHelp"
} }
] ]
}, }
actionKeys: [ // :TODO: Need better name actionKeys: [
{ {
keys: [ "escape" ] keys: [ "escape" ]
action: @method:editModeEscPressed action: @method:editModeEscPressed
@ -362,13 +363,6 @@
action: @method:editModeMenuHelp action: @method:editModeMenuHelp
} }
] ]
// :TODO: something like the following for overriding keymap
// this should only override specified entries. others will default
/*
"keyMap" : {
"accept" : [ "return" ]
}
*/
} }
} }
} }
@ -809,7 +803,8 @@
} }
{ {
value: { 1: 1 } value: { 1: 1 }
action: @method:replyDiscard action: @systemMethod:fallbackMenu
//action: @method:replyDiscard
} }
{ {
value: { 1: 2 }, value: { 1: 2 },
@ -833,7 +828,8 @@
} }
{ {
keys: [ "d", "shift + d" ] keys: [ "d", "shift + d" ]
action: @method:replyDiscard //action: @method:replyDiscard
action: @systemMethod:fallbackMenu
} }
{ {
keys: [ "q", "shift + q" ] keys: [ "q", "shift + q" ]

Binary file not shown.