Workflows/Workflow Format
Workflows | ||
Workflow Format | Components → | |
Template:Workflows |
Workflow Format
File Structure
The EPrints workflow file is written in XML, and follows the following structure:
<workflow xmlns="http://eprints.org/ep3/workflow" xmlns:ep="http://eprints.org/ep3/"> <flow> <stage ref="first_stage" /> <stage ref="second_stage" /> </flow> <stage name="first_stage"> <component>...</component> ... </stage> ... </workflow>
The <flow> structure defines the path taken through the workflow - in this case, from first_stage to second_stage. It is straightforward to embed EPScript in the flow block (as well as throughout the workflow) to provide more complex flows. For example, to only include a certain stage for a specific EPrint type:
<flow> <ep:if test="type = 'thesis'"> <stage ref="thesis_stage"> </ep:if> ... </flow>
The ref attribute of the <stage> element corresponds directly to the <stage>'s name attribute later in the workflow.
Stages
While the flow element contained a list of stages to handle, the stage contains a list of components to render. Again, the stage may contain EPScript to customize the components rendered. For example, the default EPrint workflow contains the following to ensure the 'presentation type' field is only visible for conference items:
<stage name="example_stage"> <ep:if test="type = 'conference_item'"> <component><field ref="pres_type" required="yes" /></component> </ep:if> ... </stage>
Each component within a stage may have use any or none of the following attributes:
- type (defaults to Field): The type of component to use (see the next section for components bundled with EPrints 3).
- collapse (defaults to no): If yes, the component is initially collapsed. This hides the fields from the user unless they expand the component.
- surround (defaults to Default): The surround is responsible for the 'look and feel' of the component. It renders the help, title, and the container in which the component's content is placed. It may be useful to create a custom surround based on the Default surround class, or to use the None surround, which renders nothing except the component content.
The content of the <component> element is handled by the component itself, so may vary depending on its function. Again, the <component> content may contain EPScript to allow for dynamic configuration.