Layout Element (Data)

From HLKitWiki
Revision as of 17:15, 8 March 2011 by Colen (talk | contribs) (→‎The "templateref" Element{{anchor|templateref}})
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Context: HL Kit … Kit Reference … Data File Reference 

The "layout" Element

Layouts contain an assortment of portals and templates that serve a unified purpose when presenting information to the user. Each layout is specified through the use of a "layout" element. The complete list of attributes for this element is below.

id Id – Specifies the unique id of the layout. This id is used in all references to the layout.
marginhorz (Optional) Integer – Specifies the margin gap included at both ends along the horizontal axis. The usable width of the layout is the actual width minus double the horizontal margin. Default: "0".
marginvert (Optional) Integer – Specifies the margin gap included at both ends along the vertical axis. The usable height of the layout is the actual height minus double the vertical margin. Default: "0".

The "layout" element also possesses child elements that define various facets of the layout. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.

live An optional "live" element may appear as defined by the given link. This element defines a Live Tag Expression that determines whether the template is shown to the user.
portalref Zero or more "portalref" elements may appear as defined by the given link. This element specifies the individual portals which are utilized within the layout.
templateref Zero or more "templateref" elements may appear as defined by the given link. This element specifies the individual templates which are utilized within the layout.
position An optional "position" element may appear as defined by the given link. This element defines a Position Script through which the portals are sized and positioned within the template.

The "live" Element

The "live" element defines a Live Tag Expression for the layout, which determines whether the layout is shown. The tag expression is compared against the tags assigned to the container associated with the layout (e.g. the actor). If the tag expression is satisfied, the layout is visible, else it is hidden. The complete list of attributes for this element is below.

PCDATA TagExpr – Specifies the code comprising the Live tag expression.

The "portalref" Element

The "portalref" element identifies a portal used within the layout and assigns it a logical name for use within the Position script. The complete list of attributes for this element is below.

portal Id – Unique id of the portal to be utilized within the layout.
reference (Optional) Id – Specifies the alternate unique id to be used when referencing this portal within the Position script. This makes it possible to re-use the same portal more than once within the same layout, giving each instance a different logical id. If empty, the reference id is simply the portal id. Default: Empty.
taborder (Optional) Integer – Specifies the relative tab order position of the portal and its contents within the overall layout. As long as the tab orders are different for all portals and templates within the layout, HL can properly sequence the flow of control. Default: "0".

The "templateref" Element

The "templateref" element identifies a template used within the layout and assigns it a logical name for use within the Position script. The complete list of attributes for this element is below.

template Id – Unique id of the template to be utilized within the layout.
reference (Optional) Id – Specifies the alternate unique id to be used when referencing this template within the Position script. This makes it possible to re-use the same template more than once within the same layout, giving each instance a different logical id. If empty, the reference id is simply the template id. Default: Empty.
thing (Optional) Id – Specifies the unique id of the thing or pick that is associated with this template. The given object is used with the template when determining the contents of fields and such. If empty, no thing/pick is associated with the template, which means that the template cannot contain any portals that utilize a field reference. Default: Empty.
dynamic (Optional) Boolean – Instead of specifying a thing, you can flag a template as "dynamic". This means that instead of using a specific pick, the template uses the "dynamic pick" to as its context, for determining field contents and so on. The dynamic pick is only set if the layout is used on a form that's summoned via a pick (usually by clicking a button on a template for that pick); it is set to the pick from which the form was summoned. Default: "no".
ispick (Optional) Boolean – Indicates whether the template is associated with a pick or a thing. If a pick, the first pick within the container that based on the specified thing is used. Default: "yes".
taborder (Optional) Integer – Specifies the relative tab order position of the template and its contents within the overall layout. As long as the tab orders are different for all portals and templates within the layout, HL can properly sequence the flow of control. Default: "0".

The "position" Element

The "position" element defines a Position Script for the layout, which performs all the appropriate sizing and positioning of the contained portals and templates within the region of the layout. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Position script.

Example

The following example demonstrates what a "layout" element might look like. All default values are assumed for optional attributes.

<layout id="journal">
  <portalref portal="jrTitle"/>
  <portalref portal="journal" taborder="10"/>
  <templateref template="jrHeader" thing="actor"/>
  <position>
    ~configure whether our header is visible or not
    ~Note: If the header is non-visible, no space is allotted for it below.
    template[jrHeader].visible = 1

    ~position the title at the top, followed by the template, and then the table
    perform portal[jrTitle].autoplace
    perform template[jrHeader].autoplace[6]
    perform portal[journal].autoplace[9]
    </position>
  </layout>