projectdoc Toolbox

The standard context provider for home and special pages.

Class
de.smartics.projectdoc.atlassian.confluence.page.partition.SubspaceContextProvider
Audience
Contents

Description

The main purpose of the context providers is to provide an infrastructure to create this page in the context of creating multiple pages. This is usually the case for projectdoc homepages for document types. It may also be the case for special pages.

This context provider creates the name and short description for a page by applying naming conventions to the I18N keys.

I18N KeyDescription
projectdoc.doctype.my-template-key.nameReferences the localized name of the document.
projectdoc.doctype.my-template-key.short-descriptionReferences the localized short description for the document.

If this lookup in the resource bundle of the plugin provides no result, the following keys are checked:

I18N KeyDescription
projectdoc.doctype.my-template-key.homeReferences the localized name of the document.
projectdoc.doctype.my-template-key.home.short-descriptionReferences the localized short description for the document.

Provided Context Parameters

Name and Short Description

The following blueprint context parameters are set:

Parameter NameDescription
projectdoc.doctype.common.name

The name of the document. The title of the page is usually identical or derived from the name.

For more information on document names and page titles please refer to Name and Title.

projectdoc.doctype.common.shortDescription

The short description for the document.

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 home and index templates of your blueprint.

The following fragment registers your home and index templates as Content Template Modules:

<content-template
  key="category-home-template"
  i18n-name-key="projectdoc.content.my-template-key.home.title">
  <description key="projectdoc.content.my-template-key.home.description" />
  <resource
    name="template"
    type="download"
    location="/my/path/to/home.xml" />
  <context-provider class="de.smartics.projectdoc.atlassian.confluence.page.partition.SubspaceContextProvider" />
</content-template>
<content-template
    key="category-index-template"
    i18n-name-key="projectdoc.content.my-template-key.index.all.title">
  <description key="projectdoc.content.my-template-key.index.all.desc" />
  <resource
    name="template"
    type="download"
    location="/my/path/to/index.xml" />
  <context-provider class="de.smartics.projectdoc.atlassian.confluence.page.partition.SubspaceContextProvider" />
</content-template>

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