diff --git a/core/asset.js b/core/asset.js index 8f428cc9..0e709cc9 100644 --- a/core/asset.js +++ b/core/asset.js @@ -9,6 +9,7 @@ var assert = require('assert'); exports.parseAsset = parseAsset; exports.getArtAsset = getArtAsset; +exports.getModuleAsset = getModuleAsset; exports.resolveConfigAsset = resolveConfigAsset; exports.getViewPropertyAsset = getViewPropertyAsset; @@ -17,6 +18,7 @@ var ALL_ASSETS = [ 'menu', 'method', 'systemMethod', + 'systemModule', 'prompt', 'config', ]; @@ -58,6 +60,24 @@ function getArtAsset(art) { } } +function getModuleAsset(module) { + if(!_.isString(module)) { + return null; + } + + if('@' === module[0]) { + var modAsset = parseAsset(module); + assert('module' === modAsset.type || 'systemModule' === modAsset.type); + + return modAsset; + } else { + return { + type : 'module', + asset : module, + } + } +} + function resolveConfigAsset(from) { var asset = parseAsset(from); if(asset) { diff --git a/mods/fse.js b/core/fse.js similarity index 100% rename from mods/fse.js rename to core/fse.js diff --git a/core/menu_util.js b/core/menu_util.js index 97f3775d..c7dcd153 100644 --- a/core/menu_util.js +++ b/core/menu_util.js @@ -81,13 +81,13 @@ function loadMenu(options, cb) { }); }, function loadMenuModule(menuConfig, callback) { - - var modSupplied = _.isString(menuConfig.module); + var modAsset = asset.getModuleAsset(menuConfig.module); + var modSupplied = null !== modAsset; var modLoadOpts = { - name : modSupplied ? menuConfig.module : 'standard_menu', - path : modSupplied ? Config.paths.mods : __dirname, - category : modSupplied ? 'mods' : null, + name : modSupplied ? modAsset.asset : 'standard_menu', + path : (!modSupplied || 'systemModule' === modAsset.type) ? __dirname : Config.paths.mods, + category : (!modSupplied || 'systemModule' === modAsset.type) ? null : 'mods', }; moduleUtil.loadModuleEx(modLoadOpts, function moduleLoaded(err, mod) { @@ -99,7 +99,7 @@ function loadMenu(options, cb) { callback(err, modData); }); - }, + }, function createModuleInstance(modData, callback) { Log.debug( { moduleName : modData.name, args : options.args, config : modData.config, info : modData.mod.modInfo }, diff --git a/mods/menu.json b/mods/menu.json index d77536fd..33eabee7 100644 --- a/mods/menu.json +++ b/mods/menu.json @@ -661,8 +661,8 @@ "options" : { "cls" : true } }, "demoFullScreenEditor" : { - "module" : "fse", - "art" : "demo_fse_local_user.ans", + "module" : "@systemModule:fse", + //"art" : "demo_fse_local_user.ans", "options" : { "cls" : true }, "config" : { "editorType" : "netMail",