* pipeWrite() can now parse Renegade via spec='renegade'
* WIP on user config
This commit is contained in:
parent
ea8061ae85
commit
171ee75043
|
@ -4,6 +4,7 @@
|
||||||
// ENiGMA½
|
// ENiGMA½
|
||||||
var Log = require('./logger.js').log;
|
var Log = require('./logger.js').log;
|
||||||
var enigmaToAnsi = require('./color_codes.js').enigmaToAnsi;
|
var enigmaToAnsi = require('./color_codes.js').enigmaToAnsi;
|
||||||
|
var renegadeToAnsi = require('./color_codes.js').renegadeToAnsi;
|
||||||
|
|
||||||
var iconv = require('iconv-lite');
|
var iconv = require('iconv-lite');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
@ -137,8 +138,15 @@ ClientTerminal.prototype.rawWrite = function(s) {
|
||||||
this.output.write(s);
|
this.output.write(s);
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientTerminal.prototype.pipeWrite = function(s) {
|
ClientTerminal.prototype.pipeWrite = function(s, spec) {
|
||||||
this.write(enigmaToAnsi(s, this));
|
spec = spec || 'enigma';
|
||||||
|
|
||||||
|
var conv = {
|
||||||
|
enigma : enigmaToAnsi,
|
||||||
|
renegade : renegadeToAnsi,
|
||||||
|
}[spec] || enigmaToAnsi;
|
||||||
|
|
||||||
|
this.write(conv(s, this));
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientTerminal.prototype.encode = function(s, convertLineFeeds) {
|
ClientTerminal.prototype.encode = function(s, convertLineFeeds) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ var ViewController = require('./view_controller.js').ViewController;
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
var moment = require('moment');
|
||||||
|
|
||||||
exports.getModule = UserConfigModule;
|
exports.getModule = UserConfigModule;
|
||||||
|
|
||||||
|
@ -16,11 +17,30 @@ exports.moduleInfo = {
|
||||||
author : 'NuSkooler',
|
author : 'NuSkooler',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var MciCodeIds = {
|
||||||
|
Email : 1,
|
||||||
|
Loc : 2,
|
||||||
|
Web : 3,
|
||||||
|
Affils : 4,
|
||||||
|
|
||||||
|
BirthDate : 5,
|
||||||
|
Sex : 6,
|
||||||
|
|
||||||
|
Theme : 10,
|
||||||
|
ScreenSize : 11,
|
||||||
|
};
|
||||||
|
|
||||||
function UserConfigModule(options) {
|
function UserConfigModule(options) {
|
||||||
MenuModule.call(this, options);
|
MenuModule.call(this, options);
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
self.setViewText = function(viewId, text) {
|
||||||
|
var v = self.viewControllers.menu.getView(viewId);
|
||||||
|
if(v) {
|
||||||
|
v.setText(text);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,12 +48,26 @@ require('util').inherits(UserConfigModule, MenuModule);
|
||||||
|
|
||||||
UserConfigModule.prototype.mciReady = function(mciData, cb) {
|
UserConfigModule.prototype.mciReady = function(mciData, cb) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var vc = self.viewControllers.allViews = new ViewController( { client : self.client} );
|
var vc = self.viewControllers.menu = new ViewController( { client : self.client} );
|
||||||
|
|
||||||
async.series(
|
async.series(
|
||||||
[
|
[
|
||||||
function callParentMciReady(callback) {
|
function callParentMciReady(callback) {
|
||||||
UserConfigModule.super_.prototype.mciReady.call(self, mciData, callback);
|
UserConfigModule.super_.prototype.mciReady.call(self, mciData, callback);
|
||||||
|
},
|
||||||
|
function loadFromConfig(callback) {
|
||||||
|
vc.loadFromMenuConfig( { callingMenu : self, mciMap : mciData.menu }, callback);
|
||||||
|
},
|
||||||
|
function populateViews(callback) {
|
||||||
|
var user = self.client.user;
|
||||||
|
|
||||||
|
self.setViewText(MciCodeIds.Email, user.properties.email_address);
|
||||||
|
self.setViewText(MciCodeIds.Loc, user.properties.location);
|
||||||
|
self.setViewText(MciCodeIds.Web, user.properties.web_address);
|
||||||
|
self.setViewText(MciCodeIds.Affils, user.properties.affiliation);
|
||||||
|
self.setViewText(MciCodeIds.BirthDate, moment(user.properties.birthdate).format('YYYYMMDD'));
|
||||||
|
self.setViewText(MciCodeIds.Sex, user.properties.sex);
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -559,7 +559,7 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) {
|
||||||
if(err) {
|
if(err) {
|
||||||
// non-fatal
|
// non-fatal
|
||||||
self.client.log.trace(
|
self.client.log.trace(
|
||||||
{ error : err, mci : Object.keys(options.mciMap), formId : formIdKey },
|
{ error : err.toString(), mci : Object.keys(options.mciMap), formId : formIdKey },
|
||||||
'Unable to find matching form configuration');
|
'Unable to find matching form configuration');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -460,6 +460,32 @@
|
||||||
mainMenuUserConfig: {
|
mainMenuUserConfig: {
|
||||||
module: @systemModule:user_config
|
module: @systemModule:user_config
|
||||||
art: CONFSCR
|
art: CONFSCR
|
||||||
|
form: {
|
||||||
|
0: {
|
||||||
|
mci: {
|
||||||
|
ET1: {
|
||||||
|
argName: email
|
||||||
|
}
|
||||||
|
ET2: {
|
||||||
|
argName: location
|
||||||
|
}
|
||||||
|
ET3: {
|
||||||
|
argName: webAddress
|
||||||
|
}
|
||||||
|
ET4: {
|
||||||
|
argName: affils
|
||||||
|
}
|
||||||
|
ME5: {
|
||||||
|
maskPattern: "####/##/##"
|
||||||
|
argName: birthdate
|
||||||
|
}
|
||||||
|
ME11: {
|
||||||
|
maskPattern: "##x##"
|
||||||
|
argName: termSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
// Message Area Related
|
// Message Area Related
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue