Skip to content

Commit

Permalink
Merge branch 'MDL-31113_multiple_files_file_manager' of https://githu…
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jan 25, 2012
2 parents 897e14e + 910e1ec commit 478ba35
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/form/dndupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ M.form_dndupload = {
return false;
}

e.preventDefault();
e.stopPropagation();

if (this.reached_maxfiles()) {
return false;
}

e.preventDefault();
e.stopPropagation();

return true;
},

Expand Down
13 changes: 10 additions & 3 deletions lib/form/filemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ M.form_filemanager.init = function(Y, options) {
this.filecount = 0;
}
this.setup_buttons();
this.render();
this.refresh(this.currentpath); // MDL-31113 get latest list from server
},

wait: function(client_id) {
Expand Down Expand Up @@ -141,15 +141,18 @@ M.form_filemanager.init = function(Y, options) {
}
},
filepicker_callback: function(obj) {
var button_addfile = Y.one("#btnadd-"+this.client_id);
this.filecount++;
this.check_buttons();
this.refresh(this.currentpath);
},
check_buttons: function() {
var button_addfile = Y.one("#btnadd-"+this.client_id);
if (this.filecount > 0) {
Y.one("#btndwn-"+this.client_id).setStyle('display', 'inline');
}
if (this.filecount >= this.maxfiles && this.maxfiles!=-1) {
button_addfile.setStyle('display', 'none');
}
this.refresh(this.currentpath);
},
refresh: function(filepath) {
var scope = this;
Expand All @@ -164,6 +167,8 @@ M.form_filemanager.init = function(Y, options) {
scope: scope,
params: {'filepath':filepath},
callback: function(id, obj, args) {
scope.filecount = obj.filecount;
scope.check_buttons();
scope.options = obj;
scope.render(obj);
}
Expand Down Expand Up @@ -298,6 +303,8 @@ M.form_filemanager.init = function(Y, options) {
scope: scope,
params: params,
callback: function(id, obj, args) {
scope.filecount = obj.filecount;
scope.check_buttons();
scope.options = obj;
scope.render(obj);
}
Expand Down
3 changes: 3 additions & 0 deletions repository/draftfiles_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
$filepath = optional_param('filepath', '/', PARAM_PATH);

$data = file_get_drafarea_files($draftid, $filepath);
$info = file_get_draft_area_info($draftid);
$data->filecount = $info['filecount'];
$data->filesize = $info['filesize'];
echo json_encode($data);
die;

Expand Down

0 comments on commit 478ba35

Please sign in to comment.