dont allow draging files to the current directory

This commit is contained in:
Robin Appelman 2012-04-15 16:06:16 +02:00
parent dae34edf4f
commit c0bdad5893
1 changed files with 6 additions and 4 deletions

View File

@ -13,9 +13,11 @@ $(document).ready(function() {
//drag/drop of files
$('#fileList tr td.filename').draggable(dragOptions);
$('#fileList tr[data-type="dir"][data-write="true"] td.filename').droppable(folderDropOptions);
$('div.crumb').droppable(crumbDropOptions);
$('div.crumb:not(.last)').droppable(crumbDropOptions);
$('ul#apps>li:first-child').data('dir','');
$('ul#apps>li:first-child').droppable(crumbDropOptions);
if($('div.crumb').length){
$('ul#apps>li:first-child').droppable(crumbDropOptions);
}
// Triggers invisible file input
$('.file_upload_button_wrapper').live('click', function() {
@ -412,7 +414,7 @@ var dragOptions={
};
var folderDropOptions={
drop: function( event, ui ) {
var file=ui.draggable.text().trim();
var file=ui.draggable.parent().data('file');
var target=$(this).text().trim();
var dir=$('#dir').val();
$.ajax({
@ -438,7 +440,7 @@ var crumbDropOptions={
if(dir.substr(-1,1)!='/'){
dir=dir+'/';
}
if(target==dir){
if(target==dir || target+'/'==dir){
return;
}
$.ajax({