/// <summary> /// 从配置文件中加载菜单 /// </summary> public AccordionLayout GetMenu() { var accordionLayout = new AccordionLayout(new AccordionLayout.Config { Animate = true, CollapseFirst = true }); if (String.IsNullOrEmpty(_configFile)) throw new Exception("the path can not be null"); var doc = XElement.Parse(_contentProvider.GetAllText(_configFile)); var menus = doc.Descendants("menu"); foreach (var menu in menus) { var menuPanel = new MenuPanel(new MenuPanel.Config { Title = menu.Attribute("title").Value }); foreach (var submenu in menu.Descendants("submenu")) { var menuItem = new MenuItem { Text = submenu.Attribute("title").Value, Icon = (Icon)(Convert.ToInt32(submenu.Attribute("icon").Value)) }; menuItem.CustomConfig.Add(new ConfigItem { Name = "url", Value = submenu.Attribute("url").Value, Mode = ParameterMode.Value }); menuPanel.Menu.Items.Add(menuItem); } menuPanel.Menu.Listeners.Click.Handler = "Egaplay.Ext.addTab({ title: menuItem.text, url: menuItem.url, icon: menuItem.iconCls });"; accordionLayout.Items.Add(menuPanel); } return accordionLayout; }
protected void CargaMenuTemp(IList<co_ca_menu> listMenu) { try { foreach (co_ca_menu menu in listMenu.Where(menu => menu.id_menupadre != 0)) { MenuItem hijo = new MenuItem(); hijo.ID = "MH_" + menu.men_nombreventana; hijo.IconCls = "#Application"; hijo.Text = menu.men_nombre; hijo.DestroyMenu = false; Parameter titulo = new Parameter("title", menu.men_nombre); string strurl = Constants.Load<String>(menu.men_opciones) + menu.men_url + "?k=" + menu.id_menu + "&u=" + FWPConfiguration.get_ID_User(Session.SessionID); strurl = strurl + "&z=" + FWPConfiguration.get_Accesos(Session.SessionID); Parameter url = new Parameter("url", strurl); Parameter id = new Parameter("id", menu.men_nombreventana); Parameter icono = new Parameter("icono", "#Application"); hijo.DirectEvents.Click.Event += Button_WindowDesktop; hijo.DirectEvents.Click.ExtraParams.Add(url); hijo.DirectEvents.Click.ExtraParams.Add(titulo); hijo.DirectEvents.Click.ExtraParams.Add(icono); hijo.DirectEvents.Click.ExtraParams.Add(id); dskPrincipal.StartMenu.MenuItems.Add(hijo); } } catch (Exception ex) { Mensajes.Error(ex.Message); } }
private void createSubMenu(MenuCollection menuCollection, DataTable dt, string p) { DataRow[] rows = dt.Select("parentid='" + p + "'"); if (rows == null || rows.Length == 0) { return; } Ext.Net.Menu menu = new Ext.Net.Menu(); foreach (DataRow row in rows) { sysprog prog = ConvertHelper.RowToObject <sysprog>(row); Ext.Net.MenuItem item = new Ext.Net.MenuItem(prog.ProgName); if (prog.IsGroup == "1") { item.Icon = Icon.Folder; createSubMenu(item.Menu, dt, prog.id); } else { item.Icon = Icon.ApplicationForm; item.Listeners.Click.Handler = "showmodule(#{MyDesktop},'" + prog.id + "');"; } menu.Add(item); } menuCollection.Add(menu); }
private void AddButton() { OneManyForm.AddButton(btnUpdateAndClose); OneManyForm.AddButton(btnUpdate_OneMany); Ext.Net.MenuItem item = new Ext.Net.MenuItem("Chọn bảng detail"); item.Icon = Icon.Table; item.Listeners.Click.Handler = wdConfigTable.ClientID + ".show();"; OneManyForm.AddToConfigMenu(item); }
protected void SetMenu(Ext.Net.Menu menu) { var MenuItem1 = new Ext.Net.MenuItem(); MenuItem1.ID = "MenuItem1"; MenuItem1.Text = "净化过程明细"; MenuItem1.Icon = Icon.Star; MenuItem1.Cls = "color_1"; MenuItem1.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(reload_menu1); var MenuItem2 = new Ext.Net.MenuItem(); MenuItem2.ID = "MenuItem2"; MenuItem2.Text = "血液净化记录"; MenuItem2.Icon = Icon.Star; MenuItem2.Cls = "color_10"; MenuItem2.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(reload_menu2); var MenuItem3 = new Ext.Net.MenuItem(); MenuItem3.ID = "MenuItem3"; MenuItem3.Text = "血液净化小结"; MenuItem3.Icon = Icon.Star; MenuItem3.Cls = "color_10"; MenuItem3.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(reload_menu3); var MenuItem4 = new Ext.Net.MenuItem(); MenuItem4.ID = "MenuItem4"; MenuItem4.Text = "血液净化记录表"; MenuItem4.Icon = Icon.Star; MenuItem4.Cls = "color_10"; MenuItem4.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(reload_menu4); //var MenuItem5 = new Ext.Net.MenuItem(); //MenuItem5.ID = "MenuItem5"; //MenuItem5.Text = "实时监控一"; //MenuItem5.Icon = Icon.Star; //MenuItem5.Cls = "color_10"; //MenuItem5.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(reload_menu5); //var MenuItem6 = new Ext.Net.MenuItem(); //MenuItem6.ID = "MenuItem6"; //MenuItem6.Text = "实时监控二"; //MenuItem6.Icon = Icon.Star; //MenuItem6.Cls = "color_10"; //MenuItem6.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(reload_menu6); menu.Items.Add(MenuItem1); menu.Items.Add(MenuItem2); menu.Items.Add(MenuItem3); menu.Items.Add(MenuItem4); //menu.Items.Add(MenuItem5); //menu.Items.Add(MenuItem6); }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Preview", IconUrl = Utility.GetCooliteIconUrl(Icon.Magnifier), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Manage Orders", IconUrl = Utility.GetCooliteIconUrl(Icon.Basket), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Page Caching", IconUrl = Utility.GetCooliteIconUrl(Icon.Package), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Manage Children", IconUrl = Utility.GetCooliteIconUrl(Icon.SitemapColor), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Versions", IconUrl = Utility.GetCooliteIconUrl(Icon.BookPrevious), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "File Manager", IconUrl = Utility.GetCooliteIconUrl(Icon.Folder), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Permissions", IconUrl = Utility.GetCooliteIconUrl(Icon.Lock), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Import / Export", IconUrl = Utility.GetCooliteIconUrl(Icon.PackageGo), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { MenuItem menuItem = new MenuItem { Text = "Language Overview", IconUrl = Utility.GetCooliteIconUrl(Icon.WorldGo), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public MenuItem GetMenuItem(ContentItem contentItem) { var menuItem = new MenuItem { Text = "Manage Zones", IconUrl = Utility.GetCooliteIconUrl(Icon.ApplicationSideBoxes), Handler = GetJavascriptHandler(contentItem) }; return menuItem; }
public void LoadTreeNguonDan() { NguonTuyenDungController nguontuyendungcontroller = new NguonTuyenDungController(); List <DAL.KenhTuyenDung> data = nguontuyendungcontroller.GetByAll(); foreach (var item in data) { Ext.Net.MenuItem menuitem = new Ext.Net.MenuItem(); mnuNguonTuyenDung.Items.Add(menuitem); menuitem.Text = item.Name; menuitem.Listeners.Click.Handler = "addTab(TabPanel1,'" + item.ID + "','" + item.LinkUrl + "','" + item.Name + "');"; } }
/// <summary> /// Load menu con của menu ngang /// </summary> /// <param name="parentComponent"></param> /// <param name="parentMenu"></param> private void LoadSubTopMenu(Component parentComponent, MenuInfo parentMenu) { List <MenuInfo> ChildMenu; // if (CurrentUser.IsSuperUser) ChildMenu = MenuController.GetInstance().GetMenus(parentMenu.ID, false, false); //Lấy các tree nằm trong panel // else // ChildMenu = MenuController.GetInstance().GetMenus(parentMenu.ID, false, false, CurrentUser.ID); if (ChildMenu == null || ChildMenu.Count() == 0) { return; } Ext.Net.Menu menu = new Ext.Net.Menu(); if (parentComponent.InstanceOf.Contains("Button")) { Ext.Net.Button btn = parentComponent as Ext.Net.Button; btn.Menu.Add(menu); } else { Ext.Net.MenuItem menuItem = parentComponent as Ext.Net.MenuItem; menuItem.Menu.Add(menu); } foreach (MenuInfo item in ChildMenu) { Ext.Net.MenuItem mnu = new Ext.Net.MenuItem(item.MenuName); if (string.IsNullOrEmpty(item.Icon)) { mnu.Icon = Icon.BulletBlue; } else { mnu.IconCls = item.Icon; } mnu.ID = item.ID + "mnu"; if (!string.IsNullOrEmpty(item.LinkUrl)) { if (item.LinkUrl.Contains("?") == false) { item.LinkUrl += "?mId=" + item.ID; } else { item.LinkUrl += "&mId=" + item.ID; } mnu.Listeners.Click.Handler = "addTab(#{pnTabPanel},'dm_file" + item.ID + "','" + item.LinkUrl + "', '" + item.TabName + "')"; } menu.Items.Add(mnu); LoadSubTopMenu(mnu, item); } }
private Ext.Net.MenuPanel IninPage(int flag, string sysid, Ext.Net.MenuPanel pnlMenu, string contentId, string usercode) { try { if (string.IsNullOrEmpty(contentId)) { return(pnlMenu); } UserManager userManager = new UserManager(); DataTable dt = userManager.GetDirectory(sysid, contentId, usercode); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Ext.Net.MenuItem menuItem = new Ext.Net.MenuItem(); menuItem.ID = "Menu" + dt.Rows[i][0].ToString(); menuItem.Text = dt.Rows[i][1].ToString(); menuItem.Attributes["title"] = pnlMenu.Title + "|" + dt.Rows[i][2].ToString(); menuItem.Icon = (Icon)Enum.Parse(typeof(Icon), dt.Rows[i][5].ToString(), true); menuItem.Listeners.Click.Fn = "MenuItemClick"; pnlMenu.Menu.Items.Add(menuItem); if (muIndex == -1) { muIndex = flag; } if (flag == muIndex && i == 0) { CurrentSelectMenu.Value = menuItem.Attributes["title"] + "," + menuItem.Text;//设置默认显示第一个 } if (dt.Rows[i][7].ToString() == "1") { CurrentSelectMenu.Value = menuItem.Attributes["title"] + "," + menuItem.Text;//设置显示设置默认页 } } return(pnlMenu); } else { return(null); } } catch (Exception ex) { ILog.WriteErrorLog(ex); return(null); } }
private void InitPage() { string systemid = string.Empty; string systemName = string.Empty; try { UserInfo userinfo = Session["userinfo"] as UserInfo; UserManager userManager = new UserManager(); DataTable dt = userManager.GetUserShowSystem(userinfo.UserCode); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { muIndex = -1; Ext.Net.MenuItem but = new Ext.Net.MenuItem(); but.ID = "Button" + dt.Rows[i][0].ToString(); but.Text = dt.Rows[i][1].ToString(); but.Listeners.Click.Handler = "Index.ButtonClickEvent('" + dt.Rows[i][0].ToString() + "','" + dt.Rows[i][1].ToString() + "')"; but.Style.Add(HtmlTextWriterStyle.FontWeight, "blod"); //but.Html = "<span style=\"font-family: 微软雅黑; font-size: 9pt; color: #000066;\">" + dt.Rows[i][1].ToString()+"</span>"; //but.Icon = (Icon)Enum.Parse(typeof(Icon), dt.Rows[i][2].ToString(), true); but.Style.Clear(); if (i == 0) { systemid = dt.Rows[i][0].ToString(); systemName = dt.Rows[i][1].ToString(); } ToolbarSystem.Add(but); if (i != (dt.Rows.Count - 1)) { ToolbarSystem.Add(new ToolbarSeparator()); } } } lblUserName.Text = "登录用户:" + userinfo.UserName; Ext.Net.Panel panelMenu = GetmenuPanel(systemid, systemName); if (panelMenu != null) { PanelNavigate.Items.Add(panelMenu); } } catch (Exception ex) { ILog.WriteErrorLog(ex); } }
/// <summary> /// sự kiện click của menu tình trạng làm việc, dành cho chấm công ngày hôm nay /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Click_Event(object sender, DirectEventArgs e) { try { if (!string.IsNullOrEmpty(hdfIdBangChamCong.Text)) { Ext.Net.MenuItem mnuItem = sender as Ext.Net.MenuItem; DM_TT_LAMVIEC ws = new KyHieuChamCongController().GetByName(mnuItem.Text); string sql = "update ChamCong.BangChamCongExcelTheoThang set NGAY"; if (DateTime.Now.Day > 9) { sql += DateTime.Now.Day + " = N'" + ws.KYHIEU_TT_LAMVIEC + "' where PR_KEY = "; } else { sql += "0" + DateTime.Now.Day + " = N'" + ws.KYHIEU_TT_LAMVIEC + "' where PR_KEY = "; } int start = 0; int limit = 50; List <BangChamCongExcelTheoThang> bangLuong; do { bangLuong = new ChamCongThangController().GetByIdBangChamCong(int.Parse(hdfIdBangChamCong.Text), start, limit); foreach (var item in bangLuong) { DataController.DataHandler.GetInstance().ExecuteNonQuery(sql + item.PR_KEY); } start += limit; } while (bangLuong.Count() != 0); RM.RegisterClientScriptBlock("a", "#{Store1}.reload();"); } else { X.MessageBox.Alert("Cảnh báo", "Bạn chưa chọn bảng lương").Show(); } } catch (Exception ex) { X.MessageBox.Alert("Cảnh báo", ex.Message).Show(); } }
private void createSubMenu(ItemsCollection <Component> itemsCollection, DataTable dt, string p) { DataRow[] rows = dt.Select("parentid='" + p + "'"); foreach (DataRow row in rows) { sysprog prog = ConvertHelper.RowToObject <sysprog>(row); Ext.Net.MenuItem menu = new Ext.Net.MenuItem(prog.ProgName); if (prog.IsGroup == "1") { menu.Icon = Icon.Folder; createSubMenu(menu.Menu, dt, prog.id); } else { menu.Icon = Icon.World; //menu.ID = prog.id; menu.Listeners.Click.Handler = "showmodule(#{MyDesktop},'" + prog.id + "');"; } itemsCollection.Add(menu); } }
/// <summary> /// Metodo Que carga el Menu Principal a partir de este menu se generan todos los demas /// </summary> /// <param name="listMenu">Lista de Menus a Cargar</param> protected void CargaMenuPadre(IList<co_ca_menu> listMenu) { try { //Cargo primero el MenuPadre == 0 ya que ese es siempre nuestro menu principal foreach (co_ca_menu menu in listMenu.Where(menu => menu.id_menupadre == -1).OrderBy(c => c.men_orden)) { MenuItem menuPadre = new MenuItem { Text = menu.men_nombre, IconCls = "#Application", ID = "MP_" + menu.men_nombreventana }; menuPadre.Menu.Add(CreaMenuHijos(menu.id_menu, listMenu)); dskPrincipal.StartMenu.MenuItems.Add(menuPadre); } } catch (Exception e) { Mensajes.Error(e.Message); } }
private void RemoveObjects() { try { string loggedUser = Session["username"] as string; #if DEBUG if (loggedUser == "DEVELOPER") { return; } #endif UsuarioLogic usuariologic = new UsuarioLogic(); List <COCASJOL.DATAACCESS.privilegio> privs = usuariologic.GetPrivilegiosDeUsuario(loggedUser); XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings.Get("privilegesXML"))); XmlNodeList nodes = doc.SelectNodes("privilegios/privilege"); DesktopShortcuts listDS = this.MyDesktop.Shortcuts; DesktopModulesCollection listDM = this.MyDesktop.Modules; ItemsCollection <Component> listIC = this.MyDesktop.StartMenu.Items; if (privs.Count == 0) { listDS.Clear(); listDM.Clear(); listIC.Clear(); } else { foreach (XmlNode node in nodes) { XmlNode keyNode = node.SelectSingleNode("key"); XmlNode moduleNode = node.SelectSingleNode("module"); XmlNode shortcutNode = node.SelectSingleNode("shortcut"); XmlNode menuitemNode = node.SelectSingleNode("menuitem"); string key = keyNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); string module = moduleNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); string shortcut = shortcutNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); string menuitem = menuitemNode.InnerText.Replace("\t", "").Replace("\r\n", "").Replace("\n", "").Trim(); var query = from p in privs.AsParallel() where p.PRIV_LLAVE == key select p; if (query.Count() == 0) { for (int x = 0; x < listDS.Count; x++) { DesktopShortcut ds = listDS.ElementAt(x); if (ds.ShortcutID == shortcut) { listDS.Remove(ds); } } for (int x = 0; x < listDM.Count; x++) { DesktopModule dm = listDM.ElementAt(x); if (dm.ModuleID == module) { listDM.Remove(dm); } } for (int x = 0; x < listIC.Count; x++) { Component item = listIC.ElementAt(x); if (item is Ext.Net.MenuItem) { Ext.Net.MenuItem menuItem = (Ext.Net.MenuItem)item; if (menuItem.Menu.Count > 0) { MenuCollection menu = menuItem.Menu; for (int y = 0; y < menu.Primary.Items.Count; y++) { Component itm = menu.Primary.Items.ElementAt(y); if (itm.ID == menuitem) { menu.Primary.Items.Remove(itm); } } } if (menuItem.Menu.Primary.Items.Count == 0) { listIC.Remove(menuItem); } } } } } } } catch (Exception ex) { log.Fatal("Error fatal al remover objetos sin acceso.", ex); throw; } }
protected void Test() { using (BaglantiCumlesi db = new BaglantiCumlesi()) { try { #region Layer 0 List <tbl_sbt_menu> Layer0 = (from p in db.tbl_sbt_menu where p.menu_id == 0 select p).ToList <tbl_sbt_menu>(); if (Layer0.Any()) { #region Create Null Instance Ext.Net.Menu M = null; Ext.Net.ComponentMenuItem CMI = null; Ext.Net.Container C = null; Ext.Net.MenuPanel MP = null; Ext.Net.MenuItem MI = null; Ext.Net.MenuSeparator MS = null; #endregion #region Layer 0 Loop foreach (var i in Layer0) { #region Button Ext.Net.Button B = new Ext.Net.Button(); B.ID = "Button" + i.id; B.Text = i.ad; #endregion #region Layer 1 List <tbl_sbt_menu> Layer1 = (from p in db.tbl_sbt_menu where p.menu_id == i.id select p).ToList <tbl_sbt_menu>(); if (Layer1.Any()) { #region Menu M = new Ext.Net.Menu(); M.ID = "Menu" + i.id; M.ShowSeparator = false; #endregion #region Component Menu i CMI = new Ext.Net.ComponentMenuItem(); CMI.ID = "ComponentMenuItem" + i.id; CMI.Shift = false; #endregion #region Container C = new Ext.Net.Container(); C.ID = "Container" + i.id; C.AutoWidth = true; C.AutoHeight = true; C.AnchorVertical = "100%"; C.Layout = "ColumnLayout"; #endregion #region Layer 1 Loop foreach (var t in Layer1) { #region MenuPanel MP = new Ext.Net.MenuPanel(); MP.ID = "MenuPanel" + t.id; MP.Title = t.ad; MP.Margins = "10 10 10 10"; MP.Menu.ID = "Menu" + t.id; MP.Menu.ShowSeparator = false; #endregion #region Layer 2 List <tbl_sbt_menu> Layer2 = (from p in db.tbl_sbt_menu where p.menu_id == t.id select p).ToList <tbl_sbt_menu>(); if (Layer2.Any()) { int LastID = Layer2[Layer2.Count - 1].id; #region Layer 2 Loop foreach (var y in Layer2) { #region Menu i MI = new Ext.Net.MenuItem(); MI.ID = "MenuItem" + y.id; MI.Text = y.ad; #region URL Check if (!string.IsNullOrEmpty(y.url)) { MI.Icon = Ext.Net.Icon.StarGold; MI.Listeners.Click.Handler = "TabEkle(TabPanel1, '" + MI.ID + "', '" + y.url + "', '" + MP.ID + "', '" + y.ad + "')"; } else { MI.Icon = Ext.Net.Icon.StarHalfGrey; MI.Disabled = true; } #endregion #endregion if (y.id != LastID) { #region Menu Separator MS = new Ext.Net.MenuSeparator(); MS.ID = "MenuSeparator" + y.id; #endregion } #region Adding MP.Menu.Items.Add(MI); #endregion if (y.id != LastID) { #region Adding MP.Menu.Items.Add(MS); #endregion } } #endregion } #endregion #region Adding C.Items.Add(MP); #endregion } #endregion #region Adding CMI.Component.Add(C); M.Items.Add(CMI); B.Menu.Add(M); #endregion } else { B.StandOut = true; } #endregion #region Adding MenuToolbar.Items.Add(B); #endregion } #endregion } #endregion } catch { } /* * try * { * //http://www.superstarcoders.com/blogs/posts/recursive-hierarchical-joins-in-c-sharp-and-linq.aspx * * IEnumerable<DeepNodeData> nodes = elements.RecursiveJoin( * element => element.Id, * element => element.ParentId, * (FlatData element, int index, int depth, IEnumerable<DeepNodeData> children) => * { * return new DeepNodeData() * { * Text = element.Text, * Children = children, * Depth = depth * }; * }); * * foreach (var i in nodes) * { * * } * * var q = (from p in db.tbl_sbt_menu * select new * { * ParentID = p.menu_id, * child = from c in db.tbl_sbt_menu * where c.menu_id == p.id * select new * { * ChildID = c.id, * ParentID = c.menu_id * } * }); * * //var abc = q.Select(p=>p.child).fir * * } * catch * { * * } */ } }
private MenuItem GetMenuItem(ContentItem contentItem, string clientPluginClass) { MenuItem menuItem = new MenuItem { Text = "New", IconUrl = Utility.GetCooliteIconUrl(Icon.PageAdd), Handler = GetJavascriptHandler(contentItem, clientPluginClass) }; // Add child menu items for types that can be created under the current item. IContentTypeManager manager = Context.Current.Resolve<IContentTypeManager>(); var childTypes = manager.GetAllowedChildren(manager.GetContentType(contentItem.GetType()), null, Context.Current.WebContext.User); if (childTypes.Any()) { Menu childMenu = new Menu(); menuItem.Menu.Add(childMenu); foreach (ContentType child in childTypes) { MenuItem childMenuItem = new MenuItem { Text = child.Title, IconUrl = child.IconUrl, Handler = string.Format("function() {{ new top.{0}('New {1}', '{2}').execute(); }}", clientPluginClass, child.Title, Context.AdminManager.GetEditNewPageUrl(contentItem, child, null, CreationPosition.Below)) }; childMenu.Items.Add(childMenuItem); } } return menuItem; }
private void CreateToolbar() { Toolbar topToolbar = new Toolbar(); Button addItemButton = new Button("Add Item") { ID = ID + "btnAdd", Icon = Icon.Add }; Menu addItemButtonMenu = new Menu(); IEnumerable<ContentType> allowedChildren = GetAllowedChildren(); foreach (ContentType definition in allowedChildren) { MenuItem menuItem = new MenuItem(definition.ContentTypeAttribute.Title) { IconUrl = definition.IconUrl }; menuItem.DirectEvents.Click.ExtraParams["Type"] = string.Format("{0},{1}", definition.ItemType.FullName, definition.ItemType.Assembly.FullName); menuItem.DirectEvents.Click.Event += OnAddItemClick; addItemButtonMenu.Items.Add(menuItem); } addItemButton.Menu.Add(addItemButtonMenu); topToolbar.Items.Add(addItemButton); _removeItemsButton = new Button("Remove Item(s)") { ID = ID + "btnRemoveItems", Icon = Icon.Delete, Disabled = true }; _removeItemsButton.DirectEvents.Click.ExtraParams.Add(new Parameter("DeletedItems", string.Format(@" (function() {{ var gridPanel = {0}; var selections = gridPanel.getSelectionModel().getSelections(); var selectedIndexes = []; for (var i = 0; i < selections.length; i++) selectedIndexes.push(gridPanel.getStore().indexOf(selections[i])); return selectedIndexes.join(','); }}).call(this)", ClientID), ParameterMode.Raw)); _removeItemsButton.DirectEvents.Click.Event += OnRemoveItemsClick; _removeItemsButton.DirectEvents.Click.Success = string.Format(@"flagRemovedItems({0});", ClientID); topToolbar.Items.Add(_removeItemsButton); TopBar.Add(topToolbar); }
private void CarregarSubMenu(Ext.Net.Menu menu, IList<MenuPaginaVO> sub) { foreach (MenuPaginaVO mp in sub.OrderBy(x => x.Ordem)) { if (!mp.EmMenu || (!String.IsNullOrEmpty(mp.Url) && !UsuarioLogado.PerfilAcesso.MenuPaginas.Any(x => x.Id == mp.Id)) || (String.IsNullOrEmpty(mp.Url) && !UsuarioLogado.PerfilAcesso.MenuPaginas.Any(x=> mp.MenuPaginas.Any(x1=> x1.Id == x.Id)))) continue; Ext.Net.MenuItem item = new Ext.Net.MenuItem(mp.Descricao); if (!String.IsNullOrEmpty(mp.Url)) item.Listeners.Click.Handler = "window.location = '" + mp.Url + "';"; item.Icon = mp.Icone.IsNullOrEmpty() ? Icon.None : (Icon)Enum.Parse(typeof(Icon), mp.Icone); if (mp.MenuPaginas.Count > 0) { Ext.Net.Menu menu1 = new Ext.Net.Menu(); CarregarSubMenu(menu1, mp.MenuPaginas); item.Menu.Add(menu1); } menu.Items.Add(item); AdicionarIcones(mp); } //if (UsuarioLogado.PerfilAcesso.Acoes.Any(x => x.TipoAcao == Entities.Enumertators.ETipoAcao.RegistrarPontosUsuarios)) //{ // Ext.Net.MenuItem item = new Ext.Net.MenuItem("Registrar Ponto"); // item.Icon = Ext.Net.Icon.ClockStart; // menu.Items.Add(item); // CarregarMenuPonto(item); //} }
private void createSubMenu(MenuCollection menuCollection, DataTable dt, string p) { DataRow[] rows = dt.Select("parentid='" + p + "'"); if (rows == null || rows.Length == 0) return; Ext.Net.Menu menu = new Ext.Net.Menu(); foreach (DataRow row in rows) { sysprog prog = ConvertHelper.RowToObject<sysprog>(row); Ext.Net.MenuItem item = new Ext.Net.MenuItem(prog.ProgName); if (prog.IsGroup == "1") { item.Icon = Icon.Folder; createSubMenu(item.Menu, dt, prog.id); } else { item.Icon = Icon.ApplicationForm; item.Listeners.Click.Handler = "showmodule(#{MyDesktop},'" + prog.id + "');"; } menu.Add(item); } menuCollection.Add(menu); }
private void createSubMenu(ItemsCollection<Component> itemsCollection, DataTable dt, string p) { DataRow[] rows = dt.Select("parentid='" + p + "'"); foreach (DataRow row in rows) { sysprog prog = ConvertHelper.RowToObject<sysprog>(row); Ext.Net.MenuItem menu = new Ext.Net.MenuItem(prog.ProgName); if (prog.IsGroup == "1") { menu.Icon = Icon.Folder; createSubMenu(menu.Menu, dt, prog.id); } else { menu.Icon = Icon.World; //menu.ID = prog.id; menu.Listeners.Click.Handler = "showmodule(#{MyDesktop},'" + prog.id + "');"; } itemsCollection.Add(menu); } }
/// <summary> /// metodo chamado para carregar os temas existentes /// </summary> private void CarregarTemas() { List<TemaVO> lstTemas = new TemaBO().Select(); btnTemas.Visible = lstTemas.Count > 0; if (lstTemas.Count > 0) { Ext.Net.Menu menu = new Ext.Net.Menu(); btnTemas.Menu.Add(menu); foreach (TemaVO t in lstTemas) { Ext.Net.MenuItem menuItem = new Ext.Net.MenuItem(t.Nome); menuItem.Listeners.Click.Handler = "Ext.net.DirectMethods.AlterarTema('" + t.Nome + "', '" + t.Id + "');"; btnTemas.Menu.Primary.Items.Add(menuItem); } } }
protected void Page_Load(object sender, EventArgs e) { curUser = loginService.LoginUser; label1.Text = "欢迎您:" + (string.IsNullOrEmpty(curUser.TrueName) ? curUser.Account : curUser.TrueName); //渠道内部用户及渠道合作方不能查看"关于我们"这个页面 if (curUser.AccountType == UserTypeOptions.Channel || curUser.AccountType == UserTypeOptions.ChannelPartner) { btnaboatus.Visible = false; aboatusurl = ""; } if (!X.IsAjaxRequest) { List <Soft> softs; try { softs = loginService.AvailableSofts; } catch (NotRightException) { softs = new List <Soft>(); } var topRights = loginService.AvailableRights.Where(a => a.RightLevel == 0); for (int i = 0; i < topRights.Count(); i++) { Right topRight = topRights.ElementAt(i); MenuPanel mp = new MenuPanel(); mp.ID = "mp" + topRight.ID.ToString(); mp.Title = topRight.Name; mp.Icon = Icon.BulletRight; mp.Width = 200; mp.AutoScroll = true; var subRights = loginService.AvailableRights.Where(a => a.ParentID == topRight.ID); for (int j = 0; j < subRights.Count(); j++) { Right subRight = subRights.ElementAt(j); //如果是装机商带来量的报表,则必须要求有助手的权限 if (subRight.PageUrl.ToLower() == "reports/newuserbymac.aspx") { int[] array = { 68, 69, -9, 58, 9, 57, 60, 61, 71 }; if (!softs.Exists(a => array.Contains(a.ID))) { continue; } } Ext.Net.MenuItem mi = new Ext.Net.MenuItem(); mi.ID = subRight.ID.ToString(); mi.Text = subRight.Name; mi.Icon = Icon.BulletStart; if (string.IsNullOrEmpty(url)) { url = subRight.PageUrl; title = subRight.Name; id = subRight.ID.ToString(); menupanleid = mp.ID; } //唯一标识、访问链接地址、显示名称 mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','{1}','{2}',this,{3});", subRight.ID, subRight.PageUrl, subRight.Name, mp.ID); mp.Menu.Items.Add(mi); } Panel1.Items.Add(mp); } #region 系统管理 UserTypeOptions accountType = loginService.LoginUser.AccountType; List <SystemInfo> adminSystems = loginService.AdminSystems; if ((accountType == UserTypeOptions.SuperAdmin || accountType == UserTypeOptions.Admin || accountType == UserTypeOptions.ProductAdmin) && adminSystems.Count > 0) { MenuPanel mp = new MenuPanel(); mp.ID = "SysManage"; mp.Title = "系统管理"; mp.Icon = Icon.BulletRight; mp.Width = 200; mp.AutoScroll = true; //用户管理 Ext.Net.MenuItem mi = new Ext.Net.MenuItem(); mi.ID = "UserManage"; mi.Text = "用户管理"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/UserManage.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); if (accountType == UserTypeOptions.SuperAdmin) { //系统管理 mi = new Ext.Net.MenuItem(); mi.ID = "SystemManage"; mi.Text = "系统管理"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/SystemManage.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); } if (accountType != UserTypeOptions.ProductAdmin) { //角色管理 mi = new Ext.Net.MenuItem(); mi.ID = "RoleManage"; mi.Text = "角色管理"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/RoleManage.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); } if (accountType == UserTypeOptions.SuperAdmin || accountType == UserTypeOptions.Admin) { //权限管理 mi = new Ext.Net.MenuItem(); mi.ID = "RightManage"; mi.Text = "权限管理"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/RightManage.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); //产品管理 mi = new Ext.Net.MenuItem(); mi.ID = "SoftList"; mi.Text = "产品管理"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/SoftList.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); Panel1.Items.Add(mp); //项目来源管理 mi = new Ext.Net.MenuItem(); mi.ID = "ProjectSourceManage"; mi.Text = "项目来源管理"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/ProjectSourceManage.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); } //REPORT才有这个权限 if (adminSystems.Exists(a => a.ID == 1)) { //渠道权限管理 mi = new Ext.Net.MenuItem(); mi.ID = "ChannelRightManager"; mi.Text = "渠道权限管理"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/ChannelRightManager.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); } if (accountType != UserTypeOptions.ProductAdmin) { //操作日志 mi = new Ext.Net.MenuItem(); mi.ID = "Log"; mi.Text = "操作日志"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/Log.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); } //操作日志 mi = new Ext.Net.MenuItem(); mi.ID = "RightSysDescript"; mi.Text = "权限说明"; mi.Icon = Icon.BulletStart; mi.Listeners.Click.Handler += string.Format("addTab(#{{TabPanel1}},'idClt{0}','UserRights/RightSysDescript.aspx','{1}',this,{2});", mi.ID, mi.Text, mp.ID); mp.Menu.Items.Add(mi); Panel1.Items.Add(mp); } #endregion } }
/// <summary> /// /// </summary> /// <param name="idMenuPadre"></param> /// <param name="listMenu"></param> protected Menu CreaMenuHijos(int idMenuPadre, IList<co_ca_menu> listMenu) { try { IList<MenuItem> menusHijos = new List<MenuItem>(); Menu menus = new Menu(); foreach (co_ca_menu menuHijo in listMenu.Where(menusHijo => menusHijo.id_menupadre == idMenuPadre).OrderBy(c => c.men_orden)) { co_ca_menu hijo1 = menuHijo; IEnumerable<co_ca_menu> hijos = listMenu.Where(menHijos => menHijos.id_menupadre == hijo1.id_menu); MenuItem hijo; if (hijos.Any()) { hijo = new MenuItem { Text = menuHijo.men_nombre, IconCls = "#Application", ID = "MP_" + menuHijo.men_nombreventana }; hijo.Menu.Add(CreaMenuHijos(menuHijo.id_menu, listMenu)); } else { hijo = new MenuItem(); hijo.ID = "MH_" + menuHijo.men_nombreventana; hijo.IconCls = "#Application"; hijo.Text = menuHijo.men_nombre; hijo.DestroyMenu = false; Parameter titulo = new Parameter("title", menuHijo.men_nombre); string strurl = menuHijo.men_url; string urltemp = "k=" + menuHijo.id_menu + "&u=" + FWPConfiguration.get_ID_User(Session.SessionID) + "&p=" + FWPConfiguration.get_Perfil(Session.SessionID) + "&z=" + FWPConfiguration.get_Accesos(Session.SessionID); if (strurl.Contains("?")) { strurl = strurl + "&" + urltemp; } else { strurl = strurl + "?" + urltemp; } Parameter url = new Parameter("url", strurl); Parameter id = new Parameter("id", menuHijo.men_nombreventana); Parameter icono = new Parameter("icono", "#Application"); hijo.DirectEvents.Click.Event += Button_WindowDesktop; hijo.DirectEvents.Click.ExtraParams.Add(url); hijo.DirectEvents.Click.ExtraParams.Add(titulo); hijo.DirectEvents.Click.ExtraParams.Add(icono); hijo.DirectEvents.Click.ExtraParams.Add(id); } menusHijos.Add(hijo); } menus.Items.Add(menusHijos); return menus; } catch (Exception e) { throw new Exception(e.Message); } }