diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js index 6e45547ebb4..318c764458e 100644 --- a/apps/files_imageviewer/js/lightbox.js +++ b/apps/files_imageviewer/js/lightbox.js @@ -7,7 +7,7 @@ $(document).ready(function() { $( 'body' ).append(overlay); var container=$('
'); $( 'body' ).append(container); - FileActions.register('image','View',function(filename){ + FileActions.register('image','View','',function(filename){ var location='ajax/download.php?files='+filename+'&dir='+$('#dir').val(); overlay.show(); if(!images[location]){ diff --git a/apps/media/js/files.js b/apps/media/js/files.js index d699a96db7e..307c6012a26 100644 --- a/apps/media/js/files.js +++ b/apps/media/js/files.js @@ -40,11 +40,11 @@ function loadPlayer(type,ready){ $(document).ready(function() { loadPlayer.done=false - FileActions.register('audio','Add to playlist',addAudio); - FileActions.register('application/ogg','Add to playlist',addAudio); +// FileActions.register('audio','Add to playlist','',addAudio); +// FileActions.register('application/ogg','Add to playlist','',addAudio); - FileActions.register('audio','Play',playAudio); - FileActions.register('application/ogg','Play',playAudio); + FileActions.register('audio','Play','',playAudio); + FileActions.register('application/ogg','','Play',playAudio); FileActions.setDefault('audio','Play'); FileActions.setDefault('application/ogg','Play'); }); \ No newline at end of file diff --git a/files/css/files.css b/files/css/files.css index e956f8c03af..31f041884fd 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -26,7 +26,7 @@ table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight: table td { border-bottom:1px solid #eee; font-style:normal; } table th#headerSize, table td.filesize, table th#headerDate, table td.date { width:5em; padding:0 1em; text-align:right; cursor:help; } table td.selection, table th.selection, table td.fileaction { width:2em; text-align:center; } -table td.filename a { display:block; background-image:url('../img/file.png'); text-decoration:none; } +table td.filename a.name { display:block; background-image:url('../img/file.png'); text-decoration:none; } table td.filename a, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:.5em .5em .5em 3em; background-position:1em center; background-repeat:no-repeat; } table td.filename a:hover, table td.filename a:focus { outline:0; } table td.filename a:active { outline:0; } @@ -53,6 +53,7 @@ table td.delete { background-image:url('../img/delete.png'); } #selectedActions { float:right; display:none; } #selectedActions a { margin:0 .5em; } #uploadsize-message { display:none; } +a.file_action { float:right; display:inline; padding:3px !important } /* add breadcrumb divider to the File item in navigation panel */ #plugins li:first-child { background-position:15.7em 0px; background-repeat:no-repeat; background-image:url("/owncloud/core/img/breadcrumb-divider-start.png"); width:15.7em; padding-right:11px; } diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 8c8296894a9..32029c94daa 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -1,11 +1,14 @@ FileActions={ actions:{}, defaults:{}, - register:function(mime,name,action){ + icons:{}, + currentFile:null, + register:function(mime,name,icon,action){ if(!FileActions.actions[mime]){ FileActions.actions[mime]={}; } FileActions.actions[mime][name]=action; + FileActions.icons[name]=icon; }, setDefault:function(mime,name){ FileActions.defaults[mime]=name; @@ -49,14 +52,17 @@ FileActions={ return actions[name]; }, display:function(parent){ - $('#file_menu').empty(); - parent.append($('#file_menu')); + FileActions.currentFile=parent; var actions=FileActions.get(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); var defaultAction=FileActions.getDefault(FileActions.getCurrentMimeType(),FileActions.getCurrentType()); for(name in actions){ if(actions[name]!=defaultAction && name!='Delete'){ - var html=''+name+''; + var img=FileActions.icons[name]; + var html=''; var element=$(html); + if(img){ + element.append($('')); + } element.data('action',name); element.click(function(event){ event.stopPropagation(); @@ -66,12 +72,16 @@ FileActions={ FileActions.hide(); action(currentFile); }); - $('#file_menu').append(element); + parent.children('a.name').append(element); } } if(actions['Delete']){ - var html='Delete'; + var img=FileActions.icons['Delete']; + var html=''; var element=$(html); + if(img){ + element.append($('')); + } element.data('action','Delete'); element.click(function(event){ event.stopPropagation(); @@ -83,31 +93,27 @@ FileActions={ }); 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')); + $('.file_action').remove(); }, getCurrentFile:function(){ - return $('#file_menu').parent().parent().attr('data-file'); + return FileActions.currentFile.parent().attr('data-file'); }, getCurrentMimeType:function(){ - return $('#file_menu').parent().parent().attr('data-mime'); + return FileActions.currentFile.parent().attr('data-mime'); }, getCurrentType:function(){ - return $('#file_menu').parent().parent().attr('data-type'); + return FileActions.currentFile.parent().attr('data-type'); } } -FileActions.register('all','Download',function(filename){ +FileActions.register('all','Download',OC.imagePath('core','actions/download'),function(filename){ window.location='ajax/download.php?files='+filename+'&dir='+$('#dir').val(); }); -FileActions.register('all','Delete',function(filename){ +FileActions.register('all','Delete',OC.imagePath('core','actions/delete'),function(filename){ $.ajax({ url: 'ajax/delete.php', data: "dir="+encodeURIComponent($('#dir').val())+"&file="+encodeURIComponent(filename), @@ -119,9 +125,14 @@ FileActions.register('all','Delete',function(filename){ }); }); +FileActions.register('all','Rename',OC.imagePath('core','actions/rename'),function(filename){ + //todo + alert('Implement Me!!'); +}); + FileActions.setDefault('all','Download'); -FileActions.register('dir','Open',function(filename){ +FileActions.register('dir','Open','',function(filename){ window.location='index.php?dir='+$('#dir').val()+'/'+filename; }); diff --git a/files/js/filelist.js b/files/js/filelist.js index 973fda23e1e..e84a9acb535 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -5,7 +5,7 @@ FileList={ addFile:function(name,size,lastModified,loading){ var img=(loading)?'img/loading.gif':'img/file.png'; var html='