Fixes for viewdata input redisplay and bottom line clearing, viewdata input_fields and dynamic_fields added *98#

This commit is contained in:
Deon George 2024-12-08 18:00:24 +11:00
parent e72ffdc8a4
commit d3c8b4c429
10 changed files with 75 additions and 23 deletions

View File

@ -2,16 +2,16 @@
Installation nodes.
1. For a new installation - make sure you have logged in first and created your sysop user.
- No to creating guest account
- No to creating guest account (or set it to a password so it isnt used - it asks questions during login about terminal configuration)
2. Setup files
- Replace answer.msg in text/ (or make a zero byte file)
- in mods/ ln -sf ansitex/main.js login.js
- in mods/ ln -sf ansitex/logon.js
- in mods/ ln -sf ansitex/main.js ansitex.js
- in mods/ baja ansitex/ansitex.src && mv ansitex/ansitex.bin .
- in mods/ baja ansitex/ansitex.src && mv ansitex/ansitex.bin . (NOT REQUIRED FROM 3.20a)
3 - Create Shell: SCFG->Command Shells->Ansitex (optionally limit to FLAGS, but requires (requirement string) ANSI)
- logon.js will force users to ansitex shell - to make a ini config setting for this
- Optionally System -> New User Values -> Shells ->Ansitex
- Optionally Edit users and change their shell.
- Optionally System -> New User Values -> Shells ->Ansitex (NOT REQUIRED with login.js in place)
- Optionally Edit users and change their shell. (NOT REQUIRED with logon.js in place)
4 - Turn off sysop password required for sysop login
- SCFG -> Toggle Options -> Require Sys Pass During Login -> No

View File

