Having created a Template file for our News Article example in the previous chapter, we are all set to go ahead and design a Rules file for the Template. Recall that a Rules file is a simple XML file used to define the various fields in a Template file. Rules files reside in Documentum Web Publisher within the Site Manager | Rules folder in the Docbase. Follow the steps mentioned in the following section to create a Rules file for your Template file. Note that Documentum allows you to associate a particular Rules file with multiple Template files.
In this section, we will discuss the detailed steps for creating a Rules file.
Choose the menu option File | New | Folder. The new folder creation screen comes up as shown in figure 14.2.
Provide a valid name for your custom Rules folder (say Custom_Rules
) and click on the Finish button. You could also attach some ACL (Permission Set) to the custom Rules folder for security reasons, allowing and disallowing certain groups and users from accessing the same. This can be done by clicking on the Permissions tab shown in figure 14.2.
A simple configuration step needs to be performed before you can start using the Rules file editor application. Click on the Preferences button in Web Publisher and go to the Web Developers tab as shown in figure 14.3.
In the Rules Editor section, choose the radio button for Web-based application. Click on Apply and then OK. This ensures that when you create a new Rules file or edit an existing Rules file, Documentum's internal Rules file editor is automatically invoked.
Custom_Rules
and choose menu option File | New | Rule. The new rule creation screen is shown in figure 14.4. Provide some valid name for the rules file (say cust_news_art_rule.xml)
and click on OK.Refer to figure 14.6; select the category that houses the template we created in the previous chapter (News_Articles) and select the checkbox against the Template file (cust_news_art_ templ.xml in our case). Finally, click on OK.
Documentum invokes the Rules file editor as shown in figure 14.7. We can now add Rules to the various fields in the Template file.
All the XML elements in the Template file are shown under the Tree View tab of the Rules editor. You simply need to select these XML elements individually and add Rules to them.
Note that within the Tree View tab, the template XML elements are in a read-only mode, preventing you from modifying the Template file structure. However, by switching to Text View tab, you have the flexibility to alter the structure of XML elements in the associated Template file.
It is recommended to save the Rules file during the creation process by choosing File | Save. At any point of time you can close the Rules editor and exit by choosing the option File | Close.
The following types of widgets can be created in Web Publisher editor for the template XML elements:
As shown in figure 14.8, choose the Graphic option to add a rule for the <BANNERIMG> template element.
Enter a DQL query to populate the selection list:
dm_document where folder(/Test_WebCabinet/Custom_Images)
Note that you need not provide the keywords select * from
.
The assumption here is that there pre-exists a folder Custom_Images
in the Docbase within the Test_WebCabinet
web cabinet containing image files. If it does not exist, create one and place some images within it.
The attribute name to be used in the select query is to be provided, say object_name
. This eventually translates into the following DQL:
select object_name from dm_document where folder(/Test_WebCabinet/Custom_Images)
Click on the Test Query button to check if the entered DQL syntax is correct and find out the query results that will be shown in the widget at run time.
Notice that the Import button has also been added allowing you to import image files from your local machine to the specified folder location within the Docbase.
Similarly, you can create other widgets for the remaining template fields by selecting the Rules editor widget types shown in figure 14.13.
Template XML element |
Rules file widget |
---|---|
BANNERIMG |
Graphic |
IMGALTTEXT |
Textline |
DATE |
Textline |
BODYTEXT |
Content |
REPEATBLOCK |
Repeating Block |
NEXTLINKNAME |
Textline |
NEXTLINKURL |
Textline |
Check-in the newly created Rules file (cust_news_art_rule.xml
) and make the Template file (cust_news_art_templ.xml
) available by clicking the Make Available button as discussed in the previous chapter.
For your convenience, shown next are some screenshots taken while creating Rules for the remaining template XML elements. You may treat these as guidelines while creating your Rules files:
Note that the default date format in figure 14.15 has been set as: TODAY+0,MMM dd, yyyy.
Whenever content is created using the News Article template, the News date: field will be pre-populated with that particular day's date in the specified format.
In figure 14.16, numerous formatting options can be selected for the multi-line text field. Additionally, you can choose the checkbox shown against the Links option to allow content authors to create hyperlinks to existing files in Docbase. Link browser formats allows you to specify the various file formats you wish to be displayed for the content authors to choose from. By default, only html and crtext formats are enabled, allowing files with .htm, .html
, and .txt
extensions to be shown.
The <REPEATBLOCK>
template element encloses <NEXTLINKNAME>
and <NEXTLINKURL>
elements, signifying that content authors can provide multiple article link names and their URLs within this block. In order to make <REPEATBLOCK>
a repeating block widget, highlight it and choose menu option Rules | Set Repeating Block, as shown in figure 14.17.
Provide a label and instructional text for the convenience of content authors in the repeating block, as shown in figure 14.18.
18.188.254.131