Skip to content

Commit 0eb6920

Browse files
author
Richard Jones
committed
more doc
1 parent aea67a5 commit 0eb6920

File tree

1 file changed

+44
-103
lines changed

1 file changed

+44
-103
lines changed

doc/customizing.txt

Lines changed: 44 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.21 $
5+
:Version: $Revision: 1.22 $
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
@@ -286,75 +286,6 @@ instance is attempted.::
286286
MAIL_DEFAULT_CLASS = 'issue' # use "issue" class by default
287287
#MAIL_DEFAULT_CLASS = '' # disable (or just comment the var out)
288288

289-
# Define what index links are available in the header, and what their
290-
# labels are. Each key is used to look up one of the index specifications
291-
# below - so 'DEFAULT' will use 'DEFAULT_INDEX'.
292-
# Where the FILTERSPEC has 'assignedto' with a value of None, it will be
293-
# replaced by the id of the logged-in user.
294-
HEADER_INDEX_LINKS = ['DEFAULT', 'UNASSIGNED', 'USER']
295-
296-
# list the classes that users are able to add nodes to
297-
HEADER_ADD_LINKS = ['issue']
298-
299-
# list the classes that users can search
300-
HEADER_SEARCH_LINKS = ['issue']
301-
302-
# list search filters per class
303-
SEARCH_FILTERS = ['ISSUE_FILTER', 'SUPPORT_FILTER']
304-
305-
# Now the DEFAULT display specification. TODO: describe format
306-
DEFAULT_INDEX = {
307-
'LABEL': 'All Issues',
308-
'CLASS': 'issue',
309-
'SORT': ['-activity'],
310-
'GROUP': ['priority'],
311-
'FILTER': ['status'],
312-
'COLUMNS': ['id','activity','title','creator','assignedto'],
313-
'FILTERSPEC': {
314-
'status': ['-1', '1', '2', '3', '4', '5', '6', '7'],
315-
},
316-
}
317-
318-
# The "unsassigned issues" index
319-
UNASSIGNED_INDEX = {
320-
'LABEL': 'Unassigned Issues',
321-
'CLASS': 'issue',
322-
'SORT': ['-activity'],
323-
'GROUP': ['priority'],
324-
'FILTER': ['status', 'assignedto'],
325-
'COLUMNS': ['id','activity','title','creator','status'],
326-
'FILTERSPEC': {
327-
'status': ['-1', '1', '2', '3', '4', '5', '6', '7'],
328-
'assignedto': ['-1'],
329-
},
330-
}
331-
332-
# The "my issues" index -- note that the user's id will replace the
333-
# 'CURRENT USER' value of the "assignedto" filterspec
334-
USER_INDEX = {
335-
'LABEL': 'My Issues',
336-
'CLASS': 'issue',
337-
'SORT': ['-activity'],
338-
'GROUP': ['priority'],
339-
'FILTER': ['status', 'assignedto'],
340-
'COLUMNS': ['id','activity','title','creator','status'],
341-
'FILTERSPEC': {
342-
'status': ['-1', '1', '2', '3', '4', '5', '6', '7'],
343-
'assignedto': 'CURRENT USER',
344-
},
345-
}
346-
347-
ISSUE_FILTER = {
348-
'CLASS': 'issue',
349-
'FILTER': ['status', 'priority', 'assignedto', 'creator']
350-
}
351-
352-
SUPPORT_FILTER = {
353-
'CLASS': 'issue',
354-
'FILTER': ['status', 'priority', 'assignedto', 'creator']
355-
}
356-
357-
358289
Instance Schema
359290
---------------
360291

@@ -406,6 +337,8 @@ defined using Python code. The "classic" schema looks like this::
406337
("status"))
407338
issue.setkey('title')
408339

340+
XXX security definitions
341+
409342
Classes and Properties - creating a new information store
410343
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
411344

@@ -592,7 +525,7 @@ the access through its main() method. This means that you can do pretty much
592525
anything you want as a web interface to your instance.
593526

594527
Figuring out what is displayed
595-
::::::::::::::::::::::::::::::
528+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
596529

