Context Provider

The main purpose of content providers is to add additional context entries for the blueprints provided by an add-on. projectdoc defines a number of context providers to be used by add-on developers.

The context provider classes for projectdoc help to fill the blueprint context with convenient information to populate the created documents.

The context provider class is registered with the Content Template Module in the atlassian-plugin.xml file.

Basic Configuration

The Soy template defines the wizard, the template uses the information collected in the wizard.

Soy Template

{namespace ProjectDocPlugin.Blueprints.Template.Blank}

/**
 * Wizard to collect information for the blank document.
 */
{template .page1Form}
  <form action="#" method="post" class="aui" id="blank-form">
    <fieldset>
      <div class="field-group">
        <label for="projectdoc.doctype.common.name">{getText('projectdoc.blueprint.form.label.name')}</label>
        <input id="projectdoc.doctype.common.name" class="text long-field" type="text" name="projectdoc.doctype.common.name"
        placeholder="{getText('projectdoc.blueprint.form.label.name.placeholder')}">
          </div>
      <div class="field-group">
        <label for="projectdoc.doctype.common.shortDescription">{getText('projectdoc.blueprint.form.label.shortDescription')}</label>
        <textarea id="projectdoc.doctype.common.shortDescription" class="textarea long-field" name="projectdoc.doctype.common.shortDescription" rows="6"
            placeholder="{getText('projectdoc.blueprint.form.label.shortDescription.placeholder')}"></textarea>
      </div>
      <div class="field-group" id="target-location-binder">
         <label for="targetLocation">{getText('projectdoc.blueprint.form.targetLocation')}</label>
         <input id="targetLocation" type="checkbox" value="defaultLocation" name="targetLocation"/>
         <br><span id="targetLocationDocumentation" class="help">{getText('projectdoc.blueprint.form.targetLocation.placeholder')}</span>
      </div>
      <input id="projectdoc" type="hidden" name="projectdoc" value="true">
      <input id="templateLabel" type="hidden" name="templateLabel" value="blank">
    </fieldset>
  </form>
{/template}

Page Template

The template for the blank document.

<ac:layout>
  <ac:layout-section ac:type="single">
    <ac:layout-cell>
      <ac:structured-macro ac:name="projectdoc-properties-marker">
        <ac:rich-text-body>
          <div class="table-wrap">
            <table class="confluenceTable">
              <tbody>
                <tr>
                  <th class="confluenceTh"><at:i18n at:key="projectdoc.doctype.common.shortDescription"/></th>
                  <td class="confluenceTd"><at:var at:name="projectdoc.doctype.common.shortDescription"/></td>
                  <td class="confluenceTd"></td>
                </tr>
                <tr>
                  <th class="confluenceTh"><at:i18n at:key="projectdoc.doctype.common.doctype"/></th>
                  <td class="confluenceTd">blank</td>
                  <td class="confluenceTd">hide</td>
                </tr>
                <tr>
                  <th class="confluenceTh"><at:i18n at:key="projectdoc.doctype.common.name"/></th>
                  <td class="confluenceTd"><at:var at:name="projectdoc.doctype.common.name"/></td>
                  <td class="confluenceTd"></td>
                </tr>
...

The XML code shows how the parameters from the Soy template are referenced via the at:var element.

List of Context Providers

The following context providers generate additional information and set them to the blueprint context. This information can be used in your page templates. For each standard case there is a context provider. You may want to extend on of these for your special purpose context provider or create one on your own.

Name Short Description
The standard context provider or templates.
Context provider to templates of structural pages that need not to be created individually. This is usually the case for pages like the space homepage. It is created once and edited by the user. There is no need to create this page in an existing page, like it may be the case for a doctype homepage.
The standard context provider or templates to create subpages. The context provider basically deals with the title uniqueness (by adding the parent document's name as part of the page title) and sort order (first documents first).
The standard context provider for home and special pages.