Differences between revisions 10 and 11
Revision 10 as of 2006-08-14 14:33:38
Size: 3401
Editor: BenGolding
Comment:
Revision 11 as of 2010-07-05 19:49:27
Size: 3452
Editor: 119
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
 * [http://www.research-service.com custom essay]

Albatross's templating engine supports a number of special html tags which interact with the application framework.

XXX Explain order in which namespaces which are searched when resolving variables inctx.locals. Looks in (XXX incomplete and unordered):

  • [http://www.research-service.com custom essay]

  • ctx.locals
  • as a module in the the global namespace of the execution context importing the module in the same module which creates the execution context.

Application tags are the interface between the generation of HTML and the application.

When tags aren't recognised they are just emitted as-is, no error logging is performed. This could be considered a bug but it simplifies the parsing and allows for new tags to be introduced without interfering with existing apps.

  • Application tags
    • <al-value>

      • XXX don't forget the options
    • <al-a>

      • XXX Adds the path to the returned URL.
    • <al-form>

    • <al-input>

      • Each of the al-input types has the same style, each reading and setting a named value in ctx.locals. Here's an example: if check1 isn't already set in your context, your

        page_setup method can initialise it using:

           1     ctx.locals.check1 = 1
        
        Invoke the html in your html view:
            <al-input type="checkbox" name="check1">

        When the page comes back from the server, you can inspect the value in page_process using:

           1     if ctx.local.check1:
           2         selected()
           3     else:
           4         unselected()
        
        Text field:
            <al-input name="text">
        Singleton checkbox:
            <al-input type="checkbox" name="singleton">
        Checkbox group:
            <al-input type="checkbox" name="group" value="check1">
            <al-input type="checkbox" name="group" value="check2">
        Radio buttons:
            <al-input type="radio" name="radio" value="radio1">
            <al-input type="radio" name="radio" value="radio2">
        Option menu: XXX describe how to set up an option list
            <al-select name="select1" optionexpr="option_list1"/>
            <al-select name="select2" optionexpr="option_list2"/>
        Input button
            <al-input type="submit" value="submit">
        XXX example here of how to take different action based on save/cancel buttons
    • <al-select>/<al-option>

    • <al-lookup>/<al-item>

      • Al-lookup does a simple table lookup of a value and is replaced with the matching result or nothing if no value is matched. The following is a table which translates the internal program value into HTML for display.
        <al-lookup name="bug-severity">
         <al-item expr="btsvalues.TRIVIAL"><font color="green">Trivial</font></al-item>
         <al-item expr="btsvalues.MINOR">Minor</al-item>
         <al-item expr="btsvalues.NORMAL">Normal</al-item>
         <al-item expr="btsvalues.MAJOR"><font color="red">Major</font></al-item>
         <al-item expr="btsvalues.CRITICAL"><font color="red"><b>Critical</b></font></al-item>
        </al-lookup>

        We invoke the lookup table by using the lookup attribute of the <al-value> tag.

        Severity: <al-value expr="bug.severity" lookup="bug-severity">
        Note that the btsvalues module does not need to be in the namespace at this point.
  • Flow control
    • <al-for>

    • <al-if>/<al-else>

    • <al-exec>

    • <al-comment>

  • Substitution
    • <al-include>

    • <al-macro>/<al-expand>

None: Tags (last edited 2011-02-15 06:05:18 by localhost)