From ccc6fdd1b6781228ce6c04eb168d80efa3506ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Betn=C3=A9r?= Date: Sun, 4 Jun 2006 19:28:12 +0000 Subject: [PATCH] Whole sections in config.xml can be marked as advanced, they won't be displayed at all in the basic config UI. (previously the title and the box was visible) Added all but UI part of #118 --- admin-root/config.js | 46 ++++++++++++++++++++++++++++++++++++------- admin-root/config.xml | 30 ++++++++++++++-------------- 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/admin-root/config.js b/admin-root/config.js index aaf72cbb..11e7e101 100644 --- a/admin-root/config.js +++ b/admin-root/config.js @@ -18,14 +18,30 @@ function init() { } var ConfigXML = { config: {}, + advancedSections: [], getItem: function (id) { return this.config[id]; }, getAllItems: function () { return $H(this.config); }, + isAdvancedSection: function (sectionName) { + return this.advancedSections.find(function (name) { + return name == sectionName + }); + }, + getAllAdvancedSections: function () { + return this.advancedSections; + }, + getSectionId: function (sectionName) { + return 'firefly_'+sectionName.replace(/\ /,'').toLowerCase(); + }, parseXML: function(xmlDoc) { $A(xmlDoc.getElementsByTagName('section')).each(function (section) { + if ('true' == section.getAttribute('advanced')) { + // Only used by Config._showAdvancedConfig, Config._showBasicConfig + ConfigXML.advancedSections.push(section.getAttribute('name')); + } $A(section.getElementsByTagName('item')).each(function (item) { var returnItem = {}; $A(item.attributes).each(function (attr) { @@ -70,21 +86,25 @@ var ConfigInitialValues = { sections.each(function (section) { var sectionName = section.nodeName; $A(section.childNodes).each(function (node) { + var itemId = sectionName + ':' + node.nodeName; if (node.firstChild && node.firstChild.hasChildNodes()) { var values = []; $A(node.childNodes).each(function (n) { values.push(Element.textContent(n)); }); - ConfigInitialValues.values[sectionName+':'+node.nodeName] = values; + ConfigInitialValues.values[itemId] = values; } else { - ConfigInitialValues.values[sectionName+':'+node.nodeName] = Element.textContent(node); + ConfigInitialValues.values[itemId] = Element.textContent(node); + } + if (!ConfigXML.getItem(itemId)) { + //###TODO tell the user these are missing } }); - }); + }); } }; -var Config = { - configPath: '', +var Config ={ + configPath: '', init: function () { new Ajax.Request('/config.xml',{method: 'get',onComplete: Config.storeConfigLayout}); }, @@ -117,8 +137,14 @@ var Config = { $A(section.getElementsByTagName('item')).each(function (item) { body.appendChild(Config._buildItem(item.getAttribute('id'))); }); - $('theform').appendChild(head); - $('theform').appendChild(body); + var div = document.createElement('div'); + div.id = ConfigXML.getSectionId(sectionName); + if (ConfigXML.isAdvancedSection(sectionName)) { + div.style.display = 'none'; + } + div.appendChild(head); + div.appendChild(body); + $('theform').appendChild(div); }); // Won't be using the config.xml XML doc anymore get rid of it Config.tmpConfigXML = ''; @@ -282,6 +308,9 @@ var Config = { Element.toggle('advanced_config_button'); Element.toggle('basic_config_button'); Cookie.setVar('show_advanced_config','true',30); + ConfigXML.getAllAdvancedSections().each(function (sectionName) { + Effect.BlindDown(ConfigXML.getSectionId(sectionName)); + }); ConfigXML.getAllItems().each(function (item) { if (item.value.advanced) { var element = $(item.key); @@ -300,6 +329,9 @@ var Config = { Element.toggle('advanced_config_button'); Element.toggle('basic_config_button'); Cookie.removeVar('show_advanced_config'); + ConfigXML.getAllAdvancedSections().each(function (sectionName) { + Effect.BlindUp(ConfigXML.getSectionId(sectionName)); + }); ConfigXML.getAllItems().each(function (item) { if (item.value.advanced) { var element = $(item.key); diff --git a/admin-root/config.xml b/admin-root/config.xml index a22eb9be..6c29b688 100644 --- a/admin-root/config.xml +++ b/admin-root/config.xml @@ -114,8 +114,8 @@ text -
- +
+ Process xmlFiles Should iTunes xml-files be processed? @@ -126,7 +126,7 @@ - + Ignore appledouble Skip appledouble files when scanning @@ -137,7 +137,7 @@ - + Ignore dotfiles Ignore unix hidden dot files @@ -148,7 +148,7 @@ - + Group compilations Compilations are grouped under &Various artists& @@ -203,8 +203,8 @@
-
- +
+ Empty strings select @@ -213,7 +213,7 @@ - + Supports update select @@ -222,7 +222,7 @@ - + Supports browse select @@ -234,26 +234,26 @@
-
- +
+ Plugin Directory text - + Plugins text
-
- +
+ SSC Program text - + SSC Codec Types text