⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outlookbartree.js

📁 很不错的公文流转系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
var old_cur_name = "";
var child_flag = false;//子项标志
var ROOTNODE;//根节点
var ReturnStr;//返回字符串
var level;
var targetWin="";
var bgColor="";

//项目类,用于存储一项目的属性
function URLEntry(imgsrc,name,type,URL,objectName,title)
{

	this.name=name;//项目中文名称
 	this.type=type;//类型,有folder(文件夹),open_folder(打开的文件夹),app(应用项)
	this.URL=URL;//该项目的链接地址
	this.imgsrc=imgsrc;//图片地址
	this.objectName=objectName;//项目名称
	this.level="";//层数
	this.URLEntry=new Array();//子项目
	this.display=displayURLEntry;//显示该项
	this.addURLEntry=addURLEntry;//增加一子项
	this.toggle=toggle;//收缩子项
	this.show=show;//显示
	this.title=title;//标题
	
	this.init=init;//初始化
}
//判断有无子项
function haveChild(PI)
{
	if (PI.URLEntry.length>0)
	{
		return true;
	}
	else
	{
		return false;
	}
}
//设置显示目的窗口
function setTarget(tw)
{
	targetWin=tw;
}
//设置背景颜色
function setbgColor(c)
{
	bgColor=c;
}
//设置子项类别
function setType(parentItem)
{
	if (haveChild(parentItem))
	{
		parentItem.type="open_folder";
		for (var i = 0; i < parentItem.URLEntry.length; i++) 
		{
			setType(parentItem.URLEntry[i]);
		}
	}
	else
	{
		parentItem.type="app";
	}
}
//计算树型级数
function countLevel(item)
{
	if (haveChild(item))
	{
		level++;
		for (var i = 0; i < item.URLEntry.length; i++) 
		{
			countLevel(item.URLEntry[i]);
		}
	}
}
//显示项目
function displayURLEntry(lastflag)//lastflag:2为根节点,1为最后项目(无子项),0为有子项
{
    if (lastflag == 2 )
	{
		this.level = "";
    }
    if (this.type=="folder"||this.type=="open_folder") 
	{
		for (var i = 0; i < this.URLEntry.length; i++) 
		{
			if (lastflag == 0 ) 
			{
				this.URLEntry[i].level = this.level + "1";
			}
			else 
			{
				this.URLEntry[i].level = this.level + "0";
			}
		}
    }
    
    document.write("<TR ID=\"td_"+this.objectName+"\">");
    document.write("<TD valign=\"middle\" height=\"16\" NOWRAP>");

	for (var i=1;i<this.level.length ;i++)
	{
		cur = this.level;
		a_cur = cur.substring(i,i+1);
		if (a_cur == "0") 
		{
			document.write("<IMG align=absmiddle width=10  SRC=\"/Images/blank.gif\">\n");
		} 
		else
		{
			document.write("<IMG  align=absmiddle SRC=\"/Images/vertline.gif\">");
		}
	}

    if (this.type=="folder" || this.type=="open_folder")
	{	
		if (lastflag!=2)
			document.write("<A onFocus='this.blur()' name=\""+this.objectName+"\" href=\"javascript:"+this.objectName+".toggle("+lastflag+",1)\" >");
		if (this.type == "folder")
		{
			if (lastflag != 2) 
			{
		    	if (lastflag != 0) 
				{
					document.write("<IMG  BORDER=0 SRC=\"/Images/lastnode.gif\" align=\"absmiddle\"");
					document.write(" name = \""+ this.objectName + "_node\">");
	    		}
				else
				{
					document.write("<IMG  BORDER=0 SRC=\"/Images/node.gif\" align=\"absmiddle\"");
					document.write(" name = \""+ this.objectName + "_node\">");
	    		}
	
				document.write("<IMG  BORDER=0  SRC=\"/Images/"+ this.type+".gif\" align=\"absmiddle\"");
	    		document.write(" name = \""+ this.objectName + "_folder\">");
			}
			else
			{
				document.write("<IMG  BORDER=0  SRC=\"/Images/desktop.gif\" align=\"absmiddle\"");
				document.write(" name = \""+ this.objectName + "_folder\">&nbsp");
			}
        }
		else if (this.type == "open_folder")
		{
			if (lastflag != 2) 
			{
				if (lastflag != 0) 
				{
					document.write("<IMG  BORDER=0 SRC=\"/Images/open_lastnode.gif\" align=\"absmiddle\"");
					document.write(" name = \""+ this.objectName + "_node\">");
				}
				else
				{
					document.write("<IMG  BORDER=0  SRC=\"/Images/open_node.gif\" align=\"absmiddle\"");
					document.write(" name = \""+ this.objectName + "_node\">");
				}
				document.write("<IMG  BORDER=0  SRC=\"/Images/"+ this.type+".gif\" align=\"absmiddle\"");
				document.write(" name = \""+ this.objectName + "_folder\">");
			}
			else
			{
				document.write("<IMG  BORDER=0  SRC=\"/Images/desktop.gif\" align=\"absmiddle\"");
				document.write(" name = \""+ this.objectName + "_folder\">");
			}
		}
		if (lastflag!=2)
			document.write("</A>");
    } 
	else 
	{
		if (lastflag != 0)
		{
			document.write("<IMG BORDER=0  SRC=\"/Images/line_05_last.gif\" align=\"absmiddle\">");
		}
		else 
		{
			document.write("<IMG BORDER=0  SRC=\"/Images/line_05.gif\" align=\"absmiddle\">");
		}
		document.write("<IMG BORDER=0  SRC=\"/Images/docss.gif\" align=\"absmiddle\"");
		document.write(" name = \""+ this.objectName + "_leaf\">");
    }
    
    document.write("\n");

	if (lastflag!=2)
	{
		document.write("<A onFocus='this.blur()' HREF=\""+this.URL+"\"");
		document.write(" TARGET='"+targetWin+"' onclick=kkk(this)> ");
	}
	if (lastflag == 2)
    	document.write("<font color=#ff0000>"+this.name+"</font>");
	else
    	document.write(""+this.name+"");
    
		//document.write("<IMG  align=absmiddle BORDER=0 SRC=\"/Images/Moff.gif\"");
		//document.write(" name = \""+ this.objectName + "\">");
	if (lastflag!=2)
	{
		document.write("</A>");
	}
    document.write("</TD></TR>\n");
    
    if (this.type=="open_folder") 
	{
		for (var i = 0; i < this.URLEntry.length; i++) 
		{
            if (i == this.URLEntry.length-1) 
			{
				this.URLEntry[i].display(1);
			}
			else
			{
				this.URLEntry[i].display(0);
			}
		}
    }
}

