mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-27 16:00:58 -04:00
Added support for basic and advanced config options. What goes into
advanced and what goes into basic is discussable. I just made a proposal in config.xml
This commit is contained in:
parent
0f27d923a5
commit
310b2f6db8
@ -43,6 +43,7 @@ running server. The server must be restarted for these values to
|
||||
take effect.-->
|
||||
This is still in beta, but it seems to work. Go ahead and give it a spin.</p>
|
||||
<div id="config_not_writable_warning" style="display: none;">Your config file is not writable, you can not change anything using this webpage</div>
|
||||
<div id="toggle_basic_advanced"></div>
|
||||
<form id="theform" method="get" action="#">
|
||||
</form>
|
||||
<div id="buttons"></div>
|
||||
|
@ -155,9 +155,21 @@ var Config = {
|
||||
buttons.appendChild(cancel);
|
||||
}
|
||||
}
|
||||
var advanced = Builder.node('a',{href: 'javascript://',id:'basic_config_button'},'Show basic config');
|
||||
Event.observe(advanced,'click',Config._showBasicConfig);
|
||||
var basic = Builder.node('a',{href: 'javascript://',id:'advanced_config_button'},'Show advanced config');
|
||||
Event.observe(basic,'click',Config._showAdvancedConfig);
|
||||
if (Cookie.getVar('show_advanced_config')) {
|
||||
basic.style.display = 'none';
|
||||
} else {
|
||||
advanced.style.display = 'none';
|
||||
}
|
||||
var div = $('toggle_basic_advanced');
|
||||
div.appendChild(advanced);
|
||||
div.appendChild(basic);
|
||||
},
|
||||
_buildItem: function(section,itemId) {
|
||||
var frag = document.createDocumentFragment();
|
||||
var frag = document.createElement('div');
|
||||
var href;
|
||||
var item = ConfigXML.getOption(section,itemId);
|
||||
var postId = item.config_section + ':' + itemId;
|
||||
@ -169,7 +181,7 @@ var Config = {
|
||||
if (!values || values.length === 0) {
|
||||
values = [''];
|
||||
}
|
||||
var parentSpan = Builder.node('span');
|
||||
// var parentSpan = Builder.node('span');
|
||||
values.each(function (val,i) {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(BuildElement.input(postId+i,postId,
|
||||
@ -188,11 +200,11 @@ var Config = {
|
||||
Event.observe(href,'click',Config._removeItemEvent);
|
||||
div.appendChild(href);
|
||||
div.appendChild(Builder.node('br'));
|
||||
parentSpan.appendChild(div);
|
||||
frag.appendChild(div);
|
||||
});
|
||||
// This is used by cancelForm to find out how
|
||||
// many options a multiple group has
|
||||
frag.appendChild(parentSpan);
|
||||
// frag.appendChild(parentSpan);
|
||||
href = Builder.node('a',{href:'javascript://',className:'addItemHref'},item.add_item_label);
|
||||
frag.appendChild(href);
|
||||
Event.observe(href,'click',Config._addItemEvent);
|
||||
@ -224,6 +236,9 @@ var Config = {
|
||||
alert('This should not happen (1)');
|
||||
break;
|
||||
}
|
||||
if (!Cookie.getVar('show_advanced_config') && item.advanced) {
|
||||
frag.style.display = 'none';
|
||||
}
|
||||
return frag;
|
||||
},
|
||||
_addItemEvent: function (e) {
|
||||
@ -277,6 +292,42 @@ var Config = {
|
||||
},
|
||||
_browse: function(e) {
|
||||
alert('Browse');
|
||||
},
|
||||
_showAdvancedConfig: function (e) {
|
||||
Element.toggle('advanced_config_button');
|
||||
Element.toggle('basic_config_button');
|
||||
Cookie.setVar('show_advanced_config','true',30);
|
||||
$H(ConfigXML.configIndex).each(function (item) {
|
||||
if (item.value.advanced) {
|
||||
var element = $(item.key);
|
||||
if (!element) {
|
||||
// Handle options with multiple values
|
||||
$A(document.getElementsByName(item.key)).each(function (el) {
|
||||
Effect.BlindDown(el.parentNode.parentNode);
|
||||
});
|
||||
} else {
|
||||
Effect.BlindDown(element.parentNode);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
_showBasicConfig: function (e) {
|
||||
Element.toggle('advanced_config_button');
|
||||
Element.toggle('basic_config_button');
|
||||
Cookie.removeVar('show_advanced_config');
|
||||
$H(ConfigXML.configIndex).each(function (item) {
|
||||
if (item.value.advanced) {
|
||||
var element = $(item.key);
|
||||
if (!element) {
|
||||
// Handle options with multiple values
|
||||
$A(document.getElementsByName(item.key)).each(function (el) {
|
||||
Effect.BlindUp(el.parentNode.parentNode);
|
||||
});
|
||||
} else {
|
||||
Effect.BlindUp($(item.key).parentNode);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var BuildElement = {
|
||||
@ -384,7 +435,7 @@ var i=0;
|
||||
while (initialValuesCount > currentElements.length) {
|
||||
i++;
|
||||
if (i > 10) {
|
||||
alert('An important part came off (silly errormessage 2');
|
||||
alert('An important part came off (silly errormessage 2)');
|
||||
return;
|
||||
}
|
||||
Config._addItem(currentElements[currentElements.length-1].parentNode);
|
||||
@ -448,3 +499,26 @@ function DataDumper(obj,n,prefix){
|
||||
}
|
||||
return str;
|
||||
}
|
||||
var Cookie = {
|
||||
getVar: function(name) {
|
||||
var cookie = document.cookie;
|
||||
if (cookie.length > 0) {
|
||||
cookie += ';';
|
||||
}
|
||||
re = new RegExp(name + '\=(.*?);' );
|
||||
if (cookie.match(re)) {
|
||||
return RegExp.$1;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
setVar: function(name,value,days) {
|
||||
days = days || 30;
|
||||
var expire = new Date(new Date().getTime() + days*86400);
|
||||
document.cookie = name + '=' + value +';expires=' + expire.toUTCString();
|
||||
},
|
||||
removeVar: function(name) {
|
||||
var date = new Date(12);
|
||||
document.cookie = name + '=;expires=' + date.toUTCString();
|
||||
}
|
||||
};
|
||||
|
@ -13,12 +13,12 @@
|
||||
</long_description>
|
||||
<type size="20">text</type>
|
||||
</item>
|
||||
<item id="web_root" config_section="general" required="true" restart="true">
|
||||
<item id="web_root" advanced="true" config_section="general" required="true" restart="true">
|
||||
<name>Web Root</name>
|
||||
<short_description></short_description>
|
||||
<type size="80" browse="directory">text</type>
|
||||
</item>
|
||||
<item id="port" config_section="general" required="true" restart="true">
|
||||
<item id="port" advanced="true" config_section="general" required="true" restart="true">
|
||||
<name>Port</name>
|
||||
<short_description>
|
||||
The port the server should run at; default is 3689
|
||||
@ -30,7 +30,7 @@
|
||||
<short_description></short_description>
|
||||
<type size="80" browse="file">text</type>
|
||||
</item>
|
||||
<item id="runas" config_section="general" required="true" restart="true">
|
||||
<item id="runas" advanced="true" config_section="general" required="true" restart="true">
|
||||
<name>Run As</name>
|
||||
<short_description></short_description>
|
||||
<type size="20">text</type>
|
||||
@ -49,7 +49,7 @@
|
||||
</short_description>
|
||||
<type size="20">text</type>
|
||||
</item>
|
||||
<item id="compress" config_section="general">
|
||||
<item id="compress" advanced="true" config_section="general">
|
||||
<name>Compress</name>
|
||||
<short_description>
|
||||
Should browsing data be compressed on the way to the client?
|
||||
@ -60,7 +60,7 @@
|
||||
<option value="1">Yes</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="debuglevel" config_section="general">
|
||||
<item id="debuglevel" advanced="true" config_section="general">
|
||||
<name>Debug Level</name>
|
||||
<short_description>
|
||||
Possible values are 0 to 9, 9 being the most detailed debug level.
|
||||
@ -108,7 +108,7 @@
|
||||
<option value="1">Yes</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="compdirs" config_section="general">
|
||||
<item id="compdirs" advanced="true" config_section="general">
|
||||
<name>Compilation Directories</name>
|
||||
<short_description></short_description>
|
||||
<type size="80" multiple="true" add_item_label="Add compilation directory" browse="directory">text</type>
|
||||
@ -116,7 +116,7 @@
|
||||
</section>
|
||||
|
||||
<section name="Database">
|
||||
<item id="db_type" config_section="general" restart="true">
|
||||
<item id="db_type" advanced="true" config_section="general" restart="true">
|
||||
<name>Database Type</name>
|
||||
<short_description></short_description>
|
||||
<type default_value="sqlite">select</type>
|
||||
@ -125,7 +125,7 @@
|
||||
<option value="sqlite3">sqlite3</option>
|
||||
</options>
|
||||
</item>
|
||||
<item id="db_parms" config_section="general" restart="true">
|
||||
<item id="db_parms" advanced="true" config_section="general" restart="true">
|
||||
<name>Database Directory</name>
|
||||
<short_description></short_description>
|
||||
<type size="80" browse="directory">text</type>
|
||||
@ -159,12 +159,12 @@
|
||||
</section>
|
||||
|
||||
<section name="Plugins">
|
||||
<item id="plugin_dir" config_section="plugins" restart="true">
|
||||
<item id="plugin_dir" advanced="true" config_section="plugins" restart="true">
|
||||
<name>Plugin Directory</name>
|
||||
<short_description></short_description>
|
||||
<type size="80" browse="directory">text</type>
|
||||
</item>
|
||||
<item id="plugins" config_section="plugins" restart="true">
|
||||
<item id="plugins" advanced="true" config_section="plugins" restart="true">
|
||||
<name>Plugins</name>
|
||||
<short_description></short_description>
|
||||
<type size="20" multiple="true" add_item_label="Add plugin">text</type>
|
||||
@ -172,12 +172,12 @@
|
||||
</section>
|
||||
|
||||
<section name="Transcoding">
|
||||
<item id="ssc_prog" config_section="general">
|
||||
<item id="ssc_prog" advanced="true" config_section="general">
|
||||
<name>SSC Program</name>
|
||||
<short_description></short_description>
|
||||
<type size="80" browse="file">text</type>
|
||||
</item>
|
||||
<item id="ssc_codectypes" config_section="general">
|
||||
<item id="ssc_codectypes" advanced="true" config_section="general">
|
||||
<name>SSC Codec Types</name>
|
||||
<short_description></short_description>
|
||||
<type size="80">text</type>
|
||||
|
Loading…
x
Reference in New Issue
Block a user