131 lines
4.7 KiB
C#
131 lines
4.7 KiB
C#
|
|
using System;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.Security;
|
|||
|
|
using System.Web.UI;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
using System.Web.UI.WebControls.WebParts;
|
|||
|
|
using System.Web.UI.HtmlControls;
|
|||
|
|
using WeiSha.Common;
|
|||
|
|
|
|||
|
|
using Song.ServiceInterfaces;
|
|||
|
|
using Song.Entities;
|
|||
|
|
using WeiSha.WebControl;
|
|||
|
|
|
|||
|
|
namespace Song.Site.Manage.Panel
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public partial class SysMenuTree : System.Web.UI.Page
|
|||
|
|
{
|
|||
|
|
//<2F>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
|||
|
|
Song.Entities.ManageMenu[] _allMM;
|
|||
|
|
//ϵͳ<CFB5>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>Z<EFBFBD><5A>
|
|||
|
|
private int _sysZIndex = 4000;
|
|||
|
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
_allMM = Business.Do<IManageMenu>().GetTree("sys", true, true);
|
|||
|
|
if (_allMM != null)
|
|||
|
|
{
|
|||
|
|
Response.Write(_BuildMenu(_allMM));
|
|||
|
|
}
|
|||
|
|
Response.End();
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>ϵͳ<CFB5>˵<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private string _BuildMenu(Song.Entities.ManageMenu[] mm)
|
|||
|
|
{
|
|||
|
|
string tmp = "";
|
|||
|
|
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD>ڵ<EFBFBD>
|
|||
|
|
Extend.MenuNode root = new Extend.MenuNode(null, mm);
|
|||
|
|
if (root.IsChilds)
|
|||
|
|
{
|
|||
|
|
//<2F>ݹ<EFBFBD><DDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ˵<D3B2>
|
|||
|
|
tmp += this._BuildMenuItem(root.Childs[0], 0, root.Childs[0].MM_Name);
|
|||
|
|
}
|
|||
|
|
return tmp;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>Ӳ˵<D3B2><CBB5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
private string _BuildMenuItem(Song.Entities.ManageMenu m, int level, string path)
|
|||
|
|
{
|
|||
|
|
Extend.MenuNode node = new Song.Extend.MenuNode(m, _allMM);
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ӽڵ㣬<DAB5><E3A3AC>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
|
|||
|
|
if (!node.IsChilds) return "";
|
|||
|
|
//
|
|||
|
|
string tmp = "";
|
|||
|
|
if (level == 0)
|
|||
|
|
tmp = "<div style=\"z-index: " + (_sysZIndex++) + ";\"";
|
|||
|
|
else
|
|||
|
|
tmp = "<div style=\"position: absolute; z-index: " + (_sysZIndex++) + ";\"";
|
|||
|
|
tmp += " patId='" + node.Item.MM_Id + "' ";
|
|||
|
|
tmp += " class='menuPanel' type='menuPanel' level=\"" + (level++) + "\">";
|
|||
|
|
for (int i = 0; i < node.Childs.Length; i++)
|
|||
|
|
{
|
|||
|
|
//<2F><><EFBFBD>ɲ˵<C9B2><CBB5><EFBFBD>
|
|||
|
|
Song.Entities.ManageMenu n = node.Childs[i];
|
|||
|
|
tmp += this._SysBuildNode(n, "MenuNode", path + "," + n.MM_Name);
|
|||
|
|
//tmp+="<div>"+n.Name+"</div>";
|
|||
|
|
}
|
|||
|
|
tmp += "</div>";
|
|||
|
|
//<2F>ݹ<EFBFBD><DDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ˵<D3B2>
|
|||
|
|
for (int i = 0; i < node.Childs.Length; i++)
|
|||
|
|
{
|
|||
|
|
Song.Entities.ManageMenu n = node.Childs[i];
|
|||
|
|
tmp += this._BuildMenuItem(n, level, path + "," + n.MM_Name);
|
|||
|
|
}
|
|||
|
|
return tmp;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD>ɽڵ<C9BD><DAB5><EFBFBD><EFBFBD>ı<EFBFBD>
|
|||
|
|
//node:<3A><>ǰ<EFBFBD>ڵ<EFBFBD>
|
|||
|
|
//data:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
|||
|
|
//clas:<3A><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>style
|
|||
|
|
private string _SysBuildNode(Song.Entities.ManageMenu m, string clas, string path)
|
|||
|
|
{
|
|||
|
|
Extend.MenuNode node = new Song.Extend.MenuNode(m, _allMM);
|
|||
|
|
string temp = "<div nodeId=\"" + m.MM_Id + "\"";
|
|||
|
|
temp += " nodetype=\"" + m.MM_Type + "\" ";
|
|||
|
|
temp += " title='" + (m.MM_Intro == "" ? m.MM_Name : m.MM_Intro) + "'";
|
|||
|
|
temp += " isChild=\"" + node.IsChilds + "\" type=\"" + clas + "\" >";
|
|||
|
|
//<2F>˵<EFBFBD><CBB5>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|||
|
|
string style = " ";
|
|||
|
|
if (m.MM_Color != String.Empty && m.MM_Color != null) style += "color: " + m.MM_Color + ";";
|
|||
|
|
if (m.MM_IsBold) style += "font-weight: bold;";
|
|||
|
|
if (m.MM_IsItalic) style += "font-style: italic;";
|
|||
|
|
if (m.MM_Font != String.Empty && m.MM_Font != null) style += "font-family: '" + m.MM_Font + "';";
|
|||
|
|
string name = "<span style=\"" + style + "\">" + m.MM_Name + "</span>";
|
|||
|
|
if (m.MM_Link != "")
|
|||
|
|
{
|
|||
|
|
string link = "";
|
|||
|
|
link += "<{0} href=\"";
|
|||
|
|
link += m.MM_Link + "\" isChild=\"" + node.IsChilds + "\" IsUse=\"" + m.MM_IsUse
|
|||
|
|
+ "\" width=\"" + m.MM_WinWidth + "\" height=\""+m.MM_WinHeight
|
|||
|
|
+ "\" path=\"" + path + "\" target=\"_blank\" class=\"a\">";
|
|||
|
|
link += name + "</{0}>";
|
|||
|
|
switch(m.MM_Type.ToLower())
|
|||
|
|
{
|
|||
|
|
case "link":
|
|||
|
|
link = string.Format(link, "a");
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
link = link.Replace("{0}", "span");
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
temp += link;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
temp += name;
|
|||
|
|
}
|
|||
|
|
temp += "</div>";
|
|||
|
|
return temp;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|