From 690dae4f8a83ace6e39cab0ef176ee684b772f12 Mon Sep 17 00:00:00 2001
From: richard
Date: Tue, 24 Jun 2003 00:46:21 +0000
Subject: [PATCH] fix timelog documentation, add new cgi special for variable
doc
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1748 57a73879-2fb5-44c3-a270-3262357dd7e2
---
doc/customizing.txt | 380 +++++++++++++++++++++++---------------------
1 file changed, 202 insertions(+), 178 deletions(-)
diff --git a/doc/customizing.txt b/doc/customizing.txt
index 4592a7a..178808b 100644
--- a/doc/customizing.txt
+++ b/doc/customizing.txt
@@ -2,7 +2,7 @@
Customising Roundup
===================
-:Version: $Revision: 1.89 $
+:Version: $Revision: 1.90 $
.. This document borrows from the ZopeBook section on ZPT. The original is at:
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -750,7 +750,7 @@ Determining web context
-----------------------
To determine the "context" of a request, we look at the URL and the
-special request variable ``:template``. The URL path after the tracker
+special request variable ``@template``. The URL path after the tracker
identifier is examined. Typical URL paths look like:
1. ``/tracker/issue``
@@ -783,7 +783,7 @@ e. if the path starts with an item designator and is longer than one
Both b. and e. stop before we bother to determine the template we're
going to use. That's because they don't actually use templates.
-The template used is specified by the ``:template`` CGI variable, which
+The template used is specified by the ``@template`` CGI variable, which
defaults to:
- only classname suplied: "index"
@@ -796,7 +796,7 @@ Performing actions in web requests
When a user requests a web page, they may optionally also request for an
action to take place. As described in `how requests are processed`_, the
action is performed before the requested page is generated. Actions are
-triggered by using a ``:action`` CGI variable, where the value is one
+triggered by using a ``@action`` CGI variable, where the value is one
of:
**login**
@@ -810,31 +810,12 @@ of:
log them in.
**edit**
- Perform an edit of an item in the database. There are some special form
- elements you may use:
-
- :link=designator:property and :multilink=designator:property
- The value specifies an item designator and the property on that item
- to which *this* item should be added, as a link or multilink.
- :note
- Create a message and attach it to the current item's "messages"
- property.
- :file
- Create a file and attach it to the current item's "files" property.
- Attach the file to the message created from the ``:note`` if it's
- supplied.
- :required=property,property,...
- The named properties are required to be filled in the form.
- :remove:=id(s)
- The ids will be removed from the multilink property. You may have
- multiple ``:remove:`` form elements for a single .
- :add:=id(s)
- The ids will be added to the multilink property. You may have multiple
- ``:add:`` form elements for a single .
+ Perform an edit of an item in the database. There are some `special form
+ variables`_ you may use.
**new**
- Add a new item to the database. You may use the same special form
- elements as in the "edit" action.
+ Add a new item to the database. You may use the same `special form
+ variables`_ as in the "edit" action.
**retire**
Retire the item in the database.
@@ -893,6 +874,139 @@ are:
behaviour is to check whether the user may view this class.
+Special form variables
+----------------------
+
+Item properties and their values are edited with html FORM
+variables and their values. You can:
+
+- Change the value of some property of the current item.
+- Create a new item of any class, and edit the new item's
+ properties,
+- Attach newly created items to a multilink property of the
+ current item.
+- Remove items from a multilink property of the current item.
+- Specify that some properties are required for the edit
+ operation to be successful.
+
+In the following, values are variable, "@" may be
+either ":" or "@", and other text "required" is fixed.
+
+Most properties are specified as form variables:
+
+````
+ property on the current context item
+
+``"@"``
+ property on the indicated item (for editing related information)
+
+Designators name a specific item of a class.
+
+````
+ Name an existing item of class .
+
+``"-"``
+ Name the th new item of class . If the form
+ submission is successful, a new item of is
+ created. Within the submitted form, a particular
+ designator of this form always refers to the same new
+ item.
+
+Once we have determined the "propname", we look at it to see
+if it's special:
+
+``@required``
+ The associated form value is a comma-separated list of
+ property names that must be specified when the form is
+ submitted for the edit operation to succeed.
+
+ When the is missing, the properties are
+ for the current context item. When is
+ present, they are for the item specified by
+ .
+
+ The "@required" specifier must come before any of the
+ properties it refers to are assigned in the form.
+
+``@remove@=id(s)`` or ``@add@=id(s)``
+ The "@add@" and "@remove@" edit actions apply only to
+ Multilink properties. The form value must be a
+ comma-separate list of keys for the class specified by
+ the simple form variable. The listed items are added
+ to (respectively, removed from) the specified
+ property.
+
+``@link@=``
+ If the edit action is "@link@", the simple form
+ variable must specify a Link or Multilink property.
+ The form value is a comma-separated list of
+ designators. The item corresponding to each
+ designator is linked to the property given by simple
+ form variable.
+
+None of the above (ie. just a simple form value)
+ The value of the form variable is converted
+ appropriately, depending on the type of the property.
+
+ For a Link('klass') property, the form value is a
+ single key for 'klass', where the key field is
+ specified in dbinit.py.
+
+ For a Multilink('klass') property, the form value is a
+ comma-separated list of keys for 'klass', where the
+ key field is specified in dbinit.py.
+
+ Note that for simple-form-variables specifiying Link
+ and Multilink properties, the linked-to class must
+ have a key field.
+
+ For a String() property specifying a filename, the
+ file named by the form value is uploaded. This means we
+ try to set additional properties "filename" and "type" (if
+ they are valid for the class). Otherwise, the property
+ is set to the form value.
+
+ For Date(), Interval(), Boolean(), and Number()
+ properties, the form value is converted to the
+ appropriate
+
+Any of the form variables may be prefixed with a classname or
+designator.
+
+Two special form values are supported for backwards compatibility:
+
+@note
+ This is equivalent to::
+
+ @link@messages=msg-1
+ @msg-1@content=value
+
+ except that in addition, the "author" and "date" properties of
+ "msg-1" are set to the userid of the submitter, and the current
+ time, respectively.
+
+@file
+ This is equivalent to::
+
+ @link@files=file-1
+ @file-1@content=value
+
+ The String content value is handled as described above for file
+ uploads.
+
+If both the "@note" and "@file" form variables are
+specified, the action::
+
+ @link@msg-1@files=file-1
+
+is also performed.
+
+We also check that FileClass items have a "content" property with
+actual content, otherwise we remove them from all_props before
+returning.
+
+
+
Default templates
-----------------
@@ -936,9 +1050,9 @@ The *classic* template has a number of additional templates.
Note: Remember that you can create any template extension you want to,
so if you just want to play around with the templating for new issues,
you can copy the current "issue.item" template to "issue.test", and then
-access the test template using the ":template" URL argument::
+access the test template using the "@template" URL argument::
- http://your.tracker.example/tracker/issue?:template=test
+ http://your.tracker.example/tracker/issue?@template=test
and it won't affect your users using the "issue.item" template.
@@ -1369,13 +1483,13 @@ plain render a "plain" representation of the property. This method
If true, escape the text so it is HTML safe (default: no). The
reason this defaults to off is that text is usually escaped
at a later stage by the TAL commands, unless the "structure"
- option is used in the template. The following are all
- equivalent::
+ option is used in the template. The following ``tal:content``
+ expressions are all equivalent::
-
-
-
-
+ "structure python:msg.content.plain(escape=1)"
+ "python:msg.content.plain()"
+ "msg/content/plain"
+ "msg/content"
Usually you'll only want to use the escape option in a
complex expression.
@@ -1384,9 +1498,9 @@ plain render a "plain" representation of the property. This method
If true, turn URLs, email addresses and hyperdb item
designators in the text into hyperlinks (default: no). Note
that you'll need to use the "structure" TAL option if you
- want to use this::
+ want to use this ``tal:content`` expression::
-
+ "structure python:msg.content.plain(hyperlink=1)"
Note also that the text is automatically HTML-escaped before
the hyperlinking transformation.
@@ -1417,7 +1531,7 @@ menu only on Link and Multilink properties - render a form select
list for this property
reverse only on Multilink properties - produce a list of the linked
items in reverse order
-========= =====================================================================
+========= ================================================================
The request variable
@@ -1687,7 +1801,7 @@ Note: if you add a new column to the ``:columns`` form variable
This is one of the class context views. The template used is typically
"*classname*.search". The form on this page should have "search" as its
-``:action`` variable. The "search" action:
+``@action`` variable. The "search" action:
- sets up additional filtering, as well as performing indexed text
searching
@@ -1829,11 +1943,11 @@ Properties are specified as form variables:
Once we have determined the "propname", we check to see if it is one of
the special form values:
-``:required``
+``@required``
The named property values must be supplied or a ValueError will be
raised.
-``:remove:=id(s)``
+``@remove@=id(s)``
The ids will be removed from the multilink property.
``:add:=id(s)``
@@ -1892,13 +2006,13 @@ templating through the "journal" method of the item*::
Defining new web actions
------------------------
-You may define new actions to be triggered by the ``:action`` form
+You may define new actions to be triggered by the ``@action`` form
variable. These are added to the tracker ``interfaces.py`` as methods on
the ``Client`` class.
Adding action methods takes three steps; first you `define the new
action method`_, then you `register the action method`_ with the cgi
-interface so it may be triggered by the ``:action`` form variable.
+interface so it may be triggered by the ``@action`` form variable.
Finally you `use the new action`_ in your HTML form.
See "`setting up a "wizard" (or "druid") for controlled adding of
@@ -1946,7 +2060,7 @@ Use the new action
In your HTML form, add a hidden form element like so::
-
+
where "myaction" is the name you registered in the previous step.
@@ -2128,7 +2242,7 @@ are going to add the category code::
tal:condition="python:request.user.hasPermission('View', 'category')">
Categories New Category
+ href="category?@template=item">New Category
The first two lines is the classblock definition, which sets up a
@@ -2194,7 +2308,7 @@ Next we define some code which sets up the minimum list of fields that
we require the user to enter. There will be only one field - "name" - so
they better put something in it, otherwise the whole form is pointless::
-
+
To get everything to line up properly we will put everything in a table,
and put a nice big header on it so the user has an idea what is
@@ -2243,7 +2357,7 @@ So putting it all together, and closing the table and form we get::