From f22e39a5745fcdf745aa2af0917ca62ef7598904 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 7 Jul 2011 02:28:57 +0200 Subject: [PATCH 1/6] highlight selected files in the filebrowser --- files/css/files.css | 1 + files/js/files.js | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index 9e0361327db..a3d098b9116 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -76,6 +76,7 @@ table { } tbody tr:hover, tbody tr:active { background-color:#eee; } +tbody tr.selected { background-color:#ccc; } tbody a { color:#000; } table td.filesize, table td.date diff --git a/files/js/files.js b/files/js/files.js index 2434fceff43..408bd6e48a0 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -31,15 +31,19 @@ $(document).ready(function() { // Sets the select_all checkbox behaviour : $('#select_all').click(function() { - if($(this).attr('checked')) + if($(this).attr('checked')){ // Check all $('td.selection input:checkbox').attr('checked', true); - else + $('td.selection input:checkbox').parent().parent().addClass('selected'); + }else{ // Uncheck all $('td.selection input:checkbox').attr('checked', false); + $('td.selection input:checkbox').parent().parent().removeClass('selected'); + } }); $('td.selection input:checkbox').live('click',function() { + $(this).parent().parent().toggleClass('selected'); if(!$(this).attr('checked')){ $('#select_all').attr('checked',false); }else{ From af3aceaf0863f9a4c194925aa40ef97afd459f45 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 7 Jul 2011 02:41:22 +0200 Subject: [PATCH 2/6] show file extention in a lighter color --- files/css/files.css | 4 ++++ files/index.php | 4 ++++ files/templates/part.list.php | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/files/css/files.css b/files/css/files.css index a3d098b9116..2e00a52d80b 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -111,3 +111,7 @@ table td.filename a display: inline-block; background-image:url('../img/drop-arrow.png'); } + +span.extention{ + color:#666; +} \ No newline at end of file diff --git a/files/index.php b/files/index.php index a163895131e..e06ab552632 100644 --- a/files/index.php +++ b/files/index.php @@ -47,6 +47,10 @@ $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $files = array(); foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ $i["date"] = OC_UTIL::formatDate($i["mtime"] ); + if($i['type']=='file'){ + $i['extention']=substr($i['name'],strrpos($i['name'],'.')); + $i['name']=substr($i['name'],0,strrpos($i['name'],'.')); + } if($i['directory']=='/'){ $i['directory']=''; } diff --git a/files/templates/part.list.php b/files/templates/part.list.php index c7028c3c88c..119b1bbd83d 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -3,7 +3,15 @@ $simple_size_color = 200-intval(pow($simple_file_size,3)); ?> - "; echo htmlspecialchars($file['name']); if($file['type'] == 'dir') echo ""; ?> + + + + + + + + + From 1cc9fc3ab425abac14c7796a83a917744410303a Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 7 Jul 2011 02:51:24 +0200 Subject: [PATCH 3/6] small contrast fixes --- core/css/styles.css | 2 +- files/css/files.css | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index 8723fe0eaf2..c28006ab5c0 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -224,7 +224,7 @@ table td.date { width:11em; } 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, table td.login, table td.logout, table td.download, table td.upload, table td.create, table td.delete { padding:0.5em 0.5em 0.5em 3em; background-position:1em center; background-repeat:no-repeat; } -table td.filename a:hover, table td.filename a:focus { text-decoration:underline; outline:0; } +table td.filename a:hover, table td.filename a:focus { outline:0; } table td.filename a:active { outline:0; } table em { font-weight:bold; } table td.filename a.folder-up { background-image:url('../img/back.png'); font-style:italic; } diff --git a/files/css/files.css b/files/css/files.css index 2e00a52d80b..3b01bfe0971 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -75,8 +75,7 @@ table { width: 90%; } -tbody tr:hover, tbody tr:active { background-color:#eee; } -tbody tr.selected { background-color:#ccc; } +tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#eee; } tbody a { color:#000; } table td.filesize, table td.date @@ -113,5 +112,5 @@ table td.filename a } span.extention{ - color:#666; -} \ No newline at end of file + color:#999; +} From d31349b781040ba394d8b9f9bf0e0f06f33f5b9e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 7 Jul 2011 04:14:24 +0200 Subject: [PATCH 4/6] files can now be draged and dropped in the file browser --- files/index.php | 2 +- files/js/files.js | 30 +++++++++++++++++++++--------- files/templates/part.list.php | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/files/index.php b/files/index.php index e06ab552632..e88f0ef23e5 100644 --- a/files/index.php +++ b/files/index.php @@ -49,7 +49,7 @@ foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ $i["date"] = OC_UTIL::formatDate($i["mtime"] ); if($i['type']=='file'){ $i['extention']=substr($i['name'],strrpos($i['name'],'.')); - $i['name']=substr($i['name'],0,strrpos($i['name'],'.')); + $i['basename']=substr($i['name'],0,strrpos($i['name'],'.')); } if($i['directory']=='/'){ $i['directory']=''; diff --git a/files/js/files.js b/files/js/files.js index 408bd6e48a0..85bc7a98f62 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,16 +1,28 @@ $(document).ready(function() { $('#file_action_panel').attr('activeAction', false); - - // Sets browser table behaviour : - $('.browser tr').hover( - function() { - $(this).addClass('mouseOver'); + + $('#fileList tr td.filename').draggable({ + distance: 20, revert: true, opacity: 0.7, + stop: function(event, ui) { + $('#fileList tr td.filename').addClass('ui-draggable'); }, - function() { - $(this).removeClass('mouseOver'); + }); + $('#fileList tr[data-type="dir"] td.filename').droppable({ + drop: function( event, ui ) { + var file=ui.draggable.text().trim(); + var target=$(this).text().trim(); + $.ajax({ + url: 'ajax/move.php', + data: "dir="+$('#dir').val()+"&file="+file+'&target='+target, + complete: function(data){boolOperationFinished(data, function(){ + var el=$('#fileList tr[data-file="'+file+'"] td.filename'); + el.draggable('destroy'); + FileList.remove(file); + });} + }); } - ); - + }); + // Sets the file-action buttons behaviour : $('td.fileaction a').live('click',function(event) { event.preventDefault(); diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 119b1bbd83d..14a359fe668 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -8,7 +8,7 @@ - + From 01a9d916e7fe477f6fb42a534e3265ddbe00fddd Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Thu, 7 Jul 2011 21:19:18 +0200 Subject: [PATCH 5/6] mark active navigation subentry --- core/css/styles.css | 1 + core/templates/layout.admin.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index c28006ab5c0..a0dd69516cf 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -211,6 +211,7 @@ form.searchbox { display:inline; position:fixed; top:2em; right:10em; margin:0; #plugins a.active, #plugins a:hover, #plugins a:focus, #plugins a.selected { background-color:#ccc; border-top:1px solid #ccc; border-bottom:1px solid #ccc; color:#000; outline:0; } #plugins a:active { outline:0; } #plugins .subentry { background-color:#ddd; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; } +#plugins .subentry.active { background-color:#bbb; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; } /* CONTENT ------------------------------------------------------------------ */ #content { margin:7em 0 0 16em; } diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php index 026e1272237..aa1de65c084 100644 --- a/core/templates/layout.admin.php +++ b/core/templates/layout.admin.php @@ -43,7 +43,7 @@
  • class="active">
  • -
  • class="active">
  • +
  • class="active">
  • @@ -52,7 +52,7 @@
  • class="active">
  • -
  • +
  • From 47993fe29a6a7837e39b1e24e03c3b4ac9d7f794 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 7 Jul 2011 21:43:35 +0200 Subject: [PATCH 6/6] You can now move files to a parent folder by draging them to an element in the breadcrumb bar also fixed dragging newly uploaded files and droppin in new folders --- core/css/styles.css | 6 +-- files/css/files.css | 4 ++ files/js/filelist.js | 4 ++ files/js/files.js | 58 ++++++++++++++++++++++------- files/templates/index.php | 4 +- files/templates/part.breadcrumb.php | 8 +++- 6 files changed, 64 insertions(+), 20 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index a0dd69516cf..f0dfd1e9b15 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -249,9 +249,9 @@ table td.delete { background-image:url('../img/delete.png'); } #fileList tr:hover input[type=checkbox] { display:inline; } /* NAVIGATION BAR */ -p.nav { margin:1em 0 0 2em; padding:0.8em; line-height:16px; font-weight:bold; } -p.nav a { padding:0.5em 1.5em 0.5em 0.5em; background-position:right center; background-repeat:no-repeat; background-image:url('../img/arrow.png'); text-decoration:none; } -p.nav a img { height:16px; vertical-align:text-top; } +span.nav { margin:1em 0 0 2em; padding:0.8em; line-height:16px; font-weight:bold; display:block} +span.nav a { padding:0.5em 1.5em 0.5em 0.5em; background-position:right center; background-repeat:no-repeat; background-image:url('../img/arrow.png'); text-decoration:none; } +span.nav a img { height:16px; vertical-align:text-top; } /* ACTIONS BAR */ p.actions, div.actions { padding:0; } diff --git a/files/css/files.css b/files/css/files.css index 3b01bfe0971..ed67755ab4a 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -114,3 +114,7 @@ table td.filename a span.extention{ color:#999; } + +div.crumb{ + float:left; +} \ No newline at end of file diff --git a/files/js/filelist.js b/files/js/filelist.js index 2d00c642333..290f062dae2 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -11,6 +11,7 @@ FileList={ html+=''; html+=''; FileList.insertElement(name,'file',$(html)); + $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); }, addDir:function(name,size,lastModified){ var html=''; @@ -22,6 +23,8 @@ FileList={ html+=''; FileList.insertElement(name,'dir',$(html)); + $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + $('tr[data-file="'+name+'"] td.filename').droppable(folderDropOptions); }, refresh:function(data) { result = jQuery.parseJSON(data.responseText); @@ -32,6 +35,7 @@ FileList={ resetFileActionPanel(); }, remove:function(name){ + $('tr[data-file="'+name+'"] td.filename').draggable('destroy'); $('tr[data-file="'+name+'"]').remove(); }, insertElement:function(name,type,element){ diff --git a/files/js/files.js b/files/js/files.js index 85bc7a98f62..431b49131ce 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,26 +1,33 @@ $(document).ready(function() { $('#file_action_panel').attr('activeAction', false); - - $('#fileList tr td.filename').draggable({ - distance: 20, revert: true, opacity: 0.7, - stop: function(event, ui) { - $('#fileList tr td.filename').addClass('ui-draggable'); - }, - }); - $('#fileList tr[data-type="dir"] td.filename').droppable({ + + //drag/drop of files + $('#fileList tr td.filename').draggable(dragOptions); + $('#fileList tr[data-type="dir"] td.filename').droppable(folderDropOptions); + $('div.crumb').droppable({ drop: function( event, ui ) { var file=ui.draggable.text().trim(); - var target=$(this).text().trim(); + var target=$(this).attr('data-dir'); + var dir=$('#dir').val(); + while(dir.substr(0,1)=='/'){//remove extra leading /'s + dir=dir.substr(1); + } + dir='/'+dir; + if(dir.substr(-1,1)!='/'){ + dir=dir+'/'; + } + if(target==dir){ + return; + } $.ajax({ url: 'ajax/move.php', - data: "dir="+$('#dir').val()+"&file="+file+'&target='+target, + data: "dir="+dir+"&file="+file+'&target='+target, complete: function(data){boolOperationFinished(data, function(){ - var el=$('#fileList tr[data-file="'+file+'"] td.filename'); - el.draggable('destroy'); FileList.remove(file); });} }); - } + }, + tolerance: 'pointer' }); // Sets the file-action buttons behaviour : @@ -234,3 +241,28 @@ function formatDate(date){ "July", "August", "September", "October", "November", "December" ]; return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+date.getMinutes(); } + + +//options for file drag/dropp +var dragOptions={ + distance: 20, revert: true, opacity: 0.7, + stop: function(event, ui) { + $('#fileList tr td.filename').addClass('ui-draggable'); + } +}; +var folderDropOptions={ + drop: function( event, ui ) { + var file=ui.draggable.text().trim(); + var target=$(this).text().trim(); + var dir=$('#dir').val(); + $.ajax({ + url: 'ajax/move.php', + data: "dir="+dir+"&file="+file+'&target='+dir+'/'+target, + complete: function(data){boolOperationFinished(data, function(){ + var el=$('#fileList tr[data-file="'+file+'"] td.filename'); + el.draggable('destroy'); + FileList.remove(file); + });} + }); + } +} \ No newline at end of file diff --git a/files/templates/index.php b/files/templates/index.php index b9f8c02c93b..a1254eeb423 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -23,9 +23,9 @@ - + diff --git a/files/templates/part.breadcrumb.php b/files/templates/part.breadcrumb.php index da9544008b9..34f955fe675 100644 --- a/files/templates/part.breadcrumb.php +++ b/files/templates/part.breadcrumb.php @@ -1,4 +1,8 @@ - ">" alt="Root" /> + - "> +
    + "> +
    \ No newline at end of file