@ -424,15 +424,18 @@ function MsgArea() {
try {
if (msgbase.open()) {
var raw = msgbase.get_msg_body(false,id,false,false,true,true);
//log(LOG_DEBUG,'RAW:'+JSON.stringify(raw));
// Our messages are terminated with \r=== EOF
// Our messages are terminated with FRAMES_EOF_MARKER
var regex = new RegExp('^(.*)'+FRAMES_EOF_MARKER);
//log(LOG_DEBUG,'MARKER:'+regex.test(raw));
if (! regex.test(raw))
return undefined;
var regex = new RegExp(FRAMES_EOF_MARKER+'[.\\s\\S]*$');
var content = JSON.parse(LZString.decompressFromBase64(raw.replace(regex,'')));
//log(LOG_DEBUG,'CONTENT:'+JSON.stringify(content));
msgbase.close();
} else {

View File

@ -492,15 +492,18 @@ function Page(debug) {
// Insert our *_field data (if it is set)
function insert_fields(fields,build) {
for (var i in fields) {
// writeln('- adding:'+fields[i].name+', with value:'+fields[i].value);
//log(LOG_DEBUG,'|-- Adding:'+fields[i].name+', with value:'+fields[i].value);
var content = fields[i].value.split('');
for (var x=fields[i].x;x<fields[i].x+Math.abs(fields[i].length);x++) {
var index = x-fields[i].x;
//log(LOG_DEBUG,'|-- i:'+i+', x:'+x+', y:'+fields[i].y);
if (content[index])
build[fields[i].y][x].ch = fields[i].type !== FIELD_PASSWORD ? content[index] : FIELD_PASSWORD_MASK;
build[fields[i].y][x].ch = ((fields[i].type !== FIELD_PASSWORD) ? content[index] : FIELD_PASSWORD_MASK);
else
build[fields[i].y][x].ch = (fields[i].pad ? fields[i].pad : '.');
}
}
}
@ -1241,15 +1244,27 @@ function Page(debug) {
break;
case 2:
log(LOG_DEBUG,'|-- Type: '+SESSION_EXT);
if ((SESSION_EXT === 'vtx') && contents.dynamic_fields) {
log(LOG_DEBUG,'|--- Dynamic Fields: '+contents.dynamic_fields.length);
this.dynamic_fields = contents.dynamic_fields;
}
var page = rawtoattrs(contents.content,this.width,this.__window__.body.y,this.__window__.body.x);
this.__window__.body.__properties__.content = page.content;
this.dynamic_fields = page.dynamic_fields;
if ((SESSION_EXT === 'vtx') && contents.input_fields) {
log(LOG_DEBUG, '|--- Input Fields: ' + contents.input_fields.length);
this.input_fields = contents.input_fields;
// Our fields are sorted in x descending order
if (page.input_fields.length)
} else if (page.input_fields.length)
this.input_fields = page.input_fields.sort(function(a,b) { return a.x < b.x ? 1 : -1; });
if ((SESSION_EXT === 'tex') && page.dynamic_fields)
this.dynamic_fields = page.dynamic_fields;
// Work out frame type
this.attrs = contents.attrs;
this.cost = contents.cost;

View File

@ -297,8 +297,8 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) {
// @todo remove the trailing ESC \ to end the field, just use a control code ^B \x02 (Start of Text) and ^C \x03
var m = line.match(/^\x1b_(([A-Z]+;[0-9a-z]+)([;]?.+)?)\x1b\\/);
if (m !== null) {
log(LOG_DEBUG,'Got input field: '+JSON.stringify(m));
log(LOG_DEBUG,'ansi:'+JSON.stringify(ansi));
log(LOG_DEBUG,'|-- Got input field: '+JSON.stringify(m));
//log(LOG_DEBUG,'|-- + ansi:'+JSON.stringify(ansi));
// full string that matched
match = m.shift();
@ -356,7 +356,7 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) {
value: '',
});
log(LOG_DEBUG,'input_field:'+JSON.stringify(frame.input_fields.last));
log(LOG_DEBUG,'|-- * IF found at ['+x+'x'+y+'], Type: '+fieldtype+', Name: '+field+', Char: '+fieldchar+', Length: '+fieldlen+', Attribute: '+JSON.stringify(ansi));
}
/* parse dynamic value field */
@ -373,7 +373,7 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) {
// We are interested in our field match
var df = m.shift().split(';');
log(LOG_DEBUG,'|--* DF found at ['+x+'x'+y+'], Field: '+df[0]+', Length: '+df[1]+', Pad:'+df[2]);
log(LOG_DEBUG,'|-- * DF found at ['+x+'x'+y+'], Field: '+df[0]+', Length: '+df[1]+', Pad:'+df[2]);
// If we are padding our field with a char, we need to add that back to line
// @todo validate if this goes beyond our width (and if scrolling not enabled)
line = (df[2] ? df[2] : '_').repeat(Math.abs(df[1]))+line;

View File

@ -482,7 +482,7 @@ function SessionProtocol() {
write_raw(VIEWDATA_HOME+VIEWDATA_UP+msg+
((blp > msg.length)
? (' '.repeat(blp-msg.length)+(reposition ? VIEWDATA_HOME+VIEWDATA_UP+VIEWDATA_RIGHT.repeat(msg.length) : ''))
? (' '.repeat(2+blp-msg.length)+(reposition ? VIEWDATA_HOME+VIEWDATA_UP+VIEWDATA_RIGHT.repeat(msg.length) : ''))
: '')
);
@ -542,10 +542,10 @@ function SessionProtocol() {
write_raw(VIEWDATA_HOME);
if (x > 0)
write_raw(VIEWDATA_RIGHT.repeat(x));
write_raw(VIEWDATA_RIGHT.repeat(x-1));
if (y > 0)
write_raw(VIEWDATA_DOWN.repeat(y));
write_raw(VIEWDATA_DOWN.repeat(y-1));
}
this.strlen = function(str) {

View File

@ -1 +0,0 @@
{"version":1,"frame":98,"index":"a","owner":9,"cost":0,"content":"G1swbSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMzFt2sQbWzFt3BtbMDszMm3axBtbMW3cG1swOzM0bdrEG1sxbdwbWzA7MzZtIBtbMTszM23fG1swbSAbWzMwOzQ3bdrC3NrE3Nog3CAbWzM3OzQwbQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1sxOzMxbbMbWzA7MzFt39sbWzE7MzJtsxtbMDszNm0gG1szMm3bG1sxOzM0bS5cG1swOzM0bdwbWzMzbd4bWzFt2xtbMG0gG1szMDs0N20gsyDDX9za39wgG1szNzs0MG0NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMTszMG3ExMTExMTExMTExMQbWzA7MzA7NDdt3Nzc3Nzc3Nzc3BtbMzc7NDBtDQoNCg0KDQoNCg0KDQoNCg0KDQogICAgICAgICAbWzFtLiAgICAgLiAgIBtbMzBtsxtbMG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzE7MzBtsxtbMG0NCiAgICAgICAbWzFt2r+/wr/avyC/2r8bWzBtIBtbMTszMG2zG1swbSAbWzE7MzFtVVNFUjobWzBtIBtbMW0bX1VTRVI7MjV0O/kbXBtbMG0gICAgICAgICAgICAgICAgG1sxOzMwbbMbWzBtDQogICAgICAgwL+zs7OzsyCzs7MgG1sxOzMwbbMbWzBtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1sxOzMwbbMbWzBtDQogICAgICAgG1sxOzMwbcDZ2cG02dkbWzM3bSAbWzMwbdnZ2RtbMzdtIBtbMzBtsxtbMG0gG1sxOzMxbVBBU1M6G1swbSAbWzFtG19QQVNTOzQwcDv5G1wbWzBtIBtbMTszMG2zG1swbQ0KICAgICAgICAgIBtbMTszMG3E2RtbMG0gICAgICAgG1sxOzMwbbMbWzBtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1sxOzMwbbMbWzBtDQoNCg0KICAgICAgICAgICAgIBtbMTszMG1UbyByZWdpc3RlciBhbiBhY2NvdW50IGVudGVyG1swbSAbWzFtTkVXG1swbSAbWzE7MzBtZm9yIHRoZSB1c2VyIG5hbWUbWzBtDQogICAgICAgICAgICAgICAgG1sxOzMwbVVzZRtbMG0gG1sxOzMybSoqG1swbSAbWzE7MzBtdG8gY2xlYXIgeW91ciBpbnB1dBtbMG0gG1sxOzMybSowMBtbMG0gG1sxOzMwbXRvIHN0YXJ0IGFnYWluG1swbQ0K","isPublic":1,"isAccessible":1,"type":"l","key":[null,"login",null,null,null,null,null,null,null,null],"date":"2020-07-08T05:17:35.174Z"}

21
text/tex/98a.ans Normal file
View File

@ -0,0 +1,21 @@
 ÚÄÜÚÄÜÚÄÜ ß ÚÂÜÚÄÜÚ Ü 
³ßÛ³ Û.\ÜÞÛ  ³ Ã_ÜÚßÜ 
ÄÄÄÄÄÄÄÄÄÄÄÄÜÜÜÜÜÜÜÜÜÜ
. . ³ ³
Ú¿¿Â¿Ú¿ ¿Ú¿ ³ USER: _USER;25t;ù\ ³
À¿³³³³³ ³³³ ³ ³
ÀÙÙÁ´ÙÙ ÙÙÙ ³ PASS: _PASS;40p;ù\ ³
ÄÙ ³ ³
To register an account enter NEW for the user name
Use ** to clear your input *00 to start again

View File

@ -1 +0,0 @@
{"version":1,"frame":98,"index":"a","owner":9,"cost":0,"content":"ESxsEnxsFHwsEywXN2t/IzM3ayM1ICAgICAgICAgIAIwMDAxMDAwMRF/axJ/ahQvfBN/FzVobyA8PSQsNQcgICAgICAgICAgICAgICAgICARLy4SLyoULC8TLxd1cHpwcXV6cDUgICAgICAgICAgICAgICAgICAgIFZpZGVvdGV4ICAgICAgICAgICAgICAgICAgICAgIA1TaWduIEluICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgAVVzZXIHLi4uLi4uLi4uLi4uLi4uICAgICAgICAgICAgICAgICAgIAFQYXNzBy4uLi4uLi4uLi4uLi4uLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbnRlcgJORVcHdG8gcmVnaXN0ZXIgbmV3IGFjY291bnQgICAgICAgUHJlc3MCKioHdG8gY2xlYXIgeW91ciBpbnB1dCAgICAgICAgICAgIFByZXNzAiowMAd0byBzdGFydCBhZ2Fpbgo=","isPublic":1,"isAccessible":1,"type":"l","key":[null,"login",null,null,null,null,null,null,null,null],"input_fields": [{"type":"t","length":15,"char":".","name":"USER","y":10,"x":15,"attribute":{},"value":""},{"type":"p","length":15,"char":".","name":"PASS","y":11,"x":15,"attribute":{},"value":""}],"date":"2020-07-08T05:17:35.174Z"}

1
text/vtx/98a.bin Normal file
View File

@ -0,0 +1 @@
,l|l|,,7k#37k#5 00010001kj/|5ho <=$,5 /./*,//upzpquzp5 Videotex Sign In User............... Pass............... EnterNEWto register new account Press**to clear your input Press*00to start again

View File

@ -1,17 +1,31 @@
load('ansitex/load/page.js');
load('ansitex/load/funcs.js');
load('ansitex/load/session/ansitex.js');
load('lz-string.js');
if (argv.length !== 1) {
writeln('ERROR: Need a frame ID');
if ((argv.length > 2) || (argv.length < 1)) {
writeln('ERROR: Need a frame ID and type');
exit(1);
} else {
writeln('Showing frame:'+argv[0]);
}
const SESSION_EXT = 'tex';
var SESSION_EXT;
switch (argv[1]) {
case 'TEX':
case 'tex':
SESSION_EXT = 'tex';
load('ansitex/load/session/ansitex.js');
break;
case 'VTX':
case 'vtx':
default:
load('ansitex/load/session/viewdata.js');
SESSION_EXT = 'vtx';
break;
}
var p = new Page();
var po = new PageObject(argv[0]);