• No results found

multiple nesting levels

In document Web Publisher Administration Guide (Page 188-200)

Chapter 10 Creating Templates for Web Publisher Editor

1.4 multiple nesting levels

You can create multiple nesting levels in your <repeatdef> element, but we urge caution with this type of structure because multiple nesting levels could affect the usability of

<repeatdef>. The following figure shows an example of a template constructed with a nesting level of five:

Figure 10-13. Multiple nested elds

The following code example shows the template file used to create this figure:

<doc>

<a>

<text/>

<b>

<text/>

<c>

<text/>

<d>

<text/>

<e>

<text/>

</e>

</d>

</c>

</b>

</a>

</doc>

And the corresponding rules file:

<rules>

<repeatdef tag_list="a" label="a" />

<repeatdef tag_list="b" label="b" />

<repeatdef tag_list="c" label="c" />

<repeatdef tag_list="d" label="d" />

<repeatdef tag_list="e" label="e" />

<tagcontent tag_name="text">

<textline label="text" />

</tagcontent>

</rules>

<tabledef> element

This field requires you to replicate the structure of an HTML table within your XML. The root element is associated with the <tabledef> element and corresponds to the <table>

element in an HTML table. You put fields within each cell.

Note: In Web Publisher 5.2 and earlier, the <tabledef> tags do not work in HTML-based Web Publisher Editor templates. For flexibility between Web Publisher versions, use

<tabledef> only in XML-based templates.

Figure 10-14. Table Editor

The following list is an alphabetical grouping of the <tabledef> element’s attributes.

• caption

This element corresponds to the HTML <caption> element. Assign the rules file element used to enter captions. If no field is assigned, a textline field is used. If omitted, <tabledef> does not allow authors to enter captions.

Syntax: rules_file_element_used_to_enter_caption Example: caption=’faq_caption’

• columns

The number of columns in the table. This must correspond to the number of <td>

elements in each table row in the HTML. If omitted, the Editor does not display the <tabledef> element.

Syntax: number_of_columns’

Example: columns=’3’

• instruction

Provides instructions to authors. The instructions appear below a field’s label and in a smaller font. They can be several lines long.

Syntax: string

Example: instruction=’Enter the required pricing information.’

• label

Gives a title to the field.

Syntax: string

Example: label=’Inventory’

• tag_name

The element that corresponds to the HTML <table> element. This element must contain children that correspond to the <tr> and <td> structure of an HTML table. If omitted, no fields will display in a table.

Syntax: element_name Example: tag_name=’FAQ’

• td

The element that corresponds to the HTML <td> element. This element must contain one child that is associated with a field. If omitted, the Editor defaults to ’td’ that is, it looks for a <td> element.

Syntax: element_name Example: td=’faq_td’

• tr

The element that corresponds to the HTML <tr> element. This element must contain children that correspond to HTML <td> elements. If omitted, the Editor defaults to

’tr’ that is, it looks for a <tr> element.

Syntax: element_name Example: tr=’faq_tr’

Sample <tabledef> elements

The <tabledef> element cannot be used in combination with an <xselector> element.

The <tabledef> element requires you to replicate the structure of an HTML table within your XML. The root <table> element is associated with the <tabledef> element. You then put an element within each cell and associate a Web Publisher Editor field with that.

Example 10-17. Tabledef rule

If you have the following XML for a FAQ table:

<FAQs>

Then your <tabledef> rule would read as follows:

<tabledef

tag_name='FAQs' columns='2'

label='Table field'

instruction='Enter a question and answer for each row.'

</tagcontent>

<tagcontent> element in non-XML templates

If you are using Rules Editor, when you create an XML template the <tagcontent>

element is automatically added to the rules file.

When creating any non-XML templates, such as HTML-based templates, you must manually add the <tagcontent> element. Rules Editor does not support non-XML templates. Place the following element in the file where you want the data to be stored:

<dctmEditor teComponentType="myelement">default data

</dctmEditor>

The rules file would read:

<tagcontent tag_name="myelement"></tagcontent>

