* Don't look for non-user (e.g. predefined) MCI codes in form/config lookup

This commit is contained in:
Bryan Ashby 2015-08-19 18:50:40 -06:00
parent 4cf10ba85c
commit ca26cca55b
4 changed files with 32 additions and 3 deletions

View File

@ -80,6 +80,27 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) {
} }
}; };
/*
MCIViewFactory.getUserViewClass = function(code) {
return {
TL : TextView,
ET : EditTextView,
ME : MaskEditTextView,
MT : MultiLineEditTextView,
PL : TextView,
BT : ButtonView,
VM : VerticalMenuView,
HM : HorizontalMenuView,
SM : SpinnerMenuView,
TM : ToggleMenuView,
}[code];
};
*/
MCIViewFactory.UserViewCodes = [
'TL', 'ET', 'ME', 'MT', 'PL', 'BT', 'VM', 'HM', 'SM', 'TM'
];
MCIViewFactory.prototype.createFromMCI = function(mci) { MCIViewFactory.prototype.createFromMCI = function(mci) {
assert(mci.code); assert(mci.code);
assert(mci.id > 0); assert(mci.id > 0);
@ -121,6 +142,9 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
return false; return false;
} }
//
// Note: Keep this in sync with UserViewCodes above!
//
switch(mci.code) { switch(mci.code) {
// Text Label (Text View) // Text Label (Text View)
case 'TL' : case 'TL' :
@ -236,6 +260,8 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
setOption(2, 'justify'); setOption(2, 'justify');
view = new TextView(options); view = new TextView(options);
} else {
// :TODO: log this
} }
break; break;
} }

View File

@ -9,6 +9,7 @@ var Config = require('./config.js').config;
var asset = require('./asset.js'); var asset = require('./asset.js');
var theme = require('./theme.js'); var theme = require('./theme.js');
var jsonCache = require('./json_cache.js'); var jsonCache = require('./json_cache.js');
var MCIViewFactory = require('./mci_view_factory.js').MCIViewFactory;
var fs = require('fs'); var fs = require('fs');
var paths = require('path'); var paths = require('path');
@ -138,7 +139,9 @@ function getFormConfigByIDAndMap(menuConfig, formId, mciMap, cb) {
} }
var formForId = menuConfig.form[formId]; var formForId = menuConfig.form[formId];
var mciReqKey = _.pluck(_.sortBy(mciMap, 'code'), 'code').join(''); var mciReqKey = _.filter(_.pluck(_.sortBy(mciMap, 'code'), 'code'), function(mci) {
return MCIViewFactory.UserViewCodes.indexOf(mci) > -1;
}).join('');
Log.trace( { mciKey : mciReqKey }, 'Looking for MCI configuration key'); Log.trace( { mciKey : mciReqKey }, 'Looking for MCI configuration key');

Binary file not shown.

View File

@ -284,7 +284,7 @@
"fallback" : "messageArea", "fallback" : "messageArea",
"form" : { "form" : {
"0" : { "0" : {
"TLVM" : { "VM" : {
"mci" : { "mci" : {
"VM1" : { "VM1" : {
"widht" : 30, "widht" : 30,
@ -302,7 +302,7 @@
} }
] ]
}, },
"actionKeys" : [ // :TODO: Need better name "actionKeys" : [
{ {
"keys" : [ "escape" ], "keys" : [ "escape" ],
"action" : "@menu:messageArea" "action" : "@menu:messageArea"