* A few fixes to standard MCI codes

* Load user groups properly
* Configurable/themeable date time formats
This commit is contained in:
Bryan Ashby 2015-07-22 21:35:35 -06:00
parent 40a4f8caba
commit 4288c5b2e9
6 changed files with 27 additions and 6 deletions

View File

@ -91,6 +91,9 @@ function getDefaultConfig() {
defaults : { defaults : {
theme : 'NU-MAYA', // :TODO: allow "*" here theme : 'NU-MAYA', // :TODO: allow "*" here
passwordChar : '*', // TODO: move to user ? passwordChar : '*', // TODO: move to user ?
dateTimeFormat : {
short : 'MM/DD/YYYY',
}
}, },
/* /*

View File

@ -35,19 +35,20 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) {
VN : packageJson.version, VN : packageJson.version,
UN : this.client.user.username, UN : this.client.user.username,
UI : this.client.user.userId, UI : this.client.user.userId.toString(),
UG : _.values(this.client.user.groups).join(', '), UG : _.values(this.client.user.groups).join(', '),
UR : this.client.user.properties.real_name, UR : this.client.user.properties.real_name,
LO : this.client.user.properties.location, LO : this.client.user.properties.location,
UA : this.client.user.getAge().toString(), UA : this.client.user.getAge().toString(),
UB : moment(this.client.user.properties.birthdate).format('MM/DD/YYYY'), UB : moment(this.client.user.properties.birthdate).format(this.client.currentTheme.helpers.getDateFormat()),
//UB : this.client.user.getFormattedBirthDate('medium'),
US : this.client.user.properties.sex, US : this.client.user.properties.sex,
UE : this.client.user.properties.email_address, UE : this.client.user.properties.email_address,
UW : this.client.user.properties.web_address, UW : this.client.user.properties.web_address,
UF : this.client.user.properties.affiliation, UF : this.client.user.properties.affiliation,
UT : this.client.user.properties.theme_id, UT : this.client.user.properties.theme_id,
ND : this.client.runtime.id.toString(),
OS : { OS : {
linux : 'Linux', linux : 'Linux',
darwin : 'Mac OS X', darwin : 'Mac OS X',
@ -212,6 +213,11 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
default : default :
options.text = this.getPredefinedViewLabel(mci.code); options.text = this.getPredefinedViewLabel(mci.code);
if(_.isString(options.text)) { if(_.isString(options.text)) {
setWidth(0);
setOption(1, 'textStyle');
setOption(2, 'justify');
view = new TextView(options); view = new TextView(options);
} }
break; break;

View File

@ -52,8 +52,18 @@ function loadTheme(themeID, cb) {
} }
} }
return pwChar; 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); cb(null, theme);
} catch(e) { } catch(e) {

View File

@ -38,8 +38,7 @@ function getGroupsForUser(userId, cb) {
cb(err); cb(err);
return; return;
} else { } else {
console.log(row); groups[row.group_id] = row.group_name;
//groups[row.group_id]
} }
}, },
function complete() { function complete() {

BIN
mods/art/userstats.ans Normal file

Binary file not shown.

View File

@ -8,6 +8,9 @@
"general" : { "general" : {
"passwordChar" : "φ" "passwordChar" : "φ"
}, },
"dateTimeFormat" : {
"short" : "YYYY-MMM-DD"
},
"mci" : { "mci" : {
"TM" : { "TM" : {
"styleSGR1" : "|00|30|01" "styleSGR1" : "|00|30|01"