本文来源:网站建设-网站制作|网络营销专家慧云科技-抢滩登陆2009-7-16 16:02:09
///
/// 输出 树 HTML
///
public string OutputTree()
{
string treeText = "";
nodeNum = 0;
string cid = "root";
string cname = csRoot.GetAttr( "dbName" );
string cHtml = " oTree = new BYXX_oboutTree.BYTree();
oTree.AddRootNode( cHtml, true, "Site_Run.gif" );
// vct // 递归加载子节点
AddTree( csRoot, cid, cname );
//得到顶层节点列表
treeText = oTree.OutPutTree( IconsPath, ScriptPath, StylePath );
//释放对象
oTree.Dispose();
return treeText;
}
// 递归加载子节点
private void AddTree( XmlNode pnode, string pid, string pname )
{
string cid = "";
string cname = "";
string ctitle = "";
string cHtml = "";
string cicon = "";
XmlNode cnode = pnode.FirstChild;
while( cnode != null ) {
// vct // 忽略其他 节点
if( cnode.Name != "columnSet" && cnode.Name != "column" ) {
cnode = cnode.NextSibling;
continue;
}
// vct // 准备 节点参数
cid = "node" + (nodeNum++).ToString();
cname = cnode.Attributes["name"].Value;
ctitle = cnode.Attributes["title"].Value;
cHtml = "
if( cnode.Name == "columnSet" ) {
// vct // 准备 栏目集 节点参数
cHtml += "style=‘cursor: pointer;‘>" + ctitle + "
";
cicon = "Folder.gif";
// vct // 添加 栏目(集) 节点,递归加载子节点
oTree.AddNode( pid, cid, cHtml, true, cicon, null );
AddTree( cnode, cid, cname );
} else {
// vct // 准备 栏目 节点参数
cHtml += "style=‘cursor: pointer;‘ ondblclick=\"dbClick();\">" + ctitle + "";
cicon = "notebook.gif";
// vct // 添加 栏目(集) 节点
oTree.AddNode( pid, cid, cHtml, true, cicon, null );
}
cnode = cnode.NextSibling;
}
}
}
}