* Fix some extraArgs stuff

* Minor updates to FSE related modules -- WIP!
This commit is contained in:
Bryan Ashby 2015-08-16 13:35:34 -06:00
parent d9b39fcaa6
commit 7990202317
5 changed files with 64 additions and 30 deletions

View File

@ -443,7 +443,7 @@ Client.prototype.gotoMenuModule = function(options, cb) {
var loadOptions = {
name : options.name,
client : self,
args : options.args
extraArgs : options.extraArgs,
};
menuUtil.loadMenu(loadOptions, function onMenuModuleLoaded(err, modInst) {

View File

@ -43,7 +43,9 @@ function FullScreenEditorModule(options) {
this.editorType = config.editorType;
this.editorMode = config.editorMode;
this.mciData = {};
if(_.isObject(options.extraArgs)) {
this.messageAreaId = options.extraArgs.messageAreaId || Message.WellKnownAreaIds.Private;
}
// netMail/crashMail | echoMail
//this.messageAreaId = 'netMail' === this.editorType ? Message.WellKnownAreaIds.Private : options.messageAreaId;
@ -69,7 +71,7 @@ function FullScreenEditorModule(options) {
var headerValues = self.viewControllers.header.getFormData().value;
var messageOpts = {
// areaId : self.messageAreaId,
areaId : self.messageAreaId,
toUserName : headerValues.to,
fromUserName : headerValues.from,
subject : headerValues.subject,
@ -241,12 +243,10 @@ function FullScreenEditorModule(options) {
);
};
this.mciReadyHandler = function(mciData) {
this.createInitialViews = function(mciData, cb) {
var menuLoadOpts = { callingMenu : self };
console.log('mciReadyHandler...')
async.series(
[
function header(callback) {
@ -283,20 +283,39 @@ function FullScreenEditorModule(options) {
).loadFromMenuConfig(menuLoadOpts, function footerReady(err) {
callback(err);
});
},
function prepareViewStates(callback) {
var header = self.viewControllers.header;
var from = header.getView(1);
from.acceptsFocus = false;
from.setText(self.client.user.username);
var body = self.viewControllers.body.getView(1);
self.updateTextEditMode(body.getTextEditMode());
self.updateEditModePosition(body.getEditPosition());
callback(null);
},
function setInitialFocus(callback) {
self.viewControllers.body.setFocus(false);
self.viewControllers.header.switchFocus(2); // to
callback(null);
}
],
function complete(err) {
console.log(err)
var bodyView = self.viewControllers.body.getView(1);
self.updateTextEditMode(bodyView.getTextEditMode());
self.updateEditModePosition(bodyView.getEditPosition());
self.viewControllers.body.setFocus(false);
self.viewControllers.header.switchFocus(1);
cb(err);
}
);
};
this.mciReadyHandler = function(mciData) {
self.createInitialViews(mciData, function viewsCreated(err) {
});
};
this.updateEditModePosition = function(pos) {
if('edit' === this.editorMode) {
var posView = self.viewControllers.footerEdit.getView(1);
@ -415,10 +434,11 @@ function FullScreenEditorModule(options) {
}
});
},
/*
editModeMenuSave : function(formData, extraArgs) {
var msg = self.getMessage();
console.log(msg);
},
},*/
editModeMenuQuote : function(formData, extraArgs) {
},

View File

@ -102,7 +102,7 @@ function loadMenu(options, cb) {
},
function createModuleInstance(modData, callback) {
Log.debug(
{ moduleName : modData.name, args : options.args, config : modData.config, info : modData.mod.modInfo },
{ moduleName : modData.name, extraArgs : options.extraArgs, config : modData.config, info : modData.mod.modInfo },
'Creating menu module instance');
try {
@ -110,7 +110,7 @@ function loadMenu(options, cb) {
{
menuName : options.name,
menuConfig : modData.config,
args : options.args,
extraArgs : options.extraArgs,
});
callback(null, moduleInstance);
} catch(e) {

View File

@ -259,7 +259,12 @@
"submit" : [
{
"value" : { "command" : "N" },
"action" : "@menu:messageAreaNewPost"
"action" : "@menu:messageAreaNewPost",
"extraArgs" : { "messageAreaId" : 123 }
},
{
"value" : { "command" : "Q" },
"action" : "@menu:mainMenu"
}
]
},
@ -304,7 +309,7 @@
"3" : [
{
"value" : { "subject" : null },
"action" : "@method:fseSubmitProxy"
"action" : "@method:headerSubmit"
}
]
}
@ -323,7 +328,7 @@
"*" : [
{
"value" : "message",
"action" : "@method:fseSubmitProxy"
"action" : "@method:editModeEscPressed"
}
]
},
@ -359,7 +364,7 @@
"*" : [
{
"value" : { "1" : 0 },
"action" : "@method:fseSubmitProxy"
"action" : "@method:editModeMenuSave"
},
{
"value" : { "1" : 1 },
@ -371,18 +376,18 @@
},
{
"value" : { "1" : 3 },
"action" : "@method:fseSubmitProxy"
},
"action" : "@method:editModeMenuHelp"
}/*,
{
"value" : 1,
"action" : "@method:fseSubmitProxy"
}
"action" : "@method:editModeEscPressed"
}*/
]
},
"actionKeys" : [ // :TODO: Need better name
{
"keys" : [ "escape" ],
"action" : "@method:fseSubmitProxy"
"action" : "@method:editModeEscPressed"
}
]
// :TODO: something like the following for overriding keymap

View File

@ -2,6 +2,9 @@
'use strict';
var FullScreenEditorModule = require('../core/fse.js').FullScreenEditorModule;
var Message = require('../core/message.js').Message;
var _ = require('lodash');
exports.getModule = AreaPostFSEModule;
@ -14,9 +17,15 @@ exports.moduleInfo = {
function AreaPostFSEModule(options) {
FullScreenEditorModule.call(this, options);
var self = this;
// we're posting, so always start with 'edit' mode
this.editorMode = 'edit';
this.menuMethods.editModeMenuSave = function(formData, extraArgs) {
var msg = self.getMessage();
console.log(msg);
};
}
require('util').inherits(AreaPostFSEModule, FullScreenEditorModule);