diff --git a/core/fse.js b/core/fse.js index a2b20f07..42e221f6 100644 --- a/core/fse.js +++ b/core/fse.js @@ -123,6 +123,10 @@ function FullScreenEditorModule(options) { return 'email' === self.editorType && Message.WellKnownAreaNames.Private === self.messageAreaName; }; + this.isReply = function() { + return !_.isUndefined(self.replyToMessage); + }; + this.getFooterName = function() { return 'footer' + _.capitalize(self.footerMode); // e.g. 'footerEditor', 'footerEditorMenu', ... }; @@ -140,6 +144,38 @@ function FullScreenEditorModule(options) { }[name]; }; + /*ViewModeHeader : { + From : 1, + To : 2, + Subject : 3, + + DateTime : 5, + MsgNum : 6, + MsgTotal : 7, + ViewCount : 8, + HashTags : 9, + MessageID : 10, + ReplyToMsgID : 11 + },*/ + + // :TODO: convert to something like this for all view acces: + this.getHeaderViews = function() { + var vc = self.viewControllers.header; + + if(self.isViewMode()) { + return { + from : vc.getView(1), + to : vc.getView(2), + subject : vc.getView(3), + + dateTime : vc.getView(5), + msgNum : vc.getView(7), + // ... + + }; + } + }; + this.setInitialFooterMode = function() { switch(self.editorMode) { case 'edit' : self.footerMode = 'editor'; break; @@ -158,6 +194,11 @@ function FullScreenEditorModule(options) { message : self.viewControllers.body.getFormData().value.message, }; + if(self.isReply()) { + msgOpts.replyToMsgId = self.replyToMessageId; + } + + self.message = new Message(msgOpts); }; diff --git a/core/menu_util.js b/core/menu_util.js index 9f471fc9..08bbaf13 100644 --- a/core/menu_util.js +++ b/core/menu_util.js @@ -172,6 +172,8 @@ function callModuleMenuMethod(client, asset, path, formData, extraArgs) { } try { + client.log.trace( { methodName : asset.asset, formData : formData, extraArgs : extraArgs } ); + var methodMod = require(path); methodMod[asset.asset](client.currentMenuModule, formData || { }, extraArgs); } catch(e) { @@ -190,7 +192,7 @@ function handleAction(client, formData, conf) { case 'method' : case 'systemMethod' : if(_.isString(actionAsset.location)) { - callModuleMenuMethod(client, actionAsset, paths.join(Config.paths.mods, actionAsset.location, formData, conf.extraArgs)); + callModuleMenuMethod(client, actionAsset, paths.join(Config.paths.mods, actionAsset.location), formData, conf.extraArgs); } else { if('systemMethod' === actionAsset.type) { // :TODO: Need to pass optional args here -- conf.extraArgs and args between e.g. () diff --git a/core/multi_line_edit_text_view.js b/core/multi_line_edit_text_view.js index d54a453f..cfc6341f 100644 --- a/core/multi_line_edit_text_view.js +++ b/core/multi_line_edit_text_view.js @@ -502,6 +502,7 @@ function MultiLineEditTextView(options) { width : width, tabHandling : tabHandling || 'expand', tabWidth : self.tabWidth, + tabChar : '\t', }); }; @@ -545,7 +546,10 @@ function MultiLineEditTextView(options) { var wrapped; for(var i = 0; i < text.length; ++i) { - wrapped = self.wordWrapSingleLine(text[i], 'expandTabs', self.dimens.width).wrapped; + wrapped = self.wordWrapSingleLine( + text[i], // input + 'expand', // tabHandling + self.dimens.width).wrapped; for(var j = 0; j < wrapped.length - 1; ++j) { self.textLines.splice(index++, 0, { text : wrapped[j] } ); diff --git a/core/word_wrap.js b/core/word_wrap.js index 98b9257e..defa1d69 100644 --- a/core/word_wrap.js +++ b/core/word_wrap.js @@ -12,6 +12,7 @@ function wordWrapText(text, options) { // width : word wrap width // tabHandling : expand (default=expand) // tabWidth : tab width if tabHandling is 'expand' (default=4) + // tabChar : character to use for tab expansion // assert(_.isObject(options), 'Missing options!'); assert(_.isNumber(options.width), 'Missing options.width!'); @@ -22,6 +23,8 @@ function wordWrapText(text, options) { options.tabWidth = 4; } + options.tabChar = options.tabChar || ' '; + // // Notes // * Sublime Text 3 for example considers spaces after a word @@ -47,7 +50,7 @@ function wordWrapText(text, options) { function expandTab(col) { var remainWidth = options.tabWidth - (col % options.tabWidth); - return new Array(remainWidth).join('\t'); + return new Array(remainWidth).join(options.tabChar); } // :TODO: support wrapping pipe code text (e.g. ignore color codes, expand MCI codes) @@ -84,7 +87,7 @@ function wordWrapText(text, options) { // Nice info here: http://c-for-dummies.com/blog/?p=424 // if('expand' === options.tabHandling) { - word += expandTab(results.wrapped[i].length + word.length) + '\t'; + word += expandTab(results.wrapped[i].length + word.length) + options.tabChar; } else { word += m[0]; } diff --git a/mods/apply.js b/mods/apply.js index 47ec1f31..16f1eb8c 100644 --- a/mods/apply.js +++ b/mods/apply.js @@ -32,7 +32,7 @@ function validateApplicationData(formData, cb) { } if(isNaN(Date.parse(formData.value.birthdate))) { - cb('Invalid birthdate!'); + cb('Invalid birthdate!', [ 3 ] ); return; } @@ -109,6 +109,8 @@ function submitApplication(callingMenu, formData, extraArgs) { newUser.create( { password : formData.value.password }, function created(err) { if(err) { + Log.info( { error : err, username : formData.value.username }, 'New user creation failed'); + client.gotoMenuModule( { name : extraArgs.error } ); } else { Log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created'); diff --git a/mods/menu.hjson b/mods/menu.hjson index ddd942f1..1d1804c6 100644 --- a/mods/menu.hjson +++ b/mods/menu.hjson @@ -230,6 +230,13 @@ } ] } + + actionKeys: [ + { + keys: [ "escape" ] + viewId: 13 + } + ] } } } @@ -664,6 +671,10 @@ submit: { *: [ + { + value: { 1: 0 } + action: @method:editModeMenuSave + } { value: { 1: 1 } action: @method:replyDiscard @@ -686,7 +697,7 @@ } { keys: [ "s", "shift + s" ] - action: @method:replySave + action: @method:editModeMenuSave } { keys: [ "d", "shift + d" ] diff --git a/mods/msg_area_post_fse.js b/mods/msg_area_post_fse.js index 99a9ee67..b1b5e6c6 100644 --- a/mods/msg_area_post_fse.js +++ b/mods/msg_area_post_fse.js @@ -50,7 +50,8 @@ function AreaPostFSEModule(options) { console.log(msg); } - self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); + self.client.fallbackMenuModule(); + //self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); } ); };