From 2b3d5be3d9de85f42a4466a98b1b359d8b055de5 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Tue, 24 May 2022 19:46:39 -0600 Subject: [PATCH] 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) --- art/themes/luciano_blocktronics/STATUS.ANS | Bin 4639 -> 5083 bytes art/themes/luciano_blocktronics/theme.hjson | 6 ++-- core/predefined_mci.js | 8 ++++++ core/theme.js | 10 ++++++- core/wfc.js | 29 +++++++++++++++++++- docs/_docs/art/mci.md | 2 ++ docs/_docs/art/themes.md | 2 ++ docs/_docs/modding/wfc.md | 5 +++- 8 files changed, 57 insertions(+), 5 deletions(-) diff --git a/art/themes/luciano_blocktronics/STATUS.ANS b/art/themes/luciano_blocktronics/STATUS.ANS index dc2b0ca88cc1f74e440a91bba90cf1758ad776d4..e16186216f19073d439b6c46cf759b65ebac5d3c 100644 GIT binary patch literal 5083 zcmb_gv2Ghj5S5Y6ZJHozu3;@6NgtE2Ql!KX3=2dQx>2P_bizPODWRkyUuFAuc=7#8 z-g`5*-9ix4o6w>vxg-n^OFl@Blb;qY?U55?hS8R~WWY3imv#B9-iU^0OzW?D1+ zYG_&%{I+M&F7zdu(jra0Y`0vmJDd1+uo#3I*2A$uuz~iScDu$}xI2D19NQEq#HWZD z;I0bGyPLU!(K|n_A~xHofk*uFM^V%@f7S&8kl~V-$D?H$@@;;Avk6F<^VxYBokyI{ zgNs&r3QxYP25LaTbb~Mc?0_0TI1GVug@_7F6|UaD-+|Lm!mc;_d6aJq+kWUoZ%3M7 z{m10iRBGyVgQ1}`Ehi)VKt9Nbj}hGBd#q`^04Tm}XUj|PSK;@+@6+&(7?Wpj z_WISAg?Wob%r3;TAr1iMCIk*NP;yAbh~`*hU{f0dVy!|W$ea?(YC>)zh3P?9+}b1bopB(ZCz;!dIx&ox6*IuF9N#7wY|hu2rPw<`ugog(q^G+|wx zj46|^(ZhM~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E9VaYAME~~Q z1~$cGIa3#2oH@&;gS~`|y`ieE-`{w~=T&qJG?K%UZ4I0bSZfG~qq>ETFr{7=A>$*o zp~c6KVS|m!nj~l7;8&bYmUt&AV2mhLES)rJ-?f-Mxd-Ma9*Ve=b5pL|FX&7;tmsOf za)TnVtOM^E4T^v5=gl#|jqFs(s79{T6rmsd>nkru<(HZOV?T?vFSQ``?}( tZjQd6&tdt0eHQcj;r#Jp{r6XUd-v|0?0vJR&)3htds+Sb?9ij~{V#Oy2`m5r diff --git a/art/themes/luciano_blocktronics/theme.hjson b/art/themes/luciano_blocktronics/theme.hjson index 5cdf0223..a9e2bdc3 100644 --- a/art/themes/luciano_blocktronics/theme.hjson +++ b/art/themes/luciano_blocktronics/theme.hjson @@ -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: { diff --git a/core/predefined_mci.js b/core/predefined_mci.js index 130276de..78938443 100644 --- a/core/predefined_mci.js +++ b/core/predefined_mci.js @@ -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 diff --git a/core/theme.js b/core/theme.js index a511ba33..f3bdcd27 100644 --- a/core/theme.js +++ b/core/theme.js @@ -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); + }, }; } diff --git a/core/wfc.js b/core/wfc.js index be5b5e65..aaf6bce8 100644 --- a/core/wfc.js +++ b/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 }); }); diff --git a/docs/_docs/art/mci.md b/docs/_docs/art/mci.md index a1a807d8..8c2bb7ef 100644 --- a/docs/_docs/art/mci.md +++ b/docs/_docs/art/mci.md @@ -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: diff --git a/docs/_docs/art/themes.md b/docs/_docs/art/themes.md index f7b234de..ad311566 100644 --- a/docs/_docs/art/themes.md +++ b/docs/_docs/art/themes.md @@ -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 diff --git a/docs/_docs/modding/wfc.md b/docs/_docs/modding/wfc.md index eb632b31..ea56c2f6 100644 --- a/docs/_docs/modding/wfc.md +++ b/docs/_docs/modding/wfc.md @@ -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**. \ No newline at end of file + * `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. \ No newline at end of file