@ -100,19 +100,40 @@ $(document).ready(function() {
} ) ;
$ ( '.delete' ) . click ( function ( event ) {
var files = getSelectedFiles ( 'name' ) . join ( ';' ) ;
var fileNames = getSelectedFiles ( 'name' ) ;
var files = fileNames . join ( ';' ) ;
var lastFileName = fileNames . pop ( ) ;
if ( fileNames . length > 0 ) {
fileNames = fileNames . join ( ', ' ) + ' and ' + lastFileName ;
} else {
fileNames = lastFileName ;
}
$ . ajax ( {
url : 'ajax/delete.php' ,
data : "dir=" + $ ( '#dir' ) . val ( ) + "&files=" + encodeURIComponent ( files ) ,
complete : function ( data ) {
boolOperationFinished ( data , function ( ) {
var files = getSelectedFiles ( 'name' ) ;
for ( var i = 0 ; i < files . length ; i ++ ) {
FileList . remove ( files [ i ] ) ;
}
procesSelection ( ) ;
} ) ;
$ ( "#delete-confirm" ) . dialog ( {
resizable : false ,
height : 200 ,
modal : true ,
title : "Delete " + fileNames ,
buttons : {
"Delete" : function ( ) {
$ ( this ) . dialog ( "close" ) ;
$ . ajax ( {
url : 'ajax/delete.php' ,
data : "dir=" + $ ( '#dir' ) . val ( ) + "&files=" + encodeURIComponent ( files ) ,
complete : function ( data ) {
boolOperationFinished ( data , function ( ) {
var files = getSelectedFiles ( 'name' ) ;
for ( var i = 0 ; i < files . length ; i ++ ) {
FileList . remove ( files [ i ] ) ;
}
procesSelection ( ) ;
} ) ;
}
} ) ;
} ,
Cancel : function ( ) {
$ ( this ) . dialog ( "close" ) ;
}
}
} ) ;