mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-14 07:41:14 +01:00
Continued work on Uploads, updated context menu,
This commit is contained in:
parent
7b0d6c3926
commit
752d5d1640
3 changed files with 35 additions and 18 deletions
|
@ -11,18 +11,6 @@
|
||||||
"applies-to" : "directory-only",
|
"applies-to" : "directory-only",
|
||||||
"onclick": "codiad.filemanager.createNode($('#context-menu').attr('data-path'),'directory');"
|
"onclick": "codiad.filemanager.createNode($('#context-menu').attr('data-path'),'directory');"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"title": "Archive",
|
|
||||||
"icon": "icon-archive",
|
|
||||||
"applies-to" : "directory-only non-root",
|
|
||||||
"onclick": "codiad.filemanager.archive( $('#context-menu').attr('data-path') );"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Unarchive",
|
|
||||||
"icon": "icon-archive",
|
|
||||||
"applies-to" : "file-only non-root",
|
|
||||||
"onclick": "codiad.filemanager.unarchive( $('#context-menu').attr('data-path') );"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"title": "Break",
|
"title": "Break",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
|
@ -59,6 +47,24 @@
|
||||||
"applies-to" : "file-only no-external",
|
"applies-to" : "file-only no-external",
|
||||||
"onclick": null
|
"onclick": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"title": "Archive",
|
||||||
|
"icon": "icon-archive",
|
||||||
|
"applies-to" : "directory-only non-root",
|
||||||
|
"onclick": "codiad.filemanager.archive( $('#context-menu').attr('data-path') );"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Unarchive",
|
||||||
|
"icon": "icon-archive",
|
||||||
|
"applies-to" : "file-only non-root",
|
||||||
|
"onclick": "codiad.filemanager.unarchive( $('#context-menu').attr('data-path') );"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Break",
|
||||||
|
"icon": null,
|
||||||
|
"applies-to" : "directory-only",
|
||||||
|
"onclick": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"title": "Break",
|
"title": "Break",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
|
|
|
@ -53,6 +53,8 @@ if( isset( $_GET["path"] ) || isset( $_POST["path"] ) ) {
|
||||||
|
|
||||||
$response["status"] = "error";
|
$response["status"] = "error";
|
||||||
$response["message"] = "Missing path.";
|
$response["message"] = "Missing path.";
|
||||||
|
$response["GET"] = $_GET;
|
||||||
|
$response["POST"] = $_POST;
|
||||||
exit( json_encode( $response ) );
|
exit( json_encode( $response ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
$( document ).on( 'dragenter', function( e ) {
|
$( document ).on( 'dragenter', function( e ) {
|
||||||
|
|
||||||
$( '.drop-overlay' ).css( 'display', 'block' );
|
$( '.drop-overlay' ).css( 'display', 'block' );
|
||||||
|
$( document ).on( 'keypress', codiad.filemanager.upload_overlay_off );
|
||||||
});
|
});
|
||||||
|
|
||||||
$( '.drop-overlay' ).on( 'drag dragstart dragend dragover dragenter dragleave drop', function( e ) {
|
$( '.drop-overlay' ).on( 'drag dragstart dragend dragover dragenter dragleave drop', function( e ) {
|
||||||
|
@ -129,10 +130,12 @@
|
||||||
} else if( result.includes( 'm' ) ) {
|
} else if( result.includes( 'm' ) ) {
|
||||||
|
|
||||||
let integer = result.replace( /^\D+/g, '' );
|
let integer = result.replace( /^\D+/g, '' );
|
||||||
|
console.log( integer, 1024*1024*integer );
|
||||||
result = 1024*1024*integer;
|
result = 1024*1024*integer;
|
||||||
} else if( result.includes( 'k' ) ) {
|
} else if( result.includes( 'k' ) ) {
|
||||||
|
|
||||||
let integer = result.replace( /^\D+/g, '' );
|
let integer = result.replace( /^\D+/g, '' );
|
||||||
|
console.log( integer, 1024*integer );
|
||||||
result = 1024*integer;
|
result = 1024*integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1680,7 +1683,7 @@
|
||||||
});
|
});
|
||||||
} else if( entry.isDirectory ) {
|
} else if( entry.isDirectory ) {
|
||||||
|
|
||||||
_this.upload_read_directory( entry, destination, _this.upload_split );
|
_this.upload_read_directory( entry, destination, _this.upload_blobs );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1724,17 +1727,17 @@
|
||||||
let upload_status = null;
|
let upload_status = null;
|
||||||
let total_blobs = 0;
|
let total_blobs = 0;
|
||||||
|
|
||||||
if( _this.post_max_size > ( 1024*1024*8 ) ) {
|
if( isNaN( _this.post_max_size ) || _this.post_max_size > ( 1024*1024*2 ) ) {
|
||||||
|
|
||||||
blob_size = ( 1024*1024*8 );
|
blob_size = ( 1024*1024*2 );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
blob_size = _this.post_max_size;
|
blob_size = ( _this.post_max_size / 4 ) * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log( total_size, blob_size, ( total_size / blob_size ) );
|
console.log( total_size, blob_size, ( total_size / blob_size ) );
|
||||||
|
|
||||||
if( total_size <= blob_size ) {
|
if( total_size < blob_size ) {
|
||||||
|
|
||||||
blob_size = total_size;
|
blob_size = total_size;
|
||||||
current = start + blob_size;
|
current = start + blob_size;
|
||||||
|
@ -1760,6 +1763,7 @@
|
||||||
|
|
||||||
reader.onload = async function( e ) {
|
reader.onload = async function( e ) {
|
||||||
|
|
||||||
|
console.log( path, current, total_size )
|
||||||
upload_status = await _this.upload_blob( e.target.result, path );
|
upload_status = await _this.upload_blob( e.target.result, path );
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -1774,6 +1778,10 @@
|
||||||
|
|
||||||
_this.upload_blobs( file, path, current, status );
|
_this.upload_blobs( file, path, current, status );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$().toastmessage( 'removeToast', status );
|
||||||
|
_this.rescan( path.substring( 0, path.lastIndexOf( "/" ) ) );
|
||||||
}
|
}
|
||||||
} catch( exception ) {
|
} catch( exception ) {
|
||||||
|
|
||||||
|
@ -1811,6 +1819,7 @@
|
||||||
upload_overlay_off: function() {
|
upload_overlay_off: function() {
|
||||||
|
|
||||||
$( '.drop-overlay' ).css( 'display', 'none' );
|
$( '.drop-overlay' ).css( 'display', 'none' );
|
||||||
|
$( document ).off( 'keypress', codiad.filemanager.upload_overlay_off );
|
||||||
},
|
},
|
||||||
|
|
||||||
upload_overlay_on: function( e ) {
|
upload_overlay_on: function( e ) {
|
||||||
|
@ -1840,7 +1849,7 @@
|
||||||
// Get file
|
// Get file
|
||||||
item.file( function( file ) {
|
item.file( function( file ) {
|
||||||
|
|
||||||
file_callback( file, path );
|
file_callback( file, path + file.name );
|
||||||
});
|
});
|
||||||
} else if( item.isDirectory ) {
|
} else if( item.isDirectory ) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue