Add MCI codes, helpers, and format keys for user availability and visibility
* New MCI codes: IA and IV * availInicator and visIndicator to WFC format keys * New helpers for availalbe and visible indicators (see themes)
This commit is contained in:
parent
868e14aa8e
commit
2b3d5be3d9
Binary file not shown.
|
@ -249,10 +249,10 @@
|
|||
mainMenuWaitingForCaller: {
|
||||
config: {
|
||||
quickLogTimestampFormat: "|01|02MM|08/|02DD hh:mm:ssa"
|
||||
nowDateTimeFormat: "|00|11dddd|08, |11MMMM Do YYYY |08/ |11h|08:|11mm|08:|11ss|03a"
|
||||
nowDateTimeFormat: "|00|11ddd|08, |11MMMM Do YYYY|08, |11h|08:|11mm|08:|11ss|03a"
|
||||
lastLoginDateTimeFormat: "|00|10ddd hh|08:|10mm|02a"
|
||||
|
||||
mainInfoFormat10: "|00|11{now} {currentUserName} |08- |03mail|08: |11{newPrivateMail}|03 prv|08, |11{newMessagesAddrTo}|03 addr to"
|
||||
mainInfoFormat10: "|00|11{now} {currentUserName} |08- |03Prv|08:|11{newPrivateMail} |03Addr|08:|11{newMessagesAddrTo} |08- |03Avail|08:|11{availIndicator} |03Vis|08:|11{visIndicator}"
|
||||
mainInfoFormat11: "|00|10{callsToday:>5}"
|
||||
mainInfoFormat12: "|00|10{postsToday:>5}"
|
||||
mainInfoFormat13: "|00|10{uploadsToday:>2} |08/ |10{uploadBytesToday!sizeWithoutAbbr} |02{uploadBytesToday!sizeAbbr}"
|
||||
|
@ -288,6 +288,8 @@
|
|||
error: |00|12
|
||||
fatal: |00|28
|
||||
}
|
||||
statusAvailableIndicators: [ "N", "Y" ]
|
||||
statusVisibleIndicators: [ "N", "Y" ]
|
||||
}
|
||||
0: {
|
||||
mci: {
|
||||
|
|
|
@ -192,6 +192,14 @@ const PREDEFINED_MCI_GENERATORS = {
|
|||
NP : function userNewPrivateMailCount(client) {
|
||||
return StatLog.getUserStatNumByClient(client, UserProps.NewPrivateMailCount);
|
||||
},
|
||||
IA : function userStatusAvailableIndicator(client) {
|
||||
const indicators = client.currentTheme.helpers.getStatusAvailIndicators();
|
||||
return client.user.isAvailable() ? (indicators[0] || 'Y') : (indicators[1] || 'N');
|
||||
},
|
||||
IV : function userStatusVisibleIndicator(client) {
|
||||
const indicators = client.currentTheme.helpers.getStatusVisibleIndicators();
|
||||
return client.user.isVisible() ? (indicators[0] || 'Y') : (indicators[1] || 'N');
|
||||
},
|
||||
|
||||
//
|
||||
// Date/Time
|
||||
|
|
|
@ -348,7 +348,15 @@ exports.ThemeManager = class ThemeManager {
|
|||
getDateTimeFormat : function(style = 'short') {
|
||||
const format = Config().theme.dateTimeFormat[style] || 'MM/DD/YYYY h:mm a';
|
||||
return _.get(theme, `customization.defaults.dateTimeFormat.${style}`, format);
|
||||
}
|
||||
},
|
||||
getStatusAvailIndicators : function() {
|
||||
const format = Config().theme.statusAvailableIndicators || [ 'Y', 'N' ];
|
||||
return _.get(theme, 'customization.defaults.statusAvailableIndicators', format);
|
||||
},
|
||||
getStatusVisibleIndicators : function() {
|
||||
const format = Config().theme.statusVisibleIndicators || [ 'Y', 'N' ];
|
||||
return _.get(theme, 'customization.defaults.statusVisibleIndicators', format);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
29
core/wfc.js
29
core/wfc.js
|
@ -53,6 +53,9 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
|||
}
|
||||
}
|
||||
|
||||
// initSequence -> MenuModule.displayArtAndPrepViewController() (make common)
|
||||
// main, help, log, ...
|
||||
|
||||
mciReady(mciData, cb) {
|
||||
super.mciReady(mciData, err => {
|
||||
if (err) {
|
||||
|
@ -118,9 +121,9 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
|||
}
|
||||
|
||||
_applyOpVisibility() {
|
||||
const vis = this.config.opVisibility || 'current';
|
||||
this.restoreUserIsVisible = this.client.user.isVisible();
|
||||
|
||||
const vis = this.config.opVisibility || 'current';
|
||||
switch (vis) {
|
||||
case 'hidden' : this.client.user.setVisibility(false); break;
|
||||
case 'visible' : this.client.user.setVisibility(true); break;
|
||||
|
@ -175,6 +178,20 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
|||
);
|
||||
}
|
||||
|
||||
_getStatusStrings(isAvailable, isVisible) {
|
||||
const availIndicators = Array.isArray(this.config.statusAvailableIndicators) ?
|
||||
this.config.statusAvailableIndicators :
|
||||
this.client.currentTheme.helpers.getStatusAvailableIndicators();
|
||||
const visIndicators = Array.isArray(this.config.statusVisibleIndicators) ?
|
||||
this.config.statusVisibleIndicators :
|
||||
this.client.currentTheme.helpers.getStatusVisibleIndicators();
|
||||
|
||||
return [
|
||||
isAvailable ? (availIndicators[1] || 'Y') : (availIndicators[0] || 'N'),
|
||||
isVisible ? (visIndicators[1] || 'Y') : (visIndicators[0] || 'N'),
|
||||
];
|
||||
}
|
||||
|
||||
_refreshStats(cb) {
|
||||
const fileAreaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats) || {};
|
||||
const sysMemStats = StatLog.getSystemStat(SysProps.SystemMemoryStats) || {};
|
||||
|
@ -183,6 +200,10 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
|||
|
||||
const now = moment();
|
||||
|
||||
const [availIndicator, visIndicator] = this._getStatusStrings(
|
||||
this.client.user.isAvailable(), this.client.user.isVisible()
|
||||
);
|
||||
|
||||
this.stats = {
|
||||
// Date/Time
|
||||
nowDate : now.format(this.getDateFormat()),
|
||||
|
@ -216,6 +237,8 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
|||
// Current
|
||||
currentUserName : this.client.user.username,
|
||||
currentUserRealName : this.client.user.getProperty(UserProps.RealName) || this.client.user.username,
|
||||
availIndicator : availIndicator,
|
||||
visIndicator : visIndicator,
|
||||
lastLoginUserName : lastLoginStats.userName,
|
||||
lastLoginRealName : lastLoginStats.realName,
|
||||
lastLoginDate : moment(lastLoginStats.timestamp).format(this.getDateFormat()),
|
||||
|
@ -247,7 +270,11 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
|||
ac.action = 'Logging In';
|
||||
}
|
||||
|
||||
const [availIndicator, visIndicator] = this._getStatusStrings(ac.isAvailable, ac.isVisible);
|
||||
|
||||
return Object.assign(ac, {
|
||||
availIndicator,
|
||||
visIndicator,
|
||||
timeOn : _.upperFirst((ac.timeOn || moment.duration(0)).humanize()), // make friendly
|
||||
});
|
||||
});
|
||||
|
|
|
@ -107,6 +107,8 @@ There are many predefined MCI codes that can be used anywhere on the system (pla
|
|||
| `NT` | Total *new* users *today* |
|
||||
| `NM` | Count of new messages **address to the current user** across all message areas in which they have access |
|
||||
| `NP` | Count of new private mail to the current user |
|
||||
| `IA` | Indicator as to rather the current user is **available** or not. See also `getStatusAvailIndicators()` in [Themes](themes.md) |
|
||||
| `IV` | Indicator as to rather the curent user is **visible** or not. See also `getStatusVisibleIndicators()` in [Themes](themes.md) |
|
||||
|
||||
Some additional special case codes also exist:
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ Override system defaults.
|
|||
| `dateFormat` | Sets the [moment.js](https://momentjs.com/docs/#/displaying/) style `short` and/or `long` format for dates. |
|
||||
| `timeFormat` | Sets the [moment.js](https://momentjs.com/docs/#/displaying/) style `short` and/or `long` format for times. |
|
||||
| `dateTimeFormat` | Sets the [moment.js](https://momentjs.com/docs/#/displaying/) style `short` and/or `long` format for date/time combinations. |
|
||||
| `getStatusAvailIndicators` | An array[2] of **availability** status indicators. Defaults to `[ 'Y', 'N' ]`. |
|
||||
| `getStatusVisibleIndicators` | An array[2] of **visibility** status indicators. Defaults to `[ 'Y', 'N' ]`. |
|
||||
|
||||
Example:
|
||||
```hjson
|
||||
|
|
|
@ -80,4 +80,7 @@ The following MCI codes are available:
|
|||
* `systemAvgLoad`: System average load.
|
||||
* `systemCurrentLoad`: System current load.
|
||||
* `newPrivateMail`: Number of new **privae** mail for current user.
|
||||
* `newMessagesAddrTo`: Number of new messages **addressed to the current user**.
|
||||
* `newMessagesAddrTo`: Number of new messages **addressed to the current user**.
|
||||
|
||||
|
||||
:information_source: While [Standard MCI](../art/mci.md) codes work on any menu, they will **not** refresh. For values that may change over time, please use the custom format values above.
|
Loading…
Reference in New Issue