Пример #1
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                bool   blnUseSkinPathArrowImages    = bool.Parse(GetValue(UseSkinPathArrowImages, "False"));    //This setting allows for skin independant images without breaking legacy skins
                bool   blnUseRootBreadcrumbArrow    = bool.Parse(GetValue(UseRootBreadCrumbArrow, "True"));     //This setting determines if the DNN root menu will use an arrow to indicate it is the active root level tab
                bool   blnUseSubMenuBreadcrumbArrow = bool.Parse(GetValue(UseSubMenuBreadCrumbArrow, "False")); //This setting determines if the DNN sub-menus will use an arrow to indicate it is a member of the Breadcrumb tabs
                bool   blnUseArrows = bool.Parse(GetValue(UseArrows, "True"));                                  //This setting determines if the submenu arrows will be used
                bool   blnRootOnly  = bool.Parse(GetValue(RootOnly, "False"));                                  //This setting determines if the submenu will be shown
                string strRootBreadcrumbArrow;
                string strSubMenuBreadcrumbArrow;
                string strRightArrow;
                string strDownArrow;

                if (blnRootOnly)
                {
                    blnUseArrows = false;
                    this.PopulateNodesFromClient = false;
                    this.StartTabId  = -1;
                    this.ExpandDepth = 1;
                }

