* WIP Menu system vs raw module access

This commit is contained in:
Bryan Ashby 2015-03-22 22:52:04 -06:00
parent f7462bbbdd
commit efcc8756ba
8 changed files with 153 additions and 32 deletions

View file

@ -24,20 +24,25 @@ exports.moduleInfo = {
exports.getModule = MatrixModule;
function MatrixModule() {
MenuModule.call(this);
function MatrixModule(menuConfig) {
MenuModule.call(this, menuConfig);
}
require('util').inherits(MatrixModule, MenuModule);
MatrixModule.prototype.enter = function(client) {
MatrixModule.super_.prototype.enter.call(this);
var self = this;
MatrixModule.super_.prototype.enter.call(this, client);
client.term.write(ansi.resetScreen());
//client.term.write('\x1b[?33h');
this.loadArt();
/*
var self = this;
theme.displayThemeArt('MATRIX', client, function onMatrix(err, mciMap) {
console.log(mciMap);
if(mciMap.ET1 && mciMap.ET2 && mciMap.BN1 && mciMap.BN2 && mciMap.BN3) {
@ -73,8 +78,47 @@ MatrixModule.prototype.enter = function(client) {
vc.switchFocus(1);
}
});
*/
};
MatrixModule.prototype.mciReady = function(mciMap) {
MatrixModule.super_.prototype.mciReady.call(this, mciMap);
var self = this;
if(mciMap.ET1 && mciMap.ET2 && mciMap.BN1 && mciMap.BN2 && mciMap.BN3) {
//
// Form via EditTextViews and ButtonViews
// * ET1 - userName
// * ET2 - password
// * BN1 - Login
// * BN2 - New
// * BN3 - Bye!
//
} else if(mciMap.VM1) {
//
// Menu via VerticalMenuView
//
// * VM1 - menu with the following items:
// 0 - Login
// 1 - New
// 2 - Bye!
//
//var vc = new ViewController(client);
var vc = self.addViewController(new ViewController(self.client));
vc.on('submit', function onSubmit(form) {
console.log(form);
});
vc.loadFromMCIMap(mciMap);
vc.setViewOrder();
// :TODO: Localize
vc.getView(1).setItems(['Login', 'New User', 'Goodbye!']);
vc.getView(1).submit = true;
vc.switchFocus(1);
}
};
/*
function entryPoint(client) {