From 4288c5b2e925443d7372e4b7e5d64a4574405924 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 22 Jul 2015 21:35:35 -0600 Subject: [PATCH] * A few fixes to standard MCI codes * Load user groups properly * Configurable/themeable date time formats --- core/config.js | 3 +++ core/mci_view_factory.js | 12 +++++++++--- core/theme.js | 12 +++++++++++- core/user_group.js | 3 +-- mods/art/userstats.ans | Bin 0 -> 904 bytes mods/themes/NU-MAYA/theme.json | 3 +++ 6 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 mods/art/userstats.ans diff --git a/core/config.js b/core/config.js index bda34c26..ab7f7d54 100644 --- a/core/config.js +++ b/core/config.js @@ -91,6 +91,9 @@ function getDefaultConfig() { defaults : { theme : 'NU-MAYA', // :TODO: allow "*" here passwordChar : '*', // TODO: move to user ? + dateTimeFormat : { + short : 'MM/DD/YYYY', + } }, /* diff --git a/core/mci_view_factory.js b/core/mci_view_factory.js index 9b99de8a..d6dfe8bf 100644 --- a/core/mci_view_factory.js +++ b/core/mci_view_factory.js @@ -35,19 +35,20 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) { VN : packageJson.version, UN : this.client.user.username, - UI : this.client.user.userId, + UI : this.client.user.userId.toString(), UG : _.values(this.client.user.groups).join(', '), UR : this.client.user.properties.real_name, LO : this.client.user.properties.location, UA : this.client.user.getAge().toString(), - UB : moment(this.client.user.properties.birthdate).format('MM/DD/YYYY'), - //UB : this.client.user.getFormattedBirthDate('medium'), + UB : moment(this.client.user.properties.birthdate).format(this.client.currentTheme.helpers.getDateFormat()), US : this.client.user.properties.sex, UE : this.client.user.properties.email_address, UW : this.client.user.properties.web_address, UF : this.client.user.properties.affiliation, UT : this.client.user.properties.theme_id, + ND : this.client.runtime.id.toString(), + OS : { linux : 'Linux', darwin : 'Mac OS X', @@ -212,6 +213,11 @@ MCIViewFactory.prototype.createFromMCI = function(mci) { default : options.text = this.getPredefinedViewLabel(mci.code); if(_.isString(options.text)) { + setWidth(0); + + setOption(1, 'textStyle'); + setOption(2, 'justify'); + view = new TextView(options); } break; diff --git a/core/theme.js b/core/theme.js index b8354da5..6951f027 100644 --- a/core/theme.js +++ b/core/theme.js @@ -52,8 +52,18 @@ function loadTheme(themeID, cb) { } } return pwChar; + }, + getDateFormat : function(style) { + style = style || 'short'; + + var format = Config.defaults.dateTimeFormat[style] || 'MM/DD/YYYY'; + + if(_.has(theme, 'customization.defaults.dateTimeFormat')) { + return theme.customization.defaults.dateTimeFormat[style] || format; + } + return format; } - } + }; cb(null, theme); } catch(e) { diff --git a/core/user_group.js b/core/user_group.js index 2b46748d..febac904 100644 --- a/core/user_group.js +++ b/core/user_group.js @@ -38,8 +38,7 @@ function getGroupsForUser(userId, cb) { cb(err); return; } else { - console.log(row); - //groups[row.group_id] + groups[row.group_id] = row.group_name; } }, function complete() { diff --git a/mods/art/userstats.ans b/mods/art/userstats.ans new file mode 100644 index 0000000000000000000000000000000000000000..5b35b80c3472b49945672cb0f581817aa8871b6d GIT binary patch literal 904 zcmb`_L2rUE7zSX>4ogTlExU|MFDBc?6m{XisW9hA91;;daO$KE5-Lk&$$q}2wczTG z>!C@Tr*FT0shvS@3cZO-EfWA>XO1_4)UPqi?F`b99DJJ&{m3%gy`F6dJC^mKgMw`q zI!lV0HGtzYlPnRG$oR>78uO0zRwSX&@PY*$=T2~iK7)^Q!g>7^S9m;{!osCw@k zKI9eYtZ->$XJaQ2L63ZP=`an&>PbJoBDew(rso8Ce5I>Jy~9o4E}<4nUHK(ziX1n; zvV2{k&%RpTEP3M}9hkHF`|GGZY_8JUW3p2T`RP!XchP#~W)zoIFXg>6m8aUdB_F*} z)opc!_WQEZYkSqzx*)2r?XQqGu5}g00OdI&$8(-wVXU*L&ae9xy;$Z$g3@3HA^+R| fHOA0+hEvDAy)lfzAU5s|G44YD9c<=EuDbaI{2t2& literal 0 HcmV?d00001 diff --git a/mods/themes/NU-MAYA/theme.json b/mods/themes/NU-MAYA/theme.json index 483310dc..c783c49f 100644 --- a/mods/themes/NU-MAYA/theme.json +++ b/mods/themes/NU-MAYA/theme.json @@ -8,6 +8,9 @@ "general" : { "passwordChar" : "φ" }, + "dateTimeFormat" : { + "short" : "YYYY-MMM-DD" + }, "mci" : { "TM" : { "styleSGR1" : "|00|30|01"