You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

projectdoc Toolbox

Using document and space properties as variables in the projectdoc Toolbox for Confluence.

Type
Contents

The projectdoc Toolbox for Confluence allows authors to specify properties on the document and space level. These properties can be seen as variables to control the rendering of projectdoc documents and Confluence pages.

This short tip shows you how to do this.

Define a Property

Properties can be define on document and space level.

 

A projectdoc document is a Confluence page with properties defined by the use of the Document Properties Marker Macro.

A document property is define in a table row in the body of a the Document Properties Marker Macro. The name of a property is required to be a simple text string, but the value may also be macro. The macro should not have a dynamic value since values are used with indexing and will only be updated when the document is saved.

A space property is actually a document property that is defined on the space homepage.

 

For more information on space properties, please refer to the tip Using Space Properties.

Using Properties

A property can be used in a number of ways. We will focus on document properties for our examples.

Property Reference

A property may simply be referenced with a Display Document Property Macro. Whenever the value of the property is changed, the value will change in the page using this macro is rendered.Macro editor view to render a property value.

Allowed as Property Value

 

The macro can also be used as a property values, since a page gets updated whenever a referenced page is.

There is a number of macros that allows user to render property values.

Macro Short Description
Renders the value of a property of a document.
Renders a template with property references.
Displays a document property from a referenced document.
Displays a single property of a document that is referred by a property of another document and concatenates it with the value of a local property.

Authors may also choose to render properties of a list of documents in tabular form using the Tour Macro. Each property is rendered in a column or multiple properties may be rendered in a table cell using a template.

Control Rendering Section

With document and space properties authors can control whether or not to render a section (using the Section Macro) or a region (using the Content Marker Macro) on a page.

Section is shown if the property with name 'Type' has a value of 'Epic'.

Authors may also check for a property for any value (i.e. require the property not to be empty.

Section is shown if the property with name 'Authorized by' is not an empty value.

List Documents

Document properties can be used to control which documents are shown in dynamic list. The Display List Macro and Display Table Macro provide a parameter named Where to specify queries. A Where clause looks like this:

Where clause to filter on documents.

The following shows the same query but with exact match. While the query above will also match Types like "Great Tip" and "Lousy Tip", the query below matches only for "Tip".

Exact match query.

Once the value of a property changes, the query will update the results the next time the page with the dynamic list is rendered.

Updating Property Values

Property values may be updated by editing the value in the properties table inside the Document Properties Marker Macro and saving it.

An alternative way of changing values is to use the Web API of the projectdoc Toolbox which is provided by the free Web API Extension. This way a property can be changed by a simple REST call.

Changing values with this REST API can also be made quite simple from within an author's web browser by the use of bookmarklets. Use the free Bookmarklets Extension to get started with defining your own bookmarklets.

Resources

Using Space Properties
Space properties are defined for spaces and are accessed via the Space Property Macro. This tip goes into detail in how to use space properties with inheritence and extension pages.

  • No labels