diff --git a/lib/coder.js b/lib/coder.js index 135c692..66862c6 100644 --- a/lib/coder.js +++ b/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('Creating Folder
'+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 = '        '+file+' 705'; + newLI.innerHTML = '        '+file+' '+perms+''; 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 = '        '+file+' 705'; - // 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 = '        '+file+' '+perms+''; + // 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; + } } } }