While we recommend using the <dctmEditor> tag for all non-attribute Web Publisher Editor tags within HTML-based templates, we strongly recommend using the

<dctmEditor> tag whenever the element referred to in the rules file is a <content> element.

Specifically, because of the possibility of improper nesting, do not add the

teComponentType attribute to any other type of tag the <content> element itself produces (especially tags like <b>, <font>, <p> etc.).

Note: If you use a <tagattribute> element, put teComponentType into the tag in which you want the attribute to be stored, as before:

<img border="0" teComponentType="myelement">

The rules file would read:

<tagattribute tag_name="myelement" selected_attr="src">

</tagattribute>

<textarea> element

The <textarea> element creates a text field in which an author can type content you don’t want parsed by an XML parser. Everything inside the <textarea> element is ignored by the parser.

Figure 10-15. Textarea eld

When you include a <textarea> element you can select the Output cdata checkbox in Rule Editor to mark the section in the rules file as a cdata type. cdata types can occur anywhere character data can occur. When you include a cdata type in a <textarea> element, it is clearly marked so that an author using Web Publisher Editor can recognize it.

As an example, if your Web pages include content from third parties that you are not sure parses well, you could place the content inside a <textarea> element with a cdata type.

Example 10-18. Using CDATA

Here is an example of a template file:

<?xml version="1.0" encoding="UTF-8"?>

<BODY>

<CONTENT/>

<SCRIPT>

<![CDATA[

function compare(a,b) {

if (a < b && a < 0) then {

return 1 }

else {

return 0 }

} ]]>

</SCRIPT>

</BODY>

Here is an example of a rules file:

<tagcontent tag_name="SCRIPT">

<textarea columns="20"

instruction="Try not to duplicate information here and in the benefits.

Be sure to spellcheck!"

required="N"

rows="5"

type="cdata">

</textarea>

>/tagcontent>

Here is another example of a template file:

<template>

<content>

