MDL-29872 Dropbox repository: add message handler to filepicker header 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
This commit is contained in:
Rossiani Wijaya
2012-09-07 15:45:46 +08:00
parent 555112a5ca
commit 8eb614d4bb
3 changed files with 13 additions and 0 deletions
@@ -32,3 +32,4 @@ $string['dropbox'] = 'Dropbox';
$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)';
+2
View File
@@ -132,6 +132,8 @@ class repository_dropbox extends repository {
$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'=>'/')
+10
View File
@@ -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();
},