Move more functions that are ansi specific to ANSIFrame
This commit is contained in:
parent
17f2265249
commit
d57311e935
@ -6,6 +6,21 @@ var ANSI_FRAME_HEADER =56; /* Size of page owner (length) */
|
|||||||
var ANSI_FRAME_PAGENUM =12; /* Size of page number (length with a-z) */
|
var ANSI_FRAME_PAGENUM =12; /* Size of page number (length with a-z) */
|
||||||
var ANSI_FRAME_COST = 9; /* Size of cost (length without unit) */
|
var ANSI_FRAME_COST = 9; /* Size of cost (length without unit) */
|
||||||
|
|
||||||
|
var ANSI_MSG_SENDORNOT ='\1n\1h\1GKEY 1 TO SEND, 2 NOT TO SEND';
|
||||||
|
var ANSI_MSG_LOGON ='\1n\1h\1GKEY 1 TO LOGON, 2 TO RETURN';
|
||||||
|
var ANSI_MSG_SENT ='\1n\1h\1GMESSAGE SENT - KEY # TO CONTINUE';
|
||||||
|
var ANSI_MSG_NOTSENT ='\1n\1h\1GMESSAGE NOT SENT - KEY # TO CONTINUE';
|
||||||
|
var ANSI_ERR_NO_PARENT ='\1n\1h\1RPARENT FRAME DOESNT EXIST';
|
||||||
|
var ANSI_ERR_NOT_IMPLEMENTED ='\1n\1h\1RNOT IMPLEMENTED YET?';
|
||||||
|
var ANSI_ERR_ROUTE ='\1n\1h\1WMISTAKE? \1GTRY AGAIN OR TELL US ON *08';
|
||||||
|
var ANSI_ERR_METHOD_NOT_EXIST ='\1n\1h\1WMISTAKE? \1GTRY AGAIN OR TELL US ON *08';
|
||||||
|
var ANSI_ACCESS_DENIED ='\1n\1h\1RACCESS DENIED. \1RMISTAKE? TRY AGAIN OR TELL US *08';
|
||||||
|
var ANSI_ALREADY_MEMBER ='\1n\1h\1RALREADY MEMBER OF CUG'
|
||||||
|
var ANSI_INACTIVITY ='\1n\1h\1RINACTIVITY ALERT, DISCONNECT PENDING...';
|
||||||
|
var ANSI_INACTIVE ='\1n\1h\1RINACTIVITY DISCONNECT';
|
||||||
|
var ANSI_NOACTION ='\1n\1h\1RNO ACTION PERFORMED';
|
||||||
|
var ANSI_BASESTAR ='\1N\1G\1H*';
|
||||||
|
|
||||||
// Our frame object
|
// Our frame object
|
||||||
function ANSIFrame() {
|
function ANSIFrame() {
|
||||||
this.version=1; // The version of this frame - in case we update functionality and we need to be
|
this.version=1; // The version of this frame - in case we update functionality and we need to be
|
||||||
@ -34,17 +49,31 @@ function ANSIFrame() {
|
|||||||
this.type = FRAME_TYPE_INFO; // The frame type - see FRAME_TYPES above
|
this.type = FRAME_TYPE_INFO; // The frame type - see FRAME_TYPES above
|
||||||
this.key=[ null,null,null,null,null,null,null,null,null,null ]; // Key actions [0-9]
|
this.key=[ null,null,null,null,null,null,null,null,null,null ]; // Key actions [0-9]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn off the cursor
|
||||||
|
*/
|
||||||
|
this.cursorOff=function() {
|
||||||
|
ansi.send('ext_mode','clear','cursor');
|
||||||
|
console.gotoxy(0,24);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cursorOn=function(x,y) {
|
||||||
|
ansi.send('ext_mode','set','cursor');
|
||||||
|
console.gotoxy(x,y);
|
||||||
|
}
|
||||||
|
|
||||||
// Render the frame to the user
|
// Render the frame to the user
|
||||||
this.render=function(withHeader) {
|
this.render=function(withHeader) {
|
||||||
|
log(LOG_DEBUG,'- ANSI FRAME');
|
||||||
owner = base64_decode(this.owner);
|
owner = base64_decode(this.owner);
|
||||||
|
|
||||||
header = '\n\r';
|
header = '\n\r';
|
||||||
|
|
||||||
log(LOG_DEBUG,'- FRAME User: ['+JSON.stringify(user)+']');
|
log(LOG_DEBUG,' - FRAME User: ['+JSON.stringify(user)+']');
|
||||||
|
|
||||||
// Dont show the page number on system login page
|
// Dont show the page number on system login page
|
||||||
if (user.number || (this.type != FRAME_TYPE_LOGIN && NO_HISTORY_FRAMES.indexOf(this.page) == -1)) {
|
if (user.number || (this.type != FRAME_TYPE_LOGIN && NO_HISTORY_FRAMES.indexOf(this.page) == -1)) {
|
||||||
log(LOG_DEBUG,'- Owner: ['+this.pageowner+']');
|
log(LOG_DEBUG,' - Owner: ['+this.pageowner+']');
|
||||||
|
|
||||||
cost = (this.isAccessible ? this.cost+FRAME_COSTUNIT : ' -')
|
cost = (this.isAccessible ? this.cost+FRAME_COSTUNIT : ' -')
|
||||||
|
|
||||||
@ -54,10 +83,12 @@ function ANSIFrame() {
|
|||||||
(console.screen_columns > 80 ? '\n\r' : '');
|
(console.screen_columns > 80 ? '\n\r' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.clear();
|
||||||
|
|
||||||
if ((this.type == FRAME_TYPE_LOGIN) || (this.type == FRAME_TYPE_RESPONSE)) {
|
if ((this.type == FRAME_TYPE_LOGIN) || (this.type == FRAME_TYPE_RESPONSE)) {
|
||||||
return header+this.parse(base64_decode(this.content));
|
return console.putmsg(header+this.parse(base64_decode(this.content)));
|
||||||
} else {
|
} else {
|
||||||
return header+base64_decode(this.content);
|
return console.putmsg(header+base64_decode(this.content));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -75,7 +106,7 @@ function ANSIFrame() {
|
|||||||
|
|
||||||
// Load a frame from disk (.tex file)
|
// Load a frame from disk (.tex file)
|
||||||
this.load = function(filename) {
|
this.load = function(filename) {
|
||||||
log(LOG_DEBUG,'Loading frame from: '+filename);
|
log(LOG_DEBUG,'Loading ANSI frame from: '+filename);
|
||||||
|
|
||||||
f = new File(system.mods_dir+'ansitex/text/'+filename+'.tex');
|
f = new File(system.mods_dir+'ansitex/text/'+filename+'.tex');
|
||||||
if (! f.exists || ! f.open('r')) {
|
if (! f.exists || ! f.open('r')) {
|
||||||
@ -349,6 +380,35 @@ function ANSIFrame() {
|
|||||||
log(LOG_DEBUG,'Saved file: '+this.page+'.tex');
|
log(LOG_DEBUG,'Saved file: '+this.page+'.tex');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a message to the baseline.
|
||||||
|
*
|
||||||
|
* @param text
|
||||||
|
* @param reposition
|
||||||
|
*/
|
||||||
|
this.sendBaseline=function(text,reposition) {
|
||||||
|
eval('var msg = ANSI_'+text+';');
|
||||||
|
console.pushxy();
|
||||||
|
console.gotoxy(0,24);
|
||||||
|
console.print(msg);
|
||||||
|
console.cleartoeol();
|
||||||
|
|
||||||
|
if (! reposition) {
|
||||||
|
console.popxy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.clearBaseline=function(reposition) {
|
||||||
|
console.pushxy();
|
||||||
|
console.gotoxy(0,24);
|
||||||
|
console.print('');
|
||||||
|
console.cleartoeol();
|
||||||
|
|
||||||
|
if (! reposition) {
|
||||||
|
console.popxy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Object.defineProperty(this,'accessible',{
|
Object.defineProperty(this,'accessible',{
|
||||||
get: function() {
|
get: function() {
|
||||||
log(LOG_DEBUG,'- Checking if user can access frame: '+this.page);
|
log(LOG_DEBUG,'- Checking if user can access frame: '+this.page);
|
||||||
|
13
load/defs.js
13
load/defs.js
@ -29,19 +29,6 @@ var FRAME_TYPE_RESPONSE ='r'; // Response frame, input fields are embedded in t
|
|||||||
// response will be submitted to the Service Provider, or to a method
|
// response will be submitted to the Service Provider, or to a method
|
||||||
var FRAME_TYPE_LOGIN ='l'; // Login frame, enables the user to authenticate to the system, or to a CUG
|
var FRAME_TYPE_LOGIN ='l'; // Login frame, enables the user to authenticate to the system, or to a CUG
|
||||||
|
|
||||||
var MSG_SENDORNOT ='\1n\1h\1GKEY 1 TO SEND, 2 NOT TO SEND';
|
|
||||||
var MSG_LOGON ='\1n\1h\1GKEY 1 TO LOGON, 2 TO RETURN';
|
|
||||||
var MSG_SENT ='\1n\1h\1GMESSAGE SENT - KEY # TO CONTINUE';
|
|
||||||
var MSG_NOTSENT ='\1n\1h\1GMESSAGE NOT SENT - KEY # TO CONTINUE';
|
|
||||||
var ERR_NO_PARENT ='\1n\1h\1RPARENT FRAME DOESNT EXIST';
|
|
||||||
var ERR_NOT_IMPLEMENTED ='\1n\1h\1RNOT IMPLEMENTED YET?';
|
|
||||||
var ERR_ROUTE ='\1n\1h\1WMISTAKE? \1GTRY AGAIN OR TELL US ON *08';
|
|
||||||
var ERR_METHOD_NOT_EXIST ='\1n\1h\1WMISTAKE? \1GTRY AGAIN OR TELL US ON *08';
|
|
||||||
var ACCESS_DENIED ='\1n\1h\1RACCESS DENIED. \1RMISTAKE? TRY AGAIN OR TELL US *08';
|
|
||||||
var ALREADY_MEMBER ='\1n\1h\1RALREADY MEMBER OF CUG'
|
|
||||||
var INACTIVITY ='\1n\1h\1RINACTIVITY ALERT, DISCONNECT PENDING...';
|
|
||||||
var INACTIVE ='\1n\1h\1RINACTIVITY DISCONNECT';
|
|
||||||
|
|
||||||
var NO_HISTORY_FRAMES =['980a','98b','981a'];
|
var NO_HISTORY_FRAMES =['980a','98b','981a'];
|
||||||
var SYSTEM_OWNER =9;
|
var SYSTEM_OWNER =9;
|
||||||
var INKEY_TIMEOUT =10000;
|
var INKEY_TIMEOUT =10000;
|
||||||
|
@ -44,14 +44,6 @@ if (!String.prototype.repeat) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Turn off the cursor
|
|
||||||
*/
|
|
||||||
function cursorOff() {
|
|
||||||
ansi.send('ext_mode','clear','cursor');
|
|
||||||
console.gotoxy(0,24);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a message base by code
|
* Find a message base by code
|
||||||
*
|
*
|
||||||
@ -102,14 +94,14 @@ function getPageOwners() {
|
|||||||
if (f.open("r")) {
|
if (f.open("r")) {
|
||||||
var logo = f.iniGetValue('prefix','logo');
|
var logo = f.iniGetValue('prefix','logo');
|
||||||
var users = f.iniGetValue('prefix','user');
|
var users = f.iniGetValue('prefix','user');
|
||||||
log(LOG_DEBUG,'+ pageOwner: users='+JSON.stringify(users));
|
//log(LOG_DEBUG,'+ pageOwner: users='+JSON.stringify(users));
|
||||||
pageowners.push({prefix: 0,logo: logo,user:users});
|
pageowners.push({prefix: 0,logo: logo,user:users});
|
||||||
|
|
||||||
f.iniGetSections('prefix:').forEach(function (prefix) {
|
f.iniGetSections('prefix:').forEach(function (prefix) {
|
||||||
var p = parseInt(prefix.substr(7));
|
var p = parseInt(prefix.substr(7));
|
||||||
var logo = f.iniGetValue(prefix,'logo','');
|
var logo = f.iniGetValue(prefix,'logo','');
|
||||||
var users = f.iniGetValue(prefix,'user','');
|
var users = f.iniGetValue(prefix,'user','');
|
||||||
log(LOG_DEBUG,'+ pageOwner: users='+JSON.stringify(users));
|
//log(LOG_DEBUG,'+ pageOwner: users='+JSON.stringify(users));
|
||||||
pageowners.push({prefix: p,logo: logo,user: users});
|
pageowners.push({prefix: p,logo: logo,user: users});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -119,7 +111,7 @@ function getPageOwners() {
|
|||||||
// Sort the pageowners ascending
|
// Sort the pageowners ascending
|
||||||
pageowners.sort(compare);
|
pageowners.sort(compare);
|
||||||
|
|
||||||
log(LOG_DEBUG,'+ pageOwner: pageowners='+JSON.stringify(pageowners));
|
//log(LOG_DEBUG,'+ pageOwner: pageowners='+JSON.stringify(pageowners));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pageowners;
|
return pageowners;
|
||||||
@ -193,7 +185,7 @@ function pageOwner(page) {
|
|||||||
if (e !== BreakException) throw e;
|
if (e !== BreakException) throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
log(LOG_DEBUG,'+ pageOwner: page='+page+', owner: '+JSON.stringify(o));
|
//log(LOG_DEBUG,'+ pageOwner: page='+page+', owner: '+JSON.stringify(o));
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,21 +228,4 @@ function compare(a,b) {
|
|||||||
return (a.prefix < b.prefix) ? 1 : ((b.prefix < a.prefix) ? -1 : 0);
|
return (a.prefix < b.prefix) ? 1 : ((b.prefix < a.prefix) ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a message to the baseline.
|
|
||||||
*
|
|
||||||
* @param text
|
|
||||||
* @param reposition
|
|
||||||
*/
|
|
||||||
function sendBaseline(text,reposition) {
|
|
||||||
console.pushxy();
|
|
||||||
console.gotoxy(0,24);
|
|
||||||
console.print(text);
|
|
||||||
console.cleartoeol();
|
|
||||||
|
|
||||||
if (! reposition) {
|
|
||||||
console.popxy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this;
|
this;
|
139
main.js
139
main.js
@ -42,10 +42,8 @@ while(bbs.online) {
|
|||||||
var control = []; // Methods that need to process input
|
var control = []; // Methods that need to process input
|
||||||
var extendedkey = ''; // Current Extended Key being captured
|
var extendedkey = ''; // Current Extended Key being captured
|
||||||
|
|
||||||
ansi.send('ext_mode','clear','cursor');
|
|
||||||
|
|
||||||
while (action != ACTION_TERMINATE && action !=ACTION_EXIT) {
|
while (action != ACTION_TERMINATE && action !=ACTION_EXIT) {
|
||||||
bbs.nodesync(false); // @todo Stop the display of telegrams
|
bbs.nodesync(); // @todo Stop the display of telegrams
|
||||||
var read = '';
|
var read = '';
|
||||||
var esc = false;
|
var esc = false;
|
||||||
|
|
||||||
@ -95,12 +93,12 @@ while(bbs.online) {
|
|||||||
|
|
||||||
if (read === '' && ! (user.security.exemptions&UFLAG_H) ) {
|
if (read === '' && ! (user.security.exemptions&UFLAG_H) ) {
|
||||||
if (time() > timer+((user.number ? INACTIVE_LOGIN : INACTIVE_NOLOGIN)+INKEY_TIMEOUT)/1000) {
|
if (time() > timer+((user.number ? INACTIVE_LOGIN : INACTIVE_NOLOGIN)+INKEY_TIMEOUT)/1000) {
|
||||||
sendBaseline(INACTIVE,false);
|
fo.sendBaseline('INACTIVE',false);
|
||||||
bbs.hangup();
|
bbs.hangup();
|
||||||
|
|
||||||
} else if (time() > timer+(user.number ? INACTIVE_LOGIN : INACTIVE_NOLOGIN)/1000) {
|
} else if (time() > timer+(user.number ? INACTIVE_LOGIN : INACTIVE_NOLOGIN)/1000) {
|
||||||
timeout = true;
|
timeout = true;
|
||||||
sendBaseline(INACTIVITY,false);
|
fo.sendBaseline('INACTIVITY',false);
|
||||||
|
|
||||||
if (cf)
|
if (cf)
|
||||||
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
||||||
@ -108,7 +106,7 @@ while(bbs.online) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
sendBaseline('',false);
|
fo.clearBaseline(false);
|
||||||
|
|
||||||
if (cf)
|
if (cf)
|
||||||
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
||||||
@ -176,7 +174,7 @@ while(bbs.online) {
|
|||||||
log(LOG_DEBUG,'- false: Key ['+read+'] ['+pageStr(next_page)+']');
|
log(LOG_DEBUG,'- false: Key ['+read+'] ['+pageStr(next_page)+']');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sendBaseline(ERR_ROUTE,false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -188,7 +186,7 @@ while(bbs.online) {
|
|||||||
action = ACTION_GOTO;
|
action = ACTION_GOTO;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sendBaseline(ERR_ROUTE,false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -212,14 +210,14 @@ while(bbs.online) {
|
|||||||
if (cmd == '00') {
|
if (cmd == '00') {
|
||||||
action = ACTION_RELOAD;
|
action = ACTION_RELOAD;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalid system pages.
|
// Invalid system pages.
|
||||||
if (cmd.match(/^0[2367]/)) {
|
if (cmd.match(/^0[2367]/)) {
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
sendBaseline(ERR_ROUTE, false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
}
|
}
|
||||||
@ -230,13 +228,13 @@ while(bbs.online) {
|
|||||||
|
|
||||||
// If we are not a user
|
// If we are not a user
|
||||||
if (! user.number) {
|
if (! user.number) {
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
sendBaseline(ERR_ROUTE,false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
action = false;
|
action = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fe = { frame: page, index: read };
|
fe = { frame: page, index: read };
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
action = ACTION_EDIT;
|
action = ACTION_EDIT;
|
||||||
|
|
||||||
log(LOG_DEBUG,'- MODE_BL: EDIT ['+JSON.stringify(fe)+']');
|
log(LOG_DEBUG,'- MODE_BL: EDIT ['+JSON.stringify(fe)+']');
|
||||||
@ -251,15 +249,15 @@ while(bbs.online) {
|
|||||||
// Bookmark frame
|
// Bookmark frame
|
||||||
if (cmd == '05') {
|
if (cmd == '05') {
|
||||||
if (! user.number) {
|
if (! user.number) {
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
sendBaseline(ERR_ROUTE, false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// @todo
|
// @todo
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
sendBaseline(ERR_NOT_IMPLEMENTED,false);
|
fo.sendBaseline('ERR_NOT_IMPLEMENTED',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
}
|
}
|
||||||
@ -270,15 +268,15 @@ while(bbs.online) {
|
|||||||
// Report Problem
|
// Report Problem
|
||||||
if (cmd == '08') {
|
if (cmd == '08') {
|
||||||
if (! user.number) {
|
if (! user.number) {
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
sendBaseline(ERR_ROUTE, false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// @todo
|
// @todo
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
sendBaseline(ERR_NOT_IMPLEMENTED,false);
|
fo.sendBaseline('ERR_NOT_IMPLEMENTED',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
}
|
}
|
||||||
@ -288,7 +286,7 @@ while(bbs.online) {
|
|||||||
|
|
||||||
// Reload frame
|
// Reload frame
|
||||||
if (cmd == '09') {
|
if (cmd == '09') {
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
action = ACTION_GOTO;
|
action = ACTION_GOTO;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
next_page = { frame: fo.frame, index: fo.index};
|
next_page = { frame: fo.frame, index: fo.index};
|
||||||
@ -298,8 +296,8 @@ while(bbs.online) {
|
|||||||
|
|
||||||
// Another star aborts the command
|
// Another star aborts the command
|
||||||
if (read == '*') {
|
if (read == '*') {
|
||||||
sendBaseline('',false);
|
fo.clearBaseline(false);
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
cmd = '';
|
cmd = '';
|
||||||
|
|
||||||
@ -312,8 +310,7 @@ while(bbs.online) {
|
|||||||
console.gotoxy(cf.c,cf.r);
|
console.gotoxy(cf.c,cf.r);
|
||||||
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
||||||
console.write(cf.fchar.repeat(cf.fvalue.length));
|
console.write(cf.fchar.repeat(cf.fvalue.length));
|
||||||
console.gotoxy(cf.c,cf.r);
|
fo.cursorOn(cf.c,cf.r);
|
||||||
ansi.send('ext_mode','set','cursor');
|
|
||||||
cf.fvalue = '';
|
cf.fvalue = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,7 +319,7 @@ while(bbs.online) {
|
|||||||
// Nothing typed between * and #
|
// Nothing typed between * and #
|
||||||
// *# means go back
|
// *# means go back
|
||||||
if (cmd == '') {
|
if (cmd == '') {
|
||||||
sendBaseline('',false);
|
fo.clearBaseline(false);
|
||||||
action = ACTION_BACKUP;
|
action = ACTION_BACKUP;
|
||||||
|
|
||||||
} else if (cmd == '0') {
|
} else if (cmd == '0') {
|
||||||
@ -333,7 +330,7 @@ while(bbs.online) {
|
|||||||
} else if (cmd == '04') {
|
} else if (cmd == '04') {
|
||||||
// If we are not a user
|
// If we are not a user
|
||||||
if (! user.number) {
|
if (! user.number) {
|
||||||
sendBaseline(ERR_ROUTE,false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
action = false;
|
action = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -346,7 +343,7 @@ while(bbs.online) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear the command we are finished processing...
|
// Clear the command we are finished processing...
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
cmd = '';
|
cmd = '';
|
||||||
mode = false;
|
mode = false;
|
||||||
}
|
}
|
||||||
@ -513,7 +510,7 @@ while(bbs.online) {
|
|||||||
control[control.length-1].process();
|
control[control.length-1].process();
|
||||||
|
|
||||||
} else if (fo.key[1] == '*' || fo.key[1].match(/[0-9]/)) {
|
} else if (fo.key[1] == '*' || fo.key[1].match(/[0-9]/)) {
|
||||||
sendBaseline('\1n\1h\1RNO ACTION PERFORMED',false);
|
fo.sendBaseline('NOACTION',false);
|
||||||
mode = MODE_RFSENT;
|
mode = MODE_RFSENT;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -554,7 +551,7 @@ while(bbs.online) {
|
|||||||
$next_page = $ao->page;
|
$next_page = $ao->page;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sendBaseline(ERR_METHOD_NOT_EXIST,false);
|
fo.sendBaseline('ERR_METHOD_NOT_EXIST',false);
|
||||||
|
|
||||||
mode = MODE_RFSENT;
|
mode = MODE_RFSENT;
|
||||||
}
|
}
|
||||||
@ -572,7 +569,7 @@ while(bbs.online) {
|
|||||||
mode = false;
|
mode = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sendBaseline(MSG_NOTSENT,false);
|
fo.sendBaseline('MSG_NOTSENT',false);
|
||||||
mode = MODE_RFNOTSENT;
|
mode = MODE_RFNOTSENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +604,7 @@ while(bbs.online) {
|
|||||||
|
|
||||||
// Response form after Sent processing
|
// Response form after Sent processing
|
||||||
case MODE_RFSENT:
|
case MODE_RFSENT:
|
||||||
ansi.send('ext_mode','clear','cursor');
|
fo.cursorOff();
|
||||||
|
|
||||||
switch (read) {
|
switch (read) {
|
||||||
case '*':
|
case '*':
|
||||||
@ -643,7 +640,7 @@ while(bbs.online) {
|
|||||||
|
|
||||||
// Response form ERROR
|
// Response form ERROR
|
||||||
case MODE_RFERROR:
|
case MODE_RFERROR:
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
|
|
||||||
if (read == '#') {
|
if (read == '#') {
|
||||||
/*
|
/*
|
||||||
@ -688,8 +685,8 @@ while(bbs.online) {
|
|||||||
|
|
||||||
// @todo If something on the baseline preserve it
|
// @todo If something on the baseline preserve it
|
||||||
|
|
||||||
ansi.send('ext_mode','set','cursor');
|
fo.cursorOn(0,24);
|
||||||
sendBaseline('\1N\1G\1H*',true);
|
fo.sendBaseline('BASESTAR',true);
|
||||||
action = false;
|
action = false;
|
||||||
mode = MODE_BL;
|
mode = MODE_BL;
|
||||||
|
|
||||||
@ -701,38 +698,20 @@ while(bbs.online) {
|
|||||||
// Submitting forms
|
// Submitting forms
|
||||||
case ACTION_SUBMITRF:
|
case ACTION_SUBMITRF:
|
||||||
action = false;
|
action = false;
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
log(LOG_DEBUG,'- ACTION_SUBMITRF: ['+fo.type+']');
|
log(LOG_DEBUG,'- ACTION_SUBMITRF: ['+fo.type+']');
|
||||||
sendBaseline((fo.type == 'l' ? MSG_LOGON : MSG_SENDORNOT),true);
|
fo.sendBaseline((fo.type == 'l' ? 'MSG_LOGON' : 'MSG_SENDORNOT'),true);
|
||||||
mode = MODE_SUBMITRF;
|
mode = MODE_SUBMITRF;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// GO Backwards
|
|
||||||
case ACTION_BACKUP:
|
|
||||||
// Do we have anywhere to go, drop the current page from the history.
|
|
||||||
if (history.length > 1)
|
|
||||||
history.pop();
|
|
||||||
|
|
||||||
// @todo If in control...
|
|
||||||
|
|
||||||
next_page = (history.length > 0) ? history[history.length-1] : null;
|
|
||||||
|
|
||||||
log(LOG_DEBUG,'- ACTION_BACKUP: Backing up to ['+(next_page ? pageStr(next_page) : '')+'] current ['+fo.page+']');
|
|
||||||
|
|
||||||
// If there is no next page, we'll ignore the request.
|
|
||||||
if (! next_page || (pageStr(next_page) == fo.page)) {
|
|
||||||
action = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Edit a frame
|
// Edit a frame
|
||||||
case ACTION_EDIT:
|
case ACTION_EDIT:
|
||||||
log(LOG_DEBUG,'- ACTION_EDIT: ['+JSON.stringify(fe)+']');
|
log(LOG_DEBUG,'- ACTION_EDIT: ['+JSON.stringify(fe)+']');
|
||||||
|
|
||||||
if (! pageEditor(fe ? fe.frame : fo.frame)) {
|
if (! pageEditor(fe ? fe.frame : fo.frame)) {
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
sendBaseline(ACCESS_DENIED,false);
|
fo.sendBaseline('ACCESS_DENIED',false);
|
||||||
action = false;
|
action = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -758,7 +737,7 @@ while(bbs.online) {
|
|||||||
if (fo.page == null) {
|
if (fo.page == null) {
|
||||||
fo = current;
|
fo = current;
|
||||||
// sendbaseline ERR_PAGE
|
// sendbaseline ERR_PAGE
|
||||||
sendBaseline(ERR_NO_PARENT,false);
|
fo.sendBaseline('ERR_NO_PARENT',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -780,6 +759,24 @@ while(bbs.online) {
|
|||||||
action = false;
|
action = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// GO Backwards
|
||||||
|
case ACTION_BACKUP:
|
||||||
|
// Do we have anywhere to go, drop the current page from the history.
|
||||||
|
if (history.length > 1)
|
||||||
|
history.pop();
|
||||||
|
|
||||||
|
// @todo If in control...
|
||||||
|
|
||||||
|
next_page = (history.length > 0) ? history[history.length-1] : null;
|
||||||
|
|
||||||
|
log(LOG_DEBUG,'- ACTION_BACKUP: Backing up to ['+(next_page ? pageStr(next_page) : '')+'] current ['+fo.page+']');
|
||||||
|
|
||||||
|
// If there is no next page, we'll ignore the request.
|
||||||
|
if (! next_page || (pageStr(next_page) == fo.page)) {
|
||||||
|
action = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Goto specific page
|
// Goto specific page
|
||||||
case ACTION_GOTO:
|
case ACTION_GOTO:
|
||||||
log(LOG_DEBUG,'- ACTION_GOTO: ['+(next_page ? pageStr(next_page) : '')+']');
|
log(LOG_DEBUG,'- ACTION_GOTO: ['+(next_page ? pageStr(next_page) : '')+']');
|
||||||
@ -792,7 +789,7 @@ while(bbs.online) {
|
|||||||
if (fo.page == null) {
|
if (fo.page == null) {
|
||||||
fo = current;
|
fo = current;
|
||||||
// sendbaseline ERR_PAGE
|
// sendbaseline ERR_PAGE
|
||||||
sendBaseline(ERR_ROUTE,false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -801,14 +798,14 @@ while(bbs.online) {
|
|||||||
// If the user has access to the frame
|
// If the user has access to the frame
|
||||||
if (fo.accessible) {
|
if (fo.accessible) {
|
||||||
if (fo.isMember && fo.type == FRAME_TYPE_LOGIN) {
|
if (fo.isMember && fo.type == FRAME_TYPE_LOGIN) {
|
||||||
sendBaseline(ALREADY_MEMBER,false);
|
fo.sendBaseline(ALREADY_MEMBER,false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the frame exists, and the user is the Service Provider
|
// Check if the frame exists, and the user is the Service Provider
|
||||||
} else {
|
} else {
|
||||||
sendBaseline(ACCESS_DENIED,false);
|
fo.sendBaseline('ACCESS_DENIED',false);
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
// Reset the current frame to what it was.
|
// Reset the current frame to what it was.
|
||||||
fo = current;
|
fo = current;
|
||||||
@ -837,7 +834,8 @@ while(bbs.online) {
|
|||||||
// $this->sendBaseline($client,'');
|
// $this->sendBaseline($client,'');
|
||||||
// $current['baseline'] = '';
|
// $current['baseline'] = '';
|
||||||
console.line_counter=0; // @todo fix to suppress a pause that is occurring before clear()
|
console.line_counter=0; // @todo fix to suppress a pause that is occurring before clear()
|
||||||
console.clear();
|
fo.cursorOff();
|
||||||
|
|
||||||
// Clear any controls
|
// Clear any controls
|
||||||
control = [];
|
control = [];
|
||||||
bbs.replace_text(NodeActionMain,'\1h%s \1nViewing \1h*'+fo.frame+'#\1n ['+fo.index+']');
|
bbs.replace_text(NodeActionMain,'\1h%s \1nViewing \1h*'+fo.frame+'#\1n ['+fo.index+']');
|
||||||
@ -847,7 +845,7 @@ while(bbs.online) {
|
|||||||
switch(fo.type) {
|
switch(fo.type) {
|
||||||
// Terminate frame
|
// Terminate frame
|
||||||
case FRAME_TYPE_TERMINATE:
|
case FRAME_TYPE_TERMINATE:
|
||||||
console.putmsg(fo.render());
|
fo.render();
|
||||||
mode = false;
|
mode = false;
|
||||||
action = ACTION_TERMINATE;
|
action = ACTION_TERMINATE;
|
||||||
|
|
||||||
@ -877,7 +875,7 @@ while(bbs.online) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
console.putmsg(JSON.stringify(content));
|
console.putmsg(JSON.stringify(content));
|
||||||
sendBaseline(ERR_ROUTE,false);
|
fo.sendBaseline('ERR_ROUTE',false);
|
||||||
action = false;
|
action = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -892,7 +890,7 @@ while(bbs.online) {
|
|||||||
//log(LOG_DEBUG,'FRAME_TYPE_RESPONSE :'+fo.page+', FIELDS: '+fo.frame_fields.count);
|
//log(LOG_DEBUG,'FRAME_TYPE_RESPONSE :'+fo.page+', FIELDS: '+fo.frame_fields.count);
|
||||||
fn = 0;
|
fn = 0;
|
||||||
cf = null;
|
cf = null;
|
||||||
console.putmsg(fo.render());
|
fo.render();
|
||||||
|
|
||||||
if (fo.frame_fields.length) {
|
if (fo.frame_fields.length) {
|
||||||
cf = fo.frame_fields[fn];
|
cf = fo.frame_fields[fn];
|
||||||
@ -900,14 +898,13 @@ while(bbs.online) {
|
|||||||
|
|
||||||
if (cf) {
|
if (cf) {
|
||||||
mode = MODE_FIELD;
|
mode = MODE_FIELD;
|
||||||
ansi.send('ext_mode','set','cursor');
|
fo.cursorOn(cf.c,cf.r);
|
||||||
console.gotoxy(cf.c,cf.r);
|
|
||||||
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
console.write(KEY_ESC+'['+cf.attribute.i+';'+cf.attribute.f+';'+cf.attribute.b+'m');
|
||||||
|
|
||||||
// There were no editable fields.
|
// There were no editable fields.
|
||||||
} else {
|
} else {
|
||||||
mode = MODE_COMPLETE;
|
mode = MODE_COMPLETE;
|
||||||
cursorOff();
|
fo.cursorOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -927,7 +924,7 @@ while(bbs.online) {
|
|||||||
// Standard Frame
|
// Standard Frame
|
||||||
case FRAME_TYPE_INFO:
|
case FRAME_TYPE_INFO:
|
||||||
default:
|
default:
|
||||||
console.putmsg(fo.render());
|
fo.render();
|
||||||
mode = action = false;
|
mode = action = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user