//                SkinController objSkins = new SkinController();
                //image for root menu breadcrumb marking
                if (!String.IsNullOrEmpty(RootBreadCrumbArrow))
                {
                    strRootBreadcrumbArrow = PortalSettings.ActiveTab.SkinPath + RootBreadCrumbArrow;
                }
                else
                {
                    strRootBreadcrumbArrow = Globals.ApplicationPath + "/images/breadcrumb.gif";
                }

                //image for submenu breadcrumb marking
                if (!String.IsNullOrEmpty(SubMenuBreadCrumbArrow))
                {
                    strSubMenuBreadcrumbArrow = PortalSettings.ActiveTab.SkinPath + SubMenuBreadCrumbArrow;
                }

                if (blnUseSubMenuBreadcrumbArrow)
                {
                    strSubMenuBreadcrumbArrow      = Globals.ApplicationPath + "/images/breadcrumb.gif";
                    this.NodeLeftHTMLBreadCrumbSub = "<img alt=\"*\" BORDER=\"0\" src=\"" + strSubMenuBreadcrumbArrow + "\">";
                }

                if (blnUseRootBreadcrumbArrow)
                {
                    this.NodeLeftHTMLBreadCrumbRoot = "<img alt=\"*\" BORDER=\"0\" src=\"" + strRootBreadcrumbArrow + "\">";
                }

                //image for right facing arrow
                if (!String.IsNullOrEmpty(RightArrow))
                {
                    strRightArrow = RightArrow;
                }
                else
                {
                    strRightArrow = "breadcrumb.gif";
                }
                //image for down facing arrow
                if (!String.IsNullOrEmpty(DownArrow))
                {
                    strDownArrow = DownArrow;
                }
                else
                {
                    strDownArrow = "menu_down.gif";
                }

                //Set correct image path for all separator images
                if (!String.IsNullOrEmpty(Separator))
                {
                    if (Separator.IndexOf("src=") != -1)
                    {
                        Separator = Separator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }

                if (!String.IsNullOrEmpty(LeftSeparator))
                {
                    if (LeftSeparator.IndexOf("src=") != -1)
                    {
                        LeftSeparator = LeftSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparator))
                {
                    if (RightSeparator.IndexOf("src=") != -1)
                    {
                        RightSeparator = RightSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorBreadCrumb))
                {
                    if (LeftSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        LeftSeparatorBreadCrumb = LeftSeparatorBreadCrumb.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorBreadCrumb))
                {
                    if (RightSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        RightSeparatorBreadCrumb = RightSeparatorBreadCrumb.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorActive))
                {
                    if (LeftSeparatorActive.IndexOf("src=") != -1)
                    {
                        LeftSeparatorActive = LeftSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorActive))
                {
                    if (RightSeparatorActive.IndexOf("src=") != -1)
                    {
                        RightSeparatorActive = RightSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }

                // generate dynamic menu
                if (blnUseSkinPathArrowImages)
                {
                    this.PathSystemImage = PortalSettings.ActiveTab.SkinPath;
                }
                else
                {
                    this.PathSystemImage = Globals.ApplicationPath + "/images/";
                }
                this.PathImage = PortalSettings.HomeDirectory;
                if (blnUseArrows)
                {
                    this.IndicateChildImageSub = strRightArrow;
                    if (this.ControlOrientation.ToLower() == "vertical")  //NavigationProvider.NavigationProvider.Orientation.Vertical Then
                    {
                        this.IndicateChildImageRoot = strRightArrow;
                    }
                    else
                    {
                        this.IndicateChildImageRoot = strDownArrow;
                    }
                }
                else
                {
                    this.PathSystemImage       = Globals.ApplicationPath + "/images/";
                    this.IndicateChildImageSub = "spacer.gif";
                }
                if (String.IsNullOrEmpty(PathSystemScript))
                {
                    this.PathSystemScript = Globals.ApplicationPath + "/controls/SolpartMenu/";
                }

                BuildNodes(null);
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        /// The Page_Load server event handler on this page is used
        /// to populate the role information for the page
        /// </summary>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);


            try
            {
                bool   blnUseSkinPathArrowImages    = bool.Parse(GetValue(UseSkinPathArrowImages, "False"));
                bool   blnUseRootBreadcrumbArrow    = bool.Parse(GetValue(UseRootBreadCrumbArrow, "True"));
                bool   blnUseSubMenuBreadcrumbArrow = bool.Parse(GetValue(UseSubMenuBreadCrumbArrow, "False"));
                bool   blnUseArrows = bool.Parse(GetValue(UseArrows, "True"));
                bool   blnRootOnly  = bool.Parse(GetValue(RootOnly, "False"));
                string strRootBreadcrumbArrow;
                string strSubMenuBreadcrumbArrow;
                string strRightArrow;
                string strDownArrow;
                if (blnRootOnly)
                {
                    blnUseArrows            = false;
                    PopulateNodesFromClient = false;
                    StartTabId  = -1;
                    ExpandDepth = 1;
                }
                var objSkins = new SkinController();
                //image for root menu breadcrumb marking
                if (!String.IsNullOrEmpty(RootBreadCrumbArrow))
                {
                    strRootBreadcrumbArrow = PortalSettings.ActiveTab.SkinPath + RootBreadCrumbArrow;
                }
                else
                {
                    strRootBreadcrumbArrow = Globals.ApplicationPath + "/images/breadcrumb.gif";
                }

                //image for submenu breadcrumb marking
                if (!String.IsNullOrEmpty(SubMenuBreadCrumbArrow))
                {
                    strSubMenuBreadcrumbArrow = PortalSettings.ActiveTab.SkinPath + SubMenuBreadCrumbArrow;
                }
                if (blnUseSubMenuBreadcrumbArrow)
                {
                    strSubMenuBreadcrumbArrow = Globals.ApplicationPath + "/images/breadcrumb.gif";
                    NodeLeftHTMLBreadCrumbSub = "<img alt=\"*\" BORDER=\"0\" src=\"" + strSubMenuBreadcrumbArrow + "\">";
                }
                if (blnUseRootBreadcrumbArrow)
                {
                    NodeLeftHTMLBreadCrumbRoot = "<img alt=\"*\" BORDER=\"0\" src=\"" + strRootBreadcrumbArrow + "\">";
                }

                //image for right facing arrow
                if (!String.IsNullOrEmpty(RightArrow))
                {
                    strRightArrow = RightArrow;
                }
                else
                {
                    strRightArrow = "breadcrumb.gif";
                }
                if (!String.IsNullOrEmpty(DownArrow))
                {
                    strDownArrow = DownArrow;
                }
                else
                {
                    strDownArrow = "menu_down.gif";
                }

                //Set correct image path for all separator images
                if (!String.IsNullOrEmpty(Separator))
                {
                    if (Separator.IndexOf("src=") != -1)
                    {
                        Separator = Separator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparator))
                {
                    if (LeftSeparator.IndexOf("src=") != -1)
                    {
                        LeftSeparator = LeftSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparator))
                {
                    if (RightSeparator.IndexOf("src=") != -1)
                    {
                        RightSeparator = RightSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorBreadCrumb))
                {
                    if (LeftSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        LeftSeparatorBreadCrumb = LeftSeparatorBreadCrumb.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorBreadCrumb))
                {
                    if (RightSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        RightSeparatorBreadCrumb = RightSeparatorBreadCrumb.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorActive))
                {
                    if (LeftSeparatorActive.IndexOf("src=") != -1)
                    {
                        LeftSeparatorActive = LeftSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorActive))
                {
                    if (RightSeparatorActive.IndexOf("src=") != -1)
                    {
                        RightSeparatorActive = RightSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }

                //generate dynamic menu
                if (blnUseSkinPathArrowImages)
                {
                    PathSystemImage = PortalSettings.ActiveTab.SkinPath;
                }
                else
                {
                    PathSystemImage = Globals.ApplicationPath + "/images/";
                }
                if (String.IsNullOrEmpty(PathImage))
                {
                    PathImage = PortalSettings.HomeDirectory;
                }
                if (blnUseArrows)
                {
                    IndicateChildImageSub = strRightArrow;
                    if (ControlOrientation.ToLower() == "vertical") //NavigationProvider.NavigationProvider.Orientation.Vertical Then
                    {
                        IndicateChildImageRoot = strRightArrow;
                    }
                    else
                    {
                        IndicateChildImageRoot = strDownArrow;
                    }
                }
                else
                {
                    PathSystemImage       = Globals.ApplicationPath + "/images/";
                    IndicateChildImageSub = "spacer.gif";
                }
                if (String.IsNullOrEmpty(PathSystemScript))
                {
                    PathSystemScript = Globals.ApplicationPath + "/controls/SolpartMenu/";
                }
                BuildNodes(null);
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            using (new DNNContext(this))
            {
                var blnUseSkinPathArrowImages    = Boolean.Parse(GetValue(UseSkinPathArrowImages, "false"));
                var blnUseRootBreadcrumbArrow    = Boolean.Parse(GetValue(UseRootBreadCrumbArrow, "true"));
                var blnUseSubMenuBreadcrumbArrow = Boolean.Parse(GetValue(UseSubMenuBreadCrumbArrow, "false"));
                var blnUseArrows = Boolean.Parse(GetValue(UseArrows, "true"));
                var blnRootOnly  = Boolean.Parse(GetValue(RootOnly, "false"));

                if (blnRootOnly)
                {
                    blnUseArrows            = false;
                    PopulateNodesFromClient = false;
                    StartTabId  = -1;
                    ExpandDepth = 1;
                }

                var strRootBreadcrumbArrow = !String.IsNullOrEmpty(RootBreadCrumbArrow)
                                                                ? PortalSettings.ActiveTab.SkinPath + RootBreadCrumbArrow
                                                                : ResolveUrl("~/images/breadcrumb.gif");

                if (blnUseSubMenuBreadcrumbArrow)
                {
                    var strSubMenuBreadcrumbArrow = ResolveUrl("~/images/breadcrumb.gif");
                    NodeLeftHTMLBreadCrumbSub = "<img alt='*' BORDER='0' src='" + strSubMenuBreadcrumbArrow + "'>";
                }

                if (blnUseRootBreadcrumbArrow)
                {
                    NodeLeftHTMLBreadCrumbRoot = "<img alt='*' BORDER='0' src='" + strRootBreadcrumbArrow + "'>";
                }

                var strRightArrow = !String.IsNullOrEmpty(RightArrow) ? RightArrow : "breadcrumb.gif";
                var strDownArrow  = !String.IsNullOrEmpty(DownArrow) ? DownArrow : "menu_down.gif";

                if (!String.IsNullOrEmpty(Separator))
                {
                    if (Separator.IndexOf("src=") != -1)
                    {
                        Separator = Separator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }

                if (!String.IsNullOrEmpty(LeftSeparator))
                {
                    if (LeftSeparator.IndexOf("src=") != -1)
                    {
                        LeftSeparator = LeftSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparator))
                {
                    if (RightSeparator.IndexOf("src=") != -1)
                    {
                        RightSeparator = RightSeparator.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorBreadCrumb))
                {
                    if (LeftSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        LeftSeparatorBreadCrumb = LeftSeparatorBreadCrumb.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorBreadCrumb))
                {
                    if (RightSeparatorBreadCrumb.IndexOf("src=") != -1)
                    {
                        RightSeparatorBreadCrumb = RightSeparatorBreadCrumb.Replace(
                            "src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(LeftSeparatorActive))
                {
                    if (LeftSeparatorActive.IndexOf("src=") != -1)
                    {
                        LeftSeparatorActive = LeftSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }
                if (!String.IsNullOrEmpty(RightSeparatorActive))
                {
                    if (RightSeparatorActive.IndexOf("src=") != -1)
                    {
                        RightSeparatorActive = RightSeparatorActive.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                }

                PathSystemImage = blnUseSkinPathArrowImages ? PortalSettings.ActiveTab.SkinPath : ResolveUrl("~/images/");

                PathImage = PortalSettings.HomeDirectory;

                if (blnUseArrows)
                {
                    IndicateChildImageSub  = strRightArrow;
                    IndicateChildImageRoot = (ControlOrientation.ToLower() == "vertical") ? strRightArrow : strDownArrow;
                }
                else
                {
                    PathSystemImage       = ResolveUrl("~/images/");
                    IndicateChildImageSub = "spacer.gif";
                }

                if (String.IsNullOrEmpty(PathSystemScript))
                {
                    PathSystemScript = ResolveUrl("~/controls/SolpartMenu/");
                }

                Control.Bind(GetNavigationNodes(null));
                base.OnPreRender(e);
            }
        }