sbbs/load/control-echomail.js

87 lines
1.9 KiB
JavaScript

/**
* This control renders echomail
*
* The system echomail prefix is *1, with echomail pages built from the following page number:
* zzzzEEpppp, where:
* + zzzz is the zone, zero padded, the zone identifies the message groups
* + EE is the echomail area, ie: the message areas
* + pppp is the message number, identified by the tag attached to the message header
*
* (Tags are added to the messages via an external process.)
*/
var CONTROL_ECHOMAIL = '1';
load('frame.js');
load('graphic.js');
log(LOG_DEBUG,'+ Control ECHOMAIL loaded');
function echomail(page) {
var complete = false;
var pageframe = undefined;
log(LOG_DEBUG,'Loading echomail page:'+page);
// Setup our frame
fo = viewdata ? new FrameViewdata() : new FrameAnsi();
fo.loadMessage(page);
if (fo.content)
pageframe = fo.render();
// Called before processing for a field
Object.defineProperty(this, 'getName', {
get: function () {
return 'ECHOMAIL';
}
});
Object.defineProperty(this, 'isComplete', {
get: function () {
return complete;
}
});
// Handle the keyboard responses as we receive them.
this.handle=function(read) {
log(LOG_DEBUG,'Control ECHOMAIL handle() start. ('+read+')');
switch(read) {
case KEY_DOWN:
log(LOG_DEBUG,' - Control TEST scroll 0,1');
pageframe.scroll(0,1);
read = '';
break;
case KEY_UP:
log(LOG_DEBUG,' - Control TEST scroll 0,-1');
pageframe.scroll(0,-1);
read = '';
break;
case '*':
break;
}
pageframe.cycle();
return read;
}
// @todo Does this need to be defined?
this.prefield=function() {};
this.ready=function() {
//log(LOG_DEBUG,' - pageframe:'+pageframe+',typeof:'+(typeof pageframe));
if ((typeof pageframe) === 'undefined')
log(LOG_DEBUG,'+ Control ECHOMAIL page doesnt exist ['+page+']');
else
log(LOG_DEBUG,'+ Control ECHOMAIL ready');
return (typeof pageframe) !== 'undefined';
}
}
this;