Merge pull request #1307 from owncloud/js_linkToRemote

Add js linkToRemote and linkToRemoteBase
This commit is contained in:
Lukas Reschke 2013-01-25 07:10:35 -08:00
commit 688fe0baa8
1 changed files with 21 additions and 0 deletions

View File

@ -100,6 +100,27 @@ var OC={
linkTo:function(app,file){ linkTo:function(app,file){
return OC.filePath(app,'',file); return OC.filePath(app,'',file);
}, },
/**
* Creates an url for remote use
* @param string $service id
* @return string the url
*
* Returns a url to the given service.
*/
linkToRemoteBase:function(service) {
return OC.webroot + '/remote.php/' + service;
},
/**
* @brief Creates an absolute url for remote use
* @param string $service id
* @param bool $add_slash
* @return string the url
*
* Returns a absolute url to the given service.
*/
linkToRemote:function(service) {
return window.location.protocol + '//' + window.location.host + OC.linkToRemoteBase(service);
},
/** /**
* get the absolute url for a file in an app * get the absolute url for a file in an app
* @param app the id of the app * @param app the id of the app