예제 #1
0
        private void DisplayDataEntryRepeater(String entryId)
        {
            if (Utils.IsNumeric(entryId))
            {
                var pluginData = new PluginData(PortalId);
                var pData = pluginData.GetPlugin(Convert.ToInt32(entryId));
                //render the detail page
                base.DoDetail(rpData, pData);

                base.DoDetail(rpDataH, pData);

                base.DoDetail(rpDataF, pData);
            }
        }
예제 #2
0
        protected override void OnInit(EventArgs e)
        {
            _pluginData = new PluginData(PortalId);

            base.OnInit(e);
            try
            {
                if (UserId > 0) //do nothing if user not logged on
                {

                    var ctrl = Utils.RequestQueryStringParam(Context, "ctrl");

                    // anyone only in the client role is only allowed in the products control
                    if (UserInfo.IsInRole(StoreSettings.ClientEditorRole) && (!UserInfo.IsInRole(StoreSettings.EditorRole) && !UserInfo.IsInRole(StoreSettings.ManagerRole) && !UserInfo.IsInRole("Administrators")))
                    {
                     //   ctrl = "products";
                    }

                    if (ctrl == "")
                        ctrl = (String) HttpContext.Current.Session["nbrightbackofficectrl"];
                    else
                        HttpContext.Current.Session["nbrightbackofficectrl"] = ctrl;

                    if (String.IsNullOrEmpty(ctrl))
                    {
                        var p = _pluginData.GetPlugin(0);
                        if (p != null) ctrl = p.GUIDKey;
                        if (ctrl=="") ctrl = "orders";
                        if (StoreSettings.Current.Settings().Count == 0) ctrl = "settings";
                        HttpContext.Current.Session["nbrightbackofficectrl"] = ctrl;
                    }

                    var ctlpath = GetControlPath(ctrl);
                    if (ctlpath == "")  // ctrl may not exist in system, so default to products
                    {
                        ctrl = "products";
                        ctlpath = GetControlPath(ctrl);
                    }

                    // check for group data, this MUST be there otherwise this is the first time into the BO, so redirect to Admin.
                    var l = NBrightBuyUtils.GetCategoryGroups(Utils.GetCurrentCulture(),true,""); // don't test for grouptype, on upgrade it might not be there!!
                    if (!l.Any())
                    {
                        // redisplay settings
                        ctrl = "settings";
                        ctlpath = GetControlPath(ctrl);
                        NBrightBuyUtils.SetNotfiyMessage(ModuleId, "settingssetup", NotifyCode.fail);
                    }

                    if (ctlpath != "" && CheckSecurity(ctrl))
                    {
                        // make compatible with running DNN in virtual directory
                        if (HttpContext.Current.Request.ApplicationPath != null && !ctlpath.StartsWith(HttpContext.Current.Request.ApplicationPath)) ctlpath = HttpContext.Current.Request.ApplicationPath + ctlpath;
                        var c1 = LoadControl(ctlpath);
                        phData.Controls.Add(c1);
                    }
                    else
                    {
                        var c1 = new Literal();
                        c1.Text = "INVALID CONTROL: " + ctrl;
                        phData.Controls.Add(c1);
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                //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);
            }
        }
예제 #3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            try
            {
                #region "set templates based on entry id (eid) from url"

                _entryid = Utils.RequestQueryStringParam(Context, "eid");

                var pluginTemplate = "";

                if (Utils.IsNumeric(_entryid))
                {
                    _displayentrypage = true;
                    // check if we have bespoke setting that need adding to the template
                    var pluginData = new PluginData(PortalId);
                    var pData = pluginData.GetPlugin(Convert.ToInt32(_entryid));
                    var pluginTemplatePath = pData.GetXmlProperty("genxml/hidden/plugintemplate");
                    if (pluginTemplatePath != "") pluginTemplate = Utils.ReadFile(MapPath(pluginTemplatePath));
                }
                else
                {
                    // check for new plugins
                    var pi = new PluginData(PortalId, true);
                    pi.UpdateSystemPlugins();
                }

                #endregion

                #region "load templates"

                var t1 = "pluginsheader.html";
                var t2 = "pluginsbody.html";
                var t3 = "pluginsfooter.html";

                if (Utils.IsNumeric(_entryid))
                {
                    t1 = "pluginsdetailheader.html";
                    t2 = "pluginsdetail.html";
                    t3 = "pluginsdetailfooter.html";
                }

                // Get Display Header
                var rpDataHTempl = ModCtrl.GetTemplateData(ModSettings, t1, Utils.GetCurrentCulture(), DebugMode);
                rpDataH.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataHTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                // Get Display Body
                var rpDataTempl = ModCtrl.GetTemplateData(ModSettings, t2, Utils.GetCurrentCulture(), DebugMode);
                rpDataTempl = rpDataTempl.Replace("[Template:PluginTemplate]", pluginTemplate); // replace special plugin settings
                rpData.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                // Get Display Footer
                var rpDataFTempl = ModCtrl.GetTemplateData(ModSettings, t3, Utils.GetCurrentCulture(), DebugMode);
                rpDataF.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataFTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                #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);
            }
        }