diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 45cff27..400980a 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -1589,6 +1589,10 @@ var ICEcoder = { var xhr, statusObj, timeStart; path = path.replace(/\|/g,"/"); + // Clear any prefixed iceRoot from path + if (path.indexOf(top.iceRoot) === 0) { + path = path.replace(top.iceRoot,""); + } // Start a seperate XHR call. We run seperately rather than add into the serverQueue because we may need to run // immediately, eg need to if a file/dir exists mid flow in 'Save As' function, so can't go into queue @@ -1718,8 +1722,8 @@ var ICEcoder = { ' if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {top.ICEcoder.openFile()}}" style="position: relative; left:-22px">        '+file+' '+perms+''; - // If we don't have at least 3 DOM items in here, it's an empty folder - if(locNest.childNodes.length<3) { + // If we don't have a locNest or at least 3 DOM items in there, it's an empty folder + if(!locNest || locNest.childNodes.length<3) { // We now need to begin a new UL list newUL = document.createElement("ul"); locNest = targetElem.parentNode.parentNode; diff --git a/lib/ice-coder.min.js b/lib/ice-coder.min.js index 85768f1..0ca4957 100644 --- a/lib/ice-coder.min.js +++ b/lib/ice-coder.min.js @@ -65,15 +65,15 @@ a=a?a:top.ICEcoder.selectedFiles;b=a.toString().replace(/\|/g,"/").replace(/,/g, pasteFiles:function(a){if(top.ICEcoder.copiedFiles)for(var b=0;b"+top.t["Pasting File"]+"
"+top.ICEcoder.copiedFiles[b].toString().replace(/\|/g,"/").replace(/,/g,"\n"))):top.ICEcoder.message(top.t["Sorry cannot paste..."]);else top.ICEcoder.message(top.t["Nothing to paste..."])}, duplicateFiles:function(a){var b;top.ICEcoder.copiedFiles&&(b=top.ICEcoder.copiedFiles);top.ICEcoder.copyFiles(a,"dontShowPaste","dontHide");a=a[0].substr(0,a[0].lastIndexOf("|"));top.ICEcoder.pasteFiles(a);"undefined"!=typeof b&&(top.ICEcoder.copiedFiles=b)},uploadFilesSelect:function(a){top.get("uploadDir").value=a;top.get("fileInput").click()},uploadFilesSubmit:function(a){""!=top.get("fileInput").value&&(top.ICEcoder.showHide("show",top.get("loadingMask")),top.get("uploadFilesForm").submit(), event.preventDefault())},showHideFileNav:function(a,b){var c=["optionsFile","optionsEdit","optionsSource","optionsHelp"];if("hide"==a)fileNavInt=setTimeout(function(){for(var a=0;ac&&(b-=b+a-c),top.get("fileMenu").style.top= -b+"px");return!1},showFileMenu:function(){top.get("fileMenu").style.display="inline-block";setTimeout(function(){top.get("fileMenu").style.opacity="1"},4)},hideFileMenu:function(){top.get("fileMenu").style.display="none";top.get("fileMenu").style.opacity="0"},updateFileManagerList:function(a,b,c,d,e,f,g){var h,k,l,p,n,m,q;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot,"").replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){h="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+ -1):"pft-directory";d="file"==g?top.ICEcoder.newFilePerms:top.ICEcoder.newDirPerms;b||(b="/");b=b.replace(top.iceRoot,"/");b=b.replace("//","/");k=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));l=k.parentNode.parentNode.nextSibling;p=document.createTextNode("\n");n=777==d?"background: #800; color: #eee":"color: #888";n='        '+c+' '+d+"";if(3>l.childNodes.length)m=document.createElement("ul"),l=k.parentNode.parentNode,l.parentNode.insertBefore(m,l.nextSibling),m=document.createElement("li"),m.className=h,m.draggable=!1,m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")? +top.get(b)),top.get(b+"Nav").style.color="#fff",get("fileOptions").style.opacity=1)},isPathFolder:function(a){a=top.ICEcoder.filesFrame.contentDocument.getElementsByClassName("pft-directory");for(var b=top.ICEcoder.selectedFiles[0],c,d=0;dc&&(b-=b+a-c),top.get("fileMenu").style.top=b+"px");return!1},showFileMenu:function(){top.get("fileMenu").style.display="inline-block";setTimeout(function(){top.get("fileMenu").style.opacity="1"},4)},hideFileMenu:function(){top.get("fileMenu").style.display="none";top.get("fileMenu").style.opacity="0"},updateFileManagerList:function(a,b,c,d,e,f,g){var h,k,l,p,n,m,q;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(top.iceRoot,"").replace(/\/$/,"").replace(/\//g, +"|")+"|"+c)){h="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?top.ICEcoder.newFilePerms:top.ICEcoder.newDirPerms;b||(b="/");b=b.replace(top.iceRoot,"/");b=b.replace("//","/");k=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,"|"));l=k.parentNode.parentNode.nextSibling;p=document.createTextNode("\n");n=777==d?"background: #800; color: #eee":"color: #888";n='        '+c+' '+d+"";if(!l||3>l.childNodes.length)m=document.createElement("ul"),l=k.parentNode.parentNode,l.parentNode.insertBefore(m,l.nextSibling),m=document.createElement("li"),m.className=h,m.draggable=!1,m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")? top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())},m.ondragend=function(){top.ICEcoder.dropFile(this)},m.innerHTML=n,l.nextSibling.appendChild(m),l.nextSibling.appendChild(p);else for(k=0;kc||"folder"==g&&"file"==m||k==l.childNodes.length-1)){m=document.createElement("li");m.className= h;m.draggable=!1;m.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&(-1==top.ICEcoder.editorFocusInstance.indexOf("diff")?top.ICEcoder.getcMInstance().focus():top.ICEcoder.getcMdiffInstance().focus())};m.ondragend=function(){top.ICEcoder.dropFile(this)};m.innerHTML=n;k==l.childNodes.length-1?(l.appendChild(m),l.appendChild(p)):(l.insertBefore(m,l.childNodes[k]),l.insertBefore(p,l.childNodes[k+1]));break}"file"!=g||f||(top.ICEcoder.openFiles[top.ICEcoder.selectedTab- 1]=b+c)}"rename"==a&&(f=e.replace(/\//g,"|"),k=top.get("filesFrame").contentWindow.document.getElementById(f),k.innerHTML=c,k.id=b.replace(/\//g,"|")+"|"+c,k.parentNode.title=k.id.replace(/\|/g,"/"),targetElemPerms=top.get("filesFrame").contentWindow.document.getElementById(f+"_perms"),targetElemPerms.id=b.replace(/\//g,"|")+"|"+c+"_perms",top.ICEcoder.renameInChildren(k,e,b,c));"move"==a&&(top.ICEcoder.updateFileManagerList("add",b,c,!1,!1,!1,g),top.ICEcoder.updateFileManagerList("delete",e.substr(0,