refresh_filemanager(obj.filepath, fm_cfg[obj.client_id]);
fm_cfg[obj.client_id].currentfiles++;
- if (fm_cfg[obj.client_id].currentfiles>=fm_cfg[obj.client_id].maxfiles) {
+ if (fm_cfg[obj.client_id].currentfiles>=fm_cfg[obj.client_id].maxfiles && fm_cfg[client_id].maxfiles!=-1) {
var btn = document.getElementById('btnadd-'+obj.client_id);
btn.style.display = 'none';
}
}
// create a new folder in draft area
-function mkdir(client_id, itemid) {
+function mkdir(e, client_id, itemid) {
var mkdir_cb = {
success: function(o) {
var result = json_decode(o.responseText);
el.id = 'fm-mkdir-dlg';
el.innerHTML = '<div class="hd">'+mstr.repository.entername+'</div><div class="bd"><input type="text" id="fm-newname" /></div>';
document.body.appendChild(el);
+ var x = YAHOO.util.Event.getPageX(e);
+ var y = YAHOO.util.Event.getPageY(e);
fm_mkdir_dlg = new YAHOO.widget.Dialog("fm-mkdir-dlg", {
width: "300px",
- fixedcenter: true,
visible: true,
+ x:y,
+ y:y,
constraintoviewport : true
});
breadcrumb.innerHTML = '';
var count = 0;
for(var p in options.path) {
+ var sep = document.createElement('SPAN');
+ sep.innerHTML = ' ▶ ';
+ if (count==0) {
+ sep.innerHTML = 'Path: ';
+ } else {
+ sep.innerHTML = ' ▶ ';
+ }
count++;
var pathid = 'fm-path-node-'+client_id;
pathid += ('-'+count);
el.id = pathid;
el.innerHTML = options.path[p].name;
el.href = '###';
- var sep = document.createElement('SPAN');
- sep.innerHTML = ' ▶ ';
breadcrumb.appendChild(sep);
breadcrumb.appendChild(el);
fm_move_dlg.render();
- fileadd.onclick = function(e) {
- this.options.savepath = this.options.currentpath;
- fm_launch_filepicker(this.options.target, this.options);
+ // if maxfiles == -1, the no limit
+ if (fm_cfg[client_id].filecount >= fm_cfg[client_id].maxfiles && fm_cfg[client_id].maxfiles!=-1) {
+ fileadd.style.display = 'none';
+ } else {
+ fm_cfg[client_id].currentfiles = fm_cfg[client_id].filecount;
+ fileadd.onclick = function(e) {
+ this.options.savepath = this.options.currentpath;
+ fm_launch_filepicker(this.options.target, this.options);
+ }
+ fileadd.options = fm_cfg[client_id];
}
- fileadd.options = fm_cfg[client_id];
if (fm_cfg[client_id].subdirs) {
- foldercreate.onclick = function() {
- mkdir(this.options.client_id, this.options.itemid);
+ foldercreate.onclick = function(e) {
+ mkdir(e, this.options.client_id, this.options.itemid);
}
foldercreate.options = fm_cfg[client_id];
} else {
$draftitemid = $this->getValue();
}
+ $draftareainfo = file_get_draft_area_info($draftitemid);
+ $filecount = $draftareainfo['filecount'];
+
if ($COURSE->id == SITEID) {
$context = get_context_instance(CONTEXT_SYSTEM);
} else {
$options->maxbytes = $this->getMaxbytes();
$options->maxfiles = $this->getMaxfiles();
$options->client_id = $client_id;
+ $options->filecount = $filecount;
$options->itemid = $draftitemid;
$options->subdirs = $this->_options['subdirs'];
$options->target = $id;