MDL-23171 filemanager usability context menu improvements

This commit is contained in:
Dongsheng Cai
2010-07-12 08:24:59 +00:00
parent 5cf8509753
commit 1249f770da
+14 -17
View File
@@ -372,14 +372,19 @@ M.form_filemanager.init = function(Y, options) {
break;
case 'file':
file_ids.push('#'+action);
// click file name
file_ids.push('#'+fileid);
file_data[action] = list[i];
file_data[fileid] = list[i];
if (list[i].url) {
url = list[i].url;
}
break;
case 'zip':
zip_ids.push('#'+action);
zip_ids.push('#'+fileid);
zip_data[action] = list[i];
zip_data[fileid] = list[i];
if (list[i].url) {
url = list[i].url;
}
@@ -403,26 +408,15 @@ M.form_filemanager.init = function(Y, options) {
Y.one('#draftfiles-'+this.client_id).set('innerHTML', listhtml);
// click normal file menu
Y.on('click', this.create_filemenu, file_ids, this, file_data);
Y.on('click', this.create_filemenu, file_ids, this, file_data);
Y.on('contextmenu', this.create_filemenu, file_ids, this, file_data);
// click folder menu
Y.on('click', this.create_foldermenu, folder_ids, this, folder_data);
Y.on('contextmenu', this.create_foldermenu, folder_ids, this, folder_data);
Y.on('contextmenu', this.create_foldermenu, foldername_ids, this, folder_data);
// click archievs menu
Y.on('click', this.create_zipmenu, zip_ids, this, zip_data);
// when mouse moveover every menu
function mouseover_menu(e, obj) {
var node = e.currentTarget;
node.setStyle('backgroundColor', '#0066EE');
var menu = Y.one('#'+obj[node.get('id')]);
menu.setStyle('display', 'inline');
}
function mouseout_menu(e, obj) {
var node = e.currentTarget;
node.setStyle('backgroundColor', 'transparent');
var menu = Y.one('#'+obj[node.get('id')]);
menu.setStyle('display', 'none');
}
//Y.on('mouseover', mouseover_menu, html_ids, this, html_data);
//Y.on('mouseout', mouseout_menu, html_ids, this, html_data);
Y.on('click', this.create_zipmenu, zip_ids, this, zip_data);
Y.on('contextmenu', this.create_zipmenu, zip_ids, this, zip_data);
// click folder name
Y.on('click', this.enter_folder, foldername_ids, this, folder_data);
},
@@ -432,6 +426,7 @@ M.form_filemanager.init = function(Y, options) {
this.refresh(file.filepath);
},
create_filemenu: function(e, data) {
e.preventDefault();
var options = this.options;
var node = e.currentTarget;
var file = data[node.get('id')];
@@ -463,6 +458,7 @@ M.form_filemanager.init = function(Y, options) {
this.create_menu(e, 'filemenu', menuitems, file, data);
},
create_foldermenu: function(e, data) {
e.preventDefault();
var scope = this;
var node = e.currentTarget;
var fileinfo = data[node.get('id')];
@@ -486,6 +482,7 @@ M.form_filemanager.init = function(Y, options) {
this.create_menu(e, 'foldermenu', menuitems, fileinfo, data);
},
create_zipmenu: function(e, data) {
e.preventDefault();
var scope = this;
var node = e.currentTarget;
var fileinfo = data[node.get('id')];