Exemplo n.º 1
0
    /// <summary>
    /// PreRender event handler.
    /// </summary>
    /// <param name="e">EventArgs</param>
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        if (!StopProcessing)
        {
            // Add link to page header
            string url  = CSSHelper.GetPhysicalCSSUrl(FilePath);
            string link = CSSHelper.GetCSSFileLink(url, Media);

            LiteralControl ltlCss = new LiteralControl(link);
            ltlCss.EnableViewState = false;

            Page.Header.Controls.Add(ltlCss);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Returns the links to CSS files which should be used for displaying the page.
    /// </summary>
    private static string GetCssFileLink()
    {
        // Get stylesheet
        CssStylesheetInfo csi = null;

        if (CMSContext.CurrentPageInfo.DocumentStylesheetID > 0)
        {
            csi = CssStylesheetInfoProvider.GetCssStylesheetInfo(CMSContext.CurrentPageInfo.DocumentStylesheetID);
        }
        // If not found, get default stylesheet from the current site
        if ((csi == null) && (CMSContext.CurrentSite.SiteDefaultStylesheetID > 0))
        {
            csi = CssStylesheetInfoProvider.GetCssStylesheetInfo(CMSContext.CurrentSite.SiteDefaultStylesheetID);
        }
        // If stylesheet found, get the URL
        if (csi != null)
        {
            return(CSSHelper.GetCSSFileLink(CSSHelper.GetStylesheetUrl(csi.StylesheetName)));
        }
        return(null);
    }
    /// <summary>
    /// Loads content from specific newsletter template.
    /// </summary>
    private void LoadContent()
    {
        EmailTemplateInfo emailTemplate = EmailTemplateInfoProvider.GetEmailTemplateInfo(mTemplateID);

        if ((emailTemplate == null) || string.IsNullOrEmpty(emailTemplate.TemplateBody))
        {
            return;
        }

        // Remove security parameters from macros
        string templateText = MacroResolver.RemoveSecurityParameters(emailTemplate.TemplateBody, true, null);

        if (!RequestHelper.IsPostBack() && (issue != null))
        {
            // Load content of editable regions
            IssueHelper.LoadRegionsContents(ref regionsContents, issue.IssueText);
        }

        CMSEditableRegion editableRegion = null;
        LiteralControl    before         = null;
        int    count     = 0;
        int    textStart = 0;
        string region    = null;

        string[] parts           = null;
        string   name            = null;
        int      width           = 0;
        int      height          = 0;
        string   toolbarLocation = "Out:CKEditorToolbar";
        string   toolbarSetName  = "Newsletter";

        int editRegStart = templateText.IndexOfCSafe("$$", textStart);
        int editRegEnd   = 0;

        // Apply CSS e-mail template style
        HTMLHelper.AddToHeader(Page, CSSHelper.GetCSSFileLink(EmailTemplateInfoProvider.GetStylesheetUrl(emailTemplate.TemplateName)));

        while (editRegStart >= 0)
        {
            count++;

            before = new LiteralControl();
            // Get template text surrounding editable regions - make links absolute
            before.Text = URLHelper.MakeLinksAbsolute(templateText.Substring(textStart, (editRegStart - textStart)));
            plcContent.Controls.Add(before);

            // End of region
            editRegStart += 2;
            textStart     = editRegStart;
            if (editRegStart < templateText.Length - 1)
            {
                editRegEnd = templateText.IndexOfCSafe("$$", editRegStart);
                if (editRegEnd >= 0)
                {
                    region = templateText.Substring(editRegStart, editRegEnd - editRegStart);
                    parts  = (region + ":" + ":").Split(':');

                    try
                    {
                        name = parts[0];
                        if (!string.IsNullOrEmpty(name.Trim()))
                        {
                            width  = ValidationHelper.GetInteger(parts[1], 0);
                            height = ValidationHelper.GetInteger(parts[2], 0);

                            editableRegion            = new CMSEditableRegion();
                            editableRegion.ID         = name;
                            editableRegion.RegionType = CMSEditableRegionTypeEnum.HtmlEditor;
                            editableRegion.ViewMode   = ViewModeEnum.Edit;

                            editableRegion.DialogHeight = height;
                            editableRegion.DialogWidth  = width;

                            editableRegion.WordWrap = false;
                            editableRegion.HtmlAreaToolbarLocation = toolbarLocation;
                            editableRegion.RegionTitle             = name;
                            editableRegion.UseStylesheet           = false;
                            editableRegion.HTMLEditorCssStylesheet = EmailTemplateInfoProvider.GetStylesheetUrl(emailTemplate.TemplateName);

                            if (!mReadOnly)
                            {
                                editableRegion.HtmlAreaToolbar = toolbarSetName;
                            }
                            else
                            {
                                editableRegion.HtmlAreaToolbar = "Disabled";
                            }

                            CMSHtmlEditor editor = editableRegion.HtmlEditor;
                            editor.AddExtraPlugin("CMSPlugins");
                            editor.AddExtraPlugin("autogrow");
                            editor.AutoGrowMinHeight            = height;
                            editor.LinkDialogConfig.UseFullURL  = true;
                            editor.QuickInsertConfig.UseFullURL = true;
                            editor.ResolverName = "NewsletterResolver";

                            DialogConfiguration dialogConfig = editor.MediaDialogConfig;
                            dialogConfig.UseFullURL         = true;
                            dialogConfig.MetaFileObjectID   = (issue != null) ? issue.IssueID : 0;
                            dialogConfig.MetaFileObjectType = (issue != null) && issue.IssueIsVariant ? NewsletterObjectType.NEWSLETTERISSUEVARIANT : NewsletterObjectType.NEWSLETTERISSUE;
                            dialogConfig.MetaFileCategory   = MetaFileInfoProvider.OBJECT_CATEGORY_ISSUE;
                            dialogConfig.HideAttachments    = false;

                            editableRegion.LoadContent(ValidationHelper.GetString(regionsContents[name.ToLowerCSafe()], string.Empty));

                            plcContent.Controls.Add(editableRegion);

                            textStart = editRegEnd + 2;
                        }
                    }
                    catch
                    {
                    }
                }
            }
            editRegStart = templateText.IndexOfCSafe("$$", textStart);
        }

        before      = new LiteralControl();
        before.Text = URLHelper.MakeLinksAbsolute(templateText.Substring(textStart));

        plcContent.Controls.Add(before);
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CMSContext.ViewMode = ViewModeEnum.MasterPage;

        // Keep current user
        user = CMSContext.CurrentUser;

        // Check UIProfile
        if (!user.IsAuthorizedPerUIElement("CMS.Content", "MasterPage"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "MasterPage");
        }

        // Check "Design" permission
        if (!user.IsAuthorizedPerResource("CMS.Design", "Design"))
        {
            RedirectToAccessDenied("CMS.Design", "Design");
        }

        // Register the scripts
        ScriptHelper.RegisterProgress(this);
        ScriptHelper.RegisterSaveShortcut(btnSave, null, false);

        // Save changes support
        bool   confirmChanges = SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSConfirmChanges");
        string script         = string.Empty;

        if (confirmChanges)
        {
            script = "var confirmLeave='" + ResHelper.GetString("Content.ConfirmLeave", user.PreferredUICultureCode) + "'; \n";
        }
        else
        {
            script += "confirmChanges = false;";
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "saveChangesScript", ScriptHelper.GetScript(script));

        nodeId = QueryHelper.GetInteger("NodeId", 0);

        try
        {
            CMSContext.CurrentPageInfo = PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, "/", CMSContext.PreferredCultureCode, null, false);

            // Title
            string title = CMSContext.CurrentTitle;
            if (!string.IsNullOrEmpty(title))
            {
                title = "<title>" + title + "</title>";
            }

            // Body class
            string bodyCss = CMSContext.CurrentBodyClass;
            if (bodyCss != null && bodyCss.Trim() != "")
            {
                bodyCss = "class=\"" + bodyCss + "\"";
            }
            else
            {
                bodyCss = "";
            }

            // metadata
            string meta = "<meta http-equiv=\"pragma\" content=\"no-cache\" />";

            string description = CMSContext.CurrentDescription;
            if (description != "")
            {
                meta += "<meta name=\"description\" content=\"" + description + "\" />";
            }

            string keywords = CMSContext.CurrentKeyWords;
            if (keywords != "")
            {
                meta += "<meta name=\"keywords\"  content=\"" + keywords + "\" />";
            }

            // Site style sheet
            string cssSiteSheet = "";

            CssStylesheetInfo cssInfo = null;
            int stylesheetId          = CMSContext.CurrentPageInfo.DocumentStylesheetID;

            cssInfo = CssStylesheetInfoProvider.GetCssStylesheetInfo((stylesheetId > 0) ? stylesheetId : CMSContext.CurrentSite.SiteDefaultStylesheetID);

            if (cssInfo != null)
            {
                cssSiteSheet = CSSHelper.GetCSSFileLink(CSSHelper.GetStylesheetUrl(cssInfo.StylesheetName));
            }

            // Theme css files
            string themeCssFiles = "";
            if (cssInfo != null)
            {
                try
                {
                    string directory = URLHelper.GetPhysicalPath(string.Format("~/App_Themes/{0}/", cssInfo.StylesheetName));
                    if (Directory.Exists(directory))
                    {
                        foreach (string file in Directory.GetFiles(directory, "*.css"))
                        {
                            themeCssFiles += CSSHelper.GetCSSFileLink(CSSHelper.GetPhysicalCSSUrl(cssInfo.StylesheetName, Path.GetFileName(file)));
                        }
                    }
                }
                catch
                {
                }
            }

            // Add values to page
            mHead = FormatHTML(HighlightHTML(title + meta + cssSiteSheet + themeCssFiles), 2);
            mBody = bodyCss;
        }
        catch
        {
            lblError.Visible = true;
            lblError.Text    = GetString("MasterPage.PageEditErr");
        }

        // Prepare the hints and typw dropdown
        lblType.Text = ResHelper.GetString("PageLayout.Type");

        if (drpType.Items.Count == 0)
        {
            drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Ascx"), TransformationTypeEnum.Ascx.ToString()));
            drpType.Items.Add(new ListItem(ResHelper.GetString("TransformationType.Html"), TransformationTypeEnum.Html.ToString()));
        }

        string lang = ValidationHelper.GetString(SettingsHelper.AppSettings["CMSProgrammingLanguage"], "C#");

        ltlDirectives.Text = "&lt;%@ Control Language=\"" + lang + "\" ClassName=\"Simple\" Inherits=\"CMS.PortalControls.CMSAbstractLayout\" %&gt;<br />&lt;%@ Register Assembly=\"CMS.PortalControls\" Namespace=\"CMS.PortalControls\" TagPrefix=\"cc1\" %&gt;";

        if (!SettingsKeyProvider.UsingVirtualPathProvider)
        {
            lblChecked.Visible = true;
            lblChecked.Text    = "<br />" + AddSpaces(2) + GetString("MasterPage.VirtualPathProviderNotRunning");
            txtLayout.ReadOnly = true;
        }

        LoadData();

        // Register synchronization script for split mode
        if (CMSContext.DisplaySplitMode)
        {
            RegisterSplitModeSync(true, false);
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        previewState = GetPreviewStateFromCookies(MASTERPAGE);

        // Keep current user
        user = MembershipContext.AuthenticatedUser;

        // Get document node
        tree = new TreeProvider(user);
        node = UIContext.EditedObject as TreeNode;

        // Register the dialog script
        ScriptHelper.RegisterDialogScript(Page);

        // Register save changes
        ScriptHelper.RegisterSaveChanges(Page);

        // Save changes support
        bool   confirmChanges = SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSConfirmChanges");
        string script         = string.Empty;

        if (confirmChanges)
        {
            script  = "CMSContentManager.confirmLeave=" + ScriptHelper.GetString(ResHelper.GetString("Content.ConfirmLeave", user.PreferredUICultureCode), true, false) + "; \n";
            script += "CMSContentManager.confirmLeaveShort=" + ScriptHelper.GetString(ResHelper.GetString("Content.ConfirmLeaveShort", user.PreferredUICultureCode), true, false) + "; \n";
        }
        else
        {
            script += "CMSContentManager.confirmChanges = false;";
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "saveChangesScript", script, true);

        try
        {
            if (node != null)
            {
                DocumentContext.CurrentPageInfo = PageInfoProvider.GetPageInfo(node.NodeSiteName, node.NodeAliasPath, node.DocumentCulture, null, node.NodeID, false);

                // Title
                string title = DocumentContext.CurrentTitle;
                if (!string.IsNullOrEmpty(title))
                {
                    title = "<title>" + title + "</title>";
                }

                // Body class
                string bodyCss = DocumentContext.CurrentBodyClass;
                // Remove bootstrap default class
                bodyCss = bodyCss.Replace(" cms-bootstrap", String.Empty);

                if (bodyCss != null && bodyCss.Trim() != "")
                {
                    bodyCss = "class=\"" + bodyCss + "\"";
                }
                else
                {
                    bodyCss = "";
                }

                // Metadata
                string meta = "<meta http-equiv=\"pragma\" content=\"no-cache\" />";

                string description = DocumentContext.CurrentDescription;
                if (description != "")
                {
                    meta += "<meta name=\"description\" content=\"" + description + "\" />";
                }

                string keywords = DocumentContext.CurrentKeyWords;
                if (keywords != "")
                {
                    meta += "<meta name=\"keywords\"  content=\"" + keywords + "\" />";
                }

                // Site style sheet
                string cssSiteSheet = "";

                int stylesheetId = DocumentContext.CurrentPageInfo.DocumentStylesheetID;

                CssStylesheetInfo cssInfo = CssStylesheetInfoProvider.GetCssStylesheetInfo((stylesheetId > 0) ? stylesheetId : SiteContext.CurrentSite.SiteDefaultStylesheetID);

                if (cssInfo != null)
                {
                    cssSiteSheet = CSSHelper.GetCSSFileLink(CSSHelper.GetStylesheetUrl(cssInfo.StylesheetName));
                }

                // Theme CSS files
                string themeCssFiles = "";
                if (cssInfo != null)
                {
                    try
                    {
                        string directory = URLHelper.GetPhysicalPath(string.Format("~/App_Themes/{0}/", cssInfo.StylesheetName));
                        if (Directory.Exists(directory))
                        {
                            foreach (string file in Directory.GetFiles(directory, "*.css"))
                            {
                                themeCssFiles += CSSHelper.GetCSSFileLink(CSSHelper.GetPhysicalCSSUrl(cssInfo.StylesheetName, Path.GetFileName(file)));
                            }
                        }
                    }
                    catch
                    {
                    }
                }

                // Add values to page
                mHead = FormatHTML(HighlightHTML(title + meta + cssSiteSheet + themeCssFiles), 2);
                mBody = bodyCss;
            }
        }
        catch
        {
            ShowError(GetString("MasterPage.PageEditErr"));
        }

        LoadData();

        // Add save action
        SaveAction save = new SaveAction();

        save.CommandArgument = ComponentEvents.SAVE_DATA;
        save.CommandName     = ComponentEvents.SAVE_DATA;

        headerActions.ActionsList.Add(save);

        if (pti != null)
        {
            // Disable buttons for no-template
            bool actionsEnabled = (pti.PageTemplateId > 0);

            // Edit layout
            HeaderAction action = new HeaderAction
            {
                Text          = GetString("content.ui.pagelayout"),
                Tooltip       = GetString("pageplaceholder.editlayouttooltip"),
                OnClientClick = "EditLayout();return false;",
                Enabled       = actionsEnabled
            };
            headerActions.ActionsList.Add(action);

            string elemUrl = UIContextHelper.GetElementDialogUrl("cms.design", "PageTemplate.EditPageTemplate", pti.PageTemplateId);

            // Edit page properties action
            action = new HeaderAction
            {
                Text          = GetString("PageProperties.EditTemplateProperties"),
                Tooltip       = GetString("PageProperties.EditTemplateProperties"),
                OnClientClick = "modalDialog('" + elemUrl + "', 'TemplateSelection', '85%', '85%', false);return false;",
                Enabled       = actionsEnabled
            };

            CMSPagePlaceholder.RegisterEditLayoutScript(this, pti.PageTemplateId, node.NodeAliasPath, null);
            headerActions.ActionsList.Add(action);

            // Preview
            HeaderAction preview = new HeaderAction
            {
                Text          = GetString("general.preview"),
                OnClientClick = "performToolbarAction('split');return false;",
                Visible       = ((previewState == 0) && !UIContext.DisplaySplitMode),
                Tooltip       = GetString("preview.tooltip")
            };
            headerActions.ActionsList.Add(preview);

            headerActions.ActionPerformed += headerActions_ActionPerformed;
        }

        RegisterInitScripts(pnlBody.ClientID, pnlMenu.ClientID, false);
    }
Exemplo n.º 6
0
    /// <summary>
    /// Loads content from specific newsletter template.
    /// </summary>
    private void LoadContent()
    {
        EmailTemplate emailTemplate = EmailTemplateProvider.GetEmailTemplate(templateId);

        if ((emailTemplate == null) || string.IsNullOrEmpty(emailTemplate.TemplateBody))
        {
            return;
        }

        // Remove security parameters from macros
        string templateText = MacroResolver.RemoveSecurityParameters(emailTemplate.TemplateBody, true, null);

        if (!RequestHelper.IsPostBack() && (issue != null))
        {
            // Load content of editable regions
            IssueHelper.LoadRegionsContents(ref regionsContents, issue.IssueText);
        }

        CMSEditableRegion editableRegion = null;
        LiteralControl    before         = null;
        int count        = 0;
        int textStart    = 0;
        int editRegStart = templateText.IndexOf("$$", textStart);

        // Apply CSS e-mail template style
        HTMLHelper.AddToHeader(this.Page, CSSHelper.GetCSSFileLink(EmailTemplateProvider.GetStylesheetUrl(emailTemplate.TemplateName)));

        while (editRegStart >= 0)
        {
            count++;

            before = new LiteralControl();
            // Get template text surrounding editable regions - make links absolute
            before.Text = URLHelper.MakeLinksAbsolute(templateText.Substring(textStart, (editRegStart - textStart)));
            plcContent.Controls.Add(before);

            // End of region
            editRegStart += 2;
            textStart     = editRegStart;
            if (editRegStart < templateText.Length - 1)
            {
                int editRegEnd = templateText.IndexOf("$$", editRegStart);
                if (editRegEnd >= 0)
                {
                    string   region = templateText.Substring(editRegStart, editRegEnd - editRegStart);
                    string[] parts  = (region + ":" + ":").Split(':');

                    try
                    {
                        string name = parts[0];
                        if (!string.IsNullOrEmpty(name.Trim()))
                        {
                            int width  = ValidationHelper.GetInteger(parts[1], 0);
                            int height = ValidationHelper.GetInteger(parts[2], 0);

                            editableRegion            = new CMSEditableRegion();
                            editableRegion.ID         = name;
                            editableRegion.RegionType = CMSEditableRegionTypeEnum.HtmlEditor;
                            editableRegion.ViewMode   = ViewModeEnum.Edit;

                            editableRegion.DialogHeight = height;
                            editableRegion.DialogWidth  = width;

                            editableRegion.WordWrap = false;
                            editableRegion.HtmlAreaToolbarLocation = "Out:CKEditorToolbar";
                            editableRegion.RegionTitle             = name;
                            editableRegion.UseStylesheet           = false;
                            editableRegion.HTMLEditorCssStylesheet = EmailTemplateProvider.GetStylesheetUrl(emailTemplate.TemplateName);
                            editableRegion.HtmlAreaToolbar         = "Newsletter";
                            editableRegion.HtmlEditor.MediaDialogConfig.UseFullURL = true;
                            editableRegion.HtmlEditor.LinkDialogConfig.UseFullURL  = true;
                            editableRegion.HtmlEditor.QuickInsertConfig.UseFullURL = true;

                            editableRegion.LoadContent(ValidationHelper.GetString(regionsContents[name.ToLower()], ""));

                            plcContent.Controls.Add(editableRegion);

                            textStart = editRegEnd + 2;
                        }
                    }
                    catch
                    {
                    }
                }
            }
            editRegStart = templateText.IndexOf("$$", textStart);
        }

        before      = new LiteralControl();
        before.Text = URLHelper.MakeLinksAbsolute(templateText.Substring(textStart));

        plcContent.Controls.Add(before);
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        RegisterResizeHeaders();

        CMSContext.ViewMode = ViewModeEnum.MasterPage;
        previewState        = GetPreviewStateFromCookies(MASTERPAGE);

        // Keep current user
        user = CMSContext.CurrentUser;

        // Get document node
        tree = new TreeProvider(user);
        node = CMSContext.EditedObject as TreeNode;

        // Register the dialog script
        ScriptHelper.RegisterDialogScript(Page);

        // Register save changes
        ScriptHelper.RegisterSaveChanges(Page);

        // Save changes support
        bool   confirmChanges = SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSConfirmChanges");
        string script         = string.Empty;

        if (confirmChanges)
        {
            script = "var confirmLeave='" + ResHelper.GetString("Content.ConfirmLeave", user.PreferredUICultureCode) + "'; \n";
        }
        else
        {
            script += "confirmChanges = false;";
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "saveChangesScript", ScriptHelper.GetScript(script));

        try
        {
            if (node != null)
            {
                CMSContext.CurrentPageInfo = PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, node.NodeAliasPath, node.DocumentCulture, null, false);

                // Title
                string title = CMSContext.CurrentTitle;
                if (!string.IsNullOrEmpty(title))
                {
                    title = "<title>" + title + "</title>";
                }

                // Body class
                string bodyCss = CMSContext.CurrentBodyClass;
                if (bodyCss != null && bodyCss.Trim() != "")
                {
                    bodyCss = "class=\"" + bodyCss + "\"";
                }
                else
                {
                    bodyCss = "";
                }

                // Metadata
                string meta = "<meta http-equiv=\"pragma\" content=\"no-cache\" />";

                string description = CMSContext.CurrentDescription;
                if (description != "")
                {
                    meta += "<meta name=\"description\" content=\"" + description + "\" />";
                }

                string keywords = CMSContext.CurrentKeyWords;
                if (keywords != "")
                {
                    meta += "<meta name=\"keywords\"  content=\"" + keywords + "\" />";
                }

                // Site style sheet
                string cssSiteSheet = "";

                int stylesheetId = CMSContext.CurrentPageInfo.DocumentStylesheetID;

                CssStylesheetInfo cssInfo = CssStylesheetInfoProvider.GetCssStylesheetInfo((stylesheetId > 0) ? stylesheetId : CMSContext.CurrentSite.SiteDefaultStylesheetID);

                if (cssInfo != null)
                {
                    cssSiteSheet = CSSHelper.GetCSSFileLink(CSSHelper.GetStylesheetUrl(cssInfo.StylesheetName));
                }

                // Theme CSS files
                string themeCssFiles = "";
                if (cssInfo != null)
                {
                    try
                    {
                        string directory = URLHelper.GetPhysicalPath(string.Format("~/App_Themes/{0}/", cssInfo.StylesheetName));
                        if (Directory.Exists(directory))
                        {
                            foreach (string file in Directory.GetFiles(directory, "*.css"))
                            {
                                themeCssFiles += CSSHelper.GetCSSFileLink(CSSHelper.GetPhysicalCSSUrl(cssInfo.StylesheetName, Path.GetFileName(file)));
                            }
                        }
                    }
                    catch
                    {
                    }
                }

                // Add values to page
                mHead = FormatHTML(HighlightHTML(title + meta + cssSiteSheet + themeCssFiles), 2);
                mBody = bodyCss;
            }
        }
        catch
        {
            ShowError(GetString("MasterPage.PageEditErr"));
        }


        LoadData();

        // Add save action
        SaveAction save = new SaveAction(Page);

        save.CommandArgument = ComponentEvents.SAVE_DATA;
        save.CommandName     = ComponentEvents.SAVE_DATA;

        headerActions.ActionsList.Add(save);

        if (pti != null)
        {
            // Edit layout
            HeaderAction action = new HeaderAction
            {
                Text          = GetString("content.ui.pagelayout"),
                Tooltip       = GetString("pageplaceholder.editlayouttooltip"),
                OnClientClick = "EditLayout();return false;",
                ImageUrl      = GetImageUrl("CMSModules/CMS_PortalEngine/Edit.png")
            };
            headerActions.ActionsList.Add(action);

            // Edit page properties action
            action = new HeaderAction
            {
                Text          = GetString("PageProperties.EditTemplateProperties"),
                Tooltip       = GetString("PageProperties.EditTemplateProperties"),
                OnClientClick = "modalDialog('" + ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Edit.aspx") + "?templateid=" + pti.PageTemplateId + "&nobreadcrumbs=1&dialog=1', 'TemplateSelection', 850, 680, false);return false;",
                ImageUrl      = GetImageUrl("CMSModules/CMS_Content/Template/edit.png")
            };

            CMSPagePlaceholder.RegisterEditLayoutScript(this, pti.PageTemplateId, node.NodeAliasPath, null);
            headerActions.ActionsList.Add(action);

            // Preview
            HeaderAction preview = new HeaderAction
            {
                ControlType   = HeaderActionTypeEnum.LinkButton,
                Text          = GetString("general.preview"),
                OnClientClick = "performToolbarAction('split');return false;",
                ImageUrl      = GetImageUrl("CMSModules/CMS_Content/EditMenu/Preview.png"),
                SmallImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/16/Preview.png"),
                Visible       = ((previewState == 0) && !CMSContext.DisplaySplitMode),
                Tooltip       = GetString("preview.tooltip")
            };
            headerActions.ActionsList.Add(preview);

            headerActions.ActionPerformed += new CommandEventHandler(headerActions_ActionPerformed);
        }

        RegisterInitScripts(pnlBody.ClientID, pnlMenu.ClientID, false);
    }