Some text here <![CDATA some special chars < > ' " > ]]> end here

</content>

</template>

Here is how it should look like after added a new element outside cdata section:

<template>

<content>

Some text here <cdata><![CDATA some special chars < > ' " > ]]></cdata>end here

</content>

</template>

Here is what the rules file looks like:

<rules>

<tagcontent tag_name="content">

<content activeOnly="Y" align="Y"

bold="Y" color="Y" copy="Y" cut="Y"

enable_locale_fallback="N" fontSize="Y"

formats="html,crtext" htmlTextEdit="Y"

indent="Y" instruction="instr" italic="Y"

label="label" links="Y" orderedLists="Y"

paste="Y" pasteHTML="Y" spellcheck="Y"

symbols="Y" table="Y" unorderedLists="Y" />

</tagcontent>

<tagcontent tag_name="cdata">

<textarea type="cdata" />

</tagcontent>

</rules>

In the figure below, the <textarea> element displays the cdata type selection.

Figure 10-16. cdata support in <textarea> element

The following list is an alphabetical grouping of the <tabledef> element’s attributes.

• label

Functions as a title for the field; displays in bold. If omitted, the Editor will collapse the space normally reserved for the label.

Syntax: string

• instruction

Allows you to provide instructions on what to do with this field; displays below and in a smaller font than the label. The instructions can be several lines long. If omitted, the Editor will collapse the space normally reserved for instructions.

Syntax: string

• readonly

If set to Yes, the author will not be able to enter any data into this field. Displays grayed out. If omitted, the Editor defaults to ’N’.

Syntax: ’Y’ or ’N’

• required

If set to Yes, the author will not be able to save until this field has data entered. The field is marked with a red star. If omitted, the Editor defaults to ’N’.

Syntax: ’Y’ or ’N’

• tag_name

Indicates which elements in the template file use this rule. You can select with this full XML path, or with this name. SeePath rule matching, page 147for more information.

Syntax: fully qualified path OR unqualified name

Example of fully qualified path: tag_name=/doc/faq/question Example of unqualified name: tag_name=question

• type

If set to ’cdata’, then the characters in the field will not be parsed by the parser and will be save as is. If the <!CDATA[" is not present, the Editor will automatically add it.

Syntax: string

String currently only accepts cdata.

• columns

The number of columns to display. If omitted, the Editor defaults to the same width as other fields.

Syntax: string

#

• rows

The number of rows to display. If omitted, the Editor defaults to 10.

Syntax: string

#

<textline> element

The <textline> element displays a single-line text field in which authors type unformatted text, or read comments from the template creator. The text line is either editable or read-only.

Figure 10-17. Unformatted text in Web Publisher Editor

Figure 10-18. Field for Read-only text

The following list is an alphabetical grouping of the <textline> element’s attributes.

• charlength

Sets the maximum number of characters allowed.

Syntax: string

Example: charlength=15

• default

If no data has yet been entered in this textline field when the author opens the file in the Editor, then this attribute displays a date in the textline field as a default. The date displays only if there is no data saved in the element. If this attribute is omitted, the Editor does not default to displaying a date.

Syntax: ’TODAY +/- number_of_days, date_format

where date_format uses the following: MM=month, dd=date of the month, yy=2-digit year, yyyy=4-digit year, hh=hours, mm=minutes

Examples:

default=’TODAY,MM/dd/yyyy’

default=’TODAY+15,dd-MM-yyyy’

default=’TODAY-365,MM-dd-yy hh:mm’

• instruction

Provides instructions to authors. The instructions appear below a field’s label and in a smaller font. They can be several lines long.

Syntax: string

Example: instruction=’Type the name exactly as it appears in the directory.’

• label

Gives a title to the field.

Syntax: string

Example: label=’Employee name’

• maxlength

Syntax: string

Example: maxlength=20

• readonly

If set to ’Y’ authors cannot enter data in the field. If omitted, the Editor defaults to ’N’.

Syntax: ’Y’ or ’N’

Example: readonly=’Y’

• required

If set to ’Y’ authors cannot save until this field has data in it. The field is marked with a red star. If omitted, the Editor defaults to ’N’.

Syntax: ’Y’ or ’N’

Example: required=’Y’

• tag_name

Indicates which elements in the template file use this rule. You can select with this full XML path, or with this name. SeePath rule matching, page 147for more information.

Syntax: fully qualified path OR unqualified name

Example of fully qualified path: tag_name=/doc/faq/question Example of unqualified name: tag_name=question

Sample textline rules

Example 10-19. Textline rule, with data stored as element

<tagcontent tag_name='your_xml_element_here'>

<textline

label='Single-line text field'

instruction='Enter a single line of text.' required='N'

readonly='N' default='' />

</tagcontent>

Example 10-20. Textline rule, with data stored as attribute

<tagattribute tag_name='your_xml_element_here' selected_attr='your_xml_attribute_here'>

<textline

label='Single-line text field'

instruction='Enter a single line of text.' required='N'

readonly='N' default='' />

</tagattribute>

<textselector> element

The <textselector> element displays a file-selection field that lets authors choose text from an existing (targeted) file in the repository to include on the Web page. Authors either choose from a list generated by a pre-defined DQL query or they navigate a specified repository folder hierarchy. In the Editor rules file you specify whether the list is populated by a DQL (Documentum Query Language) query. The DQL query that you use to populate the textselector list can accept reserved words in their where clause that refer to the current object for example, object ID, username, or chronicle ID. When an author highlights a file, Web Publisher Editor displays the file’s text. The

<textselector> element also gives you the option of letting authors import files from outside the repository.

Note: The <textselector> element can be used only for simple text files. If you import a PDF or XML file and preview the content, nothing is displayed for PDF and only the values of XML nodes are displayed for XML.

If you select the file-selection option, the text of the main content file is automatically updated on the website. The targeted file can change at a later time and will not affect the main content file. No additional processing is required to display the targeted text so your website performance should benefit.

If you select the folder hierarchy option, the targeted content file is copied into the main content file. The main content file will not display on the website until the targeted content file is promoted to Active and also available on the website. However, if the targeted file changes, the contents of the main content file are updated in real time to include that change since the website is reading in the contents dynamically.

In document Web Publisher Administration Guide (Page 188-200)

Related documents