* TOONODE support when already logged in

* Work on new user / NUA flow
* Various cleanup
This commit is contained in:
Bryan Ashby 2015-10-15 23:41:24 -06:00
parent a5c2e6f50b
commit d02d9e4a7c
6 changed files with 125 additions and 74 deletions

View File

@ -7,6 +7,7 @@ var ansi = require('./ansi_term.js');
var userDb = require('./database.js').dbs.user; var userDb = require('./database.js').dbs.user;
var async = require('async'); var async = require('async');
var _ = require('lodash');
exports.login = login; exports.login = login;
exports.logoff = logoff; exports.logoff = logoff;
@ -48,13 +49,30 @@ function login(callingMenu, formData, extraArgs) {
'Already logged in' 'Already logged in'
); );
// :TODO: display custom message if present (Obv/2: TOONODE.ANS) client.term.rawWrite(ansi.resetScreen());
var tooNodeArt;
if(_.has(callingMenu, 'menuConfig.config.tooNodeArt')) {
tooNodeArt = callingMenu.menuConfig.config.tooNodeArt;
} else {
tooNodeArt = 'TOONODE';
}
var artOpts = {
client : client,
font : callingMenu.menuConfig.font,
name : tooNodeArt,
};
theme.displayThemeArt(artOpts, function artDisplayed(err) {
if(err) {
client.term.write('\nA user by that name is already logged in.\n'); client.term.write('\nA user by that name is already logged in.\n');
}
setTimeout(function timeout() { setTimeout(function timeout() {
client.gotoMenuModule( { name : callingMenu.menuConfig.fallback } ); client.fallbackMenuModule();
}, 500); }, 2000);
});
return; return;
} }

View File

