>백엔드 개발 >PHP 튜토리얼 >下面是原码_PHP

下面是原码_PHP

ringa_lee
ringa_lee원래의
2018-05-12 15:02:321242검색

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 &#39;brother&#39; 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으로 문의하세요.