CSS structure display changes & find in files QS

No longer using open & closed classes (italic text on open dirs)
This is because we have new icon to show open dirs
Reworked code to handle new UL & LI structure
Target querystring passed through if we're finding in files or filenames
This commit is contained in:
Matt Pass
2012-07-05 23:06:26 +01:00
parent 939eed7b3e
commit 5a2f004c20

View File

@@ -602,37 +602,29 @@ var ICEcoder = {
var aMenus = ICEcoder.filesFrame.contentWindow.document.getElementsByTagName("LI");
for (var i=0; i<aMenus.length; i++) {
var mclass = aMenus[i].className;
if (mclass.indexOf("pft-directory") > -1) {
if (mclass.indexOf("pft-directory")>-1) {
var submenu=aMenus[i].childNodes;
for (var j=0; j<submenu.length; j++) {
if (submenu[j].tagName == "A") {
if (submenu[j].tagName=="A") {
submenu[j].onclick = function() {
var node = this.nextSibling;
while (1) {
if (node != null) {
if (node.tagName == "UL") {
var d = (node.style.display == "none");
node.style.display = (d) ? "block" : "none";
this.className = (d) ? "open" : "closed";
return false;
}
node = node.nextSibling;
} else {
return false;
}
var node = this.parentNode.nextSibling.nextSibling;
if (node.tagName=="UL") {
var d=(node.style.display=="none");
node.style.display=(d) ? "block" : "none";
this.className=(d) ? this.parentNode.className="pft-directory dirOpen" : this.parentNode.className="pft-directory";
}
return false;
}
submenu[j].className = (mclass.indexOf("open") > -1) ? "open" : "closed";
}
if (submenu[j].tagName == "UL") {
submenu[j].style.display = (mclass.indexOf("open") > -1) ? "block" : "none";
}
}
}
}
aMenus[0].childNodes[0].className = "open";
aMenus[0].childNodes[1].style.display = "block";
var ulElems = ICEcoder.filesFrame.contentWindow.document.getElementsByTagName("UL");
for (var i=2; i<ulElems.length; i++) {
ulElems[i].style.display = "none";
}
ulElems[0].childNodes[1].className = "pft-directory dirOpen";
ulElems[1].style.display = "block";
return false;
},
@@ -891,7 +883,7 @@ var ICEcoder = {
// Find & replace text according to user selections
findReplace: function(action,resultsOnly,buttonClick) {
var find, findLen, replaceLen, cM, content, lineCount, numChars, charsToCursor, charCount, startPos, endPos, replaceQS;
var find, findLen, replaceLen, cM, content, lineCount, numChars, charsToCursor, charCount, startPos, endPos, replaceQS, targetQS;
// Determine our find string, in lowercase and the length of that
find = top.document.getElementById('find').value;
@@ -990,10 +982,14 @@ var ICEcoder = {
// Show the relevant multiple results popup
if (find != "" && buttonClick) {
replaceQS = "";
targetQS = "";
if (document.findAndReplace.connector.value=="and") {
replaceQS = "&replace="+document.getElementById('replace').value;
}
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/multiple-results.php?find='+find+replaceQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>';
if (document.findAndReplace.target.value.indexOf("file")>=0) {
targetQS = "&target="+document.findAndReplace.target.value.replace(/ /g,"-");
}
top.document.getElementById('mediaContainer').innerHTML = '<iframe src="lib/multiple-results.php?find='+find+replaceQS+targetQS+'" class="whiteGlow" style="width: 700px; height: 500px"></iframe>';
}
}
},
@@ -1184,7 +1180,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 '+hrefLink+' onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+fullPath+location+'/'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px" class="closed">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</a>';
newLI.innerHTML = '<a '+hrefLink+' onMouseOver="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\''+fullPath+location+'/'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+actionElemType+'\',\'\')" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</a>';
locNest.appendChild(newLI,locNest.childNodes[0]);
// There are items in that location, so add our new item in the right position
@@ -1202,7 +1198,7 @@ var ICEcoder = {
if ((elemType==actionElemType && nameLI > file) || (actionElemType=="folder" && elemType=="file") || i==locNest.childNodes.length-1) {
newLI = document.createElement("li");
newLI.className = cssStyle;
newLI.innerHTML = '<a '+hrefLink+' onMouseOver="top.ICEcoder.overFileFolder(\''+elemType+'\',\''+fullPath+location+'/'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+elemType+'\',\'\')" style="position: relative; left:-22px" class="closed">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</a>';
newLI.innerHTML = '<a '+hrefLink+' onMouseOver="top.ICEcoder.overFileFolder(\''+elemType+'\',\''+fullPath+location+'/'+file+'\')" onMouseOut="top.ICEcoder.overFileFolder(\''+elemType+'\',\'\')" style="position: relative; left:-22px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span id="'+location.replace(/\//g,"|")+'|'+file+'">'+file+'</a>';
// Append or insert depending on which of the above if statements is true
i==locNest.childNodes.length-1 ? locNest.appendChild(newLI,locNest.childNodes[i]) : locNest.insertBefore(newLI,locNest.childNodes[i]);