/** * 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.) */ // All controls need a unique variable so that require() can know if the control has already been loaded var CONTROL_ECHOMAIL = '1'; // Optional debug message so we can see that it is loaded log(LOG_DEBUG,'+ Control ECHOMAIL loaded'); // A unique method name (same as the control name that is called as new method() on initialisation function echomail(pagenum,session) { log(LOG_DEBUG,' - Loading echomail page:'+pagenum); // has this control completed var complete = false; var ready = false; function init(pagenum,session) { log(LOG_DEBUG,'- init()'); ready = session.loadMessage(pagenum); } 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: session.page.scroll(0,1); read = ''; break; case KEY_UP: session.page.scroll(0,-1); read = ''; break; } so.render(); return read; } /** * ready() is called after a control has been initialised, to determine if the control will take the input * or if it is unable to do so * * If ready() returns: * + false, the main programming will return ERR_ROUTE to the user, * + true, the main programming will continue to load the frame, and then pass input to on the next loop handle() * * @returns {boolean} */ this.ready = function() { return ready; } init.apply(this,arguments); }