597530
Most customisation of the web view can be done by modifying the templates in
598531
the instance **html** directory. There are several types of files in there:
@@ -613,13 +546,15 @@ home.classlist
613546
displays a search page for *classname* items
614547
_generic.index
615548
used to display a list of items where there is no *classname*.index available
549+
_generic.help
550+
used to display a "class help" page where there is no *classname*.help
616551
user.register
617552
a special page just for the user class that renders the registration page
618553
style.css
619554
a static file that is served up as-is
620555

621556
How requests are processed
622-
::::::::::::::::::::::::::
557+
~~~~~~~~~~~~~~~~~~~~~~~~~~
623558

624559
The basic processing of a web request proceeds as follows:
625560

@@ -643,7 +578,7 @@ In some situations, exceptions occur:
643578
this exception percolates up to the CGI interface that called the client
644579

645580
Determining web context
646-
:::::::::::::::::::::::
581+
~~~~~~~~~~~~~~~~~~~~~~~
647582

648583
To determine the "context" of a request, we look at the URL and the special
649584
request variable ``:template``. The URL path after the instance identifier
@@ -690,7 +625,7 @@ which defaults to:
690625

691626

692627
Performing actions in web requests
693-
::::::::::::::::::::::::::::::::::
628+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
694629

695630
When a user requests a web page, they may optionally also request for an
696631
action to take place. As described in `how requests are processed`_, the
@@ -802,14 +737,11 @@ for example.
802737
How the templates work
803738
~~~~~~~~~~~~~~~~~~~~~~
804739

805-
Roundup's templates consist of two core technologies:
740+
Roundup's templates consist of special attributes on your template tags. These
741+
attributes form the Template Attribute Language, or TAL. The commands are:
806742

807-
TAL - Template Attribute Language
808-
This is the syntax which is woven into the HTML using the ``tal:`` tag
809-
attributes. A TAL parser pulls out the TAL commands from the attributes
810-
runs them using some expression engine. TAL gives us the following commands:
811743

812-
tal:define="variable expression; variable expression; ..."
744+
tal:define="variable expression; variable expression; ..."
813745
Define a new variable that is local to this tag and its contents. For
814746
example::
815747

@@ -821,7 +753,7 @@ TAL - Template Attribute Language
821753
expression "request/description". The tal:content command inside the <html>
822754
tag may then use the "title" variable.
823755

824-
tal:condition="expression"
756+
tal:condition="expression"
825757
Only keep this tag and its contents if the expression is true. For example::
826758

827759
<p tal:condition="python:request.user.hasPermission('View', 'issue')">
@@ -834,7 +766,7 @@ TAL - Template Attribute Language
834766
values. Nearly every other value is true, including non-zero numbers, and
835767
strings with anything in them (even spaces!).
836768

837-
tal:repeat="variable expression"
769+
tal:repeat="variable expression"
838770
Repeat this tag and its contents for each element of the sequence that the
839771
expression returns, defining a new local variable and a special "repeat"
840772
variable for each element. For example::
@@ -848,7 +780,7 @@ TAL - Template Attribute Language
848780
The example would iterate over the sequence of users returned by
849781
"user/list" and define the local variable "u" for each entry.
850782

851-
tal:replace="expression"
783+
tal:replace="expression"
852784
Replace this tag with the result of the expression. For example::
853785

854786
<span tal:replace="request/user/realname"></span>
@@ -857,7 +789,7 @@ TAL - Template Attribute Language
857789
realname. If the user's realname was "Bruce" then the resultant output
858790
would be "Bruce".
859791

860-
tal:content="expression"
792+
tal:content="expression"
861793
Replace the contents of this tag with the result of the expression. For
862794
example::
863795

@@ -867,7 +799,7 @@ TAL - Template Attribute Language
867799
realname. If the user's realname was "Bruce" then the resultant output
868800
would be "<span>Bruce</span>".
869801

870-
tal:attributes="attribute expression; attribute expression; ..."
802+
tal:attributes="attribute expression; attribute expression; ..."
871803
Set attributes on this tag to the results of expressions. For example::
872804

873805
<a tal:attributes="href string:user${request/user/id}">My Details</a>
@@ -876,7 +808,7 @@ TAL - Template Attribute Language
876808
the "string:user${request/user/id}" expression, which will be something
877809
like "user123".
878810

