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