function addURLEntry(newURLEntry)
{
	this.URLEntry[this.URLEntry.length]=newURLEntry;
}

function toggle(lastflag,is_user_action)
{
	if (lastflag != 2 ) 
	{
		if (this.type == "folder") 
		{
			this.type = "open_folder";
			imagename = this.objectName + "_node";
			if (document[imagename]) 
			{
				if (lastflag != 0)
				{
					document[imagename].src="/Images/open_lastnode.gif";
				}
				else
				{
					document[imagename].src="/Images/open_node.gif";
				}
        	}

			imagename = this.objectName + "_folder";
			if (document[imagename]) 
			{
				document[imagename].src="/Images/open_folderss.gif";
        	}
			this.show(0);
		}
		else if (this.type == "open_folder") 
		{
			this.type = "folder";
			imagename = this.objectName + "_node";
			if (document[imagename]) 
			{
				if (lastflag != 0)
				{
					document[imagename].src="/Images/lastnode.gif";
				} 
				else 
				{
					document[imagename].src="/Images/node.gif";
				}
        	}
			imagename = this.objectName + "_folder";
			if (document[imagename]) 
			{
				document[imagename].src="/Images/folders.gif";
        	}
			this.show(0);
    	} 
		else
		{
			return;
		}
	}
	else
	{
		//将小球移动ROOTNODE
		change_location(this.objectName);
	}

	if (is_user_action == 1) 
	{
		child_flag = false;
		isChild(this,old_cur_name);
		if (child_flag) 
		{
			this.submit();
			change_location(this.objectName);
		}
    }
}

function isChild(Parent_name,Child_name) 
{
	for (var i = 0; i < Parent_name.URLEntry.length; i++) 
	{
		if (Parent_name.URLEntry[i].objectName == Child_name) 
		{
			child_flag = true;
		}
		if (Parent_name.URLEntry[i].type == "folder" || Parent_name.URLEntry[i].type == "open_folder") 
		{
			isChild(Parent_name.URLEntry[i],Child_name);
		}
	}
}


function displayRoot()
{
    document.clear();
    document.write("<form name=\"myform\" method=\"post\">");
    document.write("<TABLE BORDER=0  cellspacing=\"-1\" cellpadding=\"-1\" width=\"100%\">");
    ROOTNODE.display(2);
    document.write("</TABLE>");
    document.write("</form>");
}

function show(flag) 
{
    if (this.type=="open_folder") 
	{
		for (var i = 0; i < this.URLEntry.length; i++) 
		{
			temp_name = "td_" + this.URLEntry[i].objectName;
			if (flag == 2) 
			{
				if (document.all[temp_name]) 
				{
					document.all[temp_name].style.display = "none";
					document.all[temp_name].style.height="0%";
				}
				this.URLEntry[i].show(2);
			}
			else
			{
				if (document.all[temp_name]) 
				{
					document.all[temp_name].style.display = "block";
					document.all[temp_name].style.height="100%";
				}
				this.URLEntry[i].show(1);
			}
		}
	}

	if (this.type=="folder") 
	{
		for (var i = 0; i < this.URLEntry.length; i++) 
		{
			temp_name = "td_" + this.URLEntry[i].objectName;
			if (document.all[temp_name]) 
			{
				document.all[temp_name].style.display = "none";
				document.all[temp_name].style.height="0%";
			}
			this.URLEntry[i].show(2);
		}
	}
}

function showRoot()
{
	ROOTNODE.init();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -