diff --git a/core/menu_view.js b/core/menu_view.js index 8d4e8308..e9fa468c 100644 --- a/core/menu_view.js +++ b/core/menu_view.js @@ -64,10 +64,12 @@ MenuView.prototype.getItem = function(index) { MenuView.prototype.focusNext = function() { // nothing @ base currently + this.emit('index update', this.focusedItemIndex); }; MenuView.prototype.focusPrevious = function() { // nothign @ base currently + this.emit('index update', this.focusedItemIndex); }; MenuView.prototype.setFocusItems = function(items) { @@ -79,7 +81,7 @@ MenuView.prototype.setFocusItems = function(items) { self.focusItems.push( { text : itemText } ); }); } -} +}; MenuView.prototype.setItemSpacing = function(itemSpacing) { itemSpacing = parseInt(itemSpacing); diff --git a/core/vertical_menu_view.js b/core/vertical_menu_view.js index 44b678bd..90fc566e 100644 --- a/core/vertical_menu_view.js +++ b/core/vertical_menu_view.js @@ -172,8 +172,6 @@ VerticalMenuView.prototype.setItems = function(items) { // :TODO: Apply draw optimizaitons when only two items need drawn vs entire view! VerticalMenuView.prototype.focusNext = function() { - VerticalMenuView.super_.prototype.focusNext.call(this); - if(this.items.length - 1 === this.focusedItemIndex) { this.focusedItemIndex = 0; @@ -191,11 +189,11 @@ VerticalMenuView.prototype.focusNext = function() { } this.redraw(); + + VerticalMenuView.super_.prototype.focusNext.call(this); }; VerticalMenuView.prototype.focusPrevious = function() { - VerticalMenuView.super_.prototype.focusPrevious.call(this); - if(0 === this.focusedItemIndex) { this.focusedItemIndex = this.items.length - 1; @@ -215,6 +213,8 @@ VerticalMenuView.prototype.focusPrevious = function() { } this.redraw(); + + VerticalMenuView.super_.prototype.focusPrevious.call(this); }; @@ -222,7 +222,7 @@ VerticalMenuView.prototype.setFocusItems = function(items) { VerticalMenuView.super_.prototype.setFocusItems.call(this, items); this.positionCacheExpired = true; -} +}; VerticalMenuView.prototype.setItemSpacing = function(itemSpacing) { VerticalMenuView.super_.prototype.setItemSpacing.call(this, itemSpacing); diff --git a/mods/menu.hjson b/mods/menu.hjson index eef2b59a..8432754b 100644 --- a/mods/menu.hjson +++ b/mods/menu.hjson @@ -528,41 +528,39 @@ } } }, - "messageAreaMessageList" : { - "module" : "msg_list", - "art" : "msg_list" - "config" : { - "listType" : "public" - }, - "form" : { - "0" : { - "VM" : { - "mci" : { - "VM1" : { - "height" : 10, - "focus" : true, - "submit" : true, - "argName" : "message" - } - }, - "submit" : { - "*": [ - { - "value" : { "message" : null }, - "action" : "@method:selectMessage" - } - ] - }, - "actionKeys" : [ + messageAreaMessageList: { + module: msg_list + art: MSGLIST + config: { + listType: public + } + form: { + 0: { + mci: { + VM1: { + height: 10 + focus: true + submit: true + argName: message + } + } + submit: { + *: [ { - "keys" : [ "escape", "q", "shift + q" ], - "action" : "@menu:messageArea" + value: { message: null } + action: @method:selectMessage } ] } + actionKeys: [ + { + keys: [ "escape", "q", "shift + q" ] + action: @menu:messageArea + } + ] } } - }, + } messageAreaViewPost: { module: msg_area_view_fse diff --git a/mods/msg_list.js b/mods/msg_list.js index fa02abe1..fc4e5f7a 100644 --- a/mods/msg_list.js +++ b/mods/msg_list.js @@ -10,6 +10,7 @@ var Message = require('../core/message.js'); var async = require('async'); var assert = require('assert'); var _ = require('lodash'); +var moment = require('moment'); exports.getModule = MessageListModule; @@ -38,9 +39,23 @@ exports.moduleInfo = { // * Multiple LV's in sync with keyboard input // * New Table LV (TV) // * + +// VM1 - message list +// TL2 - Message area desc + +// TL4 - message selected # +// TL5 - message total # // // See Obv/2, Iniq, and Mystic docs +var MciCodesIds = { + MsgList : 1, + MsgAreaDesc : 2, + + MsgSelNum : 4, + MsgTotal : 5, +}; + function MessageListModule(options) { MenuModule.call(this, options); @@ -67,6 +82,13 @@ function MessageListModule(options) { } } }; + + this.setViewText = function(id, text) { + var v = self.viewControllers.allViews.getView(id); + if(v) { + v.setText(text); + } + }; } require('util').inherits(MessageListModule, MenuModule); @@ -83,7 +105,7 @@ MessageListModule.prototype.enter = function(client) { MessageListModule.prototype.mciReady = function(mciData, cb) { var self = this; - var vc = self.viewControllers.msgList = new ViewController( { client : self.client } ); + var vc = self.viewControllers.allViews = new ViewController( { client : self.client } ); async.series( [ @@ -109,17 +131,22 @@ MessageListModule.prototype.mciReady = function(mciData, cb) { }); }, function populateList(callback) { - var msgListView = vc.getView(1); + var msgListView = vc.getView(MciCodesIds.MsgList); var listFormat = self.menuConfig.config.listFormat || '{msgNum:>4} - {subj:>35} |{to:>15}'; var focusListFormat = self.menuConfig.config.focusListFormat; var msgNum = 1; + var newMark = '*'; // :TODO: Make configurable + var dateFmt = 'ddd MMM DD'; // :TODO: Make configurable msgListView.setItems(_.map(self.messageList, function formatMsgListEntry(mle) { return listFormat.format( { msgNum : msgNum++, subj : mle.subject, - to : mle.toUserName + from : mle.fromUserName, + to : mle.toUserName, + ts : moment(mle.modTimestamp).format(dateFmt), + newMark : newMark, // :TODO: These should only be for actual new messages! } ); })); @@ -129,15 +156,29 @@ MessageListModule.prototype.mciReady = function(mciData, cb) { return focusListFormat.format( { msgNum : msgNum++, subj : mle.subject, - to : mle.toUserName + from : mle.fromUserName, + to : mle.toUserName, + ts : moment(mle.modTimestamp).format(dateFmt), + newMark : newMark, } ); })); } + msgListView.on('index update', function indexUpdated(idx) { + self.setViewText(MciCodesIds.MsgSelNum, (idx + 1).toString()); + }); + msgListView.redraw(); callback(null); - } + }, + function populateOtherMciViews(callback) { + + self.setViewText(MciCodesIds.MsgAreaDesc, messageArea.getMessageAreaByName(self.messageAreaName).desc); + self.setViewText(MciCodesIds.MsgTotal, self.messageList.length.toString()); + + callback(null); + }, ], function complete(err) { if(err) { diff --git a/mods/themes/luciano_blocktronics/MSGEHLP.ANS b/mods/themes/luciano_blocktronics/MSGEHLP.ANS new file mode 100644 index 00000000..168d7b14 Binary files /dev/null and b/mods/themes/luciano_blocktronics/MSGEHLP.ANS differ diff --git a/mods/themes/luciano_blocktronics/MSGLIST.ANS b/mods/themes/luciano_blocktronics/MSGLIST.ANS new file mode 100644 index 00000000..9a8e6ce2 Binary files /dev/null and b/mods/themes/luciano_blocktronics/MSGLIST.ANS differ diff --git a/mods/themes/luciano_blocktronics/theme.hjson b/mods/themes/luciano_blocktronics/theme.hjson index 7f421340..34f7c369 100644 --- a/mods/themes/luciano_blocktronics/theme.hjson +++ b/mods/themes/luciano_blocktronics/theme.hjson @@ -71,8 +71,8 @@ messageAreaMessageList: { config: { - listFormat: "|00|01|37{msgNum:>4} |22|37- |00|36{subj:>35} |01{to:>17}" - focusListFormat: "|00|01|42|37{msgNum:>4} |22|37- |36{subj:>35} |01{to:>17}" + listFormat: "|00|01|37{msgNum:>4} |00|37- |36{subj:<29.29} {from:<20.20} {ts} {newMark}" + focusListFormat: "|00|42|30{msgNum:>4} - {subj:<29.29} {from:<20.20} {ts} {newMark}" } }