]> source.dussan.org Git - nextcloud-server.git/commitdiff
files can now be draged and dropped in the file browser
authorRobin Appelman <icewind1991@gmail.com>
Thu, 7 Jul 2011 02:14:24 +0000 (04:14 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Thu, 7 Jul 2011 02:14:24 +0000 (04:14 +0200)
files/index.php
files/js/files.js
files/templates/part.list.php

index e06ab5526327b1619b2c2448e3e65fd3d7666c9e..e88f0ef23e50aba558439971f0956b2b78bede07 100644 (file)
@@ -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']='';
index 408bd6e48a0a17f881c1be12c8785da38663d4e5..85bc7a98f628190521a95643c7a5de4822129760 100644 (file)
@@ -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();
index 119b1bbd83d23957ff662ec3a6954c63569e6dfc..14a359fe66869474bf27b8c4a78d6a284cdfcbde 100644 (file)
@@ -8,7 +8,7 @@
                                                <?php if($file['type'] == 'dir'):?>
                                                        <strong><?php echo htmlspecialchars($file['name']);?></strong>
                                                <?php else:?>
-                                                       <?php echo htmlspecialchars($file['name']);?><span class='extention'><?php echo $file['extention'];?></span>
+                                                       <?php echo htmlspecialchars($file['basename']);?><span class='extention'><?php echo $file['extention'];?></span>
                                                <?php endif;?>
                                        </a>
                                </td>