Ejemplo n.º 1
0
        public TsMenuItem[] GetMainMenuItems()
        {
            List <TsMenuItem> items     = new List <TsMenuItem>();
            LoginUser         loginUser = TSAuthentication.GetLoginUser();

            Organization org  = TSAuthentication.GetOrganization(loginUser);
            User         user = TSAuthentication.GetUser(loginUser);
            string       data = @"{{""ContentUrl"":""{0}"",""PaneInfoUrl"":""{1}""}}";


            if (org.ParentID != null)
            {
                if (user.ShowWelcomePage == true && user.IsSystemAdmin == true)
                {
                    items.Add(new TsMenuItem("welcome", "mniWelcome", "Getting Started", "vcr/1_9_0/images/nav/20/GettingStarted.png", string.Format(data, "vcr/1_9_0/Pages/Welcome.html", "vcr/1_9_0/PaneInfo/Welcome.html")));
                }

                if (IsMenuItemActive(user, "mniDashboard"))
                {
                    items.Add(new TsMenuItem("dashboard", "mniDashboard", "Dashboard", "vcr/1_9_0/images/nav/20/Dashboard.png", string.Format(data, "vcr/1_9_0/Pages/Dashboard.html", "vcr/1_9_0/PaneInfo/Dashboard.html")));
                }

                if (IsMenuItemActive(user, "mniMyTickets"))
                {
                    TsMenuItem myItem = new TsMenuItem("mytickets", "mniMyTickets", "My Tickets", "vcr/1_9_0/images/nav/20/mytickets.png", string.Format(data, "vcr/1_9_0/Pages/TicketTabs.html?UserID=" + TSAuthentication.UserID, "vcr/1_9_0/PaneInfo/MyTickets.html"));
                    items.Add(myItem);

                    Reports privateTicketViews = new Reports(TSAuthentication.GetLoginUser());
                    privateTicketViews.LoadAllPrivateTicketViews(TSAuthentication.OrganizationID, TSAuthentication.UserID);

                    if (!privateTicketViews.IsEmpty)
                    {
                        foreach (Report report in privateTicketViews)
                        {
                            myItem.AddItem(new TsMenuItem("tickettype", "mniTicketView_" + report.ReportID.ToString(), report.Name, "vcr/1_9_0/images/nav/20/tickets.png", string.Format(data, "vcr/1_9_0/Pages/TicketView.html?ReportID=" + report.ReportID.ToString(), "vcr/1_9_0/PaneInfo/Reports.html")));
                        }
                    }
                }

                if (IsMenuItemActive(user, "mniTickets"))
                {
                    TsMenuItem ticketItem = new TsMenuItem("tickets", "mniTickets", "All Tickets", "vcr/1_9_0/images/nav/20/tickets.png", string.Format(data, "vcr/1_9_0/Pages/TicketTabs.html", "vcr/1_9_0/PaneInfo/Tickets.html"));
                    items.Add(ticketItem);

                    Reports publicTicketViews = new Reports(TSAuthentication.GetLoginUser());
                    publicTicketViews.LoadAllPublicTicketViews(TSAuthentication.OrganizationID, TSAuthentication.UserID);

                    if (!publicTicketViews.IsEmpty)
                    {
                        foreach (Report report in publicTicketViews)
                        {
                            ticketItem.AddItem(new TsMenuItem("tickettype", "mniTicketView_" + report.ReportID.ToString(), report.Name, "vcr/1_9_0/images/nav/20/tickets.png", string.Format(data, "vcr/1_9_0/Pages/TicketView.html?ReportID=" + report.ReportID.ToString(), "vcr/1_9_0/PaneInfo/Reports.html")));
                        }
                    }

                    TicketTypes ticketTypes = new TicketTypes(loginUser);
                    ticketTypes.LoadByOrganizationID(TSAuthentication.OrganizationID, org.ProductType);
                    foreach (TicketType ticketType in ticketTypes)
                    {
                        if (ticketType.IsActive)
                        {
                            string mniID = "mniTicketType_" + ticketType.TicketTypeID.ToString();
                            if (IsMenuItemActive(user, mniID))
                            {
                                ticketItem.AddItem(new TsMenuItem("tickettype", mniID, ticketType.Name, ticketType.IconUrl, string.Format(data, "vcr/1_9_0/Pages/TicketTabs.html?TicketTypeID=" + ticketType.TicketTypeID.ToString(), "vcr/1_9_0/PaneInfo/Tickets.html")));
                            }
                        }
                    }
                }

                if (org.ProductType == ProductType.Enterprise && IsMenuItemActive(user, "mniTasks"))
                {
                    items.Add(new TsMenuItem("tasks", "mniTasks", "Tasks", "vcr/1_9_0/images/nav/20/tasks.png", string.Format(data, "vcr/1_9_0/Pages/tasks.html", "vcr/1_9_0/PaneInfo/Tasks.html")));
                }

                if (IsMenuItemActive(user, "mniTicketTags"))
                {
                    items.Add(new TsMenuItem("tickettags", "mniTicketTags", "Ticket Tags", "vcr/1_9_0/images/nav/20/tag.png", string.Format(data, "Frames/TicketTags.aspx", "vcr/1_9_0/PaneInfo/TicketTags.html")));
                }

                if (IsMenuItemActive(user, "mniKB"))
                {
                    items.Add(new TsMenuItem("kb", "mniKB", "Knowledge Base", "vcr/1_9_0/images/nav/20/knowledge.png", string.Format(data, "vcr/1_9_0/Pages/KnowledgeBase.html", "vcr/1_9_0/PaneInfo/Knowledge.html")));
                }

                if (IsMenuItemActive(user, "mniForum") && org.UseForums == true)
                {
                    items.Add(new TsMenuItem("forum", "mniForum", "Community", "vcr/1_9_0/images/nav/20/forum.png", string.Format(data, "vcr/1_9_0/Pages/TicketGrid.html?tf_ForumCategoryID=-1", "vcr/1_9_0/PaneInfo/Community.html")));
                }

                if (org.ProductType != ProductType.Express && IsMenuItemActive(user, "mniWiki"))
                {
                    items.Add(new TsMenuItem("wiki", "mniWiki", "Wiki", "vcr/1_9_0/images/nav/20/wiki.png", string.Format(data, "vcr/1_9_0/Pages/Wiki_view.html", "vcr/1_9_0/PaneInfo/Wiki_view.html")));
                }

                if (IsMenuItemActive(user, "mniSearch"))
                {
                    items.Add(new TsMenuItem("search", "mniSearch", "Search", "vcr/1_9_0/images/nav/20/search.png", string.Format(data, "vcr/1_9_0/Pages/Search.html", "vcr/1_9_0/PaneInfo/Search.html")));
                }

                if (user.IsChatUser && org.ChatSeats > 0 && IsMenuItemActive(user, "mniChat"))
                {
                    //old chat: items.Add(new TsMenuItem("chat", "mniChat", "Customer Chat", "vcr/1_9_0/images/nav/20/chat.png", string.Format(data, "Frames/Chat.aspx", "vcr/1_9_0/PaneInfo/Chat.html")));
                    items.Add(new TsMenuItem("chat", "mniChat", "Customer Chat", "vcr/1_9_0/images/nav/20/chat.png", string.Format(data, "vcr/1_9_0/Pages/AgentCustomerChat.html", "vcr/1_9_0/PaneInfo/Chat.html")));
                }

                if (org.ProductType != ProductType.Express && IsMenuItemActive(user, "mniWC2"))
                {
                    items.Add(new TsMenuItem("wc2", "mniWC2", "Water Cooler", "vcr/1_9_0/images/nav/20/watercooler.png", string.Format(data, "vcr/1_9_0/Pages/WaterCooler.html", "vcr/1_9_0/PaneInfo/WaterCooler.html")));
                }

                items.Add(new TsMenuItem("calender", "mniCalender", "Calendar", "vcr/1_9_0/images/nav/20/calendar.png", string.Format(data, "vcr/1_9_0/Pages/Calendar.html", "vcr/1_9_0/PaneInfo/Calendar.html")));

                if (IsMenuItemActive(user, "mniUsers"))
                {
                    items.Add(new TsMenuItem("users", "mniUsers", "Users", "vcr/1_9_0/images/nav/20/users.png", string.Format(data, "vcr/1_9_0/Pages/Users.html", "vcr/1_9_0/PaneInfo/Users.html")));
                }

                if (IsMenuItemActive(user, "mniGroups"))
                {
                    items.Add(new TsMenuItem("groups", "mniGroups", "Groups", "vcr/1_9_0/images/nav/20/groups.png", string.Format(data, "vcr/1_9_0/Pages/Groups.html", "vcr/1_9_0/PaneInfo/Groups.html")));
                    //items.Add(new TsMenuItem("groups1", "mniGroups1", "Groups1", "vcr/1_9_0/images/nav/20/groups.png", string.Format(data, "Frames/Groups.aspx", "vcr/1_9_0/PaneInfo/Groups.html")));
                }

                if ((org.ProductType == ProductType.Enterprise || org.ProductType == ProductType.HelpDesk) && IsMenuItemActive(user, "mniCustomers"))
                {
                    //items.Add(new TsMenuItem("customers1", "mniCustomers1", "Customers1", "vcr/1_9_0/images/nav/20/customers.png", string.Format(data, "Frames/Organizations.aspx", "vcr/1_9_0/PaneInfo/Customers.html")));
                    items.Add(new TsMenuItem("customers", "mniCustomers", "Customers", "vcr/1_9_0/images/nav/20/customers.png", string.Format(data, "vcr/1_9_0/Pages/Customers.html", "vcr/1_9_0/PaneInfo/Customers.html")));
                }


                if ((org.ProductType == ProductType.Enterprise || org.ProductType == ProductType.BugTracking) && IsMenuItemActive(user, "mniProducts"))
                {
                    items.Add(new TsMenuItem("products", "mniProducts", "Products", "vcr/1_9_0/images/nav/20/products.png", string.Format(data, "vcr/1_9_0/Pages/Products.html", "vcr/1_9_0/PaneInfo/Products.html")));
                    //items.Add(new TsMenuItem("products", "mniProducts", "Products", "vcr/1_9_0/images/nav/20/products.png", string.Format(data, "Frames/Products.aspx", "vcr/1_9_0/PaneInfo/Products.html")));
                    //if (TSAuthentication.OrganizationID == 1078 || TSAuthentication.OrganizationID == 13679 || TSAuthentication.OrganizationID == 362372 || TSAuthentication.OrganizationID == 428340)
                    //{
                    //  items.Add(new TsMenuItem("products", "mniProducts1", "New Products", "vcr/1_9_0/images/nav/20/products.png", string.Format(data, "vcr/1_9_0/Pages/Products.html", "vcr/1_9_0/PaneInfo/Products.html")));
                    //}
                }

                if (org.IsInventoryEnabled && IsMenuItemActive(user, "mniInventory"))
                {
                    //items.Add(new TsMenuItem("inventory", "mniInventory", "Inventory", "vcr/1_9_0/images/nav/20/inventory.png", string.Format(data, "Inventory/Inventory.aspx", "vcr/1_9_0/PaneInfo/Inventory.html")));
                    items.Add(new TsMenuItem("inventory", "mniInventory", "Inventory", "vcr/1_9_0/images/nav/20/inventory.png", string.Format(data, "vcr/1_9_0/Pages/Inventory.html", "vcr/1_9_0/PaneInfo/Inventory.html")));
                }

                if ((user.IsSystemAdmin || !org.AdminOnlyReports) && IsMenuItemActive(user, "mniReports"))
                {
                    items.Add(new TsMenuItem("reports", "mniReports", "Reports", "vcr/1_9_0/images/nav/20/reports.png", string.Format(data, "vcr/1_9_0/pages/reports.html", "vcr/1_9_0/PaneInfo/Reports.html")));
                }

                if (user.IsSystemAdmin && IsMenuItemActive(user, "mniAdmin"))
                {
                    items.Add(new TsMenuItem("admin", "mniAdmin", "Admin", "vcr/1_9_0/images/nav/20/admin.png", string.Format(data, "Frames/Admin.aspx", "vcr/1_9_0/PaneInfo/Admin.html")));
                }

                if (TSAuthentication.OrganizationID == 1078)
                {
                    TsMenuItem utils = new TsMenuItem("utils", "mniUtils", "Utilities", "vcr/1_9_0/images/nav/20/admin.png", string.Format(data, "vcr/1_9_0/Utils/Utils.html", "vcr/1_9_0/PaneInfo/Admin.html"));
                    items.Add(utils);
                    utils.AddItem(new TsMenuItem("utils", "utils-accounts", "Accounts", "vcr/1_9_0/images/nav/20/admin.png", string.Format(data, "vcr/1_9_0/Utils/Accounts.html", "vcr/1_9_0/PaneInfo/Admin.html")));
                    utils.AddItem(new TsMenuItem("utils", "utils-tickets", "Tickets", "vcr/1_9_0/images/nav/20/admin.png", string.Format(data, "vcr/1_9_0/Utils/Tickets.html", "vcr/1_9_0/PaneInfo/Admin.html")));
                    utils.AddItem(new TsMenuItem("utils", "utils-organizations", "Organizations", "vcr/1_9_0/images/nav/20/admin.png", string.Format(data, "vcr/1_9_0/Utils/Organizations.html", "vcr/1_9_0/PaneInfo/Admin.html")));
                    utils.AddItem(new TsMenuItem("utils", "utils-devflow", "Dev Workflow", "vcr/1_9_0/images/nav/20/admin.png", string.Format(data, "https://app.teamsupport.com/wiki/justarticle.aspx?Organizationid=1078&ArticleID=44728", "vcr/1_9_0/PaneInfo/Admin.html")));
                    if (user.UserID == 34 || user.UserID == 47 || user.UserID == 4759191)
                    {
                        utils.AddItem(new TsMenuItem("utils", "utils-reporttest", "Custom Reports", "vcr/1_9_0/images/nav/20/admin.png", string.Format(data, "vcr/1_9_0/Utils/ReportTest.html", "vcr/1_9_0/PaneInfo/Admin.html")));
                    }
                }
            }
            else
            {
                items.Add(new TsMenuItem("tsusers", "mniUsers", "System Users", "vcr/1_9_0/images/nav/20/users.png", string.Format(data, "Frames/Users.aspx", "vcr/1_9_0/PaneInfo/Users.html")));
                items.Add(new TsMenuItem("tscustomers", "mniCustomers", "System Customers", "vcr/1_9_0/images/nav/20/customers.png", string.Format(data, "Frames/Organizations.aspx", "vcr/1_9_0/PaneInfo/Organizations.html")));
            }

            return(items.ToArray());
        }
Ejemplo n.º 2
0
 public void AddItem(TsMenuItem item)
 {
     _items.Add(item);
 }