function Folder(folderDescription, hreference,parentid,target) {
//constant data;
this.desc = folderDescription;
this.parentid=parentid;
this.hreference = hreference;
this.target=target;
this.id = index;
this.navObj = 0;
this.iconImg = 0;
this.nodeImg = 0;
this.isLastNode = 0;
// dynamic data
this.isRoot = true;
this.isOpen = true;
this.iconSrc=imageURL+"ftv2folderopen.gif";
this.iconRoot =imageURL+"ftv2folderopen.gif";
this.children = new Array;
this.nChildren = 0;
// methods
this.initialize = initializeFolder;
this.setState = setStateFolder;
this.addChild = addChild;
this.createIndex = createEntryIndex;
this.hide = hideFolder;
this.display = display;
this.renderOb = drawFolder;
this.totalHeight = totalHeight;
this.subEntries = folderSubEntries;
this.outputLink = outputFolderLink;
}
function setStateFolder(isOpen) {
var subEntries;
var totalHeight;
var fIt = 0;
var i = 0;
if(isOpen == this.isOpen)
return;
if(browserVersion == 2) {
totalHeight = 0
for(i = 0; i < this.nChildren; i++)
totalHeight = totalHeight + this.children[i].navObj.clip.height;
subEntries = this.subEntries();
if(this.isOpen)
totalHeight = 0 - totalHeight;
for(fIt = this.id + subEntries + 1; fIt < nEntries; fIt++)
indexOfEntries[fIt].navObj.moveBy(0, totalHeight);
}
this.isOpen = isOpen;
propagateChangesInState(this);
}
function propagateChangesInState(folder) {
var i = 0;
if(folder.isOpen) {
if(folder.nodeImg) {
if(folder.isLastNode)
folder.nodeImg.src = imageURL+"ftv2mlastnode.gif";
else
folder.nodeImg.src = imageURL+"ftv2mnode.gif";
}
if(this.isRoot)
folder.iconImg.src = imageURL+"ftv2_mail.gif";
else
folder.iconImg.src = imageURL+"ftv2folderopen.gif";
for(i = 0; i < folder.nChildren; i++)
folder.children[i].display();
}
else {
if(folder.nodeImg) {
if(folder.isLastNode)
folder.nodeImg.src = imageURL+"ftv2plastnode.gif";
else
folder.nodeImg.src = imageURL+"ftv2pnode.gif";
}
if(this.isRoot)
folder.iconImg.src = imageURL+"ftv2_mail.gif";
else
folder.iconImg.src = imageURL+"ftv2folderclosed.gif";
for(i = 0; i < folder.nChildren; i++)
folder.children[i].hide();
}
}
function hideFolder() {
if(browserVersion == 1) {
if(this.navObj.style.display == "none")
return;
this.navObj.style.display = "none";
}
else {
if(this.navObj.visibility == "hiden")
return;
this.navObj.visibility = "hiden";
}
this.setState(0);
}
function initializeFolder(level, lastNode, leftSide) {
var i = 0;
var j = 0;
var numberOfFolders;
var numberOfDocs;
nc = this.nChildren;
this.createIndex();
var nc;
var auxEv = "";
if(browserVersion > 0)
auxEv = "";
else
auxEv = "";
if(level > 0) {
if(lastNode) { //the last 'brother' in the children array
this.renderOb(leftSide + auxEv + "");
leftSide = leftSide + "";
this.isLastNode = 1;
}
else {
this.renderOb(leftSide + auxEv + "");
leftSide = leftSide + "";
this.isLastNode = 0;
}
}
else {
this.renderOb("");
}
if(nc > 0) {
level = level + 1;
for(i = 0; i < this.nChildren; i++) {
if(i == this.nChildren-1)
this.children[i].initialize(level, 1, leftSide);
else
this.children[i].initialize(level, 0, leftSide);
}
}
}
function drawFolder(leftSide) {
if(browserVersion == 2) {
if(!doc.yPos)
doc.yPos = 8;
doc.write("");
}
if(browserVersion == 1) {
this.navObj = doc.all["folder"+this.id];
this.iconImg = doc.all["folderIcon"+this.id]
this.nodeImg = doc.all["nodeIcon"+this.id]
}
else if(browserVersion == 2) {
this.navObj = doc.layers["folder"+this.id];
this.iconImg = this.navObj.document.images["folderIcon"+this.id];
this.nodeImg = this.navObj.document.images["nodeIcon"+this.id];
doc.yPos = doc.yPos + this.navObj.clip.height;
}
}
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。