Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Clearing of server queue items in turn & saving from content snapshot
When an action is performed (or not performed due to error), it is cleared from the server queue
Saving is now done from the saveTemp1 textarea element (a snapshot when save is requested by user)
  • Loading branch information
mattpass committed Mar 25, 2012
1 parent 029f5ed commit 5f58081
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/file-control.php
Expand Up @@ -50,14 +50,14 @@
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();action="newFolder";</script>';
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="newFolder";</script>';
} else {
if (!is_writable($docRoot.$file)) {
echo "<script>alert('Sorry, cannot create folder at\\n".substr($file,0,strrpos($file,"/"))."');</script>";
} else {
echo '<script>alert(\'Sorry, you need to be logged in to add folders\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();action="nothing";</script>';
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
}

Expand All @@ -69,14 +69,14 @@
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();action="rename";</script>';
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'rename\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="rename";</script>';
} else {
if (!is_writable($_GET['oldFileName'])) {
echo "<script>alert('Sorry, cannot rename\\n".$_GET['oldFileName']."');</script>";
} else {
echo '<script>alert(\'Sorry, you need to be logged in to rename\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();action="nothing";</script>';
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
}

Expand All @@ -95,19 +95,19 @@
$fileName = substr($file,strrpos($file,"/")+1);
$fileLoc = substr($file,0,strrpos($file,"/"));
if ($fileLoc=="") {$fileLoc = "/";};
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();action="delete";</script>';
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'delete\',\''.$fileLoc.'\',\''.$fileName.'\');top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="delete";</script>';
} else {
echo "<script>alert('Sorry can\\'t delete\\n".$filesArray[$i]."');</script>";
}
echo '<script>top.ICEcoder.serverMessage();action="nothing";</script>';
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
} else {
if (!is_writable($docRoot.$filesArray[$i])) {
echo "<script>alert('Sorry, cannot delete\\n".$docRoot.$filesArray[$i]."');</script>";
} else {
echo '<script>alert(\'Sorry, you need to be logged in to delete\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();action="nothing";</script>';
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
}

Expand Down Expand Up @@ -150,18 +150,18 @@ function rrmdir($dir) {
if (isset($_POST['newFileName'])&&$_POST['newFileName']!="") {
echo '<script>top.ICEcoder.renameTab(top.ICEcoder.selectedTab,\''.$file.'\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();action="doneSave";</script>';
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="doneSave";</script>';
} else {
echo "<script>alert('Sorry, cannot write\\n".$file."');</script>";
echo '<script>top.ICEcoder.serverMessage();action="nothing";</script>';
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
} else {
if (!is_writable($saveFile)) {
echo "<script>alert('Sorry, cannot write\\n".$file."');</script>";
} else {
echo '<script>alert(\'Sorry, you need to be logged in to save\');</script>';
}
echo '<script>top.ICEcoder.serverMessage();action="nothing";</script>';
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);action="nothing";</script>';
}
}
};
Expand Down Expand Up @@ -192,6 +192,7 @@ function rrmdir($dir) {
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = top.ICEcoder.content.contentWindow['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setLineClass(0, "cm-s-activeLine");
top.ICEcoder.nextcMInstance++;
top.ICEcoder.serverMessage();
top.ICEcoder.serverQueue("del",0);
top.ICEcoder.loadingFile = false;
}

Expand Down Expand Up @@ -220,8 +221,7 @@ function rrmdir($dir) {
}
document.saveFile.newFileName.value = newFileName;
<?php ;};?>
cM = top.ICEcoder.getcMInstance();
document.saveFile.contents.innerHTML = cM.getValue();
document.saveFile.contents.innerHTML = top.document.getElementById('saveTemp1').value;
document.saveFile.submit();
}
</script>
Expand Down

0 comments on commit 5f58081

Please sign in to comment.