mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Path tweaks to fix errors & correct perms shown
No need to add add / to end of getInput dialog default Double // replaced with / in error catching Correct perms shown on update of file manager; 705 on folders, 644 on files if condition block tabbed to right depth, for syntax clarity only
This commit is contained in:
41
lib/coder.js
41
lib/coder.js
@@ -722,9 +722,9 @@ var ICEcoder = {
|
||||
var newFolder, shortURL;
|
||||
|
||||
shortURL = top.ICEcoder.rightClickedFile.replace(/\|/g,"/");
|
||||
newFolder = top.ICEcoder.getInput('Enter New Folder Name at '+shortURL+'/','');
|
||||
newFolder = top.ICEcoder.getInput('Enter New Folder Name at '+shortURL,'');
|
||||
if (newFolder) {
|
||||
newFolder = shortURL + "/" + newFolder;
|
||||
newFolder = (shortURL + "/" + newFolder).replace(/\/\//,"/");
|
||||
top.ICEcoder.serverQueue("add","lib/file-control.php?action=newFolder&file="+newFolder.replace(/\//g,"|"));
|
||||
top.ICEcoder.serverMessage('<b>Creating Folder</b><br>'+newFolder);
|
||||
}
|
||||
@@ -1147,13 +1147,14 @@ var ICEcoder = {
|
||||
|
||||
// Update the file manager tree list on demand
|
||||
updateFileManagerList: function(action,location,file,perms,oldName) {
|
||||
var actionElemType, cssStyle, targetElem, locNest, newText, newUL, newLI, nameLI, shortURL, newMouseOver;
|
||||
var actionElemType, cssStyle, perms, targetElem, locNest, newText, newUL, newLI, nameLI, shortURL, newMouseOver;
|
||||
|
||||
// Adding files
|
||||
if (action=="add") {
|
||||
// Determin if this is a file or folder and based on that, set the CSS styling & link
|
||||
actionElemType = file.indexOf(".")>-1 ? "file" : "folder";
|
||||
cssStyle = actionElemType=="file" ? "pft-file ext-" + file.substr(file.indexOf(".")+1,file.length) : "pft-directory";
|
||||
perms = actionElemType=="file" ? 664 : 705;
|
||||
|
||||
// Identify our target element & the first child element in it's location
|
||||
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|"));
|
||||
@@ -1171,7 +1172,7 @@ var ICEcoder = {
|
||||
// Finally we can add the first list item for this file/folder we're adding
|
||||
newLI = document.createElement("li");
|
||||
newLI.className = cssStyle;
|
||||
newLI.innerHTML = '<a href="#" title="'+location+'/'+file+'" onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+location.replace(/\//g,"|")+'|'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px"> <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</span> <span style="color: #888; font-size: 8px" id="'+location.replace(/\//g,"|")+'|'+file+'_perms">705</span></a>';
|
||||
newLI.innerHTML = '<a href="#" title="'+location+'/'+file+'" onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+location.replace(/\//g,"|")+'|'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px"> <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</span> <span style="color: #888; font-size: 8px" id="'+location.replace(/\//g,"|")+'|'+file+'_perms">'+perms+'</span></a>';
|
||||
locNest.nextSibling.appendChild(newLI);
|
||||
locNest.nextSibling.appendChild(newText);
|
||||
|
||||
@@ -1179,25 +1180,25 @@ var ICEcoder = {
|
||||
} else {
|
||||
for (var i=0;i<=locNest.childNodes.length-1;i++) {
|
||||
if (locNest.childNodes[i].className) {
|
||||
// Identify if the item we're considering is a file or folder
|
||||
locNest.childNodes[i].className.indexOf('directory')>0 ? elemType = "folder" : elemType = "file";
|
||||
// Identify if the item we're considering is a file or folder
|
||||
locNest.childNodes[i].className.indexOf('directory')>0 ? elemType = "folder" : elemType = "file";
|
||||
|
||||
// Get the name of the item
|
||||
nameLI = locNest.childNodes[i].getElementsByTagName('span')[0].innerHTML;
|
||||
// Get the name of the item
|
||||
nameLI = locNest.childNodes[i].getElementsByTagName('span')[0].innerHTML;
|
||||
|
||||
// If it's of the same type & the name is greater, or we're adding a folder and it's a file or if we're at the end of the list
|
||||
// then we can add in here
|
||||
if ((elemType==actionElemType && nameLI > file) || (actionElemType=="folder" && elemType=="file") || i==locNest.childNodes.length-1) {
|
||||
newLI = document.createElement("li");
|
||||
newLI.className = cssStyle;
|
||||
newLI.innerHTML = '<a href="#" title="'+location+'/'+file+'" onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+location.replace(/\//g,"|")+'|'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px"> <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</span> <span style="color: #888; font-size: 8px" id="'+location.replace(/\//g,"|")+'|'+file+'_perms">705</span></a>';
|
||||
// Append or insert depending on which of the above if statements is true
|
||||
i==locNest.childNodes.length-1 ? locNest.appendChild(newLI) : locNest.insertBefore(newLI,locNest.childNodes[i]);
|
||||
i==locNest.childNodes.length-1 ? locNest.appendChild(newText) : locNest.insertBefore(newLI,locNest.childNodes[i+1]);
|
||||
// If it's of the same type & the name is greater, or we're adding a folder and it's a file or if we're at the end of the list
|
||||
// then we can add in here
|
||||
if ((elemType==actionElemType && nameLI > file) || (actionElemType=="folder" && elemType=="file") || i==locNest.childNodes.length-1) {
|
||||
newLI = document.createElement("li");
|
||||
newLI.className = cssStyle;
|
||||
newLI.innerHTML = '<a href="#" title="'+location+'/'+file+'" onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+location.replace(/\//g,"|")+'|'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px"> <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</span> <span style="color: #888; font-size: 8px" id="'+location.replace(/\//g,"|")+'|'+file+'_perms">'+perms+'</span></a>';
|
||||
// Append or insert depending on which of the above if statements is true
|
||||
i==locNest.childNodes.length-1 ? locNest.appendChild(newLI) : locNest.insertBefore(newLI,locNest.childNodes[i]);
|
||||
i==locNest.childNodes.length-1 ? locNest.appendChild(newText) : locNest.insertBefore(newLI,locNest.childNodes[i+1]);
|
||||
|
||||
// Escape from this loop now
|
||||
i=locNest.childNodes.length;
|
||||
}
|
||||
// Escape from this loop now
|
||||
i=locNest.childNodes.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user