|
@@ -1341,23 +1341,26 @@
|
|
|
|
|
|
function getUserRootIcons(foldername){
|
|
|
var icon = "folder open";
|
|
|
- if (foldername == "Desktop"){
|
|
|
+ foldername = foldername.toLowerCase();
|
|
|
+ if (foldername == "desktop"){
|
|
|
icon = "computer";
|
|
|
- }else if (foldername == "Document"){
|
|
|
+ }else if (foldername == "document"){
|
|
|
icon = "file text outline";
|
|
|
- }else if (foldername == "Music"){
|
|
|
+ }else if (foldername == "music" || foldername == "audio"){
|
|
|
icon = "music";
|
|
|
- }else if (foldername == "Photo"){
|
|
|
+ }else if (foldername == "photo" || foldername == "picture"){
|
|
|
icon = "image";
|
|
|
- }else if (foldername == "Video"){
|
|
|
+ }else if (foldername == "video" || foldername == "film"){
|
|
|
icon = "video";
|
|
|
- }else if (foldername == "Trash"){
|
|
|
+ }else if (foldername == "trash" || foldername == "bin" || foldername == "rubbish"){
|
|
|
icon = "trash"
|
|
|
- }else if (foldername == "Download"){
|
|
|
+ }else if (foldername == "download"){
|
|
|
icon = "download"
|
|
|
- }else if (foldername == "Model"){
|
|
|
+ }else if (foldername == "www" || foldername == "web" || foldername == "mysite"){
|
|
|
+ icon = "globe"
|
|
|
+ }else if (foldername == "model"){
|
|
|
icon = "cube"
|
|
|
- }else if (foldername == "Appdata"){
|
|
|
+ }else if (foldername == "appdata"){
|
|
|
icon = "code"
|
|
|
}
|
|
|
return icon;
|
|
@@ -2230,22 +2233,25 @@
|
|
|
}
|
|
|
console.log(srclist, newnamelist);
|
|
|
//Send the request to serverside
|
|
|
- $.ajax({
|
|
|
- url: "../../system/file_system/fileOpr",
|
|
|
- method: "POST",
|
|
|
- data: {opr: "rename", src: JSON.stringify(srclist), new: JSON.stringify(newnamelist)},
|
|
|
- success: function(data){
|
|
|
- if (data.error !== undefined){
|
|
|
- msgbox("remove",data.error);
|
|
|
- $("#renameBox").fadeOut(100);
|
|
|
- }else{
|
|
|
- refreshList();
|
|
|
- msgbox("checkmark","Rename suceed");
|
|
|
- $("#renameBox").fadeOut(100);
|
|
|
+ requestCSRFToken(function(token){
|
|
|
+ $.ajax({
|
|
|
+ url: "../../system/file_system/fileOpr",
|
|
|
+ method: "POST",
|
|
|
+ data: {opr: "rename", src: JSON.stringify(srclist), new: JSON.stringify(newnamelist), csrft: token},
|
|
|
+ success: function(data){
|
|
|
+ if (data.error !== undefined){
|
|
|
+ msgbox("remove",data.error);
|
|
|
+ $("#renameBox").fadeOut(100);
|
|
|
+ }else{
|
|
|
+ refreshList();
|
|
|
+ msgbox("checkmark","Rename suceed");
|
|
|
+ $("#renameBox").fadeOut(100);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ renameFileObjects = [];
|
|
|
});
|
|
|
- renameFileObjects = [];
|
|
|
+
|
|
|
hideAllPopupWindows();
|
|
|
}
|
|
|
|
|
@@ -2350,21 +2356,24 @@
|
|
|
//Stsart operations
|
|
|
if (!ao_module_virtualDesktop){
|
|
|
//Not under desktop mode. Use direct copy API
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: `../../system/file_system/fileOpr`,
|
|
|
- data: {opr: "move" ,src: JSON.stringify(fileList), dest: targetDir,existsresp: overwriteMode},
|
|
|
- success: function(data){
|
|
|
- if (data.error !== undefined){
|
|
|
- msgbox("remove",data.error);
|
|
|
- }else{
|
|
|
- //OK
|
|
|
- msgbox("checkmark",fileList.length + " objects moved.")
|
|
|
- refreshList();
|
|
|
+ requestCSRFToken(function(token){
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: `../../system/file_system/fileOpr`,
|
|
|
+ data: {opr: "move" ,src: JSON.stringify(fileList), dest: targetDir,existsresp: overwriteMode, csrft: token},
|
|
|
+ success: function(data){
|
|
|
+ if (data.error !== undefined){
|
|
|
+ msgbox("remove",data.error);
|
|
|
+ }else{
|
|
|
+ //OK
|
|
|
+ msgbox("checkmark",fileList.length + " objects moved.")
|
|
|
+ refreshList();
|
|
|
+ }
|
|
|
+ hideAllPopupWindows();
|
|
|
}
|
|
|
- hideAllPopupWindows();
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
}else{
|
|
|
//Pass the request to operation handler
|
|
|
var oprConfig = {
|
|
@@ -2408,21 +2417,24 @@
|
|
|
}else{
|
|
|
//OK!
|
|
|
if (!ao_module_virtualDesktop){
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: `../../system/file_system/fileOpr`,
|
|
|
- data: {opr: "copy" ,src: JSON.stringify(fileList), dest: targetDir,existsresp: overwriteMode },
|
|
|
- success: function(data){
|
|
|
- if (data.error !== undefined){
|
|
|
- msgbox("remove",data.error);
|
|
|
- }else{
|
|
|
- //OK
|
|
|
- msgbox("checkmark",fileList.length + " objects copied.")
|
|
|
- refreshList();
|
|
|
+ requestCSRFToken(function(token){
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: `../../system/file_system/fileOpr`,
|
|
|
+ data: {opr: "copy" ,src: JSON.stringify(fileList), dest: targetDir,existsresp: overwriteMode, csrft: token},
|
|
|
+ success: function(data){
|
|
|
+ if (data.error !== undefined){
|
|
|
+ msgbox("remove",data.error);
|
|
|
+ }else{
|
|
|
+ //OK
|
|
|
+ msgbox("checkmark",fileList.length + " objects copied.")
|
|
|
+ refreshList();
|
|
|
+ }
|
|
|
+ hideAllPopupWindows();
|
|
|
}
|
|
|
- hideAllPopupWindows();
|
|
|
- }
|
|
|
+ });
|
|
|
});
|
|
|
+
|
|
|
}else{
|
|
|
//Pass the request to operation handler
|
|
|
var oprConfig = {
|
|
@@ -2502,22 +2514,25 @@
|
|
|
//Start force delete function
|
|
|
$("#forceDeleteConfirmBox").fadeOut(100);
|
|
|
let fdlistLength = forceDeleteList.length;
|
|
|
- $.ajax({
|
|
|
- url: "../../system/file_system/fileOpr",
|
|
|
- method:"POST",
|
|
|
- data: {opr: "delete", src: JSON.stringify(forceDeleteList)},
|
|
|
- success: function(data){
|
|
|
- if (data.error !== undefined){
|
|
|
- msgbox("caution",data.error);
|
|
|
- }else{
|
|
|
- refreshList();
|
|
|
- msgbox("checkmark",fdlistLength + " objects removed.")
|
|
|
+ requestCSRFToken(function(token){
|
|
|
+ $.ajax({
|
|
|
+ url: "../../system/file_system/fileOpr",
|
|
|
+ method:"POST",
|
|
|
+ data: {opr: "delete", src: JSON.stringify(forceDeleteList), csrft: token},
|
|
|
+ success: function(data){
|
|
|
+ if (data.error !== undefined){
|
|
|
+ msgbox("caution",data.error);
|
|
|
+ }else{
|
|
|
+ refreshList();
|
|
|
+ msgbox("checkmark",fdlistLength + " objects removed.")
|
|
|
+ }
|
|
|
+ hideAllPopupWindows();
|
|
|
}
|
|
|
- hideAllPopupWindows();
|
|
|
- }
|
|
|
+ });
|
|
|
+ //Finishing up delete sequence
|
|
|
+ forceDeleteList = [];
|
|
|
});
|
|
|
- //Finishing up delete sequence
|
|
|
- forceDeleteList = [];
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2543,27 +2558,30 @@
|
|
|
}else{
|
|
|
//Continue to delete files
|
|
|
let fdlistLength = deleteFileList.length;
|
|
|
- $.ajax({
|
|
|
- url: "../../system/file_system/fileOpr",
|
|
|
- method:"POST",
|
|
|
- data: {opr: "recycle", src: JSON.stringify(deleteFileList)},
|
|
|
- success: function(data){
|
|
|
- if (data.error !== undefined){
|
|
|
- msgbox("caution",data.error);
|
|
|
- }else{
|
|
|
- refreshList();
|
|
|
- msgbox("checkmark",fdlistLength + " objects moved to trash bin.")
|
|
|
- }
|
|
|
+ requestCSRFToken(function(token){
|
|
|
+ $.ajax({
|
|
|
+ url: "../../system/file_system/fileOpr",
|
|
|
+ method:"POST",
|
|
|
+ data: {opr: "recycle", src: JSON.stringify(deleteFileList), csrft: token},
|
|
|
+ success: function(data){
|
|
|
+ if (data.error !== undefined){
|
|
|
+ msgbox("caution",data.error);
|
|
|
+ }else{
|
|
|
+ refreshList();
|
|
|
+ msgbox("checkmark",fdlistLength + " objects moved to trash bin.")
|
|
|
+ }
|
|
|
|
|
|
- if (currentPath == "user:/"){
|
|
|
- //Reload the User root folder list
|
|
|
- initRootDirs();
|
|
|
+ if (currentPath == "user:/"){
|
|
|
+ //Reload the User root folder list
|
|
|
+ initRootDirs();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ console.log(deleteFileList);
|
|
|
+ deleteFileList = [];
|
|
|
+ hideAllPopupWindows();
|
|
|
});
|
|
|
- console.log(deleteFileList);
|
|
|
- deleteFileList = [];
|
|
|
- hideAllPopupWindows();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -4664,6 +4682,15 @@
|
|
|
refreshList();
|
|
|
}
|
|
|
|
|
|
+ function requestCSRFToken(callback){
|
|
|
+ $.ajax({
|
|
|
+ url: "../../system/csrf/new",
|
|
|
+ success: function(token){
|
|
|
+ callback(token);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|