Cassie Mod

Cassie Mod

  • NA
  • 488
  • 70.5k

how to create a submenu under Extra

Oct 17 2017 6:02 AM
HI ive got the following question, now we have a menu bar above the page containing a vew items. Underneeth extra i need a submenu item. How can i realize that ? here are some part the codes.
 
  1.     public class PortalMenuItemList: List<PortalMenuItem>  
  2.     {  
  3.         private PortalMenuItem _Owner = null;  
  4.   
  5.         public PortalMenuItemList(PortalMenuItem menuItem)  
  6.         {  
  7.             _Owner = menuItem;  
  8.         }  
  9.   
  10.         public new void Add(PortalMenuItem menuItem)  
  11.         {  
  12.             if(menuItem.Parent!=null)  
  13.                 menuItem.Parent.Children.Remove(menuItem);  
  14.   
  15.             base.Add(menuItem);  
  16.             menuItem.Parent = this._Owner;  
  17.         }  
  18.   
  19.         /* 
  20.         public PortalMenuItem GetCommandByName(string commandName) 
  21.         { 
  22.             foreach(PortalCommand command in this) 
  23.             { 
  24.                 PortalCommand temp = command.GetCommandByName(commandName); 
  25.                 if (temp != null) 
  26.                     return temp; 
  27.             } 
  28.  
  29.             return null; 
  30.         }*/  
  31.     }  

 
  1. public class PortalMenuItem  
  2. {  
  3.     public string Target;  
  4.     private PortalMenuItemList _Children;  
  5.   
  6.     public PortalMenuItem()  
  7.     {  
  8.         Visible = true;  
  9.         _Children = new PortalMenuItemList(this);  
  10.     }  
  11.   
  12.     public string Title { getset; }  
  13.     public PortalMenuItem Parent { getset; }  
  14.     public string Command { getset; }  
  15.     public string Class { getset; }  
  16.     public bool Visible { getset; }  
  17.     public Dictionary<stringstring> CommandArguments { getset; }  
  18.   
  19.     public PortalMenuItemList Children { get { return _Children; } }  

 
  1. public override void InitMenu()  
  2. {  
  3.     if (UserLoggedIn)  
  4.     {  
  5.         var features = new Features(User);  
  6.         switch (User.loginType)  
  7.         {  
  8.             case UserLoginType.User:  
  9.                 AddMenuItem(new PortalMenuItem  
  10.                 {  
  11.                     Command = ApplicationCommands.UserPhoneManagement,  
  12.                     Title = "Mijn Toestel",  
  13.                     Class = "phone",  
  14.                     Visible = (features.CallingDeliveryBlock || features.DoNotDisturb || features.CallForwardingAlways),  
  15.                     CommandArguments = new Dictionary<string, string>  
  16.                     {  
  17.                         {"userId", User.username}  
  18.                     }  
  19.                 });  
  20.   
  21.                 AddMenuItem(new PortalMenuItem  
  22.                 {  
  23.                     Command = ApplicationCommands.ReceptionistView,  
  24.                     Title = "Receptionist",  
  25.                     Class = "contacts",  
  26.                     Visible = features.Receptionist && (AuthorizeUser(User.username, null, ServicePacks.DeanReceptionistEnterprise) || AuthorizeUser(User.username, null, ServicePacks.DeanReceptionistSmallBusiness)),  
  27.                     Target = "_blank"  
  28.                 });  
  29.   
  30.                 AddMenuItem(new PortalMenuItem  
  31.                 {  
  32.                     Command = ApplicationCommands.HelpPage,  
  33.                     Title = "Help",  
  34.                     Class = "help",  
  35.                     Visible = true  
  36.                 });  
  37.                 break;  
  38.   
  39.             case UserLoginType.Group:  
  40.             case UserLoginType.Partner:  
  41.             case UserLoginType.DeanOne:  
  42.                 AddMenuItem(new PortalMenuItem  
  43.                 {  
  44.                     Command = ApplicationCommands.UsersView,  
  45.                     Title = "Gebruikers",  
  46.                     Class = "phone",  
  47.                     Visible = features.ReadUsers  
  48.                 });  
  49.   
  50.                 AddMenuItem(new PortalMenuItem  
  51.                 {  
  52.                     Command = ApplicationCommands.AutoAttendantsView,  
  53.                     Title = "Keuzemenu",  
  54.                     Class = "help",  
  55.                     Visible = features.AutoAttendentBasic  
  56.                 });  
  57.   
  58.                 AddMenuItem(new PortalMenuItem  
  59.                 {  
  60.                     Command = ApplicationCommands.ExtraSettings,  
  61.                     Title = "Extra",  
  62.                     Class = "balloon",  
  63.                 });                         
  64.                 break;  
  65.         }  
  66.     }  

  1. // Topmenu.aspx  
  2.   
  3. <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TopMenu.ascx.cs" Inherits="OneXS.Orion.FrontOffice.Compleet.Portal.Controls.Topmenu" %>  
  4. <%@ Import Namespace="OneXS.Orion.FrontOffice.Compleet.PortalBase" %>  
  5. <%    
  6.     if (Repeater1.Items.Count != 0)  
  7.     {%>  
  8. <div id="main_menu_wrap">  
  9.     <div class="main_menu">  
  10.         <ul>  
  11.             <asp:Repeater ID="Repeater1" runat="server" EnableViewState="false">  
  12.                 <ItemTemplate>  
  13.                     <asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible="<%# (Container.DataItem as PortalMenuItem).Visible %>">  
  14.                         <li class="<%# ComputeCssClass(Container.DataItem as PortalMenuItem) %>">  
  15.                             <a href="<%#ComputeMenuitemDocumentUrl(Container.DataItem as PortalMenuItem)%>"  
  16.                                 title="<%#(Container.DataItem as PortalMenuItem).Title %>" target="<%#(Container.DataItem as PortalMenuItem).Target %>">  
  17.                                 <span class="icon icon-24 <%#(Container.DataItem as PortalMenuItem).Class %>"></span>  
  18.                                 <span class="label"><%# ComputeMenuItemTitle(Container.DataItem as PortalMenuItem)%></span></a></li>  
  19.                     </asp:PlaceHolder>  
  20.                 </ItemTemplate>  
  21.             </asp:Repeater>  
  22.         </ul>  
  23.     </div>  
  24. </div>  
  25. <% } %> 
 

Answers (1)