Fixes for viewdata input redisplay and bottom line clearing, viewdata input_fields and dynamic_fields added *98#
This commit is contained in:
@@ -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 {
|
||||
|
25
load/page.js
25
load/page.js
@@ -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;
|
||||
|
||||
// Our fields are sorted in x descending order
|
||||
if (page.input_fields.length)
|
||||
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
|
||||
} 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;
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user