From ca26cca55bfa6774e735aee607fbc66474122e35 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 19 Aug 2015 18:50:40 -0600 Subject: [PATCH] * Don't look for non-user (e.g. predefined) MCI codes in form/config lookup --- core/mci_view_factory.js | 26 ++++++++++++++++++++++++++ core/menu_util.js | 5 ++++- mods/art/msg_area_list.ans | Bin 192 -> 208 bytes mods/menu.json | 4 ++-- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/core/mci_view_factory.js b/core/mci_view_factory.js index 5794ce94..2328ab21 100644 --- a/core/mci_view_factory.js +++ b/core/mci_view_factory.js @@ -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) { assert(mci.code); assert(mci.id > 0); @@ -121,6 +142,9 @@ MCIViewFactory.prototype.createFromMCI = function(mci) { return false; } + // + // Note: Keep this in sync with UserViewCodes above! + // switch(mci.code) { // Text Label (Text View) case 'TL' : @@ -236,6 +260,8 @@ MCIViewFactory.prototype.createFromMCI = function(mci) { setOption(2, 'justify'); view = new TextView(options); + } else { + // :TODO: log this } break; } diff --git a/core/menu_util.js b/core/menu_util.js index 27f0423e..0f9159aa 100644 --- a/core/menu_util.js +++ b/core/menu_util.js @@ -9,6 +9,7 @@ var Config = require('./config.js').config; var asset = require('./asset.js'); var theme = require('./theme.js'); var jsonCache = require('./json_cache.js'); +var MCIViewFactory = require('./mci_view_factory.js').MCIViewFactory; var fs = require('fs'); var paths = require('path'); @@ -138,7 +139,9 @@ function getFormConfigByIDAndMap(menuConfig, formId, mciMap, cb) { } 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'); diff --git a/mods/art/msg_area_list.ans b/mods/art/msg_area_list.ans index ae43220f2ff5ab5e6c4489bc983d4cc2efb0e738..7514ccd5a6b8f81476b77f7ae55bfff9c08548b0 100644 GIT binary patch delta 31 mcmX@Wc!6<(t$=j2iJ`Tzd9G@huc36bLGDD`SVsSevsD3-YzZ|0 delta 14 Vcmcb>cz|(&?L^;LM*E4YRRJkW1v~%% diff --git a/mods/menu.json b/mods/menu.json index 18ea93a5..7efd7501 100644 --- a/mods/menu.json +++ b/mods/menu.json @@ -284,7 +284,7 @@ "fallback" : "messageArea", "form" : { "0" : { - "TLVM" : { + "VM" : { "mci" : { "VM1" : { "widht" : 30, @@ -302,7 +302,7 @@ } ] }, - "actionKeys" : [ // :TODO: Need better name + "actionKeys" : [ { "keys" : [ "escape" ], "action" : "@menu:messageArea"