respect download_url given by vfs

This commit is contained in:
Ralf Becker 2015-05-01 10:53:32 +00:00
parent 3bbc7561f9
commit f4e5718041
2 changed files with 22 additions and 14 deletions

View File

@ -753,7 +753,7 @@ app.classes.filemanager = AppJS.extend(
} }
else else
{ {
egw.open({path: path, type: data.data.mime}, 'file','view',null,'_browser'); egw.open({path: path, type: data.data.mime, download_url: data.data.download_url}, 'file','view',null,'_browser');
} }
return false; return false;
}, },

View File

@ -134,7 +134,8 @@ egw.extend('links', egw.MODULE_GLOBAL, function()
/** /**
* Get handler (link-data) for given path and mime-type * Get handler (link-data) for given path and mime-type
* *
* @param {string|object} _path vfs path, egw_link::set_data() id or object with attr path or id, app2 and id2 (path=/apps/app2/id2/id) * @param {string|object} _path vfs path, egw_link::set_data() id or
* object with attr path, optinal download_url or id, app2 and id2 (path=/apps/app2/id2/id)
* @param {string} _type mime-type, if not given in _path object * @param {string} _type mime-type, if not given in _path object
* @return {string|object} string with EGw relative link, array with get-parameters for '/index.php' or null (directory and not filemanager access) * @return {string|object} string with EGw relative link, array with get-parameters for '/index.php' or null (directory and not filemanager access)
*/ */
@ -187,12 +188,12 @@ egw.extend('links', egw.MODULE_GLOBAL, function()
// if mime_info did NOT define mime_url attribute, we use a WebDAV url drived from path // if mime_info did NOT define mime_url attribute, we use a WebDAV url drived from path
if (typeof mime_info.mime_url == 'undefined') if (typeof mime_info.mime_url == 'undefined')
{ {
data.url = '/webdav.php' + path; data.url = typeof _path == 'object' && _path.download_url ? _path.download_url : '/webdav.php' + path;
} }
} }
else else
{ {
var data = '/webdav.php' + path; var data = typeof _path == 'object' && _path.download_url ? _path.download_url : '/webdav.php' + path;
} }
return data; return data;
}, },
@ -258,12 +259,19 @@ egw.extend('links', egw.MODULE_GLOBAL, function()
* *
* Please note, the values of the query get url encoded! * Please note, the values of the query get url encoded!
* *
* @param {string} _url a url relative to the egroupware install root, it can contain a query too * @param {string} _url a url relative to the egroupware install root, it can contain a query too or
* full url containing a schema and "://"
* @param {object|string} _extravars query string arguements as string or array (prefered) * @param {object|string} _extravars query string arguements as string or array (prefered)
* if string is used ambersands in vars have to be already urlencoded as '%26', function ensures they get NOT double encoded * if string is used ambersands in vars have to be already urlencoded as '%26', function ensures they get NOT double encoded
* @return {string} generated url * @return {string} generated url
*/ */
link: function(_url, _extravars) link: function(_url, _extravars)
{
if (_url.substr(0,4) == 'http' && _url.indexOf('://') < 5)
{
// already a full url (eg. download_url of vfs), nothing to do
}
else
{ {
if (_url[0] != '/') if (_url[0] != '/')
{ {
@ -276,7 +284,7 @@ egw.extend('links', egw.MODULE_GLOBAL, function()
{ {
_url = this.webserverUrl + _url; _url = this.webserverUrl + _url;
} }
}
var vars = {}; var vars = {};
// check if the url already contains a query and ensure that vars is an array and all strings are in extravars // check if the url already contains a query and ensure that vars is an array and all strings are in extravars