mirror of
https://github.com/owntone/owntone-server.git
synced 2025-03-31 17:53:49 -04:00
Fixed #133 only send config options that has changed when saving from
web config. Temporarily removed the fixpng.js (IE transparent png fix script)
This commit is contained in:
parent
54388b4ab8
commit
a9d912e863
@ -79,6 +79,9 @@ var ConfigInitialValues = {
|
|||||||
getValue: function (id) {
|
getValue: function (id) {
|
||||||
return ConfigInitialValues.values[id];
|
return ConfigInitialValues.values[id];
|
||||||
},
|
},
|
||||||
|
setValue: function (id,value) {
|
||||||
|
this.values[id] = value;
|
||||||
|
},
|
||||||
parseXML: function (xmldoc) {
|
parseXML: function (xmldoc) {
|
||||||
// IE and w3c treat xmldoc differently make shore firstChild is firstchild of <config>
|
// IE and w3c treat xmldoc differently make shore firstChild is firstchild of <config>
|
||||||
if (xmldoc.childNodes[1] && xmldoc.childNodes[1].nodeName == 'config') {
|
if (xmldoc.childNodes[1] && xmldoc.childNodes[1].nodeName == 'config') {
|
||||||
@ -141,6 +144,14 @@ var Config ={
|
|||||||
// Need to store this until showConfig is run
|
// Need to store this until showConfig is run
|
||||||
Config.tmpConfigXML = request.responseXML;
|
Config.tmpConfigXML = request.responseXML;
|
||||||
ConfigXML.parseXML(request.responseXML);
|
ConfigXML.parseXML(request.responseXML);
|
||||||
|
ConfigXML.getAllItems().each(function (item) {
|
||||||
|
if (item.multiple) {
|
||||||
|
//###FIXME default values on item.multiple="true" not possible
|
||||||
|
ConfigInitialValues.setValue(item.id,[]);
|
||||||
|
} else {
|
||||||
|
ConfigInitialValues.setValue(item.id,item.default_value || '');
|
||||||
|
}
|
||||||
|
});
|
||||||
new Ajax.Request('/xml-rpc?method=stats',{method: 'get',onComplete: Config.updateStatus});
|
new Ajax.Request('/xml-rpc?method=stats',{method: 'get',onComplete: Config.updateStatus});
|
||||||
},
|
},
|
||||||
updateStatus: function (request) {
|
updateStatus: function (request) {
|
||||||
@ -440,8 +451,10 @@ function saveForm() {
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
debug(select.id,select.value);
|
debug(select.id,select.value);
|
||||||
} else {
|
} else {
|
||||||
|
if (select.value != ConfigInitialValues.getValue(select.id)) {
|
||||||
postVars.push(Form.Element.serialize(select.id));
|
postVars.push(Form.Element.serialize(select.id));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$A($('theform').getElementsByTagName('input')).each(function (input) {
|
$A($('theform').getElementsByTagName('input')).each(function (input) {
|
||||||
@ -456,7 +469,10 @@ function saveForm() {
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
debug(input.id,input.value);
|
debug(input.id,input.value);
|
||||||
} else {
|
} else {
|
||||||
|
if (input.value != ConfigInitialValues.getValue(input.id)) {
|
||||||
postVars.push(Form.Element.serialize(input.id));
|
postVars.push(Form.Element.serialize(input.id));
|
||||||
|
ConfigInitialValues.setValue(input.id,input.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -465,16 +481,27 @@ function saveForm() {
|
|||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
debug(item.key,item.value.join(','));
|
debug(item.key,item.value.join(','));
|
||||||
} else {
|
} else {
|
||||||
postVars.push(item.key + '=' + item.value.join(','));
|
var currentValue = item.value.join(',');
|
||||||
|
var initialValue = ConfigInitialValues.getValue(item.key).collect(function (value) {
|
||||||
|
return encodeURIComponent(value.replace(/,/g,',,'));
|
||||||
|
});
|
||||||
|
if (currentValue != initialValue) {
|
||||||
|
postVars.push(item.key + '=' + currentValue);
|
||||||
|
ConfigInitialValues.setValue(item.key,item.value.collect(function (value) {
|
||||||
|
return decodeURIComponent(value).replace(/,,/g,',');
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (postVars.length > 0 ) {
|
||||||
new Ajax.Request('/xml-rpc?method=updateconfig',
|
new Ajax.Request('/xml-rpc?method=updateconfig',
|
||||||
{method: 'post',
|
{method: 'post',
|
||||||
parameters: postVars.join('&'),
|
parameters: postVars.join('&'),
|
||||||
onComplete: saved});
|
onComplete: saved});
|
||||||
|
}
|
||||||
|
|
||||||
function debug(id,value) {
|
function debug(id,value) {
|
||||||
var getArr = [];
|
var getArr = [];
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
@ispage playlist.html:<script type="text/javascript" src="lib-js/rico.js"></script>:@
|
@ispage playlist.html:<script type="text/javascript" src="lib-js/rico.js"></script>:@
|
||||||
@ispage playlist.html:<script type="text/javascript" src="playlist.js"></script>:@
|
@ispage playlist.html:<script type="text/javascript" src="playlist.js"></script>:@
|
||||||
<script type="text/javascript" src="mt-daapd.js"></script>
|
<script type="text/javascript" src="mt-daapd.js"></script>
|
||||||
<!--[if lt IE 7.]>
|
|
||||||
<script defer type="text/javascript" src="pngfix.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
</head>
|
</head>
|
||||||
<body @ispage smart.html:onload="init()":@>
|
<body @ispage smart.html:onload="init()":@>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user