diff --git a/admin-root/config.html b/admin-root/config.html index a7a103b5..254d217f 100644 --- a/admin-root/config.html +++ b/admin-root/config.html @@ -37,7 +37,7 @@ make changes to these settings, they will not be reflected in the running server. The server must be restarted for these values to take effect.--> This is work in progress. no changes saved, some fields not updated, some not even in mt-daapd.conf
- + diff --git a/admin-root/config.js b/admin-root/config.js index 6fa64466..3a479097 100644 --- a/admin-root/config.js +++ b/admin-root/config.js @@ -1,14 +1,11 @@ -Event.observe(window,'load',function (e) {Config.init();}); +Event.observe(window,'load',init); // Config isn't defined until after the Event.observe above // I could have put it below Config = ... but I want all window.load events // at the start of the file function init() { Config.init(); -} -function hej() { - alert(Form.serialize('theform')); - + Event.observe($('button_save'),'click',saveForm); } var ConfigXML = { config: [], @@ -47,7 +44,6 @@ var ConfigXML = { }); ConfigXML.config[section.getAttribute('name')] = items; }); - a=12; } }; var Config = { @@ -255,6 +251,21 @@ var BuildElement = { } } +function saved(req) { + alert(req.responseText); +} +function saveForm() { + var getString = []; + $A($('theform').getElementsByTagName('input')).each(function (input,i) { + if ((i > 10) && (i < 17)) { + getString.push(Form.Element.serialize(input.id)); + } + }); + getString = getString.join('&'); + new Ajax.Request('/xml-rpc?method=updateconfig&'+getString,{method: 'get', + onComplete: saved + }); +} Object.extend(Element, { removeChildren: function(element) { while(element.hasChildNodes()) {