mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-02 17:36:00 -05:00
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
This commit is contained in:
parent
2ba789d0a1
commit
ccc6fdd1b6
@ -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);
|
||||
|
@ -114,8 +114,8 @@
|
||||
<type size="80" multiple="true" add_item_label="Add compilation directory" browse="directory">text</type>
|
||||
</item>
|
||||
</section>
|
||||
<section name="Scanning">
|
||||
<item id="scanning:process_xml" advanced="true">
|
||||
<section name="Scanning" advanced="true">
|
||||
<item id="scanning:process_xml">
|
||||
<name>Process xmlFiles</name>
|
||||
<short_description>
|
||||
Should iTunes xml-files be processed?
|
||||
@ -126,7 +126,7 @@
|
||||
<option value="1">Yes</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="scanning:ignore_appledouble" advanced="true">
|
||||
<item id="scanning:ignore_appledouble">
|
||||
<name>Ignore appledouble</name>
|
||||
<short_description>
|
||||
Skip appledouble files when scanning
|
||||
@ -137,7 +137,7 @@
|
||||
<option value="1">Yes</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="scanning:ignore_dotfiles" advanced="true">
|
||||
<item id="scanning:ignore_dotfiles">
|
||||
<name>Ignore dotfiles</name>
|
||||
<short_description>
|
||||
Ignore unix hidden dot files
|
||||
@ -148,7 +148,7 @@
|
||||
<option value="1">Yes</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="scanning:concat_compilations" advanced="true">
|
||||
<item id="scanning:concat_compilations">
|
||||
<name>Group compilations</name>
|
||||
<short_description>
|
||||
Compilations are grouped under &Various artists&
|
||||
@ -203,8 +203,8 @@
|
||||
</item>
|
||||
</section>
|
||||
|
||||
<section name="Daap">
|
||||
<item id="daap:empty_strings" advanced="true">
|
||||
<section name="Daap" advanced="true">
|
||||
<item id="daap:empty_strings">
|
||||
<name>Empty strings</name>
|
||||
<short_description></short_description>
|
||||
<type default_value="0">select</type>
|
||||
@ -213,7 +213,7 @@
|
||||
<option value="1">Yes</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="daap:supports_update" advanced="true">
|
||||
<item id="daap:supports_update">
|
||||
<name>Supports update</name>
|
||||
<short_description></short_description>
|
||||
<type default_value="1">select</type>
|
||||
@ -222,7 +222,7 @@
|
||||
<option value="1">Yes</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="daap:supports_browse" advanced="true">
|
||||
<item id="daap:supports_browse">
|
||||
<name>Supports browse</name>
|
||||
<short_description></short_description>
|
||||
<type default_value="1">select</type>
|
||||
@ -234,26 +234,26 @@
|
||||
|
||||
</section>
|
||||
|
||||
<section name="Plugins">
|
||||
<item id="plugins:plugin_dir" advanced="true" config_section="plugins" restart="true">
|
||||
<section name="Plugins" advanced="true">
|
||||
<item id="plugins:plugin_dir" config_section="plugins" restart="true">
|
||||
<name>Plugin Directory</name>
|
||||
<short_description></short_description>
|
||||
<type size="80" browse="directory">text</type>
|
||||
</item>
|
||||
<item id="plugins:plugins" advanced="true" config_section="plugins" restart="true">
|
||||
<item id="plugins:plugins" config_section="plugins" restart="true">
|
||||
<name>Plugins</name>
|
||||
<short_description></short_description>
|
||||
<type size="20" multiple="true" add_item_label="Add plugin">text</type>
|
||||
</item>
|
||||
</section>
|
||||
|
||||
<section name="Transcoding">
|
||||
<item id="general:ssc_prog" advanced="true">
|
||||
<section name="Transcoding" advanced="true">
|
||||
<item id="general:ssc_prog">
|
||||
<name>SSC Program</name>
|
||||
<short_description></short_description>
|
||||
<type size="80" browse="file">text</type>
|
||||
</item>
|
||||
<item id="general:ssc_codectypes" advanced="true">
|
||||
<item id="general:ssc_codectypes">
|
||||
<name>SSC Codec Types</name>
|
||||
<short_description></short_description>
|
||||
<type size="80">text</type>
|
||||
|
Loading…
x
Reference in New Issue
Block a user