November Happy Hour will be moved to Thursday December 5th.

Export composer blocks (data)

Vote:
 

I'm wondering if it possible to export/copy data stored in the composer functions for a composer page. I havn't been able to find any way to do this in Admin-mode, but perhaps programatically?

#56588
Jan 27, 2012 15:48
Vote:
 

Hi,

You can use EPisever's standard import/export function to export/copy composer pages. Have a look at below tech-note
http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-Composer/Configuration-Settings---EPiServer-Composer-4-R2-/

See under headings "Import/export EPiServer Composer pages" and "Import/export EPiServer Composer templates and global functions"

Hope it helps.

#56589
Jan 27, 2012 16:23
Vote:
 

Thanks.

However, I may have to elaborate a bit more. I have a composer standard page with a bunch of data blocks in it. I need this page to be set as the start page of the site, and at the same time keep all the properties set on this page. So what I've done is change the ASPX-file reference in Admin-mode (for the "start page" page type) to "../Composer/Page.aspx" instead of "Default.aspx".

This is why I'd like to export the data of the old composer page - if possible.

#56603
Jan 30, 2012 8:25
Vote:
 

I solved it by making a plugin for Admin-mode. It copies the "ExtensionPageProperty" containing the composer blocks from one page to another.

Markup:

Composer PageID to copy data from: <asp:TextBox runat="server" ID="tbOldComposerPageId" />
       <br />
       Composer PageID to copy data to:     <asp:TextBox runat="server" ID="tbNewComposerPageId" />
       <br />
       <br />
           From page: <b><asp:Label runat="server" ID="lblNameFrom" /></b>
           <br /><br />
           Data: <br /><asp:TextBox runat="server" ID="tbDataValueFrom" TextMode="MultiLine" />
           <br /> <br /> <br /><br />
           To page: <b><asp:Label runat="server" ID="lblNameTo" /></b>
           <br /><br />
           Data: <br /><asp:TextBox runat="server" ID="tbDataValueTo" TextMode="MultiLine" />
       
       <br /><br />
       <br /><br />
       <asp:Button ID="btnCheck" runat="server" Text="Get values" OnClick="btnCheck_Click" />     <asp:Button ID="btnCopy" runat="server" Text="Copy" OnClick="btnCopy_Click" Enabled="false" />
    

 And Code-behind:

 

protected void btnCopy_Click(object sender, EventArgs e)
        {
            PageReference pageRef = new PageReference(tbNewComposerPageId.Text);
            PageData pageData = GetPage(pageRef);

            PageData writableClone = pageData.CreateWritableClone();
            writableClone.Property["ExtensionPageProperty"].Value = tbDataValueFrom.Text;
            DataFactory.Instance.Save(writableClone, SaveAction.Publish);
        }

        protected void btnCheck_Click(object sender, EventArgs e)
        {
            PageReference pageRefFrom = new PageReference(tbOldComposerPageId.Text);
            PageData pageDataFrom = GetPage(pageRefFrom);
            lblNameFrom.Text = pageDataFrom.PageName;
            var extensionPagePropertyFrom = pageDataFrom["ExtensionPageProperty"];
            if (extensionPagePropertyFrom != null && extensionPagePropertyFrom.ToString() != string.Empty) tbDataValueFrom.Text = extensionPagePropertyFrom.ToString();

            PageReference pageRefTo = new PageReference(tbNewComposerPageId.Text);
            PageData pageDataTo = GetPage(pageRefTo);
            lblNameTo.Text = pageDataTo.PageName;
            var extensionPagePropertyTo = pageDataTo["ExtensionPageProperty"];
            if (extensionPagePropertyTo != null && extensionPagePropertyTo.ToString() != string.Empty) tbDataValueTo.Text = extensionPagePropertyTo.ToString();

            btnCopy.Enabled = true;
        }

    

#56629
Edited, Jan 31, 2012 10:24
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.