Skip to content

Commit

Permalink
"MDL-13766, improve upload UI"
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed Sep 1, 2008
1 parent ca2f6fc commit 9ccfe7a
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions repository/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ function repository_get_client($context){
$strdownload = get_string('downloadsucc', 'repository');
$strdate = get_string('date', 'repository').': ';
$strerror = get_string('error', 'repository');
$strfilenotnull = get_string('filenotnull', 'repository');
$strinvalidjson = get_string('invalidjson', 'repository');
$strlistview = get_string('listview', 'repository');
$strlogout = get_string('logout', 'repository');
Expand Down Expand Up @@ -1100,15 +1101,26 @@ function _client(){
var u = _client.ds.upload;
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);
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);
var d = document.getElementById(_client.ds.upload.id+'-file');
if(d.value!='' && d.value!=null){
var container = document.createElement('DIV');
container.id = u.id+'_loading';
container.style.textAlign='center';
var img = document.createElement('IMG');
img.src = '$CFG->pixpath/i/progressbar.gif';
var para = document.createElement('p');
para.innerHTML = '$struploading';
container.appendChild(para);
container.appendChild(img);
parent.appendChild(container);
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);
}else{
alert('$strfilenotnull');
}
}
_client.upload_cb = {
upload: function(o){
Expand Down

0 comments on commit 9ccfe7a

Please sign in to comment.