Patch from Stephane Moreau to make apache rewrites easier

This commit is contained in:
Ron Pedde 2007-08-27 00:57:47 +00:00
parent f2174b3173
commit 153e874bef
5 changed files with 21 additions and 18 deletions

View File

@ -146,6 +146,9 @@ Gareth Potter
Anton Johansson Anton Johansson
* Swedish Translations * Swedish Translations
Iam Burrell Ian Burrell
* configure patches to put plugins in libdir * configure patches to put plugins in libdir
* RH/Centos/Fedora specfiles * RH/Centos/Fedora specfiles
Stephane Moreau
* admin page updates to make apache rewrites easier

View File

@ -139,7 +139,7 @@ var ConfigInitialValues = {
var Config ={ var Config ={
configPath: '', configPath: '',
init: function () { init: function () {
new Ajax.Request('/config.xml',{method: 'get',onComplete: Config.storeConfigLayout}); new Ajax.Request('config.xml',{method: 'get',onComplete: Config.storeConfigLayout});
}, },
storeConfigLayout: function (request) { storeConfigLayout: function (request) {
// Need to store this until showConfig is run // Need to store this until showConfig is run
@ -153,12 +153,12 @@ var Config ={
ConfigInitialValues.setValue(item.id,item.default_value || ''); 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) {
Config.configPath = Element.textContent(request.responseXML.getElementsByTagName('config_path')[0]); Config.configPath = Element.textContent(request.responseXML.getElementsByTagName('config_path')[0]);
Config.isWritable = Element.textContent(request.responseXML.getElementsByTagName('writable_config')[0]) == '1'; Config.isWritable = Element.textContent(request.responseXML.getElementsByTagName('writable_config')[0]) == '1';
new Ajax.Request('/xml-rpc?method=config',{method: 'get',onComplete: Config.showConfig}); new Ajax.Request('xml-rpc?method=config',{method: 'get',onComplete: Config.showConfig});
}, },
showConfig: function (request) { showConfig: function (request) {
ConfigInitialValues.parseXML(request.responseXML); ConfigInitialValues.parseXML(request.responseXML);
@ -530,7 +530,7 @@ function saveForm() {
return; return;
} }
if (postVars.length > 0 ) { 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});
@ -545,10 +545,10 @@ function saveForm() {
getArr.push('key='+encodeURIComponent(a[1])); getArr.push('key='+encodeURIComponent(a[1]));
getArr.push('value='+encodeURIComponent(value)); getArr.push('value='+encodeURIComponent(value));
getArr.push('verify_only=1'); getArr.push('verify_only=1');
getString = '/xml-rpc?method=setconfig&' + getArr.join('&'); getString = 'xml-rpc?method=setconfig&' + getArr.join('&');
} else { } else {
getString = '/xml-rpc?method=updateconfig&' + Form.Element.serialize(id); getString = 'xml-rpc?method=updateconfig&' + Form.Element.serialize(id);
} }
var output = id + '=' + value; var output = id + '=' + value;
new Ajax.Request(getString, new Ajax.Request(getString,
@ -608,4 +608,4 @@ var i=0;
}); });
return; return;
} }

View File

