Esempio n. 1
0
        private string GenerateMarkup(Dictionary <string, string> Attributes)
        {
            try
            {
                PortalSettings ps = PortalController.Instance.GetCurrentSettings() as PortalSettings;

                if (ps != null && ps.ActiveTab != null && ps.ActiveTab.BreadCrumbs == null)
                {
                    ps.ActiveTab.BreadCrumbs = new System.Collections.ArrayList();
                }

                Dictionary <string, string> BaseAttributes = Core.Managers.BlockManager.GetGlobalConfigs(ps, "menu");
                if (Attributes["data-block-global"] == "true")
                {
                    Attributes = BaseAttributes;
                }
                else
                {
                    //Loop on base attributes and add missing attribute
                    foreach (KeyValuePair <string, string> attr in BaseAttributes)
                    {
                        if (!Attributes.ContainsKey(attr.Key))
                        {
                            Attributes.Add(attr.Key, attr.Value);
                        }
                    }
                }

                MenuSetting menuSetting = new MenuSetting
                {
                    NodeSelector  = Attributes["data-block-nodeselector"],
                    IncludeHidden = Convert.ToBoolean(Attributes["data-block-includehidden"]),
                };

                MenuNode rootNode = new MenuNode(
                    Localiser.LocaliseDNNNodeCollection(
                        Navigation.GetNavigationNodes(
                            ExtensionInfo.GUID,
                            Navigation.ToolTipSource.None,
                            -1,
                            -1,
                            MenuBase.GetNavNodeOptions(true))));

                MenuBase menu = new MenuBase();
                menu.ApplySetting(menuSetting);
                menu.RootNode = rootNode;
                menu.Initialize();

                IDictionary <string, object> dynObjects = new ExpandoObject() as IDictionary <string, object>;
                dynObjects.Add("Menu", menu);
                string Template = RazorEngineManager.RenderTemplate(ExtensionInfo.GUID, BlockPath, Attributes["data-block-template"], dynObjects);
                Template = new DNNLocalizationEngine(null, ResouceFilePath, false).Parse(Template);
                return(Template);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                return(ex.Message);
            }
        }
Esempio n. 2
0
        public static void Initialize()
        {
            if (!initialized)
            {
                initialized = true;

                injectTime = Game.ClockTime;
                MenuBase.Initialize();
                LogicBase.Initialize();
                ChampionLoader.Initialize();
            }
        }