Ejemplo n.º 1
0
    /// <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;
    }
Ejemplo n.º 2
0
    /// <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;

            DocumentContext.CurrentPageInfo = pi;

            // Set the design mode
            PortalContext.SetRequestViewMode(ViewModeEnum.DashboardWidgets);
            PortalContext.DashboardName = dashboardName;

            PortalPageInstance.ManagersContainer    = plcManagers;
            PortalPageInstance.ScriptManagerControl = manScript;
        }
        else
        {
            RedirectToInformation(GetString("dashboard.notemplate"));
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// PreInit event handler.
    /// </summary>
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Init the page components
        PageManager = manPortal;
        manPortal.SetMainPagePlaceholder(plc);

        int webPartId = QueryHelper.GetInteger("webpartid", 0);

        wpi = WebPartInfoProvider.GetWebPartInfo(webPartId);
        UIContext.EditedObject = wpi;

        // If default configuration not available, do not display content
        configAvailable = wpi.HasDefaultConfiguration();

        var pt = wpi.GetVirtualPageTemplate();

        PageInfo pi = PageInfoProvider.GetVirtualPageInfo(pt);

        pi.DocumentNamePath = "/" + ResHelper.GetString("edittabs.design");

        DocumentContext.CurrentPageInfo = pi;

        // Set the design mode
        PortalContext.SetRequestViewMode(ViewModeEnum.DesignWebPart);

        ManagersContainer    = plcManagers;
        ScriptManagerControl = manScript;
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Loads template based on UI element settings
    /// </summary>
    private void LoadTemplate()
    {
        // Init the page components
        manPortal.SetMainPagePlaceholder(plc);

        DocumentContext.CurrentPageInfo = PageInfoProvider.GetVirtualPageInfo(UIElement.ElementPageTemplateID);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// PreInit event handler.
    /// </summary>
    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);

        // Init the page components
        manPortal.SetMainPagePlaceholder(plc);

        var ui = UIElementInfo.Provider.Get(QueryHelper.GetInteger("elementid", 0));

        // Clear UIContext data of element "Modules.UserInterface.Design" (put by UIElement attribute to check permissions)
        var ctx = pnlContext.UIContext;

        ctx.Data = null;
        ctx.HideControlOnError = false;

        if (ui != null)
        {
            ctx.UIElement = ui;

            // Store resource name
            ctx.ResourceName = ApplicationUrlHelper.GetResourceName(ui.ElementResourceID);

            // Provide empty object in case of editing
            if (!ui.RepresentsNew)
            {
                var objectType = UIContextHelper.GetObjectType(ctx);
                if (!String.IsNullOrEmpty(objectType))
                {
                    ctx.EditedObject = GetEmptyObject(objectType);
                }
            }

            int pageTemplateId = ui.ElementPageTemplateID;

            // If no page template is set, dont show any content
            if (pageTemplateId == 0)
            {
                RedirectToInformation(GetString("uielement.design.notemplate"));
            }

            DocumentContext.CurrentPageInfo = PageInfoProvider.GetVirtualPageInfo(pageTemplateId);

            // 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;
            }

            RequestStockHelper.Add(CookieName.DisplayContentInDesignMode, PortalHelper.DisplayContentInUIElementDesignMode, true);

            ManagersContainer    = plcManagers;
            ScriptManagerControl = manScript;
        }
    }
    /// <summary>
    /// Loads template based on UI element settings
    /// </summary>
    private void LoadTemplate()
    {
        // Init the page components
        manPortal.SetMainPagePlaceholder(plc);

        // Prepare the page info
        PageInfo pi = PageInfoProvider.GetVirtualPageInfo(UIElement.ElementPageTemplateID);

        pi.DocumentNamePath = "/" + ResHelper.GetString("edittabs.design");

        DocumentContext.CurrentPageInfo = pi;
    }
Ejemplo n.º 7
0
    /// <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;
        }
    }
Ejemplo n.º 8
0
    /// <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);

        DocumentContext.CurrentPageInfo = PageInfoProvider.GetVirtualPageInfo(pageTemplateId);

        // Set the design mode
        PortalContext.SetRequestViewMode(ViewModeEnum.Design);
        RequestStockHelper.Add(CookieName.DisplayContentInDesignMode, "0", true);

        ManagersContainer    = plcManagers;
        ScriptManagerControl = manScript;
    }