"MDL-13766, fixed problems of filemanager"

This commit is contained in:
Dongsheng Cai 2010-05-04 06:34:40 +00:00
parent 3aafe5bcb3
commit 59eeb81b33

View file

@ -136,6 +136,7 @@ M.form_filemanager.init = function(Y, options) {
},
refresh: function(filepath) {
var scope = this;
this.currentpath = filepath;
if (!filepath) {
filepath = this.currentpath;
} else {
@ -168,7 +169,7 @@ M.form_filemanager.init = function(Y, options) {
// XXX: magic here, to let filepicker use filemanager scope
options.magicscope = this;
options.savepath = this.currentpath;
M.core_filepicker.show(Y, options);
M.core_filepicker.show(Y, options);
}, this);
}
@ -271,6 +272,7 @@ M.form_filemanager.init = function(Y, options) {
var scope = this;
var params = {};
params['filepath'] = args.requestpath;
this.currentpath = args.requestpath;
this.request({
action: 'list',
scope: scope,
@ -515,7 +517,6 @@ M.form_filemanager.init = function(Y, options) {
// XXX: magic here, to let filepicker use filemanager scope
options.magicscope = scope;
options.savepath = scope.currentpath;
console.info(options);
M.core_filepicker.show(Y, options);
}, this);
}
@ -601,6 +602,7 @@ M.form_filemanager.init = function(Y, options) {
var treeview = new YAHOO.widget.TreeView("fm-tree");
var dialog = this.movefile_dialog;
function _move(e) {
if (!treeview.targetpath) {
return;
@ -623,9 +625,10 @@ M.form_filemanager.init = function(Y, options) {
callback: function(id, obj, args) {
var p = '/';
if (obj) {
p = result.filepath;
p = obj.filepath;
}
this.movefile_dialog.cancel();
dialog.cancel();
scope.refresh(p);
}
});
}
@ -678,12 +681,16 @@ M.form_filemanager.init = function(Y, options) {
this.movefile_dialog.show();
}
var shared_items = [
{text: M.str.moodle.rename+'...', onclick: {fn: rename, obj: options, scope: this}},
{text: M.str.moodle.move+'...', onclick: {fn: move, obj: options, scope: this}},
// delete is reserve word in Javascript
{text: M.str.moodle['delete']+'...', onclick: {fn: remove, obj: options, scope: this}}
];
if (fileinfo.type!='folder') {
var shared_items = [
{text: M.str.moodle.rename+'...', onclick: {fn: rename, obj: options, scope: this}},
{text: M.str.moodle.move+'...', onclick: {fn: move, obj: options, scope: this}}
];
} else {
var shared_items = [];
}
// delete is reserve word in Javascript
shared_items.push({text: M.str.moodle['delete']+'...', onclick: {fn: remove, obj: options, scope: this}});
var menu = new YAHOO.widget.Menu(menuid, {xy:position, clicktohide:true});
menu.clearContent();
menu.addItems(menuitems);