@ -117,8 +117,11 @@
login2: { login2: {
art: USERLOG art: USERLOG
next: messageArea //next: messageArea
//"next" : "fullLoginSequenceLoginArt", next: fullLoginSequenceLoginArt
config: {
tooNodeArt: TOONODE
}
form: { form: {
0: { 0: {
mci: { mci: {
@ -246,7 +249,7 @@
} }
newUserFeedbackToSysOpPreamble: { newUserFeedbackToSysOpPreamble: {
art: NUAFDBK art: LETTER
options: { pause: true } options: { pause: true }
next: newUserFeedbackToSysOp next: newUserFeedbackToSysOp
extraArgs: { extraArgs: {
@ -257,7 +260,9 @@
newUserFeedbackToSysOp: { newUserFeedbackToSysOp: {
status: Feedback to SysOp status: Feedback to SysOp
module: msg_area_post_fse module: msg_area_post_fse
fallback: mainMenu // :TODO: If the user is auto-approved, login seq. else, DONE.ANS -> Logoff
// :TODO: client.nextOrFallback(): go next or fallback. Use in MenuModule base also
fallback: fullLoginSequenceLoginArt
config: { config: {
art: { art: {
header: MSGEHDR header: MSGEHDR
@ -273,65 +278,57 @@
0: { 0: {
mci: { mci: {
TL1: { TL1: {
width: 27
argName: from argName: from
} }
ET2: { ET2: {
width: 27
argName: to argName: to
focus: true focus: true
text: @config:general.sysOp.username text: @config:general.sysOp.username
// :TODO: readOnly: true // :TODO: readOnly: true
} }
ET3: { ET3: {
width: 27
argName: subject argName: subject
maxLength: 72 maxLength: 72
submit: true submit: true
text: New user feedback text: New user feedback
},
"MA5" : {
"width" : 27,
"textOverflow" : "..."
} }
} }
submit: { submit: {
3: [ 3: [
{ {
"value" : { "subject" : null }, value: { subject: null }
"action" : "@method:headerSubmit" action: @method:headerSubmit
} }
] ]
} }
} }
"1" : { 1: {
"mci" : { mci: {
MT1: { MT1: {
width: 79 width: 79
height: 14 argName: message
argName: `
mode: edit mode: edit
} }
} }
submit: { submit: {
*: [ { "value": "message", "action": "@method:editModeEscPressed" } ] *: [ { value: "message", action: "@method:editModeEscPressed" } ]
}, }
"actionKeys" : [ actionKeys: [
{ {
"keys" : [ "escape" ], keys: [ "escape" ]
"viewId" : 1 viewId: 1
} }
] ]
}, },
"2" : { 2: {
"TLTL" : { TLTL: {
"mci" : { mci: {
"TL1" : { TL1: {
"width" : 5 width: 5
}, }
"TL2" : { TL2: {
"width" : 4 width: 4
} }
} }
} }
@ -340,7 +337,8 @@
HM: { HM: {
mci: { mci: {
HM1: { HM1: {
items: [ "Save", "Discard", "Help" ] // :TODO: clear
items: [ "save", "help" ]
} }
} }
submit: { submit: {
@ -351,10 +349,6 @@
} }
{ {
value: { 1: 1 } value: { 1: 1 }
action: @systemMethod:fallbackMenu
}
{
value: { 1: 2 }
action: @method:editModeMenuHelp action: @method:editModeMenuHelp
} }
] ]
@ -373,29 +367,26 @@
} }
} }
} }
"fullLoginSequenceLoginArt" : { fullLoginSequenceLoginArt: {
"art" : "LOGIN", art: LOGIN
"options" : { "pause" : true }, options: { pause: true }
"next" : "fullLoginSequenceLastCallers" next: fullLoginSequenceLastCallers
}, }
"fullLoginSequenceLastCallers": { fullLoginSequenceLastCallers: {
"module" : "last_callers", module: last_callers
"art" : "LASTCALL", art: LASTCALL
"options" : { "pause" : true }, options: { pause: true }
"config" : { next: fullLoginSequenceSysStats
"dateTimeFormat" : "ddd MMM Do h:mm a" }
}, fullLoginSequenceSysStats: {
"next" : "fullLoginSequenceSysStats" art: SYSSTAT
}, options: { pause: true }
"fullLoginSequenceSysStats" : { next: fullLoginSequenceUserStats
"art" : "SYSSTAT", }
"options" : { "pause" : true }, fullLoginSequenceUserStats: {
"next" : "fullLoginSequenceUserStats"
},
"fullLoginSequenceUserStats" : {
art: STATUS art: STATUS
"options" : { "pause" : true }, options: { pause: true }
"next" : "mainMenu" next: mainMenu
}, },
"newUserActive" : { "newUserActive" : {
"art" : "SO-CC1.ANS", "art" : "SO-CC1.ANS",
@ -516,6 +507,10 @@
value: { command: "Q" } value: { command: "Q" }
action: @menu:mainMenu action: @menu:mainMenu
} }
{
value: { command: "G" }
action: @menu:logoff
}
{ {
value: 1 value: 1
action: @menu:messageArea action: @menu:messageArea
@ -854,10 +849,10 @@
} }
} }
// :TODO: messageAreaSelect (change msg areas -> call @systemMethod -> fallback to menu // :TODO: messageAreaSelect (change msg areas -> call @systemMethod -> fallback to menu
"messageAreaNewPost" : { messageAreaNewPost: {
"status" : "Posting message", status: Posting message,
"module" : "msg_area_post_fse", module: msg_area_post_fse
"fallback" : "messageArea", // :TODO: remove once default fallback is in place //"fallback" : "messageArea", // :TODO: remove once default fallback is in place
config: { config: {
art: { art: {
header: MSGEHDR header: MSGEHDR
@ -865,10 +860,10 @@
footerEditor: MSGEFTR footerEditor: MSGEFTR
footerEditorMenu: MSGEMFT footerEditorMenu: MSGEMFT
help: MSGEHLP help: MSGEHLP
}, }
editorMode: edit editorMode: edit
editorType: area editorType: area
}, }
form: { form: {
0: { 0: {
mci: { mci: {

Binary file not shown.

Binary file not shown.

View File

@ -44,6 +44,21 @@
} }
} }
newUserFeedbackToSysOp: {
0: {
mci: {
TL1: { width: 19, textOverflow: "..." }
ET2: { width: 19, textOverflow: "..." }
ET3: { width: 19, textOverflow: "..." }
}
}
1: {
mci: {
MT1: { height: 14 }
}
}
}
login2: { login2: {
mci: { mci: {
ET1: { width: 14 } ET1: { width: 14 }
@ -162,6 +177,29 @@
} }
} }
} }
fullLoginSequenceLastCallers: {
config: {
dateTimeFormat: MMM Do H:mm a
}
}
fullLoginSequenceSysStats: {
}
fullLoginSequenceUserStats: {
mci: {
UN1: { width: 17 }
UR2: { width: 17 }
LO3: { width: 17 }
UF4: { width: 17 }
UG5: { width: 17 }
UT6: { width: 17 }
UC7: { width: 17 }
}
}
} }
} }
} }