mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-13766
1. attach seekey to ajax request 2. fix string
This commit is contained in:
parent
7b6757b0d5
commit
0eaa8c5cb0
3 changed files with 44 additions and 20 deletions
|
@ -101,6 +101,7 @@ class repository_boxnet extends repository{
|
|||
// TODO: think about how to search
|
||||
$ret['list'] = $tree;
|
||||
$ret['manage'] = 'http://www.box.net/files';
|
||||
$ret['path'] = array(array('name'=>'Root','path'=>null));
|
||||
$this->listing = $tree;
|
||||
return $ret;
|
||||
} else {
|
||||
|
@ -143,13 +144,13 @@ class repository_boxnet extends repository{
|
|||
$e2->name = 'repo_id';
|
||||
$e2->value = $this->id;
|
||||
|
||||
$e3->label = get_string('username', 'repository_boxnet');
|
||||
$e3->label = get_string('username', 'repository_boxnet').': ';
|
||||
$e3->id = 'box_username';
|
||||
$e3->type = 'text';
|
||||
$e3->name = 'boxusername';
|
||||
$e3->value = $ret->username;
|
||||
|
||||
$e4->label = get_string('password', 'repository_boxnet');
|
||||
$e4->label = get_string('password', 'repository_boxnet').': ';
|
||||
$e4->id = 'box_password';
|
||||
$e4->type = 'password';
|
||||
$e4->name = 'boxpassword';
|
||||
|
|
|
@ -100,13 +100,13 @@ class repository_flickr extends repository{
|
|||
EOD;
|
||||
if($ajax){
|
||||
$ret = array();
|
||||
$e1->label = get_string('username', 'repository_flickr');
|
||||
$e1->label = get_string('username', 'repository_flickr').': ';
|
||||
$e1->id = 'account';
|
||||
$e1->type = 'text';
|
||||
$e1->name = 'flickrmail';
|
||||
|
||||
$e2->id = 'keepid';
|
||||
$e2->label = get_string('remember', 'repository_flickr');
|
||||
$e2->label = get_string('remember', 'repository_flickr').' ';
|
||||
$e2->type = 'checkbox';
|
||||
$e2->name = 'remember';
|
||||
|
||||
|
|
|
@ -616,6 +616,7 @@ function repository_move_to_filepool($path, $name, $itemid, $filearea = 'user_dr
|
|||
function repository_get_client($context){
|
||||
global $CFG, $USER;
|
||||
$suffix = uniqid();
|
||||
$sesskey = sesskey();
|
||||
$strsaveas = get_string('saveas', 'repository').': ';
|
||||
$stradd = get_string('add', 'repository');
|
||||
$strback = get_string('back', 'repository');
|
||||
|
@ -848,7 +849,7 @@ _client.rename = function(oldname, url){
|
|||
var html = '<div id="rename-form">';
|
||||
html += '<p><label for="newname-$suffix">$strsaveas</label>';
|
||||
html += '<input type="text" id="newname-$suffix" value="'+oldname+'" /></p>';
|
||||
html += '<p><label for="syncfile-$suffix">$strsync</label>';
|
||||
html += '<p><label for="syncfile-$suffix">$strsync</label> ';
|
||||
html += '<input type="checkbox" id="syncfile-$suffix" /></p>';
|
||||
html += '<p><input type="hidden" id="fileurl-$suffix" value="'+url+'" />';
|
||||
html += '<a href="###" onclick="repository_client_$suffix.viewfiles()">$strback</a> ';
|
||||
|
@ -1002,10 +1003,14 @@ _client.dynload = function (node, fnLoadComplete){
|
|||
argument:{"node":node, "fnLoadComplete": fnLoadComplete},
|
||||
timeout:600
|
||||
}
|
||||
var trans = YAHOO.util.Connect.asyncRequest('GET',
|
||||
'$CFG->wwwroot/repository/ws.php?ctx_id=$context->id&repo_id='
|
||||
+_client.repositoryid+'&p='+node.path+'&action=list',
|
||||
callback);
|
||||
var params = [];
|
||||
params['p']=node.path;
|
||||
params['env']=_client.env;
|
||||
params['sesskey']='$sesskey';
|
||||
params['ctx_id']=$context->id;
|
||||
params['repo_id']=_client.repositoryid;
|
||||
var trans = YAHOO.util.Connect.asyncRequest('POST',
|
||||
'$CFG->wwwroot/repository/ws.php?action=list', callback, _client.postdata(params));
|
||||
}
|
||||
_client.viewlist = function(){
|
||||
_client.viewmode = 0;
|
||||
|
@ -1026,15 +1031,14 @@ _client.viewlist = function(){
|
|||
}
|
||||
_client.upload = function(){
|
||||
var u = _client.ds.upload;
|
||||
var conn = YAHOO.util.Connect;
|
||||
var aform = document.getElementById(u.id);
|
||||
var parent = document.getElementById(u.id+'_div');
|
||||
var loading = document.createElement('DIV');
|
||||
loading.innerHTML = "$struploading";
|
||||
loading.id = u.id+'_loading';
|
||||
parent.appendChild(loading);
|
||||
conn.setForm(aform, true, true);
|
||||
conn.asyncRequest('POST', '$CFG->wwwroot/repository/ws.php?ctx_id=$context->id&repo_id='+_client.repositoryid+'&action=upload', _client.upload_cb);
|
||||
YAHOO.util.Connect.setForm(aform, true, true);
|
||||
var trans = YAHOO.util.Connect.asyncRequest('POST', '$CFG->wwwroot/repository/ws.php?action=upload&sesskey=$sesskey&ctx_id=$context->id&repo_id='+_client.repositoryid, _client.upload_cb);
|
||||
}
|
||||
_client.upload_cb = {
|
||||
upload: function(o){
|
||||
|
@ -1117,14 +1121,19 @@ _client.download = function(){
|
|||
var title = document.getElementById('newname-$suffix').value;
|
||||
var file = document.getElementById('fileurl-$suffix').value;
|
||||
_client.loading();
|
||||
var params = [];
|
||||
params['env']=_client.env;
|
||||
params['file']=file;
|
||||
params['title']=title;
|
||||
params['sesskey']='$sesskey';
|
||||
params['ctx_id']=$context->id;
|
||||
params['repo_id']=_client.repositoryid;
|
||||
var trans = YAHOO.util.Connect.asyncRequest('POST',
|
||||
'$CFG->wwwroot/repository/ws.php?ctx_id=$context->id&repo_id='
|
||||
+_client.repositoryid+'&action=download',
|
||||
_client.dlfile, _client.postdata({'env':_client.env, 'file':file, 'title':title}));
|
||||
'$CFG->wwwroot/repository/ws.php?action=download', _client.dlfile, _client.postdata(params));
|
||||
}
|
||||
// send login request
|
||||
_client.login = function(){
|
||||
var params = {};
|
||||
var params = [];
|
||||
var data = _client.ds.login;
|
||||
for (var k in data) {
|
||||
var el = document.getElementsByName(data[k].name)[0];
|
||||
|
@ -1137,10 +1146,10 @@ _client.login = function(){
|
|||
}
|
||||
params['env'] = _client.env;
|
||||
params['ctx_id'] = $context->id;
|
||||
params['sesskey']= '$sesskey';
|
||||
_client.loading();
|
||||
var trans = YAHOO.util.Connect.asyncRequest('POST',
|
||||
'$CFG->wwwroot/repository/ws.php?action=sign', _client.callback,
|
||||
_client.postdata(params));
|
||||
'$CFG->wwwroot/repository/ws.php?action=sign', _client.callback, _client.postdata(params));
|
||||
}
|
||||
_client.end = function(str){
|
||||
if(_client.env=='form'){
|
||||
|
@ -1250,7 +1259,15 @@ _client.req = function(id, path, reset) {
|
|||
} else {
|
||||
action = 'list';
|
||||
}
|
||||
var trans = YAHOO.util.Connect.asyncRequest('GET', '$CFG->wwwroot/repository/ws.php?action='+action+'&ctx_id=$context->id&repo_id='+id+'&p='+path+'&reset='+reset+'&env='+_client.env, _client.callback);
|
||||
var params = [];
|
||||
params['p'] = path;
|
||||
params['reset']=reset;
|
||||
params['env']=_client.env;
|
||||
params['action']=action;
|
||||
params['sesskey']='$sesskey';
|
||||
params['ctx_id']=$context->id;
|
||||
params['repo_id']=id;
|
||||
var trans = YAHOO.util.Connect.asyncRequest('POST', '$CFG->wwwroot/repository/ws.php?action='+action, _client.callback, _client.postdata(params));
|
||||
}
|
||||
_client.search = function(id){
|
||||
var data = window.prompt("$strsearching");
|
||||
|
@ -1260,7 +1277,13 @@ _client.search = function(id){
|
|||
}
|
||||
_client.viewbar.set('disabled', false);
|
||||
_client.loading();
|
||||
var trans = YAHOO.util.Connect.asyncRequest('GET', '$CFG->wwwroot/repository/ws.php?action=search&ctx_id=$context->id&repo_id='+id+'&s='+data+'&env='+_client.env, _client.callback);
|
||||
var params = [];
|
||||
params['s']=data;
|
||||
params['env']=_client.env;
|
||||
params['sesskey']='$sesskey';
|
||||
params['ctx_id']=$context->id;
|
||||
params['repo_id']=id;
|
||||
var trans = YAHOO.util.Connect.asyncRequest('POST', '$CFG->wwwroot/repository/ws.php?action=search', _client.callback, _client.postdata(params));
|
||||
}
|
||||
|
||||
return _client;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue