示例#1
0
        public MenuNode(DNNNode dnnNode, MenuNode parent)
        {
            TabId = Convert.ToInt32(dnnNode.ID);
            Text  = dnnNode.Text;
            Url   = (dnnNode.ClickAction == eClickAction.PostBack)
                    ? "postback:" + dnnNode.ID
                    : String.IsNullOrEmpty(dnnNode.JSFunction) ? dnnNode.NavigateURL : "javascript:" + dnnNode.JSFunction;
            Enabled         = dnnNode.Enabled;
            Selected        = dnnNode.Selected;
            Breadcrumb      = dnnNode.BreadCrumb;
            Separator       = dnnNode.IsBreak;
            Icon            = dnnNode.Image;
            Target          = dnnNode.Target;
            Title           = null;
            Keywords        = null;
            Description     = null;
            Parent          = parent;
            CommandName     = dnnNode.get_CustomAttribute("CommandName");
            CommandArgument = dnnNode.get_CustomAttribute("CommandArgument");

            DNNAbstract.DNNNodeToMenuNode(dnnNode, this);

            if ((dnnNode.DNNNodes != null) && (dnnNode.DNNNodes.Count > 0))
            {
                Children = ConvertDNNNodeCollection(dnnNode.DNNNodes, this);
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            using (new DNNContext(this))
            {
                try
                {
                    base.OnPreRender(e);

                    var menuStyle = GetStringSetting("MenuStyle");
                    if (String.IsNullOrEmpty(menuStyle))
                    {
                        menu = null;
                        return;
                    }

                    var menuSettings = new Settings
                    {
                        MenuStyle         = GetStringSetting("MenuStyle"),
                        NodeXmlPath       = GetStringSetting("NodeXmlPath"),
                        NodeSelector      = GetStringSetting("NodeSelector"),
                        IncludeContext    = GetBoolSetting("IncludeContext"),
                        IncludeHidden     = GetBoolSetting("IncludeHidden"),
                        IncludeNodes      = GetStringSetting("IncludeNodes"),
                        ExcludeNodes      = GetStringSetting("ExcludeNodes"),
                        NodeManipulator   = GetStringSetting("NodeManipulator"),
                        TemplateArguments =
                            DDRMenu.Settings.TemplateArgumentsFromSettingString(GetStringSetting("TemplateArguments")),
                        ClientOptions =
                            DDRMenu.Settings.ClientOptionsFromSettingString(GetStringSetting("ClientOptions"))
                    };

                    MenuNode rootNode = null;
                    if (String.IsNullOrEmpty(menuSettings.NodeXmlPath))
                    {
                        rootNode =
                            new MenuNode(
                                Localiser.LocaliseDNNNodeCollection(
                                    Navigation.GetNavigationNodes(
                                        ClientID,
                                        Navigation.ToolTipSource.None,
                                        -1,
                                        -1,
                                        DNNAbstract.GetNavNodeOptions(true))));
                    }

                    menu          = MenuBase.Instantiate(menuStyle);
                    menu.RootNode = rootNode;
                    menu.ApplySettings(menuSettings);

                    menu.PreRender();
                }
                catch (Exception exc)
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }
            }
        }
示例#3
0
        protected override void OnPreRender(EventArgs e)
        {
            using (new DNNContext(this))
            {
                try
                {
                    base.OnPreRender(e);

                    menu = MenuBase.Instantiate(MenuStyle);
                    menu.ApplySettings(
                        new Settings
                    {
                        MenuStyle         = MenuStyle,
                        NodeXmlPath       = NodeXmlPath,
                        NodeSelector      = NodeSelector,
                        IncludeContext    = IncludeContext,
                        IncludeHidden     = IncludeHidden,
                        IncludeNodes      = IncludeNodes,
                        ExcludeNodes      = ExcludeNodes,
                        NodeManipulator   = NodeManipulator,
                        ClientOptions     = ClientOptions,
                        TemplateArguments = TemplateArguments
                    });

                    if (String.IsNullOrEmpty(NodeXmlPath))
                    {
                        menu.RootNode =
                            new MenuNode(
                                Localiser.LocaliseDNNNodeCollection(
                                    Navigation.GetNavigationNodes(
                                        ClientID,
                                        Navigation.ToolTipSource.None,
                                        -1,
                                        -1,
                                        DNNAbstract.GetNavNodeOptions(true))));
                    }

                    menu.PreRender();
                }
                catch (Exception exc)
                {
                    Exceptions.ProcessModuleLoadException(this, exc);
                }
            }
        }
示例#4
0
 protected override void OnPreRender(EventArgs e)
 {
     this.IncludeHiddenSection.Visible = DNNAbstract.IncludeHiddenSupported();
 }