parent
1e3e0b8baa
commit
91d395e8bc
|
@ -24,7 +24,8 @@ exports.resetScreen = resetScreen;
|
|||
exports.normal = normal;
|
||||
exports.goHome = goHome;
|
||||
exports.disableVT100LineWrapping = disableVT100LineWrapping;
|
||||
exports.setFont = setFont;
|
||||
exports.setSyncTERMFont = setSyncTERMFont;
|
||||
exports.getSyncTERMFontFromAlias = getSyncTERMFontFromAlias;
|
||||
exports.fromPipeCode = fromPipeCode;
|
||||
|
||||
|
||||
|
@ -82,7 +83,7 @@ var SGRValues = {
|
|||
negative : 7,
|
||||
hidden : 8,
|
||||
|
||||
normal : 22,
|
||||
normal : 22, //
|
||||
steady : 25,
|
||||
positive : 27,
|
||||
|
||||
|
@ -118,6 +119,136 @@ function getBGColorValue(name) {
|
|||
// See http://cvs.synchro.net/cgi-bin/viewcvs.cgi/*checkout*/src/conio/cterm.txt
|
||||
// :TODO: document
|
||||
// :TODO: Create mappings for aliases... maybe make this a map to values instead
|
||||
// :TODO: Break this up in to two parts:
|
||||
// 1) FONT_AND_CODE_PAGES (e.g. SyncTERM/cterm)
|
||||
// 2) SAUCE_FONT_MAP: Sauce name(s) -> items in FONT_AND_CODE_PAGES.
|
||||
// ...we can then have getFontFromSAUCEName(sauceFontName)
|
||||
// Also, create a SAUCE_ENCODING_MAP: SAUCE font name -> encodings
|
||||
|
||||
//
|
||||
// An array of CTerm/SyncTERM font/encoding values. Each entry's index
|
||||
// corresponds to it's escape sequence value (e.g. cp437 = 0)
|
||||
//
|
||||
// See https://github.com/protomouse/synchronet/blob/master/src/conio/cterm.txt
|
||||
//
|
||||
var SYNCTERM_FONT_AND_ENCODING_TABLE = [
|
||||
'cp437',
|
||||
'cp1251',
|
||||
'koi8_r',
|
||||
'iso8859_2',
|
||||
'iso8859_4',
|
||||
'cp866',
|
||||
'iso8859_9',
|
||||
'haik8',
|
||||
'iso8859_8',
|
||||
'koi8_u',
|
||||
'iso8859_15',
|
||||
'iso8859_4',
|
||||
'koi8_r_b',
|
||||
'iso8859_4',
|
||||
'iso8859_5',
|
||||
'ARMSCII_8',
|
||||
'iso8859_15',
|
||||
'cp850',
|
||||
'cp850',
|
||||
'cp885',
|
||||
'cp1251',
|
||||
'iso8859_7',
|
||||
'koi8-r_c',
|
||||
'iso8859_4',
|
||||
'iso8859_1',
|
||||
'cp866',
|
||||
'cp437',
|
||||
'cp866',
|
||||
'cp885',
|
||||
'cp866_u',
|
||||
'iso8859_1',
|
||||
'cp1131',
|
||||
'c64_upper',
|
||||
'c64_lower',
|
||||
'c128_upper',
|
||||
'c128_lower',
|
||||
'atari',
|
||||
'pot_noodle',
|
||||
'mo_soul',
|
||||
'microknight_plus',
|
||||
'topaz_plus',
|
||||
'microknight',
|
||||
'topaz',
|
||||
];
|
||||
|
||||
//
|
||||
// A map of various font name/aliases such as those used
|
||||
// in SAUCE records to SyncTERM/CTerm names
|
||||
//
|
||||
// This table contains lowercased entries with any spaces
|
||||
// replaced with '_' for lookup purposes.
|
||||
//
|
||||
var FONT_ALIAS_TO_SYNCTERM_MAP = {
|
||||
'cp437' : 'cp437',
|
||||
'ibm_vga' : 'cp437',
|
||||
'ibmpc' : 'cp437',
|
||||
'ibm_pc' : 'cp437',
|
||||
'pc' : 'cp437',
|
||||
'cp437_art' : 'cp437',
|
||||
'ibmpcart' : 'cp437',
|
||||
'ibmpc_art' : 'cp437',
|
||||
'ibm_pc_art' : 'cp437',
|
||||
'msdos_art' : 'cp437',
|
||||
'msdosart' : 'cp437',
|
||||
'pc_art' : 'cp437',
|
||||
'pcart' : 'cp437',
|
||||
|
||||
'ibm_vga50' : 'cp437',
|
||||
'ibm_vga25g' : 'cp437',
|
||||
'ibm_ega' : 'cp437',
|
||||
'ibm_ega43' : 'cp437',
|
||||
|
||||
'topaz' : 'topaz',
|
||||
'amiga_topaz_1' : 'topaz',
|
||||
'amiga_topaz_1+' : 'topaz_plus',
|
||||
'topazplus' : 'topaz_plus',
|
||||
'topaz_plus' : 'topaz_plus',
|
||||
'amiga_topaz_2' : 'topaz',
|
||||
'amiga_topaz_2+' : 'topaz_plus',
|
||||
'topaz2plus' : 'topaz_plus',
|
||||
|
||||
'pot_noodle' : 'pot_noodle',
|
||||
'p0tnoodle' : 'pot_noodle',
|
||||
'amiga_p0t-noodle' : 'pot_noodle',
|
||||
|
||||
'mo_soul' : 'mo_soul',
|
||||
'mosoul' : 'mo_soul',
|
||||
'mO\'sOul' : 'mo_soul',
|
||||
|
||||
'amiga_microknight' : 'microknight',
|
||||
'amiga_microknight+' : 'microknight_plus',
|
||||
|
||||
|
||||
'atari' : 'atari',
|
||||
'atarist' : 'atari',
|
||||
|
||||
};
|
||||
|
||||
function setSyncTERMFont(name, fontPage) {
|
||||
var p1 = miscUtil.valueWithDefault(fontPage, 0);
|
||||
|
||||
assert(p1 >= 0 && p1 <= 3);
|
||||
|
||||
var p2 = SYNCTERM_FONT_AND_ENCODING_TABLE[name];
|
||||
if(_.isNumber(p2)) {
|
||||
return ESC_CSI + p1 + ';' + p2 + ' D';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function getSyncTERMFontFromAlias(alias) {
|
||||
return FONT_ALIAS_TO_SYNCTERM_MAP[alias.toLowerCase().replace(/ /g, '_')];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
var FONT_MAP = {
|
||||
// Codepage 437 English
|
||||
'cp437' : 0,
|
||||
|
@ -204,6 +335,7 @@ var FONT_MAP = {
|
|||
'topaz' : 42,
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
// Create methods such as up(), nextLine(),...
|
||||
Object.keys(CONTROL).forEach(function onControlName(name) {
|
||||
|
@ -291,6 +423,7 @@ function disableVT100LineWrapping() {
|
|||
//
|
||||
// See http://cvs.synchro.net/cgi-bin/viewcvs.cgi/*checkout*/src/conio/cterm.txt
|
||||
//
|
||||
/*
|
||||
function setFont(name, fontPage) {
|
||||
name = name.toLowerCase().replace(/ /g, '_'); // conform to map
|
||||
|
||||
|
@ -305,6 +438,7 @@ function setFont(name, fontPage) {
|
|||
|
||||
return '';
|
||||
}
|
||||
*/
|
||||
|
||||
// Also add:
|
||||
// * fromRenegade(): |<0-23>
|
||||
|
|
|
@ -498,12 +498,15 @@ function display(options, cb) {
|
|||
var ansiFont = '';
|
||||
if(options.font) {
|
||||
// :TODO: how to set to ignore SAUCE?
|
||||
ansiFont = ansi.setFont(options.font);
|
||||
ansiFont = ansi.setSyncTERMFont(options.font);
|
||||
} else if(options.sauce) {
|
||||
var fontName = getFontNameFromSAUCE(options.sauce);
|
||||
if(fontName) {
|
||||
fontName = ansi.getSyncTERMFontFromAlias(fontName);
|
||||
}
|
||||
|
||||
if(fontName) {
|
||||
ansiFont = ansi.setFont(fontName);
|
||||
ansiFont = ansi.setSyncTERMFont(fontName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,8 +35,6 @@ function View(options) {
|
|||
this.acceptsFocus = options.acceptsFocus || false;
|
||||
this.acceptsInput = options.acceptsInput || false;
|
||||
|
||||
//this.submit = this.acceptsInput ? options.acceptsInput || false : false;
|
||||
|
||||
this.position = { x : 0, y : 0 };
|
||||
this.dimens = { height : 1, width : 0 };
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ function ViewController(options) {
|
|||
this.views = {}; // map of ID -> view
|
||||
this.formId = options.formId || 0;
|
||||
this.mciViewFactory = new MCIViewFactory(this.client);
|
||||
this.submitKeyMap = {};
|
||||
|
||||
this.clientKeyPressHandler = function(key, isSpecial) {
|
||||
if(isSpecial) {
|
||||
|
@ -46,10 +47,14 @@ function ViewController(options) {
|
|||
|
||||
this.clientSpecialKeyHandler = function(keyName) {
|
||||
|
||||
// :TODO: Handle special key mappings from config, e.g. 'esc'
|
||||
|
||||
if(self.focusedView && self.focusedView.acceptsInput) {
|
||||
self.focusedView.onSpecialKeyPress(keyName);
|
||||
var submitViewId = self.submitKeyMap[keyName];
|
||||
if(submitViewId) {
|
||||
self.switchFocus(submitViewId);
|
||||
self.submitForm();
|
||||
} else {
|
||||
if(self.focusedView && self.focusedView.acceptsInput) {
|
||||
self.focusedView.onSpecialKeyPress(keyName);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -81,7 +86,8 @@ function ViewController(options) {
|
|||
value : {
|
||||
"1" : "hurp",
|
||||
"2" : [ 'a', 'b', ... ],
|
||||
"3 " 2,
|
||||
"3" 2,
|
||||
"pants" : "no way"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -118,6 +124,9 @@ function ViewController(options) {
|
|||
if(safeFormData.value.password) {
|
||||
safeFormData.value.password = '*****';
|
||||
}
|
||||
if(safeFormData.value.passwordConfirm) {
|
||||
safeFormData.value.passwordConfirm = '*****';
|
||||
}
|
||||
return safeFormData;
|
||||
};
|
||||
|
||||
|
@ -153,7 +162,14 @@ function ViewController(options) {
|
|||
};
|
||||
|
||||
this.setViewPropertiesFromMCIConf = function(view, conf) {
|
||||
view.submit = conf.submit || false;
|
||||
if(_.isBoolean(conf.submit)) {
|
||||
view.submit = conf.submit;
|
||||
} else if(_.isArray(conf.submit) && conf.submit.length > 0) {
|
||||
view.submit = true;
|
||||
} else {
|
||||
view.submit = false;
|
||||
}
|
||||
//view.submit = conf.submit || false;
|
||||
|
||||
if(_.isArray(conf.items)) {
|
||||
view.setItems(conf.items);
|
||||
|
@ -190,6 +206,12 @@ function ViewController(options) {
|
|||
|
||||
if(view.submit) {
|
||||
submitId = viewId;
|
||||
|
||||
if(_.isArray(mciConf.submit)) {
|
||||
for(var i = 0; i < mciConf.submit.length; i++) {
|
||||
self.submitKeyMap[mciConf.submit[i]] = viewId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nextItem(null);
|
||||
|
|
|
@ -36,7 +36,7 @@ function validateApplicationData(formData, cb) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(formData.value.password !== formData.value.pwConfirm) {
|
||||
if(formData.value.password !== formData.value.passwordConfirm) {
|
||||
cb('Passwords do not match!', [ 9, 10 ]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
"matrix" : {
|
||||
"art" : "matrix",
|
||||
"form" : {
|
||||
"0" : { // :TODO: Make form "0" the default if missing (e.g. optional)
|
||||
"0" : { // :TODO: Make form "0" the default if missing (e.g. optional)... not sure how with current structure though
|
||||
"VM1" : {
|
||||
"mci" : {
|
||||
"VM1" : {
|
||||
|
@ -99,7 +99,6 @@
|
|||
"form" : {
|
||||
"0" : {
|
||||
"BT12BT13ET1ET10ET2ET3ET4ET5ET6ET7ET8ET9TL11" : {
|
||||
"cancelKeys" : [ "esc" ],
|
||||
"mci" : {
|
||||
"ET1" : {
|
||||
"focus" : true,
|
||||
|
@ -113,20 +112,20 @@
|
|||
"ET7" : { "argName" : "email" },
|
||||
"ET8" : { "argName" : "web" },
|
||||
"ET9" : { "argName" : "password" },
|
||||
"ET10" : { "argName" : "pwConfirm" },
|
||||
"ET10" : { "argName" : "passwordConfirm" },
|
||||
"BT12" : {
|
||||
"submit" : true,
|
||||
"text" : "Apply"
|
||||
},
|
||||
"BT13" : {
|
||||
"submit" : true,
|
||||
"submit" : [ "esc" ],
|
||||
"text" : "Cancel"
|
||||
}
|
||||
},
|
||||
"submit" : {
|
||||
"12" : [ // Apply
|
||||
{
|
||||
"value" : 12,
|
||||
"value" : 12, // :TODO: better, this should be optional; if not present it's a any match
|
||||
"action" : "@method:apply/submitApplication",
|
||||
"extraArgs" : {
|
||||
"inactive" : "userNeedsActivated",
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"userCredentials" : {
|
||||
"art" : "USERCRED",
|
||||
"mci" : {
|
||||
"ET1" : {
|
||||
"argName" : "username"
|
||||
},
|
||||
"ET2" : {
|
||||
"submit" : true,
|
||||
"argName" : "password"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue