diff --git a/Phi/config.json b/Phi/config.json index e6a1d4502..3ee01519a 100644 --- a/Phi/config.json +++ b/Phi/config.json @@ -1,45 +1,33 @@ { "plugins": { "Aircraft": { - "component": { - "key": "Aircraft", - "lib": "topics/Aircraft" - } + "index": 100, + "component": "topics/Aircraft" }, "Environment": { - "component": { - "key": "Environment", - "lib": "topics/Environment" - } + "index": 200, + "component": "topics/Environment" }, "Map": { - "component": { - "key": "Map", - "lib": "topics/Map" - } + "index": 300, + "component": "topics/Map" }, "Tools": { - "component": { - "key": "Tools", - "lib": "topics/Tools" - } + "index": 400, + "component": "topics/Tools" }, "Simulator": { - "component": { - "key": "Simulator", - "lib": "topics/Simulator" - } + "index": 500, + "component": "topics/Simulator" }, "Help": { - "component": { - "key": "Help", - "lib": "topics/Help" - } + "index": 600, + "component": "topics/Help" } } } diff --git a/Phi/main.js b/Phi/main.js index 980d362ca..79b2a8b00 100644 --- a/Phi/main.js +++ b/Phi/main.js @@ -203,20 +203,33 @@ require([ jquery.get('/config.json', null, function(config) { + // merge user config into global config + jquery.get('/fg-home/Phi/config.json', null, function(userConfig) { + for ( var p in userConfig.plugins ) { + config.plugins[p] = userConfig.plugins[p]; + } + var topics = []; if (config && config.plugins ) { for ( var p in config.plugins ) { var plugin = config.plugins[p]; - if (plugin.component && plugin.component.key && plugin.component.lib) { - if (false == ko.components.isRegistered(plugin.component.key)) { - ko.components.register(plugin.component.key, { require: plugin.component.lib }); + if (plugin.component) { + if (false == ko.components.isRegistered(p)) { + ko.components.register(p, { require: plugin.component }); } } topics.push(p); } } + + topics.sort(function(a,b) { + indexa = config.plugins[a].index || 0; + indexb = config.plugins[b].index || 0; + return indexa - indexb; + }); ko.applyBindings(new PhiViewModel(topics), document.getElementById('wrapper')); + }); });