diff --git a/files/css/files.css b/files/css/files.css index 590c7bac36..37cb64bff0 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -88,7 +88,7 @@ table td.filesize, table td.date table td.date { - width: 11em; + width: 12em; } table td.selection, table th.selection, table td.fileaction diff --git a/files/js/fileactions.js b/files/js/fileactions.js index a6891a5f82..4920e803b7 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -54,7 +54,7 @@ FileActions={ var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); for(name in actions){ - if(actions[name]!=defaultAction){ + if(actions[name]!=defaultAction && name!='Delete'){ var html=''+name+''; var element=$(html); element.data('action',name); @@ -69,12 +69,27 @@ FileActions={ $('#file_menu').append(element); } } + if(actions['Delete']){ + var html='Delete'; + var element=$(html); + element.data('action','Delete'); + element.click(function(event){ + event.stopPropagation(); + event.preventDefault(); + var action=actions[$(this).data('action')]; + var currentFile=FileActions.getCurrentFile(); + FileActions.hide(); + action(currentFile); + }); + parent.parent().children().last().append(element); + } $('#file_menu').show(); return false; }, hide:function(){ $('#file_menu').hide(); $('#file_menu').empty(); + $('#action_delete').remove(); $('body').append($('#file_menu')); }, getCurrentFile:function(){