Enable loading a page and overwriting its contents with a file
This commit is contained in:
parent
a1bcc1f5cb
commit
0625691ae5
@ -47,13 +47,9 @@ function MsgAreas() {
|
||||
writeln('Areas that we ARE managing mail:'+this.areas.length);
|
||||
|
||||
for(var x in this.areas_excluded) {
|
||||
/*
|
||||
writeln(this.areas_excluded[x].area_name = undefined
|
||||
? JSON.stringify(this.areas_excluded[x])
|
||||
: this.areas_excluded[x].area_name);
|
||||
*/
|
||||
writeln(JSON.stringify(this.areas_excluded[x]));
|
||||
exit();
|
||||
writeln(x+':'+((this.areas_excluded[x].area_name === undefined)
|
||||
? this.areas_excluded[x]
|
||||
: JSON.stringify(this.areas_excluded[x])));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -443,8 +443,7 @@ function Page(debug) {
|
||||
/**
|
||||
* Build in any input_fields with values
|
||||
*/
|
||||
this.build_input_fields = function()
|
||||
{
|
||||
this.build_input_fields = function() {
|
||||
var that = this;
|
||||
|
||||
var f = this.input_fields.filter(function(item) { return item.value.length; });
|
||||
@ -836,7 +835,7 @@ function Page(debug) {
|
||||
throw new Error('page must be a PageObject');
|
||||
|
||||
// Load a page from disk first if it exists
|
||||
if (FRAMES_MSG_FILES && this.import(FRAMES_HOME+SESSION_EXT+'/'+page.toString()))
|
||||
if (FRAMES_MSG_FILES && this.import(FRAMES_HOME+SESSION_EXT+'/'+page.toString(),SESSION_EXT))
|
||||
return true;
|
||||
|
||||
// Fall back to loading from msgbase
|
||||
@ -868,7 +867,7 @@ function Page(debug) {
|
||||
* @returns {boolean}
|
||||
* @todo Dont allow load() to load a Viewdata frame for an ANSItex session and visa-versa.
|
||||
*/
|
||||
this.import = function(filename,width,height) {
|
||||
this.import = function(filename,ext,width,height) {
|
||||
log(LOG_DEBUG,'|- Importing frame: ['+filename+']');
|
||||
|
||||
var f = new File(filename);
|
||||
@ -881,7 +880,6 @@ function Page(debug) {
|
||||
f.close();
|
||||
|
||||
var valid_sauce = false;
|
||||
var ext = SESSION_EXT;
|
||||
|
||||
if (contents.substr(-128, 7) === 'SAUCE00') {
|
||||
ext = file_getext(filename).substr(1).toLowerCase();
|
||||
|
@ -43,10 +43,12 @@ function rawtoattrs(contents,width,yoffset,xoffset,debug) {
|
||||
|
||||
// @todo temp hack, rework ansi variable - perhaps have a function that converts an attribute back into an ANSI sequence
|
||||
var ansi = { i: 0, f: 37, b: 40 };
|
||||
var line;
|
||||
var x;
|
||||
|
||||
while (lines.length > 0) {
|
||||
var x = 0;
|
||||
var line = lines.shift();
|
||||
x = 0;
|
||||
line = lines.shift();
|
||||
|
||||
if ((debug !== undefined) && (y > debug)) {
|
||||
exit(1);
|
||||
|
@ -1,12 +1,19 @@
|
||||
/**
|
||||
* Load a frame, optionally with a new ANSI/BIN and load it into the msgbase.
|
||||
*/
|
||||
|
||||
load('ansitex/load/funcs.js');
|
||||
// Our page handler
|
||||
load('ansitex/load/page.js');
|
||||
|
||||
/* parse command arguments */
|
||||
if (argv.length !== 1) {
|
||||
writeln('! ERROR: Need 1 arguments only');
|
||||
if (argv.length !== 3) {
|
||||
writeln('! ERROR: Need 3 arguments only');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
var frame = argv.shift();
|
||||
var index = argv.shift();
|
||||
var file = argv.shift();
|
||||
|
||||
var ext = file_getext(file).substr(1).toLowerCase();
|
||||
@ -14,16 +21,17 @@ var ext = file_getext(file).substr(1).toLowerCase();
|
||||
// Type of frame to load
|
||||
switch (ext) {
|
||||
case 'tex':
|
||||
case 'ans':
|
||||
require('ansitex/load/session/ansitex.js','SESSION_ANSITEX');
|
||||
break;
|
||||
|
||||
case 'vtx':
|
||||
case 'bin':
|
||||
require('ansitex/load/session/viewdata.js','SESSION_VIEWDATA');
|
||||
break;
|
||||
}
|
||||
|
||||
var page = new Page(false);
|
||||
page.import(file);
|
||||
//page.build();
|
||||
//page.get(new PageObject(980,'a'));
|
||||
var page = new Page();
|
||||
page.get(new PageObject(frame,index));
|
||||
page.import(file,ext);
|
||||
page.save();
|
||||
|
@ -102,8 +102,8 @@ if (! tex.import(FRAMES_HOME+SESSION_EXT+'/'+page)) {
|
||||
|
||||
// Checking keys
|
||||
if (vtx.raw && tex.raw) {
|
||||
|
||||
writeln('- Checking Page: ');
|
||||
|
||||
if (vtx.name.toString() !== tex.name.toString()) {
|
||||
writeln(' - ! VTX: '+vtx.name.toString());
|
||||
writeln(' - ! TEX: '+tex.name.toString());
|
||||
|
@ -1,4 +1,4 @@
|
||||
load('ansitex/load/msgbases.js');
|
||||
|
||||
var ma = new MsgAreas();
|
||||
writeln(JSON.stringify(ma.list));
|
||||
ma.list;
|
||||
|
Loading…
Reference in New Issue
Block a user