From 901f83453cc9ff91489fc623daefde1ec337cdd7 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 9 Aug 2015 19:32:38 -0600 Subject: [PATCH] * Lots of experimental stuff with message area in relation of FSE. Have a fairly good idea now how this can work... a few missing pieces --- core/fse.js | 36 ++++++---------- core/menu_module.js | 12 +++--- mods/menu.json | 103 ++++++++++++++++++++++++++++---------------- mods/prompt.json | 13 ++++++ 4 files changed, 100 insertions(+), 64 deletions(-) diff --git a/core/fse.js b/core/fse.js index 39660af4..f46f58d0 100644 --- a/core/fse.js +++ b/core/fse.js @@ -24,18 +24,23 @@ function FullScreenEditorModule(options) { MenuModule.call(this, options); var self = this; - this.menuConfig = options.menuConfig; // :TODO: MenuModule does this... + //this.menuConfig = options.menuConfig; // :TODO: MenuModule does this... // - // Editor Type ('editorType'): - // * netMail : User to user, optionally remote - // * + // menuConfig.config: + // editorType : email | area + // this.editorType = this.menuConfig.config.editorType; this.artNames = [ 'header', 'body', 'footerEdit', 'footerEditMenu', 'footerView' ]; // :TODO: The following needs to be passed in via args: - this.editorMode = 'edit'; // view | edit | editMenu | + + // + // options.extraArgs: + // editorMode : edit | view + + this.editorMode = 'edit'; // view | edit | editMenu | quote this.isLocal = true; this.toUserId = options.toUserId || 0; @@ -63,7 +68,7 @@ function FullScreenEditorModule(options) { }[name]; }; - this.getMessageData = function() { + this.getMessage = function() { var headerValues = self.viewControllers.header.getFormData().value; var messageOpts = { @@ -72,23 +77,9 @@ function FullScreenEditorModule(options) { fromUserName : headerValues.from, subject : headerValues.subject, message : self.viewControllers.body.getFormData().value.message, - - }; - console.log(messageOpts); - - var msg = new Message(messageOpts); - - if(self.isLocal) { - msg.meta.System.local_to_user_id = self.toUserId; - msg.meta.System.local_from_user_id = self.fromUserId; - } - - /*msg.persist(function persisted(err, msgId) { - - });*/ - + return new Message(messageOpts); }; this.redrawFooter = function(options, cb) { @@ -425,7 +416,8 @@ function FullScreenEditorModule(options) { }); }, editModeMenuSave : function(formData, extraArgs) { - self.getMessageData(); + var msg = self.getMessage(); + console.log(msg); }, editModeMenuQuote : function(formData, extraArgs) { diff --git a/core/menu_module.js b/core/menu_module.js index c09d549d..b9511991 100644 --- a/core/menu_module.js +++ b/core/menu_module.js @@ -42,13 +42,15 @@ function MenuModule(options) { self.menuConfig.art, self.client, { font : self.menuConfig.font }, - function displayed(err, artData) - { - if(!err) { + function displayed(err, artData) { + if(err) { + self.client.log.debug( { art : self.menuConfig.arg, err : err }, 'Could not display art'); + } else { mciData.menu = artData.mciMap; } - callback(err); - }); + callback(null); // non-fatal + } + ); } else { callback(null); } diff --git a/mods/menu.json b/mods/menu.json index 33eabee7..7e05b0a6 100644 --- a/mods/menu.json +++ b/mods/menu.json @@ -220,42 +220,6 @@ "mainMenu" : { "art" : "MAINMENU", "options" : { "cls" : true }, - /* - "form" : { - "0" : { - "ET" : { - "mci" : { - "ET1" : { - "focus" : true, - "submit" : true, - "textStyle" : "lower", - "width" : 20, - "maxLength" : 20 - } - }, - "submit" : { - "*" : [ - { - "value" : { "1" : "g" }, - "action" : "@menu:logoff" - }, - { - "value" : { "1" : "d" }, - "action" : "@menu:doorPimpWars" - }, - { - "value" : { "1" : "l" }, - "action" : "@menu:doorLORD" - }, - { - "value" : 1, - "action" : "@menu:mainMenu" - } - ] - } - } - } - },*/ "prompt" : "menuCommand", "submit" : [ { @@ -270,12 +234,78 @@ "value" : { "command" : "L" }, "action" : "@menu:doorLORD" }, + { + "value" : { "command" : "M" }, + "action" : "@menu:messageAreaMenu" + }, { "value" : 1, "action" : "@menu:mainMenu" } ] }, + /////////////////////////////////////////////////////////////////////// + // Message Area Related + /////////////////////////////////////////////////////////////////////// + "messageAreaMenu" : { + "module" : "message_area", + "art" : "MSGAREA", + "options" : { "cls" : true }, + "prompt" : "menuCommand", + "config" : { + "fseArt" : { + "header" : "demo_fse_netmail_header.ans", + "body" : "demo_fse_netmail_body.ans", + "footerEdit" : "demo_fse_netmail_footer_edit.ans", + "footerEditMenu" : "demo_fse_netmail_footer_edit_menu.ans", + "footerView" : "demo_fse_netmail_footer_view.ans", + "help" : "demo_fse_netmail_help.ans" + } + }, + "submit" : [ + { + "value" : { "command" : "R" }, + "action" : "@method:readMessages" + }, + { + "value" : { "command" : "P" }, + "action" : "@method:postMessage" + } + ] + }, + "messageAreaNewFSE" : { + "module" : "fse", + "options" : { "cls" : true }, + "config" : { + "editorType" : "area", + "art" : { + "header" : "fse_area_header", + "body" : "fse_area_body", + "footerEdit" : "fse_footer_edit", + "footerEditMenu" : "fse_footer_edit_menu", + "help" : "fse_help" + } + } + } + /*"messageAreaEmailFSE" : { + "module" : "fse", + "options" : { "cls" : true }, + "config" : { + "editorType" : "email", + "art" : { + "header" : "fse_email_header", + "body" : "fse_email_body", + "footerEdit" : "fse_email_footer_edit", + "footerEditMenu" : "fse_email_footer_edit_menu", + "footerView" : "fse_email_footer_view", + "help" : "fse_help" + } + } + }, + */ + /////////////////////////////////////////////////////////////////////// + // Doors + /////////////////////////////////////////////////////////////////////// "doorPimpWars" : { "module" : "abracadabra", "fallback" : "mainMenu", @@ -662,7 +692,6 @@ }, "demoFullScreenEditor" : { "module" : "@systemModule:fse", - //"art" : "demo_fse_local_user.ans", "options" : { "cls" : true }, "config" : { "editorType" : "netMail", diff --git a/mods/prompt.json b/mods/prompt.json index dafe49ad..bf4f8317 100644 --- a/mods/prompt.json +++ b/mods/prompt.json @@ -28,6 +28,19 @@ } } }, + "newAreaPostPrompt" : { + "art" : "message_area_new_post", + "mci" : { + "ET1" : { + "argName" : "to", + "width" : 20 + }, + "ET2" : { + "argName" : "subject", + "width" : 20 + } + } + }, /////////////////////////////////////////////////////////////////////// // Standard / Required ///////////////////////////////////////////////////////////////////////