879-
tal:omit-tag="expression"
811+
tal:omit-tag="expression"
880812
Remove this tag (but not its contents) if the expression is true. For
881813
example::
882814

@@ -886,21 +818,19 @@ TAL - Template Attribute Language
886818

887819
Hello, world!
888820

889-
Note that the commands on a given tag are evaulated in the order above, so
890-
*define* comes before *condition*, and so on.
821+
Note that the commands on a given tag are evaulated in the order above, so
822+
*define* comes before *condition*, and so on.
891823

892-
Additionally, a tag is defined, tal:block, which is removed from output. Its
893-
content is not, but the tag itself is (so don't go using any tal:attributes
894-
commands on it). This is useful for making arbitrary blocks of HTML
895-
conditional or repeatable (very handy for repeating multiple table rows,
896-
which would othewise require an illegal tag placement to effect the repeat).
824+
Additionally, a tag is defined, tal:block, which is removed from output. Its
825+
content is not, but the tag itself is (so don't go using any tal:attributes
826+
commands on it). This is useful for making arbitrary blocks of HTML
827+
conditional or repeatable (very handy for repeating multiple table rows,
828+
which would othewise require an illegal tag placement to effect the repeat).
897829

898-
TALES - TAL Expression Syntax
899-
The expression engine used in this case is TALES, which runs the expressions
900-
that form the tag attribute values. TALES expressions come in three
901-
flavours:
830+
The expressions you may use in the attibute values may be one of the following
831+
three forms:
902832

903-
Path Expressions - eg. ``item/status/checklist``
833+
Path Expressions - eg. ``item/status/checklist``
904834
These are object attribute / item accesses. Roughly speaking, the path
905835
``item/status/checklist`` is broken into parts ``item``, ``status``
906836
and ``checklist``. The ``item`` part is the root of the expression.
@@ -912,14 +842,15 @@ TALES - TAL Expression Syntax
912842
they are the default expression type, so it's not necessary.
913843

914844
XXX | components of expressions
845+
915846
XXX "nothing" and "default"
916847

917-
String Expressions - eg. ``string:hello ${user/name}``
848+
String Expressions - eg. ``string:hello ${user/name}``
918849
These expressions are simple string interpolations (though they can be just
919850
plain strings with no interpolation if you want. The expression in the
920851
``${ ... }`` is just a path expression as above.
921852

922-
Python Expressions - eg. ``python: 1+1``
853+
Python Expressions - eg. ``python: 1+1``
923854
These expressions give the full power of Python. All the "root level"
924855
variables are available, so ``python:item.status.checklist()`` would be
925856
equivalent to ``item/status/checklist``, assuming that ``checklist`` is
@@ -950,9 +881,13 @@ The following variables are available to templates.
950881
The current instance
951882
*db*
952883
The current database, through which db.config may be reached.
884+
*nothing*
885+
XXX a special variable
886+
*default*
887+
XXX a special variable
953888

954889
The context variable
955-
::::::::::::::::::
890+
::::::::::::::::::::
956891

957892
The *context* variable is one of three things based on the current context
958893
(see `determining web context`_ for how we figure this out):
@@ -990,7 +925,13 @@ user a HTMLUser instance for this user
990925
classname the current classname (possibly None)
991926
template the current template (suffix, also possibly None)
992927
form the current CGI form variables in a FieldStorage
993-
**Index page specific variables (indexing arguments)**
928+
=========== ================================================================
929+
930+
**Index page specific variables (indexing arguments)**
931+
932+
=========== ================================================================
933+
Variable Holds
934+
=========== ================================================================
994935
columns dictionary of the columns to display in an index page
995936
show a convenience access to columns - request/show/colname will
996937
be true if the columns should be displayed, false otherwise
@@ -999,7 +940,7 @@ group index grouping property (direction, column name)
999940
filter properties to filter the index on
1000941
filterspec values to filter the index on
1001942
search_text text to perform a full-text search on for an index
1002-
----------- ----------------------------------------------------------------
943+
=========== ================================================================
1003944

1004945

1005946
Displaying Properties

0 commit comments

Comments
 (0)