Information Classification: External Restricted.
See https://www.chili-publish.com/security

External Snippets XML

Concept

The "External Snippets" panel allows a user to drop snippets into a document. Rather than navigating through the directories and documents of CHILIs Document Management area, the user gets a directory structure configured by an external system.

Administrators can configure the panel by providing the following URLs:

  • Directory List URL: this dynamic page should return XML describing the directories
  • Asset List URL: this dynamic page should return XML describing the snippets available in a selected directory. The URL can contain %id%, which is replaced by the ID of the selected directory.
  • Search URL: the XML format returned is identical to the Asset List URL XML. The search URL can contain %search%, which is replaced by the search term entered by the user

URLs can include the variables described in External XML URL replacement

Depending on the provided URLs, the Panel will adjust its behavior:

  • If only a single directory is returned by the Directory List URL, the directory tree is hidden, and its content is immediately loaded
  • If only one of Directory or Search URL is provided (one is required), the "Browse" / "Search" navigation will be updated accordingly

XML Definitions

Directory XML
<directories>
  <item id="1" name="Main Directory">
    <item id="2" name="Sub Directory 1"/>
    <item id="3" name="Sub Directory 2"/>
  </item>
  <item id="4" name="Main Directory 2"/>
</directories>

The directory XML contains items (in a hierarchical structure) describing the available directories. Each directory requires an "id" and "name" attribute.
The editor will replace "%id%" in the Asset List URL and the Post URL with the value from the attribute "id" of the selected directory. 

Snippet XML
<assets>
  <item id="1" snippetID="8c78afc1-1c2d-4060-ba17-8e95826a0c0b" name="Product 1"
        thumb="http://localhost/CHILI/temp/boober1.jpg"
        saveInline="true"
        defaultWidth="100mm"
        defaultHeight="150mm"
        placeAsFrames="false"  
  onlyUpdateVariables="true" accessibleFromClient="false" >
		<variables>
      		<item name="Name" value="SOME PRODUCT"/>
  		    <item name="Promo" value="false"/>
	      	<item name="Description" value="SOME PRODUCTs DESCRIPTION"/>
    	  	<item name="Image1">
        		<imgXML name="boober2.jpg" fileName="boober2.jpg" remoteURL="http://localhost/CHILI/temp/boober2.jpg"  thumb="http://localhost/CHILI/temp/boober2.jpg" targetPath="TEMP_DOWNLOADS" />
      		</item>
      		<item name="Image2">
        		<imgXML name="boober1.jpg" fileName="boober1.jpg" remoteURL="http://localhost/CHILI/temp/boober1.jpg"  thumb="http://localhost/CHILI/temp/boober1.jpg" targetPath="TEMP_DOWNLOADS" />
      		</item>
	    </variables>
  </item>
  <item id="2" snippetID="d4dcb87f-25f4-4e9b-bce9-4d2c510e22a0" name="Product 2"
        thumb="http://localhost/CHILI/temp/boober2.jpg"
        saveInline="false"
        useOrigSize="true"
        placeAsFrames="false" accessibleFromClient="false" >
		<variables>
      		<item name="Name" value="SOME PRODUCT"/>
	      	<item name="Promo" value="false"/>
      		<item name="Description" value="SOME PRODUCTs DESCRIPTION"/>
      		<item name="Image1">
        		<imgXML name="boober2.jpg" fileName="boober2.jpg" remoteURL="http://localhost/CHILI/temp/boober2.jpg"  thumb="http://localhost/CHILI/temp/boober2.jpg" targetPath="TEMP_DOWNLOADS" />
      		</item>
      		<item name="Image2">
        		<imgXML name="boober1.jpg" fileName="boober1.jpg" remoteURL="http://localhost/CHILI/temp/boober1.jpg"  thumb="http://localhost/CHILI/temp/boober1.jpg" targetPath="TEMP_DOWNLOADS" />
      		</item>
    	</variables>
  </item>
  <item id="3" snippetID="7cd35a63-feeb-41e4-a969-fa514d1bffb2" name="Product 3"
        thumb="http://localhost/CHILI/temp/boobertoy.jpg"
        saveInline="true"
        placeFullPage="true"
        placeAsFrames="true"  accessibleFromClient="false" >
    	<variables>
      		<item name="Name" value="SOME PRODUCT"/>
 		    <item name="Promo" value="false"/>
      		<item name="Description" value="SOME PRODUCTs DESCRIPTION"/>
      		<item name="Image1">
        		<imgXML name="boober2.jpg" fileName="boober2.jpg" remoteURL="http://localhost/CHILI/temp/boober2.jpg"  thumb="http://localhost/CHILI/temp/boober2.jpg" targetPath="TEMP_DOWNLOADS" />
      		</item>
      		<item name="Image2">
        		<imgXML name="boober1.jpg" fileName="boober1.jpg" remoteURL="http://localhost/CHILI/temp/boober1.jpg"  thumb="http://localhost/CHILI/temp/boober1.jpg" targetPath="TEMP_DOWNLOADS" />
      		</item>
    	</variables>
  </item>
</assets>

The list of snippets for a particular directory contains a list items. Each item requires the following attributes:

  • id: unique ID of the item
  • snippetID: id of the snippet/document in CHILI. This can be found either manually (in the "info" tab when selecting a document) or using various API functions
  • onlyUpdateVariables: if "true", the snippet document is not downloaded/placed for existing snippets (rather: only the variable definitions are applied to the existing snippet)
  • name: display name for the panel
  • thumb: url (accessible from the client) of a thumbnail of the file
  • saveInline: if "true", the placed snippet is saved inline (rather than as a reference to the original document)
  • defaultWidth/defaultHeight: measurement units (optional) for the width and height of the placed snippet (eg: "210mm" and "297mm")
  • useOrigSize: if no width/height are provided, and useOrigSize = "true", the snippet is placed at the size of the snippet document
  • placeFullPage: if no width/height/useOrigSize are provided, the snippet is placed at the top left of the page, filling the entire page
  • placeAsFrames: if "true", the placed snippet will be converted to frames
  • useClosestAlternateLayout: if "true" or "false", the corresponding snippet setting is configured
  • accessibleFromClient: indicates whether the images can be accessed from the client

Each snippet item can (optionally) get a list of variable values. These will only be applied when the snippet is saved inline or converted to frames.

If the placed snippet contains snippets as well, the variables of those snippets can be set using the "tag" attribute on the variables item node. This should correspond to the tag given to the placed sub-snippet (which can be done in the "Location" panel)

 

The “accessibleFromClient” indicates whether the images can be accessed from the client

  • true: the external snippet is viewable/downloadable from the client (no flash security warnings)
  • false: the external snippet is not accessible from the client, and should be served using the backoffice preview_external.aspx page

 

accessibleFromClient="true"

Icon

An external snippet server should always specify the CORS header:
Access-Control-Allow-Origin:  http://domain-where-chili-editor-runs.com

And we recommend to also specify this header:
Access-Control-Allow-Credentials: true

If you don't want to specify this header (For example for security reasons), please put "requestWithCredentials" to false

 

All information on this page must be treated as External Restricted, or more strict. https://www.chili-publish.com/security