* 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) {
|
function getMessageAreaByName(areaName) {
|
||||||
areaName = areaName.toLowerCase();
|
areaName = areaName.toLowerCase();
|
||||||
|
|
||||||
var availAreas = getAvailableMessageAreas();
|
var availAreas = getAvailableMessageAreas( { includePrivate : true } );
|
||||||
var index = _.findIndex(availAreas, function pred(an) {
|
var index = _.findIndex(availAreas, function pred(an) {
|
||||||
return an.name == areaName;
|
return an.name == areaName;
|
||||||
});
|
});
|
||||||
|
|
|
@ -98,6 +98,9 @@ function submitApplication(callingMenu, formData, extraArgs) {
|
||||||
|
|
||||||
message_area_name : getDefaultMessageArea().name,
|
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:
|
// :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,
|
//account_status : Config.users.requireActivation ? user.User.AccountStatus.inactive : user.User.AccountStatus.active,
|
||||||
|
|
||||||
|
|
|
@ -491,7 +491,7 @@
|
||||||
}
|
}
|
||||||
actionKeys: [
|
actionKeys: [
|
||||||
{
|
{
|
||||||
keys: [ "escape" ]
|
keys: [ "escape", "q", "shift + q" ]
|
||||||
action: @systemMethod:fallbackMenu
|
action: @systemMethod:fallbackMenu
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -12,6 +12,24 @@ var assert = require('assert');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
var moment = require('moment');
|
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.getModule = MessageListModule;
|
||||||
|
|
||||||
exports.moduleInfo = {
|
exports.moduleInfo = {
|
||||||
|
@ -20,34 +38,6 @@ exports.moduleInfo = {
|
||||||
author : 'NuSkooler',
|
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 = {
|
var MciCodesIds = {
|
||||||
MsgList : 1,
|
MsgList : 1,
|
||||||
MsgAreaDesc : 2,
|
MsgAreaDesc : 2,
|
||||||
|
@ -134,36 +124,32 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
var msgListView = vc.getView(MciCodesIds.MsgList);
|
var msgListView = vc.getView(MciCodesIds.MsgList);
|
||||||
|
|
||||||
// :TODO: fix default format
|
// :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 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 msgNum = 1;
|
||||||
var newMark = '*'; // :TODO: Make configurable
|
|
||||||
var dateFmt = 'ddd MMM DD'; // :TODO: Make configurable
|
function getMsgFmtObj(mle) {
|
||||||
msgListView.setItems(_.map(self.messageList, function formatMsgListEntry(mle) {
|
return {
|
||||||
return listFormat.format( {
|
|
||||||
msgNum : msgNum++,
|
msgNum : msgNum++,
|
||||||
subj : mle.subject,
|
subj : mle.subject,
|
||||||
from : mle.fromUserName,
|
from : mle.fromUserName,
|
||||||
to : mle.toUserName,
|
to : mle.toUserName,
|
||||||
ts : moment(mle.modTimestamp).format(dateFmt),
|
ts : moment(mle.modTimestamp).format(dateTimeFormat),
|
||||||
newMark : newMark, // :TODO: These should only be for actual new messages!
|
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;
|
msgNum = 1;
|
||||||
msgListView.setFocusItems(_.map(self.messageList, function formatMsgListEntry(mle) {
|
msgListView.setFocusItems(_.map(self.messageList, function formatMsgListEntry(mle) {
|
||||||
return focusListFormat.format( {
|
return focusListFormat.format(getMsgFmtObj(mle));
|
||||||
msgNum : msgNum++,
|
});
|
||||||
subj : mle.subject,
|
|
||||||
from : mle.fromUserName,
|
|
||||||
to : mle.toUserName,
|
|
||||||
ts : moment(mle.modTimestamp).format(dateFmt),
|
|
||||||
newMark : newMark,
|
|
||||||
} );
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
msgListView.on('index update', function indexUpdated(idx) {
|
msgListView.on('index update', function indexUpdated(idx) {
|
||||||
self.setViewText(MciCodesIds.MsgSelNum, (idx + 1).toString());
|
self.setViewText(MciCodesIds.MsgSelNum, (idx + 1).toString());
|
||||||
|
@ -184,10 +170,7 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
||||||
],
|
],
|
||||||
function complete(err) {
|
function complete(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
// :TODO: log this properly
|
self.client.log.error( { error : err.toString() }, 'Error loading message list');
|
||||||
// :TODO: use fallbackMenuModule() here
|
|
||||||
self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
|
|
||||||
console.log(err)
|
|
||||||
}
|
}
|
||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,8 @@
|
||||||
|
|
||||||
mainMenuUserList: {
|
mainMenuUserList: {
|
||||||
config: {
|
config: {
|
||||||
listFormat: "|00|01|36{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:<21.21}{lastLoginTs}"
|
focusListFormat: "|00|42|30{userName:<17.17}{affils:<21.21}{note:<19.19}{lastLoginTs}"
|
||||||
dateTimeFormat: MMM Do h:mma
|
dateTimeFormat: MMM Do h:mma
|
||||||
}
|
}
|
||||||
mci: {
|
mci: {
|
||||||
|
@ -118,6 +118,7 @@
|
||||||
config: {
|
config: {
|
||||||
listFormat: "|00|01|37{msgNum:>4} |00|37- |36{subj:<29.29} {from:<20.20} {ts} |01|31{newMark}"
|
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}"
|
focusListFormat: "|00|42|30{msgNum:>4} - {subj:<29.29} {from:<20.20} {ts} {newMark}"
|
||||||
|
dateTimeFormat: ddd MMM DDD
|
||||||
}
|
}
|
||||||
mci: {
|
mci: {
|
||||||
VM1: {
|
VM1: {
|
||||||
|
|
|
@ -12,14 +12,15 @@ var assert = require('assert');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Available listFormat object members:
|
Available listFormat/focusListFormat object members:
|
||||||
userId
|
|
||||||
userName
|
userId : User ID
|
||||||
lastLoginTs
|
userName : User name/handle
|
||||||
status
|
lastLoginTs : Last login timestamp
|
||||||
location
|
status : Status: active | inactive
|
||||||
affiliation
|
location : Location
|
||||||
note
|
affiliation : Affils
|
||||||
|
note : User note
|
||||||
*/
|
*/
|
||||||
|
|
||||||
exports.moduleInfo = {
|
exports.moduleInfo = {
|
||||||
|
|
Loading…
Reference in New Issue