* 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 : {
theme : 'NU-MAYA', // :TODO: allow "*" here
passwordChar : '*', // TODO: move to user ?
dateTimeFormat : {
short : 'MM/DD/YYYY',
}
},
/*

View File

@ -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;

View File

@ -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) {

View File

@ -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() {

BIN
mods/art/userstats.ans Normal file

Binary file not shown.

View File

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