Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-29872 Dropbox repository: add message handler to filepicker heade…

…r and add message to logout from dropbox.

When user clicked on logout button from dropbox repository, it will also logging them out from dropbox site through a popup window
  • Loading branch information...
commit 8eb614d4bb4a80ed51520bca528530914082136f 1 parent 555112a
@rwijaya rwijaya authored
View
1  repository/dropbox/lang/en/repository_dropbox.php
@@ -32,3 +32,4 @@
$string['secret'] = 'Dropbox secret';
$string['instruction'] = 'You can get your API Key and secret from <a href="http://www.dropbox.com/developers/apps">Dropbox developers</a>. When setting up your key please select "Full Dropbox" as the "Access level".';
$string['dropbox:view'] = 'View a Dropbox folder';
+$string['logoutdesc'] = '(Logout when you finish using Dropbox)';
View
2  repository/dropbox/lib.php
@@ -132,6 +132,8 @@ public function get_listing($path = '', $page = '1') {
$list['manage'] = false;
$list['dynload'] = true;
$list['nosearch'] = true;
+ $list['logouturl'] = 'https://www.dropbox.com/logout';
+ $list['message'] = get_string('logoutdesc', 'repository_dropbox');
// process breadcrumb trail
$list['path'] = array(
array('name'=>get_string('dropbox', 'repository_dropbox'), 'path'=>'/')
View
10 repository/filepicker.js
@@ -844,6 +844,8 @@ M.core_filepicker.init = function(Y, options) {
this.active_repo.norefresh = data.norefresh?true:false;
this.active_repo.nologin = data.nologin?true:false;
this.active_repo.logouttext = data.logouttext?data.logouttext:null;
+ this.active_repo.logouturl = (data.logouturl || '');
+ this.active_repo.message = (data.message || '');
this.active_repo.help = data.help?data.help:null;
this.active_repo.manage = data.manage?data.manage:null;
},
@@ -1344,6 +1346,9 @@ M.core_filepicker.init = function(Y, options) {
scope.print_login(obj);
}
}, true);
+ if (this.active_repo.logouturl) {
+ window.open(this.active_repo.logouturl, 'repo_auth', 'location=0,status=0,width=500,height=300,scrollbars=yes');
+ }
}, this);
toolbar.appendChild(logout);
}
@@ -1362,6 +1367,11 @@ M.core_filepicker.init = function(Y, options) {
help.innerHTML = '<img src="'+M.util.image_url('a/help')+'" /> '+M.str.repository.help;
toolbar.appendChild(help);
}
+ if(r.message) {
+ var msg = document.createElement('div');
+ msg.innerHTML = r.message;
+ toolbar.appendChild(msg);
+ }
this.print_path();
},
Please sign in to comment.
Something went wrong with that request. Please try again.