@ -131,7 +131,7 @@ CustomDropzone.prototype = (new Rico.Dropzone()).extend( {
}, },
_insert: function(songids) { _insert: function(songids) {
var url = '/databases/1/containers/' + this.htmlElement.value + "/items/add?output=xml&dmap.itemid=" + songids; var url = 'databases/1/containers/' + this.htmlElement.value + "/items/add?output=xml&dmap.itemid=" + songids;
new Ajax.Request(url ,{method: 'get',onComplete:this.responseAdd}); new Ajax.Request(url ,{method: 'get',onComplete:this.responseAdd});
}, },
@ -160,7 +160,7 @@ function initPlaylist() {
Ajax.Responders.register({ onCreate: Spinner.incRequestCount, Ajax.Responders.register({ onCreate: Spinner.incRequestCount,
onComplete: Spinner.decRequestCount}); onComplete: Spinner.decRequestCount});
new Ajax.Request('/databases/1/containers?output=xml',{method: 'get',onComplete:rsSource}); new Ajax.Request('databases/1/containers?output=xml',{method: 'get',onComplete:rsSource});
Query.send('genres'); Query.send('genres');
Event.observe('search','keypress',EventHandler.searchKeyPress); Event.observe('search','keypress',EventHandler.searchKeyPress);
Event.observe('source','change',EventHandler.sourceChange); Event.observe('source','change',EventHandler.sourceChange);
@ -222,7 +222,7 @@ var Source = {
}); });
}, },
addPlaylist: function () { addPlaylist: function () {
var url = '/databases/1/containers/add?output=xml'; var url = 'databases/1/containers/add?output=xml';
var name= 'untitled playlist'; var name= 'untitled playlist';
if (this._playlistExists(name)) { if (this._playlistExists(name)) {
var i=1; var i=1;
@ -242,7 +242,7 @@ var Source = {
}, },
removePlaylist: function () { removePlaylist: function () {
if (window.confirm('Really delete playlist?')) { if (window.confirm('Really delete playlist?')) {
var url = '/databases/1/containers/del?output=xml'; var url = 'databases/1/containers/del?output=xml';
url += '&dmap.itemid=' + $('source').value; url += '&dmap.itemid=' + $('source').value;
new Ajax.Request(url ,{method: 'get',onComplete:this.response}); new Ajax.Request(url ,{method: 'get',onComplete:this.response});
var option = this._getOptionElement($('source').value); var option = this._getOptionElement($('source').value);
@ -251,7 +251,7 @@ var Source = {
}, },
savePlaylistName: function () { savePlaylistName: function () {
input = $('edit_playlist_name'); input = $('edit_playlist_name');
var url = '/databases/1/containers/edit?output=xml'; var url = 'databases/1/containers/edit?output=xml';
url += '&dmap.itemid=' + Source.playlistId; url += '&dmap.itemid=' + Source.playlistId;
url += '&dmap.itemname=' + encodeURIComponent(input.value); url += '&dmap.itemname=' + encodeURIComponent(input.value);
new Ajax.Request(url ,{method: 'get',onComplete:this.response}); new Ajax.Request(url ,{method: 'get',onComplete:this.response});

View File

@ -87,10 +87,10 @@ function pl_update() {
if(id == '0') { if(id == '0') {
/* new playlist... post it! */ /* new playlist... post it! */
var url = '/databases/1/containers/add?output=xml&org.mt-daapd.playlist-type=1&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; var url = 'databases/1/containers/add?output=xml&org.mt-daapd.playlist-type=1&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec;
result = pl_exec(url,false); result = pl_exec(url,false);
} else { } else {
var url='/databases/1/containers/edit?output=xml&dmap.itemid=' + id + '&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; var url='databases/1/containers/edit?output=xml&dmap.itemid=' + id + '&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec;
result = pl_exec(url,false); result = pl_exec(url,false);
} }
@ -121,7 +121,7 @@ function pl_new() {
function pl_delete(pl_id) { function pl_delete(pl_id) {
if(confirm('Are you sure you want to delete playlist "' + playlist_info[pl_id]['name'] + '"?')) { if(confirm('Are you sure you want to delete playlist "' + playlist_info[pl_id]['name'] + '"?')) {
result=pl_exec("/databases/1/containers/del?output=xml&dmap.itemid=" + pl_id,false); result=pl_exec("databases/1/containers/del?output=xml&dmap.itemid=" + pl_id,false);
init(); init();
} }
} }
@ -237,7 +237,7 @@ function pl_state_change() {
} }
function init() { function init() {
pl_exec("/databases/1/containers?output=xml&meta=dmap.itemid,dmap.itemname,org.mt-daapd.playlist-type,org.mt-daapd.smart-playlist-spec",true); pl_exec("databases/1/containers?output=xml&meta=dmap.itemid,dmap.itemname,org.mt-daapd.playlist-type,org.mt-daapd.smart-playlist-spec",true);
} }
function pl_exec(url, async) { function pl_exec(url, async) {

View File

@ -466,7 +466,7 @@ void config_handler(WS_CONNINFO *pwsc) {
/* this is quite broken, but will work */ /* this is quite broken, but will work */
os_stat(resolved_path,&sb); os_stat(resolved_path,&sb);
if(S_ISDIR(sb.st_mode)) { if(S_ISDIR(sb.st_mode)) {
ws_addresponseheader(pwsc,"Location","/index.html"); ws_addresponseheader(pwsc,"Location","index.html");
ws_returnerror(pwsc,302,"Moved"); ws_returnerror(pwsc,302,"Moved");
config_set_status(pwsc,0,NULL); config_set_status(pwsc,0,NULL);
ws_should_close(pwsc,1); ws_should_close(pwsc,1);