diff options
author | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2014-01-29 10:55:44 +0100 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2014-01-29 10:55:44 +0100 |
commit | 13ed59c1cf2598f28c415c0c2459b5a4495ff5ef (patch) | |
tree | 890efcfe462f19468e2aa05ca1a22049edc21ab6 /core/js/js.js | |
parent | c767ebcc03c604f3141af4c286ad099fdf64c561 (diff) | |
parent | cf2c061f1f2577b3a995d9e2423c93589d7df2b3 (diff) | |
download | nextcloud-server-13ed59c1cf2598f28c415c0c2459b5a4495ff5ef.tar.gz nextcloud-server-13ed59c1cf2598f28c415c0c2459b5a4495ff5ef.zip |
merge master into mobile-style
Diffstat (limited to 'core/js/js.js')
-rw-r--r-- | core/js/js.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js index e84f482d672..1c7d89ea055 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -253,6 +253,12 @@ var OC={ return link; }, /** + * Redirect to the target URL, can also be used for downloads. + */ + redirect: function(targetUrl) { + window.location = targetUrl; + }, + /** * get the absolute path to an image file * @param app the app id to which the image belongs * @param file the name of the image file @@ -364,6 +370,34 @@ var OC={ } return result; }, + + /** + * Builds a URL query from a JS map. + * @param params parameter map + * @return string containing a URL query (without question) mark + */ + buildQueryString: function(params) { + var s = ''; + var first = true; + if (!params) { + return s; + } + for (var key in params) { + var value = params[key]; + if (first) { + first = false; + } + else { + s += '&'; + } + s += encodeURIComponent(key); + if (value !== null && typeof(value) !== 'undefined') { + s += '=' + encodeURIComponent(value); + } + } + return s; + }, + /** * Opens a popup with the setting for an app. * @param appid String. The ID of the app e.g. 'calendar', 'contacts' or 'files'. |