mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-30 17:23:44 -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.-->
|
take effect.-->
|
||||||
This is still in beta, but it seems to work. Go ahead and give it a spin.</p>
|
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="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 id="theform" method="get" action="#">
|
||||||
</form>
|
</form>
|
||||||
<div id="buttons"></div>
|
<div id="buttons"></div>
|
||||||
|
@ -155,9 +155,21 @@ var Config = {
|
|||||||
buttons.appendChild(cancel);
|
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) {
|
_buildItem: function(section,itemId) {
|
||||||
var frag = document.createDocumentFragment();
|
var frag = document.createElement('div');
|
||||||
var href;
|
var href;
|
||||||
var item = ConfigXML.getOption(section,itemId);
|
var item = ConfigXML.getOption(section,itemId);
|
||||||
var postId = item.config_section + ':' + itemId;
|
var postId = item.config_section + ':' + itemId;
|
||||||
@ -169,7 +181,7 @@ var Config = {
|
|||||||
if (!values || values.length === 0) {
|
if (!values || values.length === 0) {
|
||||||
values = [''];
|
values = [''];
|
||||||
}
|
}
|
||||||
var parentSpan = Builder.node('span');
|
// var parentSpan = Builder.node('span');
|
||||||
values.each(function (val,i) {
|
values.each(function (val,i) {
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.appendChild(BuildElement.input(postId+i,postId,
|
div.appendChild(BuildElement.input(postId+i,postId,
|
||||||
@ -188,11 +200,11 @@ var Config = {
|
|||||||
Event.observe(href,'click',Config._removeItemEvent);
|
Event.observe(href,'click',Config._removeItemEvent);
|
||||||
div.appendChild(href);
|
div.appendChild(href);
|
||||||
div.appendChild(Builder.node('br'));
|
div.appendChild(Builder.node('br'));
|
||||||
parentSpan.appendChild(div);
|
frag.appendChild(div);
|
||||||
});
|
});
|
||||||
// This is used by cancelForm to find out how
|
// This is used by cancelForm to find out how
|
||||||
// many options a multiple group has
|
// many options a multiple group has
|
||||||
frag.appendChild(parentSpan);
|
// frag.appendChild(parentSpan);
|
||||||
href = Builder.node('a',{href:'javascript://',className:'addItemHref'},item.add_item_label);
|
href = Builder.node('a',{href:'javascript://',className:'addItemHref'},item.add_item_label);
|
||||||
frag.appendChild(href);
|
frag.appendChild(href);
|
||||||
Event.observe(href,'click',Config._addItemEvent);
|
Event.observe(href,'click',Config._addItemEvent);
|
||||||
@ -224,6 +236,9 @@ var Config = {
|
|||||||
alert('This should not happen (1)');
|
alert('This should not happen (1)');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!Cookie.getVar('show_advanced_config') && item.advanced) {
|
||||||
|
frag.style.display = 'none';
|
||||||
|
}
|
||||||
return frag;
|
return frag;
|
||||||
},
|
},
|
||||||
_addItemEvent: function (e) {
|
_addItemEvent: function (e) {
|
||||||
@ -277,6 +292,42 @@ var Config = {
|
|||||||
},
|
},
|
||||||
_browse: function(e) {
|
_browse: function(e) {
|
||||||
alert('Browse');
|
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 = {
|
var BuildElement = {
|
||||||
@ -384,7 +435,7 @@ var i=0;
|
|||||||
while (initialValuesCount > currentElements.length) {
|
while (initialValuesCount > currentElements.length) {
|
||||||
i++;
|
i++;
|
||||||
if (i > 10) {
|
if (i > 10) {
|
||||||
alert('An important part came off (silly errormessage 2');
|
alert('An important part came off (silly errormessage 2)');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Config._addItem(currentElements[currentElements.length-1].parentNode);
|
Config._addItem(currentElements[currentElements.length-1].parentNode);
|
||||||
@ -448,3 +499,26 @@ function DataDumper(obj,n,prefix){
|
|||||||
}
|
}
|
||||||
return str;
|
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>
|
</long_description>
|
||||||
<type size="20">text</type>
|
<type size="20">text</type>
|
||||||
</item>
|
</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>
|
<name>Web Root</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="80" browse="directory">text</type>
|
<type size="80" browse="directory">text</type>
|
||||||
</item>
|
</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>
|
<name>Port</name>
|
||||||
<short_description>
|
<short_description>
|
||||||
The port the server should run at; default is 3689
|
The port the server should run at; default is 3689
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="80" browse="file">text</type>
|
<type size="80" browse="file">text</type>
|
||||||
</item>
|
</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>
|
<name>Run As</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="20">text</type>
|
<type size="20">text</type>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
</short_description>
|
</short_description>
|
||||||
<type size="20">text</type>
|
<type size="20">text</type>
|
||||||
</item>
|
</item>
|
||||||
<item id="compress" config_section="general">
|
<item id="compress" advanced="true" config_section="general">
|
||||||
<name>Compress</name>
|
<name>Compress</name>
|
||||||
<short_description>
|
<short_description>
|
||||||
Should browsing data be compressed on the way to the client?
|
Should browsing data be compressed on the way to the client?
|
||||||
@ -60,7 +60,7 @@
|
|||||||
<option value="1">Yes</option>
|
<option value="1">Yes</option>
|
||||||
</options>
|
</options>
|
||||||
</item>
|
</item>
|
||||||
<item id="debuglevel" config_section="general">
|
<item id="debuglevel" advanced="true" config_section="general">
|
||||||
<name>Debug Level</name>
|
<name>Debug Level</name>
|
||||||
<short_description>
|
<short_description>
|
||||||
Possible values are 0 to 9, 9 being the most detailed debug level.
|
Possible values are 0 to 9, 9 being the most detailed debug level.
|
||||||
@ -108,7 +108,7 @@
|
|||||||
<option value="1">Yes</option>
|
<option value="1">Yes</option>
|
||||||
</options>
|
</options>
|
||||||
</item>
|
</item>
|
||||||
<item id="compdirs" config_section="general">
|
<item id="compdirs" advanced="true" config_section="general">
|
||||||
<name>Compilation Directories</name>
|
<name>Compilation Directories</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="80" multiple="true" add_item_label="Add compilation directory" browse="directory">text</type>
|
<type size="80" multiple="true" add_item_label="Add compilation directory" browse="directory">text</type>
|
||||||
@ -116,7 +116,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="Database">
|
<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>
|
<name>Database Type</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type default_value="sqlite">select</type>
|
<type default_value="sqlite">select</type>
|
||||||
@ -125,7 +125,7 @@
|
|||||||
<option value="sqlite3">sqlite3</option>
|
<option value="sqlite3">sqlite3</option>
|
||||||
</options>
|
</options>
|
||||||
</item>
|
</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>
|
<name>Database Directory</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="80" browse="directory">text</type>
|
<type size="80" browse="directory">text</type>
|
||||||
@ -159,12 +159,12 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="Plugins">
|
<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>
|
<name>Plugin Directory</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="80" browse="directory">text</type>
|
<type size="80" browse="directory">text</type>
|
||||||
</item>
|
</item>
|
||||||
<item id="plugins" config_section="plugins" restart="true">
|
<item id="plugins" advanced="true" config_section="plugins" restart="true">
|
||||||
<name>Plugins</name>
|
<name>Plugins</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="20" multiple="true" add_item_label="Add plugin">text</type>
|
<type size="20" multiple="true" add_item_label="Add plugin">text</type>
|
||||||
@ -172,12 +172,12 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="Transcoding">
|
<section name="Transcoding">
|
||||||
<item id="ssc_prog" config_section="general">
|
<item id="ssc_prog" advanced="true" config_section="general">
|
||||||
<name>SSC Program</name>
|
<name>SSC Program</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="80" browse="file">text</type>
|
<type size="80" browse="file">text</type>
|
||||||
</item>
|
</item>
|
||||||
<item id="ssc_codectypes" config_section="general">
|
<item id="ssc_codectypes" advanced="true" config_section="general">
|
||||||
<name>SSC Codec Types</name>
|
<name>SSC Codec Types</name>
|
||||||
<short_description></short_description>
|
<short_description></short_description>
|
||||||
<type size="80">text</type>
|
<type size="80">text</type>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user