* Code cleanup + comments
* Fix message area access in NUA path
This commit is contained in:
parent
e36507fec1
commit
549fba6b34
|
@ -53,7 +53,7 @@ function getDefaultMessageArea() {
|
|||
function getMessageAreaByName(areaName) {
|
||||
areaName = areaName.toLowerCase();
|
||||
|
||||
var availAreas = getAvailableMessageAreas();
|
||||
var availAreas = getAvailableMessageAreas( { includePrivate : true } );
|
||||
var index = _.findIndex(availAreas, function pred(an) {
|
||||
return an.name == areaName;
|
||||
});
|
||||
|
|
|
@ -98,6 +98,9 @@ function submitApplication(callingMenu, formData, extraArgs) {
|
|||
|
||||
message_area_name : getDefaultMessageArea().name,
|
||||
|
||||
term_height : client.term.termHeight,
|
||||
term_width : client.term.termWidth,
|
||||
|
||||
// :TODO: This is set in User.create() -- proabbly don't need it here:
|
||||
//account_status : Config.users.requireActivation ? user.User.AccountStatus.inactive : user.User.AccountStatus.active,
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@
|
|||
}
|
||||
actionKeys: [
|
||||
{
|
||||
keys: [ "escape" ]
|
||||
keys: [ "escape", "q", "shift + q" ]
|
||||
action: @systemMethod:fallbackMenu
|
||||
}
|
||||
]
|
||||
|
|
|
@ -12,6 +12,24 @@ var assert = require('assert');
|
|||
var _ = require('lodash');
|
||||
var moment = require('moment');
|
||||
|
||||
/*
|
||||
Available listFormat/focusListFormat members (VM1):
|
||||
|
||||
msgNum : Message number
|
||||
to : To username/handle
|
||||
from : From username/handle
|
||||
subj : Subject
|
||||
ts : Message mod timestamp (format with config.dateTimeFormat)
|
||||
newIndicator : New mark/indicator (config.newIndicator)
|
||||
|
||||
MCI codes:
|
||||
|
||||
VM1 : Message list
|
||||
TL2 : Message area description
|
||||
TL4 : Message selected #
|
||||
TL5 : Total messages in area
|
||||
*/
|
||||
|
||||
exports.getModule = MessageListModule;
|
||||
|
||||
exports.moduleInfo = {
|
||||
|
@ -20,34 +38,6 @@ exports.moduleInfo = {
|
|||
author : 'NuSkooler',
|
||||
};
|
||||
|
||||
//
|
||||
// :TODO:
|
||||
// * Avail data:
|
||||
// To - {to}
|
||||
// From - {from}
|
||||
// Subject
|
||||
// Date
|
||||
// Status (New/Read)
|
||||
// Message Num (Area)
|
||||
// Message Total (Area)
|
||||
// Message Area desc - {areaDesc} / %TL2
|
||||
// Message Area Name - {areaName}
|
||||
//
|
||||
// Ideas
|
||||
// * Module config can define custom formats for items & focused items (inc. Pipe Codes)
|
||||
// * Single list view with advanced formatting (would need textOverflow stuff), advanced formatting...
|
||||
// * 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,
|
||||
|
@ -134,36 +124,32 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
|||
var msgListView = vc.getView(MciCodesIds.MsgList);
|
||||
|
||||
// :TODO: fix default format
|
||||
var listFormat = self.menuConfig.config.listFormat || '{msgNum:>4} - {subj:>35} |{to:>15}';
|
||||
var listFormat = self.menuConfig.config.listFormat || '{msgNum} - {subj} |{to}';
|
||||
var focusListFormat = self.menuConfig.config.focusListFormat || listFormat; // :TODO: default change color here
|
||||
var dateTimeFormat = self.menuConfig.config.dateTimeFormat || 'ddd MMM DDD';
|
||||
var newIndicator = self.menuConfig.config.newIndicator || '*';
|
||||
|
||||
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( {
|
||||
|
||||
function getMsgFmtObj(mle) {
|
||||
return {
|
||||
msgNum : msgNum++,
|
||||
subj : mle.subject,
|
||||
from : mle.fromUserName,
|
||||
to : mle.toUserName,
|
||||
ts : moment(mle.modTimestamp).format(dateFmt),
|
||||
newMark : newMark, // :TODO: These should only be for actual new messages!
|
||||
} );
|
||||
ts : moment(mle.modTimestamp).format(dateTimeFormat),
|
||||
newIndicator : newIndicator, // :TODO: These should only be for actual new messages!
|
||||
}
|
||||
}
|
||||
|
||||
msgListView.setItems(_.map(self.messageList, function formatMsgListEntry(mle) {
|
||||
return listFormat.format(getMsgFmtObj(mle));
|
||||
}));
|
||||
|
||||
if(focusListFormat) {
|
||||
msgNum = 1;
|
||||
msgListView.setFocusItems(_.map(self.messageList, function formatMsgListEntry(mle) {
|
||||
return focusListFormat.format( {
|
||||
msgNum : msgNum++,
|
||||
subj : mle.subject,
|
||||
from : mle.fromUserName,
|
||||
to : mle.toUserName,
|
||||
ts : moment(mle.modTimestamp).format(dateFmt),
|
||||
newMark : newMark,
|
||||
} );
|
||||
}));
|
||||
}
|
||||
return focusListFormat.format(getMsgFmtObj(mle));
|
||||
});
|
||||
|
||||
msgListView.on('index update', function indexUpdated(idx) {
|
||||
self.setViewText(MciCodesIds.MsgSelNum, (idx + 1).toString());
|
||||
|
@ -184,10 +170,7 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
|||
],
|
||||
function complete(err) {
|
||||
if(err) {
|
||||
// :TODO: log this properly
|
||||
// :TODO: use fallbackMenuModule() here
|
||||
self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
|
||||
console.log(err)
|
||||
self.client.log.error( { error : err.toString() }, 'Error loading message list');
|
||||
}
|
||||
cb(err);
|
||||
}
|
||||
|
|
|
@ -105,8 +105,8 @@
|
|||
|
||||
mainMenuUserList: {
|
||||
config: {
|
||||
listFormat: "|00|01|36{userName:<17.17}{affils:<21.21}{note:<21.21}{lastLoginTs}"
|
||||
focusListFormat: "|00|42|30{userName:<17.17}{affils:<21.21}{note:<21.21}{lastLoginTs}"
|
||||
listFormat: "|00|01|36{userName:<17.17}{affils:<21.21}{note:<19.19}{lastLoginTs}"
|
||||
focusListFormat: "|00|42|30{userName:<17.17}{affils:<21.21}{note:<19.19}{lastLoginTs}"
|
||||
dateTimeFormat: MMM Do h:mma
|
||||
}
|
||||
mci: {
|
||||
|
@ -118,6 +118,7 @@
|
|||
config: {
|
||||
listFormat: "|00|01|37{msgNum:>4} |00|37- |36{subj:<29.29} {from:<20.20} {ts} |01|31{newMark}"
|
||||
focusListFormat: "|00|42|30{msgNum:>4} - {subj:<29.29} {from:<20.20} {ts} {newMark}"
|
||||
dateTimeFormat: ddd MMM DDD
|
||||
}
|
||||
mci: {
|
||||
VM1: {
|
||||
|
|
|
@ -12,14 +12,15 @@ var assert = require('assert');
|
|||
var _ = require('lodash');
|
||||
|
||||
/*
|
||||
Available listFormat object members:
|
||||
userId
|
||||
userName
|
||||
lastLoginTs
|
||||
status
|
||||
location
|
||||
affiliation
|
||||
note
|
||||
Available listFormat/focusListFormat object members:
|
||||
|
||||
userId : User ID
|
||||
userName : User name/handle
|
||||
lastLoginTs : Last login timestamp
|
||||
status : Status: active | inactive
|
||||
location : Location
|
||||
affiliation : Affils
|
||||
note : User note
|
||||
*/
|
||||
|
||||
exports.moduleInfo = {
|
||||
|
|
Loading…
Reference in New Issue