# orion.page.content

Plugins can contribute page content for a page that is framed by the common Orion banner and equipped with standard Orion page services, such as the related pages menu. The page content itself is rendered in an iframe inside the page. Pages contributed in this way are opened in a URL that specifies the id of the extension.

## Service methods

None. This service is purely declarative.

## Service attributes

Implementations of `orion.page.content` must define the following attributes:

name
  The name of the content, which is shown as the page title in the Orion banner.
id
  A symbolic id for referencing this extension point.
uriTemplate
  a URI Template that defines the href for the iframe content. When content is opened, it might be targeted against a particular file or folder. In this case, the template variables can refer to file or folder metadata from the target file. In addition to the standard variables used in Orion and the file/folder metadata, some special variables are used:

- `{SaveURL}` refers to a URL that can be used to save content back to Orion.
- `{ExitURL}` refers to a URL that can be used if the user chooses to exit the embedded application.

saveToken
  Optional. An Array of objects describing token(s) that appear in the URL of the page that saves the content. The saveToken is used to find the location of any content stored by the plugin.

## Examples

The following snippet defines an orion.page.content extension for showing the Pixlr image editor inside Orion.

      provider.registerServiceProvider("orion.page.content", {}, {
         id: "orion.pixlr.content",
         name: "Pixlr",
         saveToken: [{token: "imgapi?image=", terminator: "&"},
         uriTemplate: "http://pixlr.com/editor/?image={OrionHome}{Location}&referrer=Orion&title={Name}&locktype=true&exit={ExitURL}&target={SaveURL}imgapi&locktitle=true,contentProvider=orion.pixlr.content"});

The URL to open this page is `/content/content.html#{Location},contentProvider=orion.pixlr.content`

If the page content requires a resource location (for example, it is an editor), then typically the page would be linked using the orion editor extension point. This ensures that the page were opened with a specified location parameter in the URL. The pixlr plugin contributes an editor in this way.

      provider.registerServiceProvider("orion.edit.editor", {}, {
         id: "orion.pixlr",
         name: "Pixlr Image Editor",
         uriTemplate: "{OrionHome}/content/content.html#{Location},contentProvider=orion.pixlr.content"});

The corresponding "open with" extension point is

      provider.registerServiceProvider("orion.navigate.openWith", {}, {
         editor: "orion.pixlr",
         contentType: ["image/gif", "image/jpeg", "image/ico", "image/png","image/tiff"]});