summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2016-02-08 15:55:09 +0000
committerRobin McCorkell <robin@mccorkell.me.uk>2016-05-03 11:30:02 +0100
commit43abe2b64855d5acbde4ce4c58a4f543371bb001 (patch)
treef1ed1713ad114ff870ea4f0f1388ec66c5af98f6 /apps/files_external
parentde98a6e54cd2d732e0b7c1297e8da43e53bb97c7 (diff)
downloadnextcloud-server-43abe2b64855d5acbde4ce4c58a4f543371bb001.tar.gz
nextcloud-server-43abe2b64855d5acbde4ce4c58a4f543371bb001.zip
Add links to load GDrive/Dropbox configuration pages
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/js/dropbox.js28
-rw-r--r--apps/files_external/js/gdrive.js24
-rw-r--r--apps/files_external/js/oauth1.js4
-rw-r--r--apps/files_external/js/oauth2.js4
-rw-r--r--apps/files_external/lib/backend/dropbox.php1
-rw-r--r--apps/files_external/lib/backend/google.php1
6 files changed, 58 insertions, 4 deletions
diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js
new file mode 100644
index 00000000000..9e1427e4603
--- /dev/null
+++ b/apps/files_external/js/dropbox.js
@@ -0,0 +1,28 @@
+$(document).ready(function() {
+
+ function generateUrl($tr) {
+ var app_key = $tr.find('[data-parameter="app_key"]').val();
+ if (app_key) {
+ return 'https://www.dropbox.com/developers/apps/info/' + app_key;
+ } else {
+ return 'https://www.dropbox.com/developers/apps';
+ }
+ }
+
+ OCA.External.Settings.mountConfig.whenSelectBackend(function($tr, backend, onCompletion) {
+ if (backend === 'dropbox') {
+ var config = $tr.find('.configuration');
+ var el = $(document.createElement('a'))
+ .attr('href', generateUrl($tr))
+ .attr('target', '_blank')
+ .text(t('files_external', 'Dropbox Configuration') + ' ↗')
+ ;
+ el.on('click', function(event) {
+ var a = $(event.target);
+ a.attr('href', generateUrl($(this).parent()));
+ });
+ config.append(el);
+ }
+ });
+
+});
diff --git a/apps/files_external/js/gdrive.js b/apps/files_external/js/gdrive.js
new file mode 100644
index 00000000000..e660aa8cb26
--- /dev/null
+++ b/apps/files_external/js/gdrive.js
@@ -0,0 +1,24 @@
+$(document).ready(function() {
+
+ function generateUrl($tr) {
+ // no mapping between client ID and Google 'project', so we always load the same URL
+ return 'https://console.developers.google.com/';
+ }
+
+ OCA.External.Settings.mountConfig.whenSelectBackend(function($tr, backend, onCompletion) {
+ if (backend === 'googledrive') {
+ var config = $tr.find('.configuration');
+ var el = $(document.createElement('a'))
+ .attr('href', generateUrl($tr))
+ .attr('target', '_blank')
+ .text(t('files_external', 'Google Drive Configuration') + ' ↗')
+ ;
+ el.on('click', function(event) {
+ var a = $(event.target);
+ a.attr('href', generateUrl($(this).parent()));
+ });
+ config.append(el);
+ }
+ });
+
+});
diff --git a/apps/files_external/js/oauth1.js b/apps/files_external/js/oauth1.js
index e2ba25ebf8e..8c64f1189f4 100644
--- a/apps/files_external/js/oauth1.js
+++ b/apps/files_external/js/oauth1.js
@@ -13,7 +13,7 @@ $(document).ready(function() {
onCompletion.then(function() {
var configured = $tr.find('[data-parameter="configured"]');
if ($(configured).val() == 'true') {
- $tr.find('.configuration input').attr('disabled', 'disabled');
+ $tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
$tr.find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>');
} else {
var app_key = $tr.find('.configuration [data-parameter="app_key"]').val();
@@ -33,7 +33,7 @@ $(document).ready(function() {
$(configured).val('true');
OCA.External.Settings.mountConfig.saveStorageConfig($tr, function(status) {
if (status) {
- $tr.find('.configuration input').attr('disabled', 'disabled');
+ $tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
$tr.find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>');
}
});
diff --git a/apps/files_external/js/oauth2.js b/apps/files_external/js/oauth2.js
index 2556bf45cae..64be9b1ed93 100644
--- a/apps/files_external/js/oauth2.js
+++ b/apps/files_external/js/oauth2.js
@@ -13,7 +13,7 @@ $(document).ready(function() {
onCompletion.then(function() {
var configured = $tr.find('[data-parameter="configured"]');
if ($(configured).val() == 'true') {
- $tr.find('.configuration input').attr('disabled', 'disabled');
+ $tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
$tr.find('.configuration').append($('<span/>').attr('id', 'access')
.text(t('files_external', 'Access granted')));
} else {
@@ -43,7 +43,7 @@ $(document).ready(function() {
$(configured).val('true');
OCA.External.Settings.mountConfig.saveStorageConfig($tr, function(status) {
if (status) {
- $tr.find('.configuration input').attr('disabled', 'disabled');
+ $tr.find('.configuration input.auth-param').attr('disabled', 'disabled');
$tr.find('.configuration').append($('<span/>')
.attr('id', 'access')
.text(t('files_external', 'Access granted')));
diff --git a/apps/files_external/lib/backend/dropbox.php b/apps/files_external/lib/backend/dropbox.php
index f9156082515..2133c274996 100644
--- a/apps/files_external/lib/backend/dropbox.php
+++ b/apps/files_external/lib/backend/dropbox.php
@@ -44,6 +44,7 @@ class Dropbox extends Backend {
// all parameters handled in OAuth1 mechanism
])
->addAuthScheme(AuthMechanism::SCHEME_OAUTH1)
+ ->addCustomJs('dropbox')
->setLegacyAuthMechanism($legacyAuth)
;
}
diff --git a/apps/files_external/lib/backend/google.php b/apps/files_external/lib/backend/google.php
index b2b48a0e402..b18b7bdb348 100644
--- a/apps/files_external/lib/backend/google.php
+++ b/apps/files_external/lib/backend/google.php
@@ -44,6 +44,7 @@ class Google extends Backend {
// all parameters handled in OAuth2 mechanism
])
->addAuthScheme(AuthMechanism::SCHEME_OAUTH2)
+ ->addCustomJs('gdrive')
->setLegacyAuthMechanism($legacyAuth)
;
}