* 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;
if(_.isString(self.currentMenuModule.menuConfig.fallback)()) {
if(_.isString(self.currentMenuModule.menuConfig.fallback)) {
modOpts = {
name : self.currentMenuModule.menuConfig.fallback,
extraArgs : options.extraArgs,
};
self.gotoMenuModule(modOpts, cb);
} else if(self.lastMenuModuleInfo) {
modOpts = {
name : self.lastMenuModuleInfo.menuName,
extraArgs : self.lastMenuModuleInfo.extraArgs,
savedState : self.lastMenuModuleInfo.savedState,
};
}
if(modOpts) {
self.gotoMenuModule(modOpts, cb);
} else {
cb(new Error('Nothing to fallback to!'));

View File

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

View File

@ -172,7 +172,9 @@ function callModuleMenuMethod(client, asset, path, formData, extraArgs) {
}
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);
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; },
VN : function version() { return packageJson.version; },
// :TODO: SysOp username
// :TODO: SysOp real name
UN : function userName() { return client.user.username; },
UI : function userId() { return client.user.userId.toString(); },
UG : function groups() { return _.values(client.user.groups).join(', '); },

View File

@ -10,6 +10,7 @@ var async = require('async');
exports.login = login;
exports.logoff = logoff;
exports.fallbackMenu = fallbackMenu;
function login(callingMenu, formData, extraArgs) {
var client = callingMenu.client;
@ -138,7 +139,7 @@ function logoff(callingMenu, formData, extraArgs) {
function fallbackMenu(callingMenu, formData, extraArgs) {
callingMenu.client.fallbackMenuModule( { extraArgs : extraArgs }, function result(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: {
art: NUA
next: newUserFeedbackToSysOp
next: newUserFeedbackToSysOpPreamble
form: {
0: {
mci: {
@ -242,10 +242,16 @@
}
}
newUserFeedbackToSysOpPreamble: {
art: NUAFDBK
options: { pause: true }
next: newUserFeedbackToSysOp
}
newUserFeedbackToSysOp: {
status: Feedback to SysOp
module: msg_area_post_fse
"fallback" : "messageArea", // :TODO: remove once default fallback is in place
fallback: mainMenu
config: {
art: {
header: MSGEHDR
@ -256,9 +262,9 @@
},
editorMode: edit
editorType: area
},
"form" : {
"0" : {
}
form: {
0: {
mci: {
TL1: {
width: 27
@ -268,30 +274,30 @@
width: 27
argName: to
focus: true
text: All
// :TODO: @systemMethod:getSysOpUsername
text: @config:general.sysOp.username
// :TODO: readOnly: true
}
"ET3" : {
"width" : 27,
"argName" : "subject",
"maxLength" : 72,
"submit" : true
ET3: {
width: 27
argName: subject
maxLength: 72
submit: true
text: New user feedback
},
"MA5" : {
"width" : 27,
"textOverflow" : "..."
}
},
"submit" : {
"3" : [
}
submit: {
3: [
{
"value" : { "subject" : null },
"action" : "@method:headerSubmit"
}
]
}
},
}
"1" : {
"mci" : {
MT1: {
@ -323,36 +329,31 @@
}
}
}
},
"3" : {
"HM" : {
"mci" : {
"HM1" : {
// :TODO: Continue, Save, Discard, Clear, Quote, Help
"items" : [ "Save", "Discard", "Quote", "Help" ]
}
},
"submit" : {
"*" : [
3: {
HM: {
mci: {
HM1: {
items: [ "Save", "Discard", "Help" ]
}
}
submit: {
*: [
{
"value" : { "1" : 0 },
"action" : "@method:editModeMenuSave"
},
value: { 1: 0 }
action: @method:editModeMenuSave
}
{
"value" : { "1" : 1 },
"action" : "@menu:messageArea"
},
value: { 1: 1 }
action: @systemMethod:fallbackMenu
}
{
value: { 1: 2 },
action: @method:editModeQuote
},
{
"value" : { "1" : 3 },
"action" : "@method:editModeMenuHelp"
value: { 1: 2 }
action: @method:editModeMenuHelp
}
]
},
actionKeys: [ // :TODO: Need better name
}
actionKeys: [
{
keys: [ "escape" ]
action: @method:editModeEscPressed
@ -362,13 +363,6 @@
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 }
action: @method:replyDiscard
action: @systemMethod:fallbackMenu
//action: @method:replyDiscard
}
{
value: { 1: 2 },
@ -833,7 +828,8 @@
}
{
keys: [ "d", "shift + d" ]
action: @method:replyDiscard
//action: @method:replyDiscard
action: @systemMethod:fallbackMenu
}
{
keys: [ "q", "shift + q" ]

Binary file not shown.