Added support for config options with multiple values (mp3_dir,compdirs) to config.html

This commit is contained in:
Anders Betnér 2006-05-10 20:14:11 +00:00
parent b8027504de
commit 99a1e55497
2 changed files with 58 additions and 11 deletions

View File

@ -47,12 +47,25 @@ var Config = {
$('theform').appendChild(body); $('theform').appendChild(body);
}); });
}, },
_getConfigOptionValue: function(id) { _getConfigOptionValue: function(id,multiple) {
var value = Config.configOptionValues.getElementsByTagName(id); if (multiple) {
if (value.length > 0) { var ret = [];
return Element.textContent(value[0]); var option = Config.configOptionValues.getElementsByTagName(id);
if (option.length > 0) {
$A(option[0].getElementsByTagName('item')).each(function (item) {
ret.push(Element.textContent(item));
});
} else {
ret.push('');
}
return ret;
} else { } else {
return ''; var value = Config.configOptionValues.getElementsByTagName(id);
if (value.length > 0) {
return Element.textContent(value[0]);
} else {
return '';
}
} }
}, },
_buildItem: function(item) { _buildItem: function(item) {
@ -73,7 +86,28 @@ var Config = {
Config._getConfigOptionValue(itemId),80, Config._getConfigOptionValue(itemId),80,
Element.textContent(item.getElementsByTagName('short_description')[0]), Element.textContent(item.getElementsByTagName('short_description')[0]),
''); '');
break; break;
case 'short_text_multiple':
ret = document.createDocumentFragment();
Config._getConfigOptionValue(itemId,true).each(function (value,i) {
ret.appendChild(BuildElement.input(itemId+i,
Element.textContent(item.getElementsByTagName('name')[0]),
value,20,
Element.textContent(item.getElementsByTagName('short_description')[0])
));
});
break;
case 'long_text_multiple':
//###TODO Do something smart instead of just copying
ret = document.createDocumentFragment();
Config._getConfigOptionValue(itemId,true).each(function (value,i) {
ret.appendChild(BuildElement.input(itemId+i,
Element.textContent(item.getElementsByTagName('name')[0]),
value,80,
Element.textContent(item.getElementsByTagName('short_description')[0])
));
});
break;
case 'select': case 'select':
ret = BuildElement.select(itemId, ret = BuildElement.select(itemId,
Element.textContent(item.getElementsByTagName('name')[0]), Element.textContent(item.getElementsByTagName('name')[0]),

View File

@ -7,9 +7,9 @@
The name iTunes and other daap clients should see The name iTunes and other daap clients should see
</short_description> </short_description>
<long_description> <long_description>
This is both the name of the server as advertised via This is both the name of the server as advertised via rendezvous, and the
rendezvous, and the name of the database exported via name of the database exported via DAAP. Also know as "What shows up in
DAAP. Also know as "What shows up in iTunes". iTunes".
</long_description> </long_description>
<type>short_text</type> <type>short_text</type>
</item> </item>
@ -83,7 +83,7 @@
<item id="mp3_dir"> <item id="mp3_dir">
<name>MP3 Directory</name> <name>MP3 Directory</name>
<short_description></short_description> <short_description></short_description>
<type>long_text</type> <type>long_text_multiple</type>
</item> </item>
<item id="extensions"> <item id="extensions">
<name>Extensions</name> <name>Extensions</name>
@ -108,7 +108,7 @@
<item id="compdirs"> <item id="compdirs">
<name>Compilation Directories</name> <name>Compilation Directories</name>
<short_description></short_description> <short_description></short_description>
<type>long_text</type> <type>long_text_multiple</type>
</item> </item>
<item id="art_filename"> <item id="art_filename">
<name>Art Filename</name> <name>Art Filename</name>
@ -157,6 +157,19 @@
</item> </item>
</section> </section>
<section name="Plugins">
<item id="plugin_dir">
<name>Plugin Directory</name>
<short_description></short_description>
<type>long_text</type>
</item>
<item id="plugins">
<name>Plugins</name>
<short_description></short_description>
<type>short_text_multiple</type>
</item>
</section>
<section name="Transcoding"> <section name="Transcoding">
<item id="ssc_prog"> <item id="ssc_prog">
<name>SSC Program</name> <name>SSC Program</name>