From 810f001901ca5576aa3278b10a71fd88900f8002 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 22 Mar 2015 23:16:49 -0600 Subject: [PATCH] * Cleanup & some logging --- core/client.js | 1 - core/menu_module.js | 1 - core/menu_util.js | 8 ++- mods/matrix.js | 133 +------------------------------------------- 4 files changed, 8 insertions(+), 135 deletions(-) diff --git a/core/client.js b/core/client.js index 149c8725..37541dd6 100644 --- a/core/client.js +++ b/core/client.js @@ -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); diff --git a/core/menu_module.js b/core/menu_module.js index 23fda989..45f54bcc 100644 --- a/core/menu_module.js +++ b/core/menu_module.js @@ -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); }); diff --git a/core/menu_util.js b/core/menu_util.js index 2f3838a8..d6aa8167 100644 --- a/core/menu_util.js +++ b/core/menu_util.js @@ -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); } diff --git a/mods/matrix.js b/mods/matrix.js index a441c7b8..3236d45f 100644 --- a/mods/matrix.js +++ b/mods/matrix.js @@ -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) { @@ -118,92 +75,4 @@ MatrixModule.prototype.mciReady = function(mciMap) { vc.getView(1).submit = true; 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); - }); - } - }); -} -*/ \ No newline at end of file +}; \ No newline at end of file