Search code examples
iframec1-cms

iframe in console application


I have made a console application in Composite C1. This console application shows a list of dataitems. When you edit a dataitem it will show a tab with the information from the dataitem. On another tab I want to show a pdf that is referenced from the dataitem.

I would like to do it in the style of the 'Preview' tab when you edit a page.

So just an iFrame to show the pdf file.

Can anyone point me in the right direction to achieve this? Is it possible to create a preview like tab.

thanks in advance, Goldhorn


Solution

  • The auto generated data item editor view currently do not have support for preview.

    You would need to either move the preview to a 'view' command you show in the tree or create a custom page to create the edit form/preview functionality.

    Here is a sample Tree Definition file which shows how a new command is attached to an existing data element in the trees:

    <ElementStructure xmlns="http://www.composite.net/ns/management/trees/treemarkup/1.0" xmlns:f="http://www.composite.net/ns/function/1.0"> 
      <ElementStructure.AutoAttachments> 
        <DataType Type="Composite.Data.Types.IPage" Position="Top" /> 
      </ElementStructure.AutoAttachments> 
      <ElementRoot> 
        <Actions> 
          <CustomUrlAction Label="View" Url="~/MyView.aspx?Id=${C1:Data:Composite.Data.Types.IPage:Id}" /> 
        </Actions> 
      </ElementRoot> 
    </ElementStructure>
    

    To make this hook on to your data type replace the two occurrences of "Composite.Data.Types.IPage" with your types full name (type namespace + name).

    Tree definitions are stored as xml files in the folder ~/App_Data/Composite/TreeDefinitions - once you put the file there Composite C1 will pick it up, and in this case attach a command to some types of tree elements.

    Read more about Tree Definitions.

    If you are going for the custom edit form with preview in it you would also use a Tree Definition to 'hook in' your custom form.

    The custom page you invoke inside the C1 Console need to abide to some rules - grab a copy of ~/Composite/content/views/log/log.aspx and gut it and you have a starting point for your custom page.