Remove stray old code, error if fail to move or rename

This commit is contained in:
mattpass
2020-07-13 19:22:08 +01:00
parent a905b0bb30
commit b009ef24ab
2 changed files with 9 additions and 7 deletions

View File

@@ -2078,7 +2078,6 @@ var ICEcoder = {
let i, closeTabLink, fileName;
if (newName && newName !== oldName) {
i = this.openFiles.indexOf(oldName.replace(/\|/g, "/"));
if (this.ask("Are you sure you want to move file " + oldName + " to " + newName + " ?")){
this.serverQueue("add", iceLoc + "/lib/file-control.php?action=move&oldFileName=" + encodeURIComponent(oldName.replace(/\//g, "|")) + "&csrf=" + this.csrf, encodeURIComponent(newName.replace(/\//g, "|")));
this.serverMessage('<b>' + t['Moving to'] + '</b><br>' + newName);

View File

@@ -248,12 +248,15 @@ if (!$error && "move" === $_GET['action']) {
$fileOrFolder = is_dir($docRoot . $fileLoc . "/" . $fileName) ? "folder" : "file";
$fileClass->updateFileManager('move', $fileLoc, $fileName, '', str_replace($iceRoot, "", str_replace("|", "/", $_GET['oldFileName'])), '', $fileOrFolder);
$doNext .= 'tabNum = ICEcoder.openFiles.indexOf(\'' . str_replace("|", "/", $_GET['oldFileName']) . '\') + 1; if (0 < tabNum) {ICEcoder.renameTab(tabNum, \'' . $fileLoc . "/" . $fileName . '\');};';
$finalAction = "move";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirMove($doNext);
} else {
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot move'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
$finalAction = "nothing";
}
}
$finalAction = "move";
// Run any extra processes
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirMove($doNext);
} else {
$doNext .= "ICEcoder.message('" . $t['Sorry, cannot move'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
$finalAction = "nothing";
@@ -290,12 +293,12 @@ if (!$error && "rename" === $_GET['action']) {
$extraProcessesClass = new ExtraProcesses($fileLoc, $fileName);
$doNext = $extraProcessesClass->onFileDirRename($doNext);
} else {
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . $_GET['oldFileName'] . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['does not seem...'] . "');";
$finalAction = "nothing";
}
}
} else {
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . $_GET['oldFileName'] . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
$doNext .= "ICEcoder.message('".$t['Sorry, cannot rename'] . "\\\\n" . str_replace("|", "/", $_GET['oldFileName']) . "\\\\n\\\\n" . $t['Maybe public write...'] . "');";
$finalAction = "nothing";
}
$doNext .= 'ICEcoder.serverMessage(); ICEcoder.serverQueue("del", 0);';