22Customising Roundup
33===================
44
5- :Version: $Revision: 1.30 $
5+ :Version: $Revision: 1.31 $
66
77.. This document borrows from the ZopeBook section on ZPT. The original is at:
88 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
99
1010.. contents::
11-
11+ :depth: 1
1212
1313What You Can Do
1414===============
@@ -437,6 +437,10 @@ XXX example
437437Web Interface
438438=============
439439
440+ .. contents::
441+ :local:
442+ :depth: 1
443+
440444The web is provided by the roundup.cgi.client module and is used by
441445roundup.cgi, roundup-server and ZRoundup.
442446In all cases, we determine which tracker is being accessed
@@ -536,14 +540,14 @@ action to take place. As described in `how requests are processed`_, the
536540action is performed before the requested page is generated. Actions are
537541triggered by using a ``:action`` CGI variable, where the value is one of:
538542
539- login
543+ ** login**
540544 Attempt to log a user in.
541- logout
545+ ** logout**
542546 Log the user out - make them "anonymous".
543- register
547+ ** register**
544548 Attempt to create a new user based on the contents of the form and then log
545549 them in.
546- edit
550+ ** edit**
547551 Perform an edit of an item in the database. There are some special form
548552 elements you may use:
549553
@@ -560,16 +564,16 @@ edit
560564 :required=property,property,...
561565 The named properties are required to be filled in the form.
562566
563- new
567+ ** new**
564568 Add a new item to the database. You may use the same special form elements
565569 as in the "edit" action.
566570
567- editCSV
571+ ** editCSV**
568572 Performs an edit of all of a class' items in one go. See also the
569573 *class*.csv templating method which generates the CSV data to be edited, and
570574 the "_generic.index" template which uses both of these features.
571575
572- search
576+ ** search**
573577 Mangle some of the form variables.
574578
575579 Set the form ":filter" variable based on the values of the
@@ -590,29 +594,29 @@ Each action also has a corresponding *actionPermission* (where
590594whether the action is permissible given the current user. The base permission
591595checks are:
592596
593- login
597+ ** login**
594598 Determine whether the user has permission to log in.
595599 Base behaviour is to check the user has "Web Access".
596- logout
600+ ** logout**
597601 No permission checks are made.
598- register
602+ ** register**
599603 Determine whether the user has permission to register
600604 Base behaviour is to check the user has "Web Registration".
601- edit
605+ ** edit**
602606 Determine whether the user has permission to edit this item.
603607 Base behaviour is to check the user can edit this class. If we're
604608 editing the "user" class, users are allowed to edit their own
605609 details. Unless it's the "roles" property, which requires the
606610 special Permission "Web Roles".
607- new
611+ ** new**
608612 Determine whether the user has permission to create (edit) this item.
609613 Base behaviour is to check the user can edit this class. No
610614 additional property checks are made. Additionally, new user items
611615 may be created if the user has the "Web Registration" Permission.
612- editCSV
616+ ** editCSV**
613617 Determine whether the user has permission to edit this class.
614618 Base behaviour is to check the user can edit this class.
615- search
619+ ** search**
616620 Determine whether the user has permission to search this class.
617621 Base behaviour is to check the user can view this class.
618622
@@ -623,29 +627,29 @@ Default templates
623627Most customisation of the web view can be done by modifying the templates in
624628the tracker **html** directory. There are several types of files in there:
625629
626- page
630+ ** page**
627631 This template defines the overall look of your tracker. When you
628632 view an issue, it appears inside this template. When you view an index, it
629633 also appears inside this template. It will have a ``tal:content`` or
630634 ``tal:replace`` command with the expression ``structure content`` which
631635 will show the issue, list of issues or whatever.
632- home
636+ ** home**
633637 the default page displayed when no other page is indicated by the user
634- home.classlist
638+ ** home.classlist**
635639 a special version of the default page that lists the classes in the tracker
636- *classname* .item
640+ **classname .item**
637641 displays an item of the *classname* class
638- *classname* .index
642+ **classname .index**
639643 displays a list of *classname* items
640- *classname* .search
644+ **classname .search**
641645 displays a search page for *classname* items
642- _generic.index
646+ ** _generic.index**
643647 used to display a list of items where there is no *classname*.index available
644- _generic.help
648+ ** _generic.help**
645649 used to display a "class help" page where there is no *classname*.help
646- user.register
650+ ** user.register**
647651 a special page just for the user class that renders the registration page
648- style.css
652+ ** style.css**
649653 a static file that is served up as-is
650654
651655How the templates work
@@ -655,7 +659,7 @@ Roundup's templates consist of special attributes on your template tags. These
655659attributes form the Template Attribute Language, or TAL. The commands are:
656660
657661
658- tal:define="variable expression; variable expression; ..."
662+ ** tal:define="variable expression; variable expression; ..."**
659663 Define a new variable that is local to this tag and its contents. For
660664 example::
661665
@@ -667,7 +671,7 @@ tal:define="variable expression; variable expression; ..."
667671 expression "request/description". The tal:content command inside the <html>
668672 tag may then use the "title" variable.
669673
670- tal:condition="expression"
674+ ** tal:condition="expression"**
671675 Only keep this tag and its contents if the expression is true. For example::
672676
673677 <p tal:condition="python:request.user.hasPermission('View', 'issue')">
@@ -680,7 +684,7 @@ tal:condition="expression"
680684 values. Nearly every other value is true, including non-zero numbers, and
681685 strings with anything in them (even spaces!).
682686
683- tal:repeat="variable expression"
687+ ** tal:repeat="variable expression"**
684688 Repeat this tag and its contents for each element of the sequence that the
685689 expression returns, defining a new local variable and a special "repeat"
686690 variable for each element. For example::
@@ -694,7 +698,7 @@ tal:repeat="variable expression"
694698 The example would iterate over the sequence of users returned by
695699 "user/list" and define the local variable "u" for each entry.
696700
697- tal:replace="expression"
701+ ** tal:replace="expression"**
698702 Replace this tag with the result of the expression. For example::
699703
700704 <span tal:replace="request/user/realname"></span>
@@ -703,7 +707,7 @@ tal:replace="expression"
703707 realname. If the user's realname was "Bruce" then the resultant output
704708 would be "Bruce".
705709
706- tal:content="expression"
710+ ** tal:content="expression"**
707711 Replace the contents of this tag with the result of the expression. For
708712 example::
709713
@@ -713,7 +717,7 @@ tal:content="expression"
713717 realname. If the user's realname was "Bruce" then the resultant output
714718 would be "<span>Bruce</span>".
715719
716- tal:attributes="attribute expression; attribute expression; ..."
720+ ** tal:attributes="attribute expression; attribute expression; ..."**
717721 Set attributes on this tag to the results of expressions. For example::
718722
719723 <a tal:attributes="href string:user${request/user/id}">My Details</a>
@@ -722,7 +726,7 @@ tal:attributes="attribute expression; attribute expression; ..."
722726 the "string:user${request/user/id}" expression, which will be something
723727 like "user123".
724728
725- tal:omit-tag="expression"
729+ ** tal:omit-tag="expression"**
726730 Remove this tag (but not its contents) if the expression is true. For
727731 example::
728732
@@ -744,7 +748,7 @@ which would othewise require an illegal tag placement to effect the repeat).
744748The expressions you may use in the attibute values may be one of the following
745749three forms:
746750
747- Path Expressions - eg. ``item/status/checklist``
751+ ** Path Expressions** - eg. ``item/status/checklist``
748752 These are object attribute / item accesses. Roughly speaking, the path
749753 ``item/status/checklist`` is broken into parts ``item``, ``status``
750754 and ``checklist``. The ``item`` part is the root of the expression.
@@ -759,12 +763,12 @@ Path Expressions - eg. ``item/status/checklist``
759763
760764 XXX "nothing" and "default"
761765
762- String Expressions - eg. ``string:hello ${user/name}``
766+ ** String Expressions** - eg. ``string:hello ${user/name}``
763767 These expressions are simple string interpolations (though they can be just
764768 plain strings with no interpolation if you want. The expression in the
765769 ``${ ... }`` is just a path expression as above.
766770
767- Python Expressions - eg. ``python: 1+1``
771+ ** Python Expressions** - eg. ``python: 1+1``
768772 These expressions give the full power of Python. All the "root level"
769773 variables are available, so ``python:item.status.checklist()`` would be
770774 equivalent to ``item/status/checklist``, assuming that ``checklist`` is
@@ -773,14 +777,14 @@ Python Expressions - eg. ``python: 1+1``
773777Information available to templates
774778----------------------------------
775779
776- The following variables are available to templates.
780+ Note: this is implemented by roundup.cgi.templating.RoundupPageTemplate
777781
778- .. taken from roundup.cgi.templating.RoundupPageTemplate docstring
782+ The following variables are available to templates.
779783
780- *context*
784+ ** context* *
781785 The current context. This is either None, a
782786 `hyperdb class wrapper`_ or a `hyperdb item wrapper`_
783- *request*
787+ ** request* *
784788 Includes information about the current request, including:
785789 - the url
786790 - the current index information (``filterspec``, ``filter`` args,
@@ -790,11 +794,11 @@ The following variables are available to templates.
790794 - *form*
791795 The current CGI form information as a mapping of form argument
792796 name to value
793- *tracker*
797+ ** tracker* *
794798 The current tracker
795- *db *
799+ **db* *
796800 The current database, through which db.config may be reached.
797- *nothing*
801+ ** nothing* *
798802 This is a special variable - if an expression evaluates to this, then the
799803 tag (in the case of a tal:replace), its contents (in the case of
800804 tal:content) or some attributes (in the case of tal:attributes) will not
@@ -806,7 +810,7 @@ The following variables are available to templates.
806810
807811 <span>Hello, World!</span>
808812
809- *default*
813+ ** default* *
810814 Also a special variable - if an expression evaluates to this, then the
811815 existing HTML in the template will not be replaced or removed, it will
812816 remain. So::
@@ -817,7 +821,7 @@ The following variables are available to templates.
817821
818822 <span>Hello, World!</span>
819823
820- *utils*
824+ ** utils* *
821825 This variable makes available some utility functions like batching.
822826
823827The context variable
@@ -1103,7 +1107,6 @@ An example of batching::
11031107 <td tal:define="batch python:utils.Batch(keywords, 4, start)"
11041108 tal:repeat="keyword batch" tal:content="keyword/name">keyword here</td>
11051109 </tr>
1106- <tr><td colspan="4" style="border-top: 1px solid gray"> </td></tr>
11071110 </table>
11081111
11091112... which will produce a table with four columns containing the items of the
0 commit comments