Document config <creation>
Overview
Documentation for the <creation>
element is expressed in two sections. The first details the actual structure of the element. The second explains how dynamic values can be used to determine the name and location of a new PSML document.
If the <creation>
element is not specified or the document-config.xml
doesn’t exist, a document type inherits all applicable values from the default document.
Element structure
The <creation>
element has the following structure:
<creation [disable="true"]> <title> ... </title>? <folder ... />? <filename ... />? <document ... />? <description> ... </description>? </creation>
All the following elements are optional:
Element | Description |
---|---|
<title> | The title of this document type |
<folder> | Constraints on the document location |
<filename> | Constraints on the filename |
<document> | Information related to the document created |
<description> | Description of the document type |
- @disable – there are situations where the creation of new documents might be delegated to another app, for example, reports generated from a database then uploaded to a group. While the creation of these documents might be restricted, users might require the rest of PageSeeder’s functionality to behave as normal. In this situation, set the boolean value to
true
on the@disable
attribute.
Details
<title>
The title is used by the PageSeeder UI to provide a user-friendly name of the document type which does not have the restrictions imposed on the name of the document type, by allowing any character.
It defaults to the name of the document type.
<folder>
The folder can be used to determine where the documents must be created. It can also be used to specify a path to create to store the document.
Attribute | Description |
---|---|
context |
Defines a path where the document can be created. When the actual context folder does not match this value, the document type cannot be selected. The path can contain wildcards (*) and can be absolute (starting with /) within the group or relative (starting with a character). Relative context uses a matching folder anywhere in the current location. For example, in group
|
path | Defines the folder where the document is created relative to the context or current folder. It might contain dynamic elements such as auto numbers, date parts (date, year, month, day, etc.) or UI parameters. |
transform | A comma-separated list of transformations that need to be applied to the @path attribute. |
Transform options are evaluated in order and can include the following:
charfolding
– to use character folding to replace characters that have diacritical marks by the character without the mark, (for example, ‘é’ -> ‘e’).lowercase
– to transform all characters to lower case.uppercase
– to transform all characters to upper case.underscore
– to replace non-ASCII and space characters by an underscore ‘_’ .hyphen
– to replace non-ASCII and space characters by a hyphen ‘-’ .trim
– removes leading and trailing space, ‘_’ or ‘-’ in value.
The default transform value is charfolding,lowercase,underscore,trim
.
<filename>
The <filename>
element allows better control of how the name of the file where the document is stored is generated.
Attribute | Description |
---|---|
value | Defines the name of the file for the document (not including .psml ) - can contain dynamic elements. |
transform | A comma-separated list of transformations that need to be applied to the value of the filename (see above). |
editable | A boolean attribute to indicate whether the filename can be edited at document creation - if @value has been specified, it is always false , otherwise true by default. |
<document>
The <document>
element can be used to override any value entered by the user so that it can include dynamic elements such as a date or auto number. These values are also passed to the document template when it is instantiated.
Attribute | Description |
---|---|
title | Defines the title for the document if different from the title entered by the user - can contain dynamic elements |
labels | Labels to assign to the document when it is created |
docid | Document ID to assign to the document at creation - might contain dynamic elements |
description | Defines the description for the document - might contain dynamic elements |
publicationid | Publication ID to assign to the document at creation - might contain dynamic elements. Requires PageSeeder v6. |
publicationtype | Publication type to assign to the document at creation - might contain dynamic elements. Requires PageSeeder v6. |
<description>
The description is displayed to the user when choosing a document type. It currently only supports plain text. It is recommended that every document type have a description.
Dynamic parameters
Dynamic parameters are prefixed by a dollar sign $
, can be inserted in some attribute values and are wrapped in curly brackets ‘{ }
’.
UI parameters
Any parameter coming from the user interface is available as $ui.[name]
. The following built-in UI parameters are supported, plus any defined in the document template:
$ui.title
– the title entered by the user.$ui.docid
– the document ID entered by the user.
Dynamic numbers
Dynamic numbers are represented as a single letter symbol. They can be inserted in some attribute values and are wrapped in curly brackets ‘{ }
’. They include date parts and generated numbers and are all integers.
Dates
Date parts can be extracted using the values Y (year), M (month), D (day), W (Week).
Date | M | D | W | |
---|---|---|---|---|
1 January 2000 | 2000 | 1 | 1 | 1 |
1 July 2001 | 2001 | 7 | 1 | 27 |
17 December 2013 | 2013 | 12 | 17 | 51 |
Autonumbering
A number can be automatically computed from the context. It is found by incrementing a counter for the document type which is stored on the folder context (see above) in the current group.
- So for a different group, document type, or context, it is a different counter.
If no context is specified, it is a group wide counter. However, in this case, if the docid
is not auto-numbered, the generated number might not be unique.
It can be referenced as N (number itself), Px (= N divided by x), Qx (= N divided by x + 1), K (= N divided by 1000 = P1000).
N | P100 | Q100 | K |
---|---|---|---|
1 | 0 | 1 | 0 |
99 | 0 | 1 | 0 |
100 | 1 | 2 | 0 |
999 | 9 | 10 | 0 |
1000 | 10 | 11 | 1 |
10001 | 100 | 101 | 1 |
Number formatting
There are three possible formats for a number:
- Symbol by itself = the value.
- Symbol preceded by zeros = the value with padded zeros with overflow.
- Repeated Symbol = the value with padded zeros with NO overflow.
Number | X | 00X | XXX |
---|---|---|---|
1 | 1 | 001 | 001 |
12 | 12 | 012 | 012 |
123 | 123 | 123 | 123 |
1234 | 1234 | 1234 | 234 |
Summary
Symbol | Description |
---|---|
Y | Year of current date |
M | Month of current date (January is 1) |
W | Week of current date |
D | Day of current date within the month |
N | Generated autonumber |
Px | Generated autonumber divided by a x |
Qx | Generated autonumber divided by a x + 1 |
K | Generated autonumber divided 1000 |
Examples
Example 1: default
The PageSeeder default documents have no restrictions imposed on their location and directly inherit the values from what the user enters in the UI.
<creation> <filename transform="charfolding,lowercase,underscore,trim" /> <description>Default PageSeeder document</description> </creation>
Example 2: tutorial
Tutorial documents must be created in the tutorial folder, organized by DocID.
<creation> <title>Tutorial</title> <folder context="/tutorials" path="{0P1000}"/> <filename value="{NNN}-tutorial" editable="false"/> <document title="Tutorial #{N} {$ui.title}" docid="T{0000N}" /> <description>A tutorial to include in the guide<br/> Tutorials are stored under the <code>/tutorials/XX</code> folder of the group and named automatically. </description> </creation>
The files would be created as follows:
# | Path | Document Title | DocID |
---|---|---|---|
1 | /tutorials/00/001-tutorial.psml | Tutorial #1 | T00001 |
999 | /tutorials/00/999-tutorial.psml | Tutorial #999 | T00999 |
1000 | /tutorials/01/000-tutorial.psml | Tutorial #1000 | T01000 |
1001 | /tutorials/01/001-tutorial.psml | Tutorial #1001 | T01001 |
12345 | /tutorials/12/345-tutorial.psml | Tutorial #12345 | T12345 |
99999 | /tutorials/99/999-tutorial.psml | Tutorial #99999 | T99999 |
100000 | /tutorials/100/000-tutorial.psml | Tutorial #100000 | T100000 |
Example 3: article
Articles organized by date of creation.
<creation> <title>Article</title> <folder context="/articles" path="{YYYY}/{MM}/{DD}"/> <filename value="{N}-{$ui.title}" transform="charfolding,lowercase,hyphen,trim"/> <description>Articles organized by date.</description> </creation>
The files would be created as follows:
# | Date | Title | Path |
---|---|---|---|
1 | 2 Jan 03 | Hello World! | /articles/2003/01/03/1-hello-world.psml |
2 | 10 Sep 09 | Café? | /articles/2009/09/10/2-cafe.psml |
3 | 27 Oct 12 | Yes or No | /articles/2012/10/27/3-yes-or-no.psml |
4 | 27 Oct 12 | The end... | /articles/2012/10/27/4-the-end.psml |