|
5#
楼主 |
发表于 2014-4-14 15:50:22
|
只看该作者
都是有的
protected void Page_Init(object sender, EventArgs e)
{
string menuType = "menu";
HttpCookie menuCookie = Request.Cookies["MenuStyle_v4"];
if (menuCookie != null)
{
menuType = menuCookie.Value;
}
// 工具栏上的帮助菜单
JArray ja = JArray.Parse("[{\'Text\':\'万年历\',\'Icon\':\'Calendar\',\'ID\':\'wannianli\',\'URL\':\'~/help/wannianli.htm\'},{\'Text\':\'科学计算器\',\'Icon\':\'Calculator\',\'ID\':\'jisuanqi\',\'URL\':\'~/help/jisuanqi.htm\'},{\'Text\':\'系统帮助\',\'Icon\':\'Help\',\'ID\':\'help\',\'URL\':\'~/help/help.htm\'}]");
foreach (JObject jo in ja)
{
MenuButton menuItem = new MenuButton();
menuItem.EnablePostBack = false;
menuItem.Text = jo.Value<string>("Text");
menuItem.Icon = IconHelper.String2Icon(jo.Value<string>("Icon"), true);
menuItem.OnClientClick = String.Format("addExampleTab('{0}','{1}','{2}')", jo.Value<string>("ID"), ResolveUrl(jo.Value<string>("URL")), jo.Value<string>("Text"));
btnHelp.Menu.Items.Add(menuItem);
}
// 用户可见的菜单列表
List<Menu> menus = ResolveUserMenuList();
if (menus.Count == 0)
{
Response.Write("系统管理员尚未给你配置菜单!");
Response.End();
return;
}
// 注册客户端脚本,服务器端控件ID和客户端ID的映射关系
JObject ids = GetClientIDS(btnExpandAll, btnCollapseAll, mainTabStrip, leftRegion, menuSettings, btnRefreshTxt, txtUser,
txtOnlineUserCount, txtCurrentTime);
ids.Add("userName", GetIdentityName());
ids.Add("userIP", Request.UserHostAddress);
ids.Add("onlineUserCount", GetOnlineCount());
//ids.Add("theme", PageManager.Instance.Theme.ToString());
if (menuType == "accordion")
{
Accordion accordionMenu = InitAccordionMenu(menus);
ids.Add("mainMenu", accordionMenu.ClientID);
ids.Add("menuType", "accordion");
}
else
{
Tree treeMenu = InitTreeMenu(menus);
ids.Add("mainMenu", treeMenu.ClientID);
ids.Add("menuType", "menu");
}
// 只在页面第一次加载时注册客户端用到的脚本
if (!Page.IsPostBack)
{
string idsScriptStr = String.Format("window.IDS={0};", ids.ToString(Newtonsoft.Json.Formatting.None));
PageContext.RegisterStartupScript(idsScriptStr);
}
}
#endregion |
|