Commit a8de45a9 authored by Francois Cartegnie's avatar Francois Cartegnie

web intf: fix uri decoding when browsing.

And now make use of URI
parent 7e326833
...@@ -163,16 +163,16 @@ function sendCommand(params,append){ ...@@ -163,16 +163,16 @@ function sendCommand(params,append){
} }
} }
function browse(dir){ function browse(dir){
dir = dir==undefined ? '~' : dir; dir = dir==undefined ? 'file://~' : dir;
$.ajax({ $.ajax({
url: 'requests/browse.xml', url: 'requests/browse.xml',
data:'dir='+encodeURIComponent(dir), data:'uri='+encodeURIComponent(dir),
success: function(data,status,jqXHR){ success: function(data,status,jqXHR){
var tgt = browse_target.indexOf('__')==-1 ? browse_target : browse_target.substr(0,browse_target.indexOf('__')); var tgt = browse_target.indexOf('__')==-1 ? browse_target : browse_target.substr(0,browse_target.indexOf('__'));
$('#browse_elements').empty(); $('#browse_elements').empty();
$('element',data).each(function(){ $('element',data).each(function(){
if($(this).attr('type')=='dir' || $.inArray($(this).attr('name').substr(-3),video_types)!=-1 || $.inArray($(this).attr('name').substr(-3),audio_types)!=-1){ if($(this).attr('type')=='dir' || $.inArray($(this).attr('name').substr(-3),video_types)!=-1 || $.inArray($(this).attr('name').substr(-3),audio_types)!=-1){
$('#browse_elements').append(createElementLi($(this).attr('name'),$(this).attr('type'),$(this).attr('path'),$(this).attr('name').substr(-3))); $('#browse_elements').append(createElementLi($(this).attr('name'),$(this).attr('type'),$(this).attr('uri'),$(this).attr('name').substr(-3)));
} }
}); });
$('[opendir]').dblclick(function(){ $('[opendir]').dblclick(function(){
...@@ -195,7 +195,7 @@ function browse(dir){ ...@@ -195,7 +195,7 @@ function browse(dir){
case '#mobile': case '#mobile':
break; break;
default: default:
sendCommand('command=in_play&input=file://'+encodeURIComponent($(this).attr('openfile'))); sendCommand('command=in_play&input='+encodeURIComponent($(this).attr('openfile')));
break; break;
} }
$('#window_browse').dialog('close'); $('#window_browse').dialog('close');
...@@ -212,7 +212,7 @@ function browse(dir){ ...@@ -212,7 +212,7 @@ function browse(dir){
$('[openfile]').click(function(){ $('[openfile]').click(function(){
switch(tgt){ switch(tgt){
case '#mobile': case '#mobile':
sendCommand('command=in_play&input=file://'+encodeURIComponent($(this).attr('openfile')),"window.location='mobile.html'"); sendCommand('command=in_play&input='+encodeURIComponent($(this).attr('openfile')),"window.location='mobile.html'");
break; break;
default: default:
break; break;
......
...@@ -341,15 +341,21 @@ getbrowsetable = function () ...@@ -341,15 +341,21 @@ getbrowsetable = function ()
local uri = _GET["uri"] local uri = _GET["uri"]
--uri takes precedence, but fall back to dir --uri takes precedence, but fall back to dir
if uri then if uri then
if uri == "file://~" then
dir = uri
else
dir = vlc.strings.make_path(uri) dir = vlc.strings.make_path(uri)
end
else else
dir = _GET["dir"] dir = _GET["dir"]
end end
--backwards compatibility with old format driveLetter:\\.. --backwards compatibility with old format driveLetter:\\..
--this is forgiving with the slash type and number --this is forgiving with the slash type and number
if dir then
local position=string.find(dir, '%a:[\\/]*%.%.',0) local position=string.find(dir, '%a:[\\/]*%.%.',0)
if position==1 then dir="" end if position==1 then dir="" end
end
local result={} local result={}
--paths are returned as an array of elements --paths are returned as an array of elements
...@@ -357,7 +363,7 @@ getbrowsetable = function () ...@@ -357,7 +363,7 @@ getbrowsetable = function ()
result.element._array={} result.element._array={}
if dir then if dir then
if dir == "~" then dir = vlc.misc.homedir() end if dir == "~" or dir == "file://~" then dir = vlc.misc.homedir() end
-- FIXME: hack for Win32 drive list -- FIXME: hack for Win32 drive list
if dir~="" then if dir~="" then
dir = common.realpath(dir.."/") dir = common.realpath(dir.."/")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment