* Lots of WIP around menu.json handlinge/etc.

This commit is contained in:
Bryan Ashby
2015-03-29 21:47:48 -06:00
parent 8c9b0e729f
commit d6ffa2b26e
6 changed files with 162 additions and 42 deletions

BIN
mods/art/LOGIN1.ANS Normal file

Binary file not shown.

48
mods/login.js Normal file
View File

@@ -0,0 +1,48 @@
/* jslint node: true */
'use strict';
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 ViewController = require('../core/view_controller.js').ViewController;
//var async = require('async');
// :TODO: clean up requires
exports.moduleInfo = {
name : 'Login',
desc : 'Login Module',
author : 'NuSkooler',
};
exports.getModule = LoginModule;
function LoginModule(menuConfig) {
MenuModule.call(this, menuConfig);
}
require('util').inherits(LoginModule, MenuModule);
LoginModule.prototype.enter = function(client) {
LoginModule.super_.prototype.enter.call(this, client);
};
LoginModule.prototype.beforeArt = function() {
LoginModule.super_.prototype.beforeArt.call(this);
this.client.term.write(ansi.resetScreen());
};
LoginModule.prototype.mciReady = function(mciMap) {
LoginModule.super_.prototype.mciReady.call(this, mciMap);
var self = this;
var vc = self.addViewController(new ViewController(self.client));
vc.loadFromMCIMapAndConfig( { mciMap : mciMap, menuConfig : self.menuConfig }, function onViewReady(err) {
});
};

View File

@@ -4,6 +4,7 @@
*/
"matrix" : {
"art" : "matrix",
// :TODO: Not currently supporting more than form 0. Should probably do that!
"form" : [
{
"mciReq" : [ "VM1" ],
@@ -11,12 +12,35 @@
"VM1" : {
"submit" : true,
"focus" : true,
// :TODO: need a good way to localize these ... Standard Orig->Lookup seems good.
"items" : [ "Login", "Apply", "Log Off" ]
}
}
},
/*
Some Examples:
VerticalMenu: { id: 0, submitId: 1, value: { '1': 1 } }
Another concept:
"menu" : "@helper.js/logoff" -> calls helper.js::logoff(...)
*/
"submit" : [
{
"value" : { "1" : 0 },
"menu" : "login"
},
{
"value" : { "1" : 1 },
"menu" : "apply"
},
{
"value" : { "1" : 2 },
"menu" : "logoff"
}
]
}
]
//"module" : "matrix"
},
"login" : {
"art" : "login",

View File

@@ -37,11 +37,13 @@ StandardMenuModule.prototype.mciReady = function(mciMap) {
var self = this;
var vc = self.addViewController(new ViewController(self.client));
vc.loadFromMCIMapAndConfig(mciMap, self.menuConfig, function onViewReady(err) {
vc.loadFromMCIMapAndConfig( { mciMap : mciMap, menuConfig : self.menuConfig }, function onViewReady(err) {
if(err) {
console.log(err);
} else {
// vc.switchFocus(1);
/* vc.on('submit', function onFormSubmit(formData) {
console.log(formData);
});*/
}
});
@@ -117,8 +119,8 @@ StandardMenuModule.prototype.mciReady = function(mciMap) {
};
if(0 === form.id && 1 === form.submitId) {
console.log(viewModuleMap[form.values[1]]);
self.client.gotoMenuModule(viewModuleMap[form.values[1]]);
console.log(viewModuleMap[form.value[1]]);
self.client.gotoMenuModule(viewModuleMap[form.value[1]]);
}
});