/// <summary> /// PreInit event handler. /// </summary> protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); // Init the page components PageManager = manPortal; manPortal.SetMainPagePlaceholder(plc); int pageTemplateId = QueryHelper.GetInteger("templateid", 0); UIContext.EditedObject = PageTemplateInfoProvider.GetPageTemplateInfo(pageTemplateId); // Prepare the page info PageInfo pi = PageInfoProvider.GetVirtualPageInfo(pageTemplateId); pi.DocumentNamePath = "/" + ResHelper.GetString("edittabs.design"); DocumentContext.CurrentPageInfo = pi; // Set the design mode PortalContext.SetRequestViewMode(ViewModeEnum.Design); ContextHelper.Add("DisplayContentInDesignMode", "0", true, false, false, DateTime.MinValue); ManagersContainer = plcManagers; ScriptManagerControl = manScript; }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); // Init the page components this.PageManager = this.manPortal; this.manPortal.SetMainPagePlaceholder(this.plc); int pageTemplateId = QueryHelper.GetInteger("templateid", 0); // Prepare virtual page info PageInfo pi = new PageInfo(); pi.DocumentCulture = CMSContext.PreferredCultureCode; pi.DocumentPageTemplateID = pageTemplateId; pi.ClassName = "CMS.Root"; pi.NodeAliasPath = ""; pi.DocumentNamePath = "/" + ResHelper.GetString("edittabs.design"); pi.NodeSiteId = CMSContext.CurrentSiteID; CMSContext.CurrentPageInfo = pi; // Set the design mode PortalContext.SetRequestViewMode(ViewModeEnum.Design); ContextHelper.Add("DisplayContentInDesignMode", "0", true, false, false, DateTime.MinValue); this.ManagersContainer = this.plcManagers; this.ScriptManagerControl = this.manScript; }
/// <summary> /// Ensures dashboard inicialization. /// </summary> public void SetupDashboard() { if (PortalPageInstance == null) { throw new Exception("[DashboardControl.SetupDashboard] Portal page instance must be set."); } // Default settings for drag and drop for dashboard manPortal.HighlightDropableAreas = HighlightDropableAreas; manPortal.ActivateZoneBorder = ActivateZoneBorder; string dashboardName = QueryHelper.GetString("DashboardName", PersonalizationInfoProvider.UNDEFINEDDASHBOARD); // Set culture CultureInfo ci = CultureHelper.PreferredUICultureInfo; Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; // Init the page components PortalPageInstance.PageManager = manPortal; manPortal.SetMainPagePlaceholder(plc); string templateName = QueryHelper.GetString("templatename", String.Empty); PageTemplateInfo pti = PageTemplateInfoProvider.GetPageTemplateInfo(templateName); if (pti != null) { if (pti.PageTemplateType != PageTemplateTypeEnum.Dashboard) { URLHelper.Redirect(URLHelper.ResolveUrl("~/CMSDesk/accessdenied.aspx") + "?message=" + ResHelper.GetString("dashboard.invalidpagetemplate")); } // Prepare virtual page info PageInfo pi = new PageInfo(); pi.DocumentPageTemplateID = pti.PageTemplateId; pi.PageTemplateInfo = pti; pi.ClassName = "CMS.Root"; pi.NodeAliasPath = String.Empty; pi.DocumentNamePath = "/" + templateName; pi.NodeSiteId = CMSContext.CurrentSiteID; CMSContext.CurrentPageInfo = pi; // Set the design mode PortalContext.SetRequestViewMode(ViewModeEnum.DashboardWidgets); PortalContext.DashboardName = dashboardName; ContextHelper.Add("DisplayContentInDesignMode", "0", true, false, false, DateTime.MinValue); PortalPageInstance.ManagersContainer = plcManagers; PortalPageInstance.ScriptManagerControl = manScript; } else { RedirectToInformation(GetString("dashboard.notemplate")); } }
/// <summary> /// PreInit event handler. /// </summary> protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); // Init the page components manPortal.SetMainPagePlaceholder(plc); var ui = UIElementInfoProvider.GetUIElementInfo(QueryHelper.GetInteger("elementid", 0)); // Clear UIContext data of element "Modules.UserInterface.Design" (put by UIElement attribute to check permissions) UIContext.Data = null; if (ui != null) { UIContext.UIElement = ui; // Store resource name UIContext.ResourceName = UIContextHelper.GetResourceName(ui.ElementResourceID); int pageTemplateId = ui.ElementPageTemplateID; // If no page template is set, dont show any content if (pageTemplateId == 0) { RedirectToInformation(GetString("uielement.design.notemplate")); } // Prepare the page info PageInfo pi = PageInfoProvider.GetVirtualPageInfo(pageTemplateId); pi.DocumentNamePath = "/" + ResHelper.GetString("edittabs.design"); DocumentContext.CurrentPageInfo = pi; // Set the design mode bool enable = (SystemContext.DevelopmentMode || (ui.ElementResourceID == QueryHelper.GetInteger("moduleId", 0) && ui.ElementIsCustom)); PortalContext.SetRequestViewMode(ViewModeEnum.Design); // If displayed module is not selected, disable design mode if (!enable) { plc.ViewMode = ViewModeEnum.DesignDisabled; } ContextHelper.Add("DisplayContentInDesignMode", PortalHelper.DisplayContentInUIElementDesignMode, true, false, false, DateTime.MinValue); ManagersContainer = plcManagers; ScriptManagerControl = manScript; } }
/// <summary> /// Ensures dashboard initialization. /// </summary> public void SetupDashboard() { // Register placeholder for context menu ICMSPage page = Page as ICMSPage; if (page != null) { page.ContextMenuContainer = plcCtx; } if (PortalPageInstance == null) { throw new Exception("[DashboardControl.SetupDashboard] Portal page instance must be set."); } // Default settings for drag and drop for dashboard manPortal.HighlightDropableAreas = HighlightDropableAreas; manPortal.ActivateZoneBorder = ActivateZoneBorder; string dashboardName = QueryHelper.GetString("DashboardName", PersonalizationInfoProvider.UNDEFINEDDASHBOARD); // Set culture CultureInfo ci = CultureHelper.PreferredUICultureInfo; Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; // Init the page components PortalPageInstance.PageManager = manPortal; manPortal.SetMainPagePlaceholder(plc); string templateName = QueryHelper.GetString("templatename", String.Empty); PageTemplateInfo pti = PageTemplateInfoProvider.GetPageTemplateInfo(templateName); if (pti != null) { if (pti.PageTemplateType != PageTemplateTypeEnum.Dashboard) { RedirectToAccessDenied("dashboard.invalidpagetemplate"); } // Prepare virtual page info PageInfo pi = PageInfoProvider.GetVirtualPageInfo(pti.PageTemplateId); pi.DocumentNamePath = "/" + templateName; CMSContext.CurrentPageInfo = pi; // Set the design mode PortalContext.SetRequestViewMode(ViewModeEnum.DashboardWidgets); PortalContext.DashboardName = dashboardName; ContextHelper.Add("DisplayContentInDesignMode", "0", true, false, false, DateTime.MinValue); PortalPageInstance.ManagersContainer = plcManagers; PortalPageInstance.ScriptManagerControl = manScript; } else { RedirectToInformation(GetString("dashboard.notemplate")); } }