How to Create/Edit an Edit Layout Template I. Introduction Edit Layout Templates allow WebSite Director (WSD) administrators to provide complete control over the data entry form when Page Layout Templates are used. This allows template designers to create data entry formats that are different from the layouts used when the content is actually published to the web site. Edit Layout templates are created the same way as Page Layout Templates, and provide some enhancements over the command sets used to build Page Layout Templates. When creating Edit Layout Templates, designers can use HTML controls to
Edit Layout Templates are stored in the "editlayout" templates directory and are listed as a separate template Category in Maintain Templates. II. Implementing Edit Layout Templates (Initial Release)Edit Layout Templates are an optional component when using Page Layout Templates. If a Page Layout Template does not have an associated Edit Layout Template, the Page Layout Template is used as the basis for data entry. Edit Layout Templates are assigned to a new WSD update request by setting the "editlayout" property using a "SetProperty" template command in a Page Layout Template. In this initial release, the WSD "Submit New Request" function does not have a way to select Edit Layout Templates independently from the Page Layout Template selection. Example: To associate the "sample.edit_layout" Edit Layout Template with the "sample.template" Page-Layout Template, include the following command at the top of the "sample.template" template: SetProperty editlayout = "sample.edit_layout" When a content contributor enters the Create/Edit Online screen, WSD checks the request properties for the "editlayout" property. If that property exists, WSD loads the specified Edit Layout Template into the Create/Edit Online screen (between the "Editing ...." title at the top and the row of buttons at the bottom). Because only the Page Layout Template can be selected on the request's Properties screen, the Page Layout Template designer can associate different Edit Layout Templates with the same Page Layout Template
This allows different content contributors to manage distinct page elements within the same content by using different Edit Layout Templates. III. Creating Edit Layout TemplatesThe Edit Layout Template is a data entry form, and can contain any valid HTML statement. The Edit Layout Template will be placed within the WSD-generated page, allowing content contributors to enter information for approval and publishing. As such, you should take care when using HTML <HEAD> and <BODY> tags, because some browsers may not allow imbedded documents. The data entry form can have the same look and feel as the published document, or it may contain only a subset of the template fields used in the Page Layout Template. When an Edit Layout Template contains only a subset of fields, the fields not referenced will not be modified by WSD during editing. In addition to WSD’s Page Layout Template commands, the data entry form can contain Javascript validation code and any other processing allowed in a traditional HTML form except the <FORM> tag. The Create/Edit Online screen created by WSD provides the <HEAD>, <BODY>, and <FORM> tags used for data entry in the screen. The Edit Layout Template can contain the same layout template field tags as Page Layout Templates, and they are processed in the same way. However, the only required attribute in template field tags in Edit Layout templates is the "name=" attribute that identifies the corresponding field on the associated Page Layout Template. When additional template field attributes are defined on an Edit Layout template, these attributes will override the corresponding attribute from the Page Layout Template. Example: You can remove the prompt value defined in the Page Layout Template by setting 'prompt=" "' in the Edit Layout Template. In addition to regular WSD template field tags, standard HTML form fields can be defined in the Edit Layout Template using traditional HTML form field tags (i.e. "<INPUT>", "<SELECT>", etc.). To allow WSD to match up selected values with the equivalent fields in the Page Layout Template, the field name specified in the HTML form field must match the Page Layout Template field name. To prevent name collisions with internal WSD fields in the same form, references to Page Layout Template field names are made in the form $<name>$ where <name> is the template field name from the Page Layout Template (i.e. "NewsReleaseYear"). The "$<name>$ reference can be used in any HTML statement, including HIDDEN fields. To refer to the value of a WSD field anywhere on the form, use the format: "{$<name>$}".
The following annotation is required when you want WSD to associate previously entered <OPTION>, <INPUT type=RADIO>, and <INPUT type=CHECKBOX> field values to render them properly when content contributors are modifying existing content. There are three elements associated with any of these fields when they are to be rendered by WSD. These are:
The format of this reference is: {$<name>$:"<value>":"<keyword>"} The following example is taken from the "sample.edit_layout" template. It allows WSD to properly show the actual selected value (i.e. "2001" if it was selected during initial entry) from the existing content when WSD displays it during content modification. HTML used for data entry/selection:
Template designers can also reference Page Layout Template variables in creating Javascript code that manipulates one or more data entry <FORM> field variables to calculate values to be stored in content maintained by Page Layout Templates. V. Example 2 – Javascript in Edit Layout Templates The following example is taken from the "sample2.edit_layout" template. It shows the use of javascript to join multiple data entry fields (data values selected for 3 <SELECT> fields named "NewsReleaseMonth," "NewsReleaseDay," and "NewsReleaseYear") to be placed into a single Page Layout Template field named "NewsReleaseDate" in such a manner that WSD can properly render it back to the content contributor when the content is later modified. The example has 3 parts, placed in different locations of the Edit Layout template. Part 1 precedes the other page content. Part 2 is placed at the location in the template where the content contributor actually chooses the information to be stored in the content. Part 3 is placed at the end of the Edit Layout template and used by WSD to place/replace the calculated value in the content file. Part 1, precedes template commands:
Part 2, used for data entry/selection:
Part 3, parses previously entered value before page is displayed:
VI. Example 3 – Creating a "Preview" button for a selected image The following example is taken from the "sample.edit_layout" template. It uses javascript to create an "Image Preview Button" in an Edit Layout Template. This button allows a content contributor to preview the currently selected image for a Page Layout Template image insertion command without having to preview the entire page. As with all javascript examples, this one has multiple parts.
The following shows the format used for this example
<script language="JavaScript"> <!— function preview$<variable-name>$() { var window_opts = 'toolbar=no,location=no,directories=no,status=no,width=220,height=300, ' + 'menubar=no,scrollbars=yes,resizable=yes'; var icon_field = document.EditOnline.$<variable-name>$; if (icon_field.selectedIndex == 0) { alert('<error message text if variable has not been selected>'); return; } var icon = icon_field.options[icon_field.selectedIndex].value; var url='<base URL to directory from which content for variable-name was selected>' + icon; win = window.open(url,'preview_Icon',window_opts); win.focus(); } //--> </script>
|