Ejemplo n.º 1
0
    private bool IsMenuAccesible(CMS.AMS.Models.Menu item)
    {
        switch (item.AppMenuID)
        {
        //For folder subMenu, check whether user has access to it.
        case 28:
            return(((AuthenticatedUI)this.Page).CurrentUser.UserPermissions.AccessFolders);

        //For CAM subtab, check whether CAM engine is installed or not?
        case 33:
            return(m_Common.Is_Engine_Installed(6));

        default:
            return(true);
        }
    }
Ejemplo n.º 2
0
    private void SetUpSubMenu(CMS.AMS.Models.Menu mainmenu)
    {
        int submenukeycounter = 0;

        string[]            submenuaccesskeys = { "!", "@", "#", "$", "%", "^", "&", "*", "(", ")" };
        CMS.AMS.Models.Menu HighlightMenu     = null;
        foreach (CMS.AMS.Models.Menu menu in mainmenu.Menus)
        {
            if (menu != null)
            {
                HyperLink hyp = new HyperLink();
                hyp.NavigateUrl = menu.NavigateURL;
                hyp.CssClass    = menu.Highlighet ? "on" : "";
                if (submenukeycounter < 10)
                {
                    hyp.Attributes["accesskey"] = submenuaccesskeys[submenukeycounter];
                    submenukeycounter++;
                }
                hyp.ID                  = "subtab" + (menu.AppMenuID).ToString();
                hyp.ClientIDMode        = ClientIDMode.Static;
                hyp.Attributes["title"] = menu.TitlePhraseID == 0 ? menu.Caption : AunthUI.PhraseLib.Lookup(menu.TitlePhraseID, AunthUI.LanguageID);
                hyp.Text                = menu.PhraseID == 0 ? menu.Caption : AunthUI.PhraseLib.Lookup(menu.PhraseID, AunthUI.LanguageID);
                phSubMenu.Controls.Add(hyp);
                phSubMenu.Controls.Add(new LiteralControl("\n"));
                if (menu.Highlighet)
                {
                    HighlightMenu = menu;
                }
            }
        }
        if (HighlightMenu == null || HighlightMenu.Menus == null)
        {
            //Allow AuthorisePage to be called from ASPX page in case User does not have access to the Highlighted Sub-Tab
            if (mainmenu.AppMenuID == 8)
            {
                return;
            }
            MenuError();

            return;
        }
        foreach (CMS.AMS.Models.Menu menu in HighlightMenu.Menus)
        {
            HyperLink hyp = new HyperLink();
            hyp.NavigateUrl = menu.NavigateURL;
            hyp.CssClass    = menu.Highlighet ? "on" : "";
            if (submenukeycounter < 10)
            {
                hyp.Attributes["accesskey"] = submenuaccesskeys[submenukeycounter];
                submenukeycounter++;
            }
            hyp.ID                  = "subtab" + (menu.AppMenuID).ToString();
            hyp.ClientIDMode        = ClientIDMode.Static;
            hyp.Attributes["title"] = menu.TitlePhraseID == 0 ? menu.Caption : AunthUI.PhraseLib.Lookup(menu.TitlePhraseID, AunthUI.LanguageID);
            hyp.Attributes["style"] = "float: right; left: auto; right: 11px;";
            hyp.Text                = menu.PhraseID == 0 ? menu.Caption : AunthUI.PhraseLib.Lookup(menu.PhraseID, AunthUI.LanguageID);
            phSubMenu.Controls.Add(hyp);
            phSubMenu.Controls.Add(new LiteralControl("\n"));
            if (menu.Highlighet)
            {
                HighlightMenu = menu;
            }
        }
        if (HighlightMenu == null || HighlightMenu.Menus == null)
        {
            MenuError();

            return;
        }
    }