summaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-07 21:43:35 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-07 21:55:58 +0200
commit47993fe29a6a7837e39b1e24e03c3b4ac9d7f794 (patch)
treedd3fed3ae02d32d0a0468db13db94daa74d61c06 /files
parent01a9d916e7fe477f6fb42a534e3265ddbe00fddd (diff)
downloadnextcloud-server-47993fe29a6a7837e39b1e24e03c3b4ac9d7f794.tar.gz
nextcloud-server-47993fe29a6a7837e39b1e24e03c3b4ac9d7f794.zip
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
Diffstat (limited to 'files')
-rw-r--r--files/css/files.css4
-rw-r--r--files/js/filelist.js4
-rw-r--r--files/js/files.js58
-rw-r--r--files/templates/index.php4
-rw-r--r--files/templates/part.breadcrumb.php8
5 files changed, 61 insertions, 17 deletions
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+='<td class="fileaction"><a href="" title="+" class="dropArrow"></a></td>';
html+='</tr>';
FileList.insertElement(name,'file',$(html));
+ $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions);
},
addDir:function(name,size,lastModified){
var html='<tr data-file="'+name+'" data-type="dir">';
@@ -22,6 +23,8 @@ FileList={
html+='</tr>';
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 @@
</div>
</div>
-<p class="nav">
+<span class="nav">
<?php echo($_['breadcrumb']); ?>
-</p>
+</span>
<table cellspacing="0">
<thead>
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 @@
- <a href="<?php echo link_to("files", "index.php?dir=/"); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root" /></a>
+ <div class='crumb' data-dir='/'>
+ <a href="<?php echo link_to("files", "index.php?dir=/"); ?>"><img src="<?php echo image_path("", "actions/go-home.png"); ?>" alt="Root"/></a>
+ </div>
<?php foreach($_["breadcrumb"] as $crumb): ?>
- <a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a>
+ <div class='crumb' data-dir='<?php echo $crumb["dir"];?>'>
+ <a href="<?php echo link_to("files", "index.php?dir=".$crumb["dir"]); ?>"><?php echo htmlspecialchars($crumb["name"]); ?></a>
+ </div>
<?php endforeach; ?> \ No newline at end of file