Use new fileOrFolder param to determin type

Rather than rely on a . in the name
This commit is contained in:
Matt Pass
2014-04-14 08:36:23 +01:00
parent 68e5e0b5a5
commit 1385d65a2b
2 changed files with 3 additions and 3 deletions

View File

@@ -961,13 +961,13 @@ var ICEcoder = {
},
// Update the file manager tree list on demand
updateFileManagerList: function(action,location,file,perms,oldName,uploaded) {
updateFileManagerList: function(action,location,file,perms,oldName,uploaded,fileOrFolder) {
var actionElemType, cssStyle, perms, targetElem, locNest, newText, innerLI, newUL, newLI, elemType, nameLI, shortURL, newMouseOver;
// Adding files
if (action=="add" && !top.get('filesFrame').contentWindow.document.getElementById(location.replace(/\/$/, "").replace(/\//g,"|")+"|"+file)) {
// Is this is a file or folder and based on that, set the CSS styling & link
actionElemType = file.indexOf(".")>-1 ? "file" : "folder";
actionElemType = fileOrFolder;
cssStyle = actionElemType=="file" ? "pft-file ext-" + file.substr(file.indexOf(".")+1) : "pft-directory";
perms = actionElemType=="file" ? 664 : 705;

View File

@@ -37,7 +37,7 @@ a[0].lastIndexOf("|"));top.ICEcoder.pasteFiles(a);"undefined"!=typeof b&&(top.IC
0;a<c.length;a++)top.ICEcoder.showHide("hide",top.get(c[a])),top.get(c[a]+"Nav").style.color=""},150);else for(var d=0;d<c.length;d++)top.ICEcoder.showHide("hide",top.get(c[d])),top.get(c[d]+"Nav").style.color="";get("fileOptions").style.opacity=0;"show"==a&&("undefined"!=typeof fileNavInt&&clearTimeout(fileNavInt),top.ICEcoder.showHide(a,top.get(b)),top.get(b+"Nav").style.color="#fff",get("fileOptions").style.opacity=1)},showMenu:function(a){var b,c;0!=top.ICEcoder.selectedFiles.length&&-1!=top.ICEcoder.selectedFiles.indexOf(top.ICEcoder.selectedFiles[top.ICEcoder.selectedFiles.length-
1].replace(/\//g,"|"))||top.ICEcoder.selectFileFolder(a);a=129;c=window.innerHeight;"undefined"!=typeof top.ICEcoder.thisFileFolderLink&&""!=top.ICEcoder.thisFileFolderLink&&(b=-1<top.ICEcoder.selectedFiles[0].indexOf(".")?"file":"folder",top.get("folderMenuItems").style.display="folder"==b&&1==top.ICEcoder.selectedFiles.length?"block":"none","folder"==b&&1==top.ICEcoder.selectedFiles.length&&(a+=67,"block"==top.get("fmMenuPasteOption").style.display&&(a+=19)),top.get("singleFileMenuItems").style.display=
1<top.ICEcoder.selectedFiles.length?"none":"block",1==top.ICEcoder.selectedFiles.length&&(a+=43),top.get("fileMenu").style.display="inline-block",setTimeout(function(){top.get("fileMenu").style.opacity="1"},4),top.get("fileMenu").style.left=top.ICEcoder.mouseX+20+"px",b=top.ICEcoder.mouseY-top.ICEcoder.filesFrame.contentWindow.document.body.scrollTop-10,b+a>c&&(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){var g,m,h,k,n,p,l,r;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){g=-1<c.indexOf(".")?"file":"folder";m="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?664:705;b||(b="/");b=b.replace(top.iceRoot,"");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,
"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 m,h,k,n,p,l,r;if("add"==a&&!top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c)){m="file"==g?"pft-file ext-"+c.substr(c.indexOf(".")+1):"pft-directory";d="file"==g?664:705;b||(b="/");b=b.replace(top.iceRoot,"");h=top.get("filesFrame").contentWindow.document.getElementById(b.replace(/\//g,
"|"));k=h.parentNode.parentNode.nextSibling;n=document.createTextNode("\n");p='<a nohref title="'+b.replace(/\/$/,"")+"/"+c+'" onMouseOver="top.ICEcoder.overFileFolder(\''+g+"','"+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+"')\" onMouseOut=\"top.ICEcoder.overFileFolder('"+g+'\',\'\')" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+b.replace(/\/$/,"").replace(/\//g,"|")+"|"+c+'">'+c+'</span> <span style="color: #888; font-size: 8px" id="'+b.replace(/\/$/,
"").replace(/\//g,"|")+"|"+c+'_perms">'+d+"</span></a>";if(3>k.childNodes.length)l=document.createElement("ul"),k=h.parentNode.parentNode,k.parentNode.insertBefore(l,k.nextSibling),l=document.createElement("li"),l.className=m,l.draggable=!0,l.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&top.ICEcoder.getcMInstance().focus()},l.ondragend=function(){top.ICEcoder.dropFile(this)},l.innerHTML=p,k.nextSibling.appendChild(l),k.nextSibling.appendChild(n);else for(h=
0;h<k.childNodes.length;h++)if(k.childNodes[h].className&&(l=0<k.childNodes[h].className.indexOf("directory")?"folder":"file",r=k.childNodes[h].getElementsByTagName("span")[0].innerHTML,l==g&&r>c||"folder"==g&&"file"==l||h==k.childNodes.length-1)){l=document.createElement("li");l.className=m;l.draggable=!0;l.ondrag=function(a){top.ICEcoder.draggingWithKeyTest(a);top.ICEcoder.getcMInstance()&&top.ICEcoder.getcMInstance().focus()};l.ondragend=function(){top.ICEcoder.dropFile(this)};l.innerHTML=p;h==