* Mostly work on building demo / NU-MAYA theme for testing / working out details / etc.

This commit is contained in:
Bryan Ashby 2015-09-07 21:18:09 -06:00
parent 6517f50e0c
commit 2edc63632b
12 changed files with 180 additions and 49 deletions

View File

@ -431,7 +431,7 @@ Client.prototype.address = function() {
Client.prototype.gotoMenuModule = function(options, cb) { Client.prototype.gotoMenuModule = function(options, cb) {
var self = this; var self = this;
assert(options.name); assert(_.isString(options.name), 'Missing options.name');
// Assign a default missing module handler callback if none was provided // Assign a default missing module handler callback if none was provided
var callbackOnErrorOnly = !_.isFunction(cb); var callbackOnErrorOnly = !_.isFunction(cb);
@ -452,9 +452,17 @@ Client.prototype.gotoMenuModule = function(options, cb) {
} else { } else {
self.log.debug( { menuName : options.name }, 'Goto menu module'); self.log.debug( { menuName : options.name }, 'Goto menu module');
modInst.enter(self); if(self.currentMenuModule) {
self.lastMenuModuleInfo = {
name : self.currentMenuModule.modInfo.name,
extraArgs : self.currentMenuModuleExtraArgs,
};
}
self.currentMenuModule = modInst; modInst.enter(self);
self.currentMenuModule = modInst; // :TODO: should probably be before enter() above
self.currentMenuModuleExtraArgs = options.extraArgs;
if(!callbackOnErrorOnly) { if(!callbackOnErrorOnly) {
cb(null); cb(null);
@ -464,7 +472,16 @@ Client.prototype.gotoMenuModule = function(options, cb) {
}; };
Client.prototype.fallbackMenuModule = function(cb) { Client.prototype.fallbackMenuModule = function(cb) {
var self = this;
if(self.lastMenuModuleInfo) {
var modOpts = {
name : self.lastMenuModuleInfo.name,
extraArgs : self.lastMenuModuleInfo.extraArgs,
};
self.gotoMenuModule(modOpts, cb);
}
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -43,12 +43,18 @@ exports.moduleInfo = {
TL10 - Message ID TL10 - Message ID
TL11 - Reply to message ID TL11 - Reply to message ID
TL12 - User1
TL13 - User2
Footer - Viewing Footer - Viewing
HM1 - Menu (prev/next/etc.) HM1 - Menu (prev/next/etc.)
TL6 - Message number TL6 - Message number
TL7 - Message total (in area) TL7 - Message total (in area)
TL12 - User1 (fmt message object)
TL13 - User2
*/ */
var MCICodeIds = { var MCICodeIds = {
@ -64,6 +70,10 @@ var MCICodeIds = {
HashTags : 9, HashTags : 9,
MessageID : 10, MessageID : 10,
ReplyToMsgID : 11 ReplyToMsgID : 11
},
ViewModeFooter : {
MsgNum : 6,
MsgTotal : 7,
} }
}; };
@ -150,6 +160,7 @@ function FullScreenEditorModule(options) {
if(self.isReady) { if(self.isReady) {
self.initHeaderViewMode(); self.initHeaderViewMode();
self.initFooterViewMode();
var bodyMessageView = self.viewControllers.body.getView(1); var bodyMessageView = self.viewControllers.body.getView(1);
if(bodyMessageView && _.has(self, 'message.message')) { if(bodyMessageView && _.has(self, 'message.message')) {
@ -181,7 +192,7 @@ function FullScreenEditorModule(options) {
// Body : We must find this in the config / theme // Body : We must find this in the config / theme
// //
// :TODO: don't hard code this -- allow footer height to be part of theme/etc. // :TODO: don't hard code this -- allow footer height to be part of theme/etc.
self.client.term.rawWrite(ansi.goto(23, 1)); self.client.term.rawWrite(ansi.goto(24, 1));
callback(null); callback(null);
}, },
function clearFooterArea(callback) { function clearFooterArea(callback) {
@ -401,6 +412,7 @@ function FullScreenEditorModule(options) {
case 'view' : case 'view' :
if(self.message) { if(self.message) {
self.initHeaderViewMode(); self.initHeaderViewMode();
self.initFooterViewMode();
var bodyMessageView = self.viewControllers.body.getView(1); var bodyMessageView = self.viewControllers.body.getView(1);
if(bodyMessageView && _.has(self, 'message.message')) { if(bodyMessageView && _.has(self, 'message.message')) {
@ -502,6 +514,19 @@ function FullScreenEditorModule(options) {
setHeaderText(MCICodeIds.ViewModeHeader.ReplyToMsgID, self.message.replyToMessageId); setHeaderText(MCICodeIds.ViewModeHeader.ReplyToMsgID, self.message.replyToMessageId);
}; };
this.initFooterViewMode = function() {
function setFooterText(id, text) {
var v = self.viewControllers.footerView.getView(id);
if(v) {
v.setText(text);
}
}
setFooterText(MCICodeIds.ViewModeFooter.MsgNum, (self.messageIndex + 1).toString());
setFooterText(MCICodeIds.ViewModeFooter.MsgTotal, self.messageTotal.toString());
};
this.displayHelp = function() { this.displayHelp = function() {
self.client.term.rawWrite(ansi.resetScreen()); self.client.term.rawWrite(ansi.resetScreen());

View File

@ -62,6 +62,8 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) {
UW : this.client.user.properties.web_address, UW : this.client.user.properties.web_address,
UF : this.client.user.properties.affiliation, UF : this.client.user.properties.affiliation,
UT : this.client.user.properties.theme_id, UT : this.client.user.properties.theme_id,
UC : this.client.user.properties.login_count.toString(),
MS : moment(this.client.user.properties.account_created).format(this.client.currentTheme.helpers.getDateFormat()), MS : moment(this.client.user.properties.account_created).format(this.client.currentTheme.helpers.getDateFormat()),
CS : this.client.currentStatus, CS : this.client.currentStatus,
MD : getCurrentMenuDescription(), MD : getCurrentMenuDescription(),

View File

@ -16,6 +16,8 @@ var _ = require('lodash');
exports.MenuModule = MenuModule; exports.MenuModule = MenuModule;
// :TODO: some of this is a bit off... should pause after finishedLoading()
function MenuModule(options) { function MenuModule(options) {
PluginModule.call(this, options); PluginModule.call(this, options);

View File

@ -63,7 +63,7 @@
"*" : [ "*" : [
{ {
"value" : { "1" : 0 }, "value" : { "1" : 0 },
"action" : "@menu:login" "action" : "@menu:login2"
}, },
{ {
"value" : { "1" : 1 }, "value" : { "1" : 1 },
@ -86,8 +86,8 @@
// :TODO: may want { "prompt" : { "name" : "blah", "action" : ... }} // :TODO: may want { "prompt" : { "name" : "blah", "action" : ... }}
"prompt" : "userCredentials", "prompt" : "userCredentials",
"fallback" : "matrix", "fallback" : "matrix",
//"next" : "fullLoginSequenceLoginArt", "next" : "fullLoginSequenceLoginArt",
"next" : "messageArea", //"next" : "messageArea",
"action" : "@systemMethod:login", "action" : "@systemMethod:login",
// :TODO: support alt submit method for prompts // :TODO: support alt submit method for prompts
@ -104,6 +104,45 @@
"cls" : true "cls" : true
} }
}, },
"login2" : {
"art" : "USRCRED",
"fallback" : "matrix",
"next" : "fullLoginSequenceLoginArt",
"options" : { "cls" : true },
"form" : {
"0" : {
"mci" : {
"ET1" : {
"width" : 20,
"maxLength" : "@config:users.usernameMax",
"argName" : "username",
"focus" : true
},
"ET2" : {
"width" : 20,
"password" : true,
"maxLength" : "@config:users.passwordMax",
"argName" : "password",
"submit" : true
}
},
"submit" : {
"*" : [
{
"value" : { "password" : null },
"action" : "@systemMethod:login"
}
]
},
"actionKeys" : [
{
"keys" : [ "escape" ],
"action" : "@menu:matrix"
}
]
}
}
},
"logoff" : { "logoff" : {
"art" : "LOGOFF", "art" : "LOGOFF",
"action" : "@systemMethod:logoff", "action" : "@systemMethod:logoff",
@ -205,10 +244,15 @@
"config" : { "config" : {
"dateTimeFormat" : "ddd MMM Do h:mm a" "dateTimeFormat" : "ddd MMM Do h:mm a"
}, },
"action" : "@menu:fullLoginSequenceSysStats"
},
"fullLoginSequenceSysStats" : {
"art" : "SYSSTAT",
"options" : { "cls" : true, "pause" : true },
"action" : "@menu:fullLoginSequenceUserStats" "action" : "@menu:fullLoginSequenceUserStats"
}, },
"fullLoginSequenceUserStats" : { "fullLoginSequenceUserStats" : {
"art" : "userstats", "art" : "USRSTAT",
"options" : { "cls" : true, "pause" : true }, "options" : { "cls" : true, "pause" : true },
"action" : "@menu:mainMenu" "action" : "@menu:mainMenu"
}, },
@ -223,7 +267,8 @@
//"action" : "@menu:lastCallers" //"action" : "@menu:lastCallers"
}, },
"mainMenu" : { "mainMenu" : {
"art" : "MAINMENU", "art" : "MMENU1",
"desc" : "Main Menu",
"options" : { "cls" : true }, "options" : { "cls" : true },
"prompt" : "menuCommand", "prompt" : "menuCommand",
"submit" : [ "submit" : [
@ -235,10 +280,20 @@
"value" : { "command" : "D" }, "value" : { "command" : "D" },
"action" : "@menu:doorPimpWars" "action" : "@menu:doorPimpWars"
}, },
/*
{ {
"value" : { "command" : "L" }, "value" : { "command" : "L" },
"action" : "@menu:doorLORD" "action" : "@menu:doorLORD"
}, },
*/
{
"value" : { "command" : "L" },
"action" : "@menu:mainMenuLastCallers"
},
{
"value" : { "command" : "U" },
"action" : "@menu:mainMenuUserStats"
},
{ {
"value" : { "command" : "M" }, "value" : { "command" : "M" },
"action" : "@menu:messageArea" "action" : "@menu:messageArea"
@ -249,6 +304,20 @@
} }
] ]
}, },
"mainMenuLastCallers" : {
"module" : "last_callers",
"art" : "LASTCALL",
"options" : { "cls" : true, "pause" : true },
"config" : {
"dateTimeFormat" : "ddd MMM Do h:mm a"
},
"action" : "@menu:mainMenu"
},
"mainMenuUserStats" : {
"art" : "USRSTAT",
"options" : { "cls" : true, "pause" : true },
"action" : "@menu:mainMenu"
},
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Message Area Related // Message Area Related
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
@ -365,11 +434,11 @@
"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" : "msg_area_view_header", "header" : "MSGVHDR",
"body" : "demo_fse_netmail_body.ans", "body" : "demo_fse_netmail_body.ans",
"footerEdit" : "demo_fse_netmail_footer_edit.ans", "footerEdit" : "demo_fse_netmail_footer_edit.ans",
"footerEditMenu" : "demo_fse_netmail_footer_edit_menu.ans", "footerEditMenu" : "demo_fse_netmail_footer_edit_menu.ans",
"footerView" : "msg_area_footer_view.ans", "footerView" : "MSGVFTR",
"help" : "demo_fse_netmail_help.ans" "help" : "demo_fse_netmail_help.ans"
}, },
"editorMode" : "view", "editorMode" : "view",
@ -379,20 +448,21 @@
"0" : { "0" : {
"mci" : { "mci" : {
"TL1" : { "TL1" : {
"width" : 36 "width" : 27
}, },
"TL2" : { "TL2" : {
"width" : 36 "width" : 27
}, },
"TL3" : { "TL3" : {
"width" : 39, //"width" : 39,
"width" : 27,
"textOverflow" : "..." "textOverflow" : "..."
}, },
"TL5" : { "TL5" : {
"width" : 19 "width" : 27
}, },
"MA5" : { "MA5" : {
"width" : 19, "width" : 27,
"textOverflow" : "..." "textOverflow" : "..."
} }
} }
@ -402,7 +472,7 @@
"mci" : { "mci" : {
"MT1" : { "MT1" : {
"width" : 79, "width" : 79,
"height" : 17, "height" : 12,
"mode" : "preview" "mode" : "preview"
} }
}, },
@ -435,43 +505,53 @@
} }
}, },
"4" : { "4" : {
"HM" : { "mci" : {
"mci" : { "HM1" : {
"HM1" : { // (P)rev/(N)ext/Post/(R)eply/(Q)uit/(?)Help
// (P)rev/(N)ext/Post/(R)eply/(Q)uit/(?)Help // (#)Jump/(L)Index (msg list)/Last
// (#)Jump/(L)Index (msg list)/Last "items" : [ "Prev", "Next", "Reply", "Quit", "Help" ]
"items" : [ "Prev", "Next", "Reply", "Quit", "Help" ] }
} },
}, "submit" : {
"submit" : { "*" : [
"*" : [
{
"value" : { "1" : 0 },
"action" : "@method:prevMessage"
},
{
"value" : { "1" : 1 },
"action" : "@method:nextMessage"
},
{
"value" : { "1" : 3 },
"action" : "@menu:messageArea"
}
]
},
"actionKeys" : [
/*
{ {
"keys" : [ "escape" ], "value" : { "1" : 0 },
"action" : "@method:editModeEscPressed" // :TODO: fixme "action" : "@method:prevMessage"
},
{
"value" : { "1" : 1 },
"action" : "@method:nextMessage"
}, },
*/
{ {
"keys" : [ "down arrow", "up arrow", "page up", "page down" ], "value" : { "1" : 3 },
"action" : "@method:movementKeyPressed" "action" : "@menu:messageArea"
} }
] ]
} },
"actionKeys" : [
/*
{
"keys" : [ "escape" ],
"action" : "@method:editModeEscPressed" // :TODO: fixme
},
*/
{
"keys" : [ "P", "p" ],
"action" : "@method:prevMessage"
},
{
"keys" : [ "N", "n" ],
"action" : "@method:nextMessage"
},
{
"keys" : [ "escape", "Q", "q" ],
"action" : "@menu:messageArea"
},
{
"keys" : [ "down arrow", "up arrow", "page up", "page down" ],
"action" : "@method:movementKeyPressed"
}
]
} }
} }
}, },

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -62,6 +62,11 @@
"width" : 17, "width" : 17,
"textOverflow" : "..." "textOverflow" : "..."
} }
},
"messageAreaViewPost" : {
"TL3" : {
"width" : 25
}
} }
}, },
"prompts" : { "prompts" : {