projectdoc Toolbox

The standard context provider or templates.

Class
de.smartics.projectdoc.atlassian.confluence.blueprint.provider.ProjectDocContextProvider
Audience
Since
1.11
 

Prior to version 1.11 the name of the class has been de.smartics.projectdoc.atlassian.confluence.ProjectDocContextProvider.

Contents

Description

The main purpose of the context providers is adding additional parameters to the blueprint context. These parameters are available in the templates that are created by the use of the page wizards.

projectdoc usually demands that every document provides a name (that may differ from the page title) and a short description. The context provider may alter any of the parameters or add additional ones.

Provided Context Parameters

Page Title and Document Name Handling

If the targetLocation or  adjustTitleAfterMoveRequest is not set by the wizard (soy template), the placeholder @parentPageTitle be replaced with the parent page's name. The sort key property will also be set to the next higher number according to the current siblings of the new page, if at least one placeholder is used.

Otherwise the title of the page is set to the name of the document.

Add Space Information to Blueprint Context

The space key is accessible by the key spaceKey from the blueprint context.

Since it is sometimes convenient to render a complete XML tag, this XML fragment is also generated and stored by the key spaceKeyElement:

<ri:space ri:space-key="spaceKey" /> 

Here is an example on how to use the XML element with the Create from Template Macro:

<structured-macro name="create-from-template">
  <parameter name="blueprintModuleCompleteKey">someKey</parameter>
  <parameter name="buttonLabel">Some Label</parameter>
  <parameter name="spaceKey"><at:var at:name="spaceKeyElement" at:rawxhtml="true"/></parameter>
</structured-macro>

This example shows how the spaceKeyElement property is used to render the complete element.

Add Creation Metadata to Blueprint Context

The following properties are added to the blueprint context.

ParameterDescription
projectdoc.doctype.common.creationDateThe date of the creation formatted by the user's preferences.
projectdoc.doctype.common.creationTimeThe time of the creation formatted by the user's preferences.
de.smartics.projectdoc.creationDateInstanceThe date instance for access by the Java API.

Translate Placeholders in Short Description

The following placeholders are translated:

PlaceholderDescription
@parentPageTitleInserts the title of the parent page.
@pageTitle

Inserts the title of the current page. This is useful for template authors for use cases where a macro references a page by its title.

It cannot be used with the wizard, because the page has no title.

@spaceKeyInserts the key of the current space.
@spaceNameInserts the name of the current space.
@currentDateInserts the current date, formatted by the global formatter configuration.
@currentDateTokenInserts the current date formatted by yyyy-MM-dd (year, month, day).

Example Usage

The context provider is used for regular templates of your blueprint. It helps to map the wizard's input information to the page.

The following fragment registers your template as a Content Template Module:

<content-template
    key="my-template-key-template"
    i18n-name-key="projectdoc.my-template-key.template.title">
   <resource
       name="template"
       type="download"
      location="/my/path/to/my-template-key-template.xml" />
  <context-provider class="de.smartics.projectdoc.atlassian.confluence.ProjectDocContextProvider" />
</content-template>

The my-template-key is usually the name of the template (e.g. retrospective or user-character).