* Work on Renegade style pipe codes

* Change age -> birthday
* Minor tweaks and tests
This commit is contained in:
Bryan Ashby 2015-07-20 22:56:48 -06:00
parent 31ff67f32b
commit 81e684cdcc
11 changed files with 58 additions and 28 deletions

View File

@ -111,7 +111,7 @@ var SGRValues = {
greenBG : 42,
yellowBG : 43,
blueBG : 44,
magentaBG : 45,
cyanBG : 46,
whiteBG : 47,
};

View File

@ -457,7 +457,7 @@ function display(options, cb) {
var nextPauseTermHeight = options.client.term.termHeight;
var continous = false;
/*
parser.on('row update', function rowUpdate(row) {
if(row >= nextPauseTermHeight) {
if(!continous && 'termHeight' === options.pause) {
@ -474,6 +474,7 @@ function display(options, cb) {
nextPauseTermHeight += options.client.term.termHeight;
}
});
*/
parser.on('mci', function mciEncountered(mciInfo) {

View File

@ -7,6 +7,7 @@ var assert = require('assert');
exports.pipeToAnsi = exports.enigmaToAnsi = enigmaToAnsi;
exports.stripPipeCodes = exports.stripEnigmaCodes = stripEnigmaCodes;
exports.renegadeToAnsi = renegadeToAnsi;
// :TODO: Not really happy with the module name of "color_codes". Would like something better
@ -62,7 +63,6 @@ function enigmaToAnsi(s) {
return result;
}
// :TODO: NYI
function renegadeToAnsi(s) {
if(-1 == s.indexOf('|')) {
return s; // no pipe codes present
@ -85,17 +85,36 @@ if(-1 == s.indexOf('|')) {
if(isNaN(val)) {
val = 0;
}
assert(val >= 0 && val <= 23);
var attr = '';
if(7 == val) {
attr = ansi.sgr('normal');
} else if (val < 7 || val >= 16) {
attr = ansi.sgr(['normal', val]);
} else if (val <= 15) {
attr = ansi.sgr(['normal', val - 8, 'bold']);
}
var attr = ansi.sgr({
0 : [ 'reset', 'black' ],
1 : [ 'reset', 'blue' ],
2 : [ 'reset', 'green' ],
3 : [ 'reset', 'cyan' ],
4 : [ 'reset', 'red' ],
5 : [ 'reset', 'magenta' ],
6 : [ 'reset', 'yellow' ],
7 : [ 'reset', 'white' ],
8 : [ 'bold', 'black' ],
9 : [ 'bold', 'blue' ],
10 : [ 'bold', 'green' ],
11 : [ 'bold', 'cyan' ],
12 : [ 'bold', 'red' ],
13 : [ 'bold', 'magenta' ],
14 : [ 'bold', 'yellow' ],
15 : [ 'bold', 'white' ],
16 : [ 'blackBG' ],
17 : [ 'blueBG' ],
18 : [ 'greenBG' ],
19 : [ 'cyanBG' ],
20 : [ 'redBG' ],
21 : [ 'magentaBG' ],
22 : [ 'yellowBG' ],
23 : [ 'whiteBG' ],
}[val] || 'normal');
result += s.substr(lastIndex, m.index - lastIndex) + attr;
lastIndex = re.lastIndex;

View File

@ -137,5 +137,9 @@ function getDefaultConfig() {
}
*/
},
logging : {
level : 'debug'
}
};
}

View File

@ -124,11 +124,14 @@ function connectEntry(client) {
//
displayBanner(term);
/*
theme.displayThemeArt({client : client, name : 'DM-ENIG2.ANS'}, function onArt() {
/* var art1 = require('fs').readFileSync('/home/nuskooler/dev/enigma-bbs/mods/themes/NU-MAYA/APPLY1.ANS');
term.rawWrite(art1);
});*/
term.write(ansi.resetScreen());
theme.displayThemeArt({client : client, name : 'APPLY1.ANS'}, function onArt() {
});
*/
setTimeout(function onTimeout() {
client.gotoMenuModule( { name : Config.firstMenu });
}, 500);

View File

@ -50,7 +50,6 @@ function JSONCache() {
JSONCache.prototype.getJSON = function(fileName, cb) {
var self = this;
var filePath = paths.join(Config.paths.mods, fileName);
console.log(filePath)
if(filePath in this.cache) {
cb(null, this.cache[filePath]);

View File

@ -47,9 +47,9 @@ module.exports = {
{
type : 'rotating-file',
path : logFile,
period : '1d',
period : Config.logging.period || '1d',
count : 3,
level : 'trace'
level : Config.logging.level || 'debug',
}
/*,
{

View File

@ -74,14 +74,14 @@ function submitApplication(callingMenu, formData, extraArgs) {
menuViewController.switchFocus(viewIds[0]);
} else {
// Seems legit!
// :TODO: All of this should be a system API, not a mod
// :TODO: All of this should be a system API, not a mod, e.g. createNewUser(...)
var newUser = new user.User();
newUser.username = formData.value.username;
newUser.properties = {
real_name : formData.value.realName,
age : formData.value.age,
birthday : formData.value.birthday,
sex : formData.value.sex,
location : formData.value.location,
affiliation : formData.value.affils,

View File

@ -110,7 +110,7 @@
"next" : "newUserActive",
"form" : {
"0" : {
"BT12BT13ET1ET10ET2ET3ET4ET5ET6ET7ET8ET9TL11" : {
"BT12BT13ET1ET10ET2ET4ET5ET6ET7ET8ET9ME3TL11" : {
"mci" : {
"ET1" : {
"focus" : true,
@ -121,14 +121,14 @@
"argName" : "realName",
"maxLength" : 32
},
"ET3" : {
"argName" : "age",
"width" : 3,
"maxLength" : 3
"ME3" : {
"argName" : "birthday",
//"width" : 8,
"maskPattern" : "####/##/##"
},
"ET4" : {
"argName" : "sex",
"width" : 1,
//"width" : 1,
"maxLength" : 1
},
"ET5" : {

Binary file not shown.

View File

@ -26,8 +26,12 @@
"apply" : {
"ET1" : { "width" : 21 },
"ET2" : { "width" : 21 },
"ET3" : { "width" : 21 },
"ET4" : { "width" : 21 },
//"ET3" : { "width" : 21 },
"ME3" : {
"styleSGR1" : "|00|30|01",
"styleSGR2" : "|00|37"
},
"ET4" : { "width" : 1 },
"ET5" : { "width" : 21 },
"ET6" : { "width" : 21 },
"ET7" : { "width" : 21 },