Example #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            try
            {

                // check for new plugins
                var pi = new PluginData(PortalId, true);
                pi.UpdateSystemPlugins();
                pi.CheckforNewSystemConfig();

                #region "load templates"

                var t1 = "backoffice.html";

                // Get Display Body
                var dataTempl = ModCtrl.GetTemplateData(ModSettings, t1, Utils.GetCurrentCulture(), DebugMode);
                // insert page header text
                var headerTempl = NBrightBuyUtils.GetGenXmlTemplate(dataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, headerTempl, ModSettings.Settings(), null, DebugMode);

                // remove any DNN modules from the BO page
                var tabInfo = PortalSettings.Current.ActiveTab;
                var modCount = tabInfo.Modules.Count;
                for (int i = 0; i < modCount; i++)
                {
                    tabInfo.Modules.RemoveAt(0);
                }

                var aryTempl = Utils.ParseTemplateText(dataTempl);

                foreach (var s in aryTempl)
                {
                    var htmlDecode = System.Web.HttpUtility.HtmlDecode(s);
                    if (htmlDecode != null)
                    {
                        switch (htmlDecode.ToLower())
                        {
                            case "<tag:menu>":
                                var c1 = LoadControl(ControlPath + "/Menu.ascx");
                                phData.Controls.Add(c1);
                                break;
                            case "<tag:container>":
                                var c2 = LoadControl(ControlPath +  "/Container.ascx");
                                phData.Controls.Add(c2);
                                break;
                            default:
                                var lc = new Literal {Text = s};
                                phData.Controls.Add(lc);
                                break;
                        }
                    }
                }

                #endregion

            }
            catch (Exception exc)
            {
                //display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
                var l = new Literal();
                l.Text = exc.ToString();
                phData.Controls.Add(l);
            }
        }