* Message list updated to be functional with new MCI/etc. (Still WIP, but working good)
This commit is contained in:
parent
3038213c09
commit
6e0a4e84af
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"
|
||||
messageAreaMessageList: {
|
||||
module: msg_list
|
||||
art: MSGLIST
|
||||
config: {
|
||||
listType: public
|
||||
}
|
||||
},
|
||||
"submit" : {
|
||||
"*": [
|
||||
form: {
|
||||
0: {
|
||||
mci: {
|
||||
VM1: {
|
||||
height: 10
|
||||
focus: true
|
||||
submit: true
|
||||
argName: message
|
||||
}
|
||||
}
|
||||
submit: {
|
||||
*: [
|
||||
{
|
||||
"value" : { "message" : null },
|
||||
"action" : "@method:selectMessage"
|
||||
value: { message: null }
|
||||
action: @method:selectMessage
|
||||
}
|
||||
]
|
||||
},
|
||||
"actionKeys" : [
|
||||
}
|
||||
actionKeys: [
|
||||
{
|
||||
"keys" : [ "escape", "q", "shift + q" ],
|
||||
"action" : "@menu:messageArea"
|
||||
keys: [ "escape", "q", "shift + q" ]
|
||||
action: @menu:messageArea
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
messageAreaViewPost: {
|
||||
module: msg_area_view_fse
|
||||
|
|
|
@ -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) {
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -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}"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue