* Cleanup & some logging

This commit is contained in:
Bryan Ashby 2015-03-22 23:16:49 -06:00
parent efcc8756ba
commit 810f001901
4 changed files with 8 additions and 135 deletions

View File

@ -201,7 +201,6 @@ Client.prototype.gotoMenuModule = function(name, cb) {
if(err) {
cb(err);
} else {
// :TODO: log module info not just menu!!
Log.debug({ menuName : name }, 'Goto menu module');
modInst.enter(self);

View File

@ -21,7 +21,6 @@ function MenuModule(menuConfig) {
async.waterfall(
[
function displayArt(callback) {
console.log(self.menuConfig)
theme.displayThemeArt(self.menuConfig.art, self.client, function onArt(err, mciMap) {
callback(err, mciMap);
});

View File

@ -4,6 +4,7 @@
var moduleUtil = require('./module_util.js');
var theme = require('./theme.js');
var async = require('async');
var Log = require('./logger.js').log;
var menuJson = require('../mods/menu.json');
@ -26,11 +27,16 @@ function loadMenu(name, client, cb) {
}
var menuConfig = menuJson[name];
Log.debug(menuConfig, 'Menu config');
moduleUtil.loadModule(menuConfig.module || 'standard_menu', 'mods', function onModule(err, mod) {
var moduleName = menuConfig.module || 'standard_menu';
moduleUtil.loadModule(moduleName, 'mods', function onModule(err, mod) {
if(err) {
cb(err);
} else {
Log.debug( { moduleName : moduleName, moduleInfo : mod.moduleInfo }, 'Loading menu module');
var modInst = new mod.getModule(menuConfig);
cb(null, modInst);
}

View File

@ -34,51 +34,8 @@ MatrixModule.prototype.enter = function(client) {
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) {
//
// 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(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);
}
});
*/
};
MatrixModule.prototype.mciReady = function(mciMap) {
@ -119,91 +76,3 @@ MatrixModule.prototype.mciReady = function(mciMap) {
vc.switchFocus(1);
}
};
/*
function entryPoint(client) {
client.term.write(ansi.resetScreen());
//client.term.write('\x1b[?33h');
theme.displayThemeArt('MATRIX', client, function onMatrix(err, mciMap) {
console.log(mciMap);
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);
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) {
var term = client.term;
term.write(ansi.resetScreen());
// :TODO: types, random, and others? could come from conf.mods.matrix or such
theme.getThemeArt('MCI_ET1.ANS', client.user.properties.art_theme_id, function onArt(err, theArt) {
//art.getArt('MATRIX_1.ANS', {}, function onArt(err, theArt) {
if(!err) {
art.display(theArt, { client : client, mciReplaceChar : ' ' }, function onArtDisplayed(err, mci) {
if(err) {
return;
}
user.authenticate('NuSkooler', 'password', client, function onAuth(isValid) {
console.log(isValid);
});
var vc = new viewController.ViewController(client);
vc.on('submit', function onSubmit(formData) {
console.log(formData);
vc.detachClientEvents();
modules.goto('test_module1', client);
});
vc.loadFromMCIMap(mci);
//vc.getView(3).setText('New');
//vc.getView(4).setText('Login');
vc.setViewOrder();
vc.getView(2).submit = true;
//vc.getView(1).setItems(['System Login', 'Apply', 'GTFO!']);
//vc.getView(2).submit = true;
//vc.getView(3).setText('Apply');
vc.switchFocus(1);
});
}
});
}
*/