2014-10-17 02:21:06 +00:00
|
|
|
/* jslint node: true */
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
//var art = require('../core/art.js');
|
|
|
|
var ansi = require('../core/ansi_term.js');
|
|
|
|
var lineEditor = require('../core/line_editor.js');
|
|
|
|
var art = require('../core/art.js');
|
2014-10-20 05:30:44 +00:00
|
|
|
var user = require('../core/user.js');
|
2014-10-17 02:21:06 +00:00
|
|
|
|
2014-10-22 05:12:44 +00:00
|
|
|
//var view = require('../core/view.js');
|
|
|
|
var textView = require('../core/text_view.js');
|
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',
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.entryPoint = entryPoint;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
//art.getArt('SO-CC1.ANS'/* 'MATRIX'*/, { types: ['.ans'], random: true}, function onArt(err, theArt) {
|
2014-10-20 03:06:39 +00:00
|
|
|
art.getArt('MCI_TEST3.ANS', /*'MATRIX_TEST1.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-17 02:21:06 +00:00
|
|
|
art.display(theArt.data, { client : client, mciReplaceChar : ' ' }, function onArtDisplayed(err, mci) {
|
|
|
|
if(err) {
|
2014-10-20 03:06:39 +00:00
|
|
|
return;
|
2014-10-17 02:21:06 +00:00
|
|
|
}
|
|
|
|
|
2014-10-22 05:12:44 +00:00
|
|
|
var tv = new textView.TextView(client, {
|
|
|
|
position : [5, 5],
|
|
|
|
text : 'Hello, World!',
|
|
|
|
textStyle : 'password',
|
|
|
|
maxLength : 10
|
|
|
|
});
|
|
|
|
|
|
|
|
tv.redraw();
|
|
|
|
|
|
|
|
/*
|
2014-10-20 03:06:39 +00:00
|
|
|
var vc = new view.ViewsController(client);
|
|
|
|
vc.loadFromMCIMap(mci);
|
|
|
|
vc.setViewOrder();
|
|
|
|
vc.switchFocus(1);
|
2014-10-20 05:30:44 +00:00
|
|
|
vc.setSubmitView(2);
|
|
|
|
|
|
|
|
vc.on('action', function onAction(act) {
|
|
|
|
if('submit' === act.action) {
|
2014-10-21 04:47:13 +00:00
|
|
|
var un = vc.getView(1).value;
|
|
|
|
var pw = vc.getView(2).value;
|
|
|
|
console.log('userName: ' + un);
|
2014-10-22 05:12:44 +00:00
|
|
|
console.log('password: ' + pw);
|
2014-10-21 04:47:13 +00:00
|
|
|
|
|
|
|
user.User.loadWithCredentials(un, pw, function onUser(err, user) {
|
2014-10-20 05:30:44 +00:00
|
|
|
if(err) {
|
|
|
|
console.log(err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(user.id);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2014-10-22 05:12:44 +00:00
|
|
|
*/
|
2014-10-17 02:21:06 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|