

Renderer Template File

The renderer template file is a control file for a simple macro-based processing language.  The language consists of three commands at this point, as follows:

[repeat <object_type>]...[end]
  
  this outputs its contents once for each "object" of <object_type>.  <object_type> can be one of "selection", "theme" or "group".

[if <attribute> <=|!=> <value>]...[end]
  
  this is a conditional statement to output some contents only if the conditional statement evaluates to true.  It tests an attribute of the current object against some value (= is equal, != is not equal).  Currently this only supports the "selected" attribute and the associated values are "true" or "false".  

[<attribute>]

  this outputs an attribute of the current object.

For processing context selector rendering files, the following objects and attributes are available:

"selection" : There is one selection object for each selection tag in the cwc2 template that defines the context selector widget.  The attributes of the "selection" object are:

 * selection_selected : true or false depending on whether the "selection" object is the currently selected one or not.
 * selection_name : the display name of this selection
 * selection_template : the name of the cwc2 template associated with this selection
 * selection_themefile : the name of the ContextSelector theme file that controls this selection
 * selection_contextfile : the name of a Context file to load with this selection
 * selection_rendererfile : the name of a rendering template file used to process the user interface for this selection
 * selection_url : a javascript function call that can be invoked to switch to the new context.

"theme" : There is one theme object for each theme tag in each selection.  The attributes of the "theme" object are:

 * theme_name : the name of the theme
 * theme_type : the input type of the theme control, one of "radio" or "checkbox"
 * theme_abstract : a string containing a textual description of the theme
 * theme_bold : whether or not the theme name is to be displayed in bold, "true" or "false".
 * theme_font : the font to display the theme name in
 * theme_font_size : the font size to display the theme name in
 * theme_icon : the icon to display for the theme
 * theme_input : this is the html associated with an input box for the current theme
 * theme_url : this is a hyperlink to display metadata for the current theme
 * theme_numlayers : the sum of all the layers in all the groups, based on the layers available in the current context.

"group" : There is one "group" object for each "group" tag inside each theme tag.  The attributes of a "group" object are:

 * group_name : the name of the group
 * group_abstract : a string containing a textual description of the group
 * group_visible : controls the display of the group icon
 * group_bold : whether or not the group name is to be displayed in bold, "true" or "false".
 * group_font : the font to display the group name in
 * group_font_size : the font size to display the group name in
 * group_icon : the icon to display for the group
 * group_input : this is the html associated with an input box for the current group
 * group_url : this is a hyperlink to display metadata for the current group
 * group_numlayers : the number of layers that are available for this group from the current context
 
The following is a sample of a very simple renderer file:

<table>
  <tr>
[repeat selection]
  [if selection_selected = "true"]
    <td><b>[selection_name]</b></td>
  [else]
    <td><a href="[selection_url]">[selection_name]</a></td>
  [end]
[end]
  </tr>
[if selection_selected = "true"]
  [repeat theme]
  <tr>
    <td><img src="[theme_icon]"></td>
    [if theme_numlayers = "0"]
    <td colspan="2">[theme_name]</td>
    [else]
    <td>[theme_input]</td>
    <td><a href="[theme_url]"><font name="[theme_font]" size="[theme_font_size]">[theme_name]</font></a></td>
    [end]
  </tr>
    [repeat group]
      [if group_visible = "true"]
  <tr>
    <td><img src="[group_icon]"></td>
    [if group_numlayers = "0"]
    <td colspan="2">[group_name]</td>
    [else]
    <td>[group_input]</td>
    <td><a href="[group_url]"><font name="[group_font]" size="[group_font_size]">[group_name]</font></a></td>
    [end]
  </tr>
      [end]
    [end]
  [end]
[end]
</table>

