/// <summary> /// Binds the menu. /// </summary> private void BindMenuFromDataSource(ComponentArt.Web.UI.Menu menu, SiteMapDataSource source) { //menu.Items.Add(CreateItem("StartLook")); int index = 0; foreach (SiteMapNode node in source.Provider.RootNode.ChildNodes) { // Check if item is visible if (!String.IsNullOrEmpty(node["visible"]) && !Boolean.Parse(node["visible"])) { continue; } if (index > 0) { SiteMenu.Items.Add(CreateItem("BreakLook")); } ComponentArt.Web.UI.MenuItem menuItem = new ComponentArt.Web.UI.MenuItem(); menuItem.ID = node.Key; menuItem.Text = node.Title; menuItem.NavigateUrl = node.Url; menuItem.LookId = "TopItemLook"; menu.Items.Add(menuItem); index++; LoadFromNodeRecursive(node, menuItem); } //menu.Items.Add(CreateItem("EndLook")); menu.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ComponentArt.Web.UI.Menu sys = (ComponentArt.Web.UI.Menu)Page.Master.FindControl("SysMenu"); Initial(ref sys);//Bind Menu } }
public void Initial(ref ComponentArt.Web.UI.Menu SysMenu) { string strUserId = Page.User.Identity.Name;//Myfunction.SubStringUser(Page.User.Identity.Name); string EmpCode = "SurasakNaka"; string oRoleId = getRoleUser(EmpCode); //get role ของพนักงาน CreateMenu(EmpCode, oRoleId); //Bind menu ตาม Role ที่ได้ //string EmpCode; //if (Employee.getEmployeeAD(strUserId) != null) //{ // BasePage bp = new BasePage(); // if (bp.GetEmail(strUserId) != "") // { // EmpCode = Employee.getEmployeeAD(strUserId).empCode; // if (RoleUser.checkRoleId(EmpCode)) // { // lblAlias_Name.Text = "ผู้ใช้ระบบ: " + Employee.getEmployeeAD(strUserId).name + " [ " + Employee.getEmployeeAD(strUserId).userAD + " ]"; // CostCenter oCost = CostCenter.getCostCenter(Employee.getEmployeeAD(strUserId).costCenter); // lblProfile.Text = oCost.costId + ": " + oCost.costName; // string oRoleId = getRoleUser(EmpCode);//get role ของพนักงาน // CreateMenu(EmpCode, oRoleId);//Bind menu ตาม Role ที่ได้ // } // else // { // string msgError; // msgError = "ไม่พบสิทธิ์การใช้งานของรหัสพนักงาน " + EmpCode + " กรุณาติดต่อผู้ดูแลระบบ"; // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "AlertMessage", String.Format("alert('{0}');", msgError), true); // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "javascript", "closeWeb();", true); // return; // } // } // else // { // string msgError; // msgError = "ไม่มี e-mail ในระบบของผู้ใช้ระบบ UserAD: " + strUserId; // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "AlertMessage", String.Format("alert('{0}');", msgError), true); // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "javascript", "closeWeb();", true); // return; // } //} //else //{ // string msgError; // msgError = "ไม่มีข้อมูลผู้ใช้ระบบ UserAD: " + strUserId; // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "AlertMessage", String.Format("alert('{0}');", msgError), true); // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "javascript", "closeWeb();", true); // return; //} }
private void RenderMenu(ComponentArt.Web.UI.Menu actionsMenu) { ComponentArt.Web.UI.MenuItem topMenuItem; actionsMenu.Items.Clear(); #region Legend Item topMenuItem = new ComponentArt.Web.UI.MenuItem(); topMenuItem.Text = GetGlobalResourceObject("IbnFramework.Calendar", "tLegend").ToString(); // topMenuItem.Look.LeftIconUrl = ResolveClientUrl("~/Layouts/Images/downbtn1.gif"); // topMenuItem.Look.LeftIconHeight = Unit.Pixel(5); // topMenuItem.Look.LeftIconWidth = Unit.Pixel(16); topMenuItem.LookId = "TopItemLook"; topMenuItem.ClientSideCommand = "ShowLegend()"; actionsMenu.Items.Add(topMenuItem); #endregion #region View Menu Items topMenuItem = new ComponentArt.Web.UI.MenuItem(); topMenuItem.Text = LocRM.GetString("tView"); topMenuItem.Look.LeftIconUrl = ResolveClientUrl("~/Layouts/Images/downbtn1.gif"); topMenuItem.Look.LeftIconHeight = Unit.Pixel(5); topMenuItem.Look.LeftIconWidth = Unit.Pixel(16); topMenuItem.LookId = "TopItemLook"; ComponentArt.Web.UI.MenuItem subItem; string graphPeriod = _pc["MV_Weeks"]; subItem = new ComponentArt.Web.UI.MenuItem(); if (graphPeriod == "1") // 1 week { subItem.Look.LeftIconUrl = "~/Layouts/Images/accept.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); } subItem.ClientSideCommand = "javascript:" + Page.ClientScript.GetPostBackEventReference(ViewButton, "1"); subItem.Text = LocRM.GetString("Week1"); topMenuItem.Items.Add(subItem); subItem = new ComponentArt.Web.UI.MenuItem(); if (graphPeriod == "3") // 3 week { subItem.Look.LeftIconUrl = "~/Layouts/Images/accept.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); } subItem.ClientSideCommand = "javascript:" + Page.ClientScript.GetPostBackEventReference(ViewButton, "3"); subItem.Text = LocRM.GetString("Week3"); topMenuItem.Items.Add(subItem); actionsMenu.Items.Add(topMenuItem); #endregion }
private void AddMenuHeader(ref ComponentArt.Web.UI.Menu SysMenu, string MenuName, string MenuValue, string MenuURL) { ComponentArt.Web.UI.MenuItem newItem = default(ComponentArt.Web.UI.MenuItem); newItem = new ComponentArt.Web.UI.MenuItem(); newItem.Text = ImgIconLevel0 + MenuName; newItem.Value = MenuValue; newItem.LookId = "TopItemLook"; if (MenuURL != string.Empty) { newItem.NavigateUrl = MenuURL; } SysMenu.Items.Add(newItem); }
private void BindMenu(ComponentArt.Web.UI.Menu menu, string link1, string link2) { ComponentArt.Web.UI.MenuItem topMenuItem = new ComponentArt.Web.UI.MenuItem(); topMenuItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tActions}"); topMenuItem.DefaultSubGroupExpandDirection = ComponentArt.Web.UI.GroupExpandDirection.BelowRight; topMenuItem.Look.LeftIconUrl = "~/Layouts/Images/downbtn1.gif"; topMenuItem.Look.LeftIconHeight = Unit.Pixel(5); topMenuItem.Look.LeftIconWidth = Unit.Pixel(16); topMenuItem.LookId = "TopItemLook"; ComponentArt.Web.UI.MenuItem subItem; subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/nfolder.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.NavigateUrl = link1; subItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tAddFolder}"); topMenuItem.Items.Add(subItem); subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/listsnew.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); subItem.NavigateUrl = link2; subItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:tAddList}"); topMenuItem.Items.Add(subItem); subItem = new ComponentArt.Web.UI.MenuItem(); subItem.Look.LeftIconUrl = "~/Layouts/Images/import.gif"; subItem.Look.LeftIconWidth = Unit.Pixel(16); subItem.Look.LeftIconHeight = Unit.Pixel(16); CommandManager cm = CommandManager.GetCurrent(this.Page); CommandParameters cp = new CommandParameters("MC_ListApp_ImportWizard"); cp.CommandArguments = new Dictionary <string, string>(); cp.AddCommandArgument("ListFolderId", _folderId.ToString()); subItem.ClientSideCommand = cm.AddCommand("", "", "ListInfoList", cp); subItem.Text = CHelper.GetResFileString("{IbnFramework.ListInfo:ImportListMenu}"); topMenuItem.Items.Add(subItem); menu.Items.Add(topMenuItem); }