2014-10-17 02:21:06 +00:00
|
|
|
/* jslint node: true */
|
|
|
|
'use strict';
|
|
|
|
|
2015-03-19 05:08:23 +00:00
|
|
|
var ansi = require('../core/ansi_term.js');
|
|
|
|
var art = require('../core/art.js');
|
|
|
|
var user = require('../core/user.js');
|
|
|
|
var theme = require('../core/theme.js');
|
|
|
|
var MenuModule = require('../core/menu_module.js').MenuModule;
|
|
|
|
|
|
|
|
//var view = require('../core/view.js');
|
|
|
|
var textView = require('../core/text_view.js');
|
2014-10-23 05:41:00 +00:00
|
|
|
var editTextView = require('../core/edit_text_view.js');
|
2014-11-05 06:50:42 +00:00
|
|
|
var ViewController = require('../core/view_controller.js').ViewController;
|
|
|
|
|
2015-03-19 05:08:23 +00:00
|
|
|
//var async = require('async');
|
2014-10-20 03:06:39 +00:00
|
|
|
|
2014-10-17 02:21:06 +00:00
|
|
|
exports.moduleInfo = {
|
|
|
|
name : 'Matrix',
|
|
|
|
desc : 'Standardish Matrix',
|
|
|
|
author : 'NuSkooler',
|
|
|
|
};
|
|
|
|
|
2015-03-19 05:08:23 +00:00
|
|
|
//exports.entryPoint = entryPoint;
|
|
|
|
exports.getModule = MatrixModule;
|
|
|
|
|
|
|
|
|
|
|
|
function MatrixModule() {
|
|
|
|
MenuModule.call(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
require('util').inherits(MatrixModule, MenuModule);
|
|
|
|
|
|
|
|
MatrixModule.prototype.enter = function(client) {
|
|
|
|
MatrixModule.super_.prototype.enter.call(this);
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2014-10-17 02:21:06 +00:00
|
|
|
|
2015-03-19 05:08:23 +00:00
|
|
|
/*
|
2014-11-05 06:50:42 +00:00
|
|
|
function entryPoint(client) {
|
|
|
|
|
2014-11-10 04:24:09 +00:00
|
|
|
client.term.write(ansi.resetScreen());
|
|
|
|
//client.term.write('\x1b[?33h');
|
|
|
|
|
2014-11-05 06:50:42 +00:00
|
|
|
theme.displayThemeArt('MATRIX', client, function onMatrix(err, mciMap) {
|
2014-11-10 04:24:09 +00:00
|
|
|
console.log(mciMap);
|
2014-11-05 06:50:42 +00:00
|
|
|
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) {
|
2015-03-19 05:08:23 +00:00
|
|
|
console.log(form);
|
2014-11-05 06:50:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
vc.loadFromMCIMap(mciMap);
|
|
|
|
vc.setViewOrder();
|
|
|
|
// :TODO: Localize
|
|
|
|
vc.getView(1).setItems(['Login', 'New User', 'Goodbye!']);
|
2015-03-19 05:08:23 +00:00
|
|
|
vc.getView(1).submit = true;
|
2014-11-05 06:50:42 +00:00
|
|
|
vc.switchFocus(1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2015-03-19 05:08:23 +00:00
|
|
|
*/
|
2014-11-05 06:50:42 +00:00
|
|
|
|
|
|
|
/*
|
2014-10-17 02:21:06 +00:00
|
|
|
function entryPoint(client) {
|
|
|
|
var term = client.term;
|
|
|
|
|
2014-10-20 03:06:39 +00:00
|
|
|
term.write(ansi.resetScreen());
|
2014-10-20 05:30:44 +00:00
|
|
|
|
2014-10-17 02:21:06 +00:00
|
|
|
// :TODO: types, random, and others? could come from conf.mods.matrix or such
|
|
|
|
|
2014-11-04 07:34:54 +00:00
|
|
|
theme.getThemeArt('MCI_ET1.ANS', client.user.properties.art_theme_id, function onArt(err, theArt) {
|
2014-10-27 04:06:41 +00:00
|
|
|
|
|
|
|
//art.getArt('MATRIX_1.ANS', {}, function onArt(err, theArt) {
|
2014-10-17 02:21:06 +00:00
|
|
|
if(!err) {
|
2014-10-20 03:06:39 +00:00
|
|
|
|
2014-10-27 04:06:41 +00:00
|
|
|
art.display(theArt, { client : client, mciReplaceChar : ' ' }, function onArtDisplayed(err, mci) {
|
2014-10-17 02:21:06 +00:00
|
|
|
if(err) {
|
2014-10-20 03:06:39 +00:00
|
|
|
return;
|
2014-10-17 02:21:06 +00:00
|
|
|
}
|
|
|
|
|
2014-10-26 03:35:42 +00:00
|
|
|
user.authenticate('NuSkooler', 'password', client, function onAuth(isValid) {
|
|
|
|
console.log(isValid);
|
|
|
|
});
|
|
|
|
|
2014-10-23 05:41:00 +00:00
|
|
|
var vc = new viewController.ViewController(client);
|
2014-11-03 23:49:15 +00:00
|
|
|
vc.on('submit', function onSubmit(formData) {
|
|
|
|
console.log(formData);
|
2014-11-04 05:53:01 +00:00
|
|
|
|
|
|
|
vc.detachClientEvents();
|
|
|
|
modules.goto('test_module1', client);
|
2014-11-03 23:49:15 +00:00
|
|
|
});
|
|
|
|
|
2014-10-23 05:41:00 +00:00
|
|
|
vc.loadFromMCIMap(mci);
|
2014-10-24 04:18:38 +00:00
|
|
|
//vc.getView(3).setText('New');
|
|
|
|
//vc.getView(4).setText('Login');
|
2014-10-23 05:41:00 +00:00
|
|
|
vc.setViewOrder();
|
2014-11-03 23:49:15 +00:00
|
|
|
vc.getView(2).submit = true;
|
2014-11-04 05:53:01 +00:00
|
|
|
//vc.getView(1).setItems(['System Login', 'Apply', 'GTFO!']);
|
|
|
|
//vc.getView(2).submit = true;
|
|
|
|
//vc.getView(3).setText('Apply');
|
2014-10-23 05:41:00 +00:00
|
|
|
vc.switchFocus(1);
|
2014-10-17 02:21:06 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2014-11-05 06:50:42 +00:00
|
|
|
}
|
|
|
|
*/
|