22Customising Roundup
33===================
44
5- :Version: $Revision: 1.161.2.5 $
5+ :Version: $Revision: 1.161.2.6 $
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
@@ -2614,6 +2614,46 @@ the database.
26142614Adding a new field to the classic schema
26152615~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26162616
2617+ This example shows how to add a simple field (a due date) to the default
2618+ classic schema. It does not add any additional behaviour, such as enforcing
2619+ the due date, or causing automatic actions to fire if the due date passes.
2620+
2621+
2622+ 1. modify the schema::
2623+
2624+ issue = IssueClass(db, "issue",
2625+ assignedto=Link("user"), topic=Multilink("keyword"),
2626+ priority=Link("priority"), status=Link("status"),
2627+ due_dat=Date())
2628+
2629+ 2. add an edit field to the issue.item.html template::
2630+
2631+ <tr>
2632+ <th>Due Date</th>
2633+ <td tal:content="structure context/due_date/field" />
2634+ </tr>
2635+
2636+ 3. add the property to the issue.index.html page::
2637+
2638+ (in the heading row)
2639+ <th tal:condition="request/show/due_date">Due Date</th>
2640+ (in the data row)
2641+ <td tal:condition="request/show/priority" tal:content="i/due_date" />
2642+
2643+ 4. add the property to the issue.search.html page::
2644+
2645+ <tr tal:define="name string:due_date">
2646+ <th i18n:translate="">Due Date:</th>
2647+ <td metal:use-macro="search_input"></td>
2648+ <td metal:use-macro="column_input"></td>
2649+ <td metal:use-macro="sort_input"></td>
2650+ <td metal:use-macro="group_input"></td>
2651+ </tr>
2652+
2653+
2654+ Adding a new constrained field to the classic schema
2655+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2656+
26172657This example shows how to add a new constrained property (i.e. a
26182658selection of distinct values) to your tracker.
26192659
@@ -3943,20 +3983,22 @@ tracker "detectors" directory)::
39433983So now, if an edit action attempts to set "assignedto" to a user that
39443984doesn't have the "Fixer" Permission, the error will be raised.
39453985
3986+
39463987Users may only edit their issues
39473988~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39483989
39493990Users registering themselves are granted Provisional access - meaning they
39503991have access to edit the issues they submit, but not others. We create a new
39513992Role called "Provisional User" which is granted to newly-registered users,
39523993and has limited access. One of the Permissions they have is the new "Edit
3953- Own" on issues (regular users have "Edit".) We back up the permissions with
3954- an auditor.
3994+ Own" on issues (regular users have "Edit".)
39553995
39563996First up, we create the new Role and Permission structure in
39573997``schema.py``::
39583998
3999+ #
39594000 # New users not approved by the admin
4001+ #
39604002 db.security.addRole(name='Provisional User',
39614003 description='New user registered via web or email')
39624004
@@ -3975,11 +4017,11 @@ First up, we create the new Role and Permission structure in
39754017
39764018 # Assign the Permissions for issue-related classes
39774019 for cl in 'file', 'msg', 'query', 'keyword':
3978- db.security.addPermissionToRole('User', 'View', cl)
3979- db.security.addPermissionToRole('User', 'Edit', cl)
3980- db.security.addPermissionToRole('User', 'Create', cl)
4020+ db.security.addPermissionToRole('Provisional User', 'View', cl)
4021+ db.security.addPermissionToRole('Provisional User', 'Edit', cl)
4022+ db.security.addPermissionToRole('Provisional User', 'Create', cl)
39814023 for cl in 'priority', 'status':
3982- db.security.addPermissionToRole('User', 'View', cl)
4024+ db.security.addPermissionToRole('Provisional User', 'View', cl)
39834025
39844026 # and give the new users access to the web and email interface
39854027 db.security.addPermissionToRole('Provisional User', 'Web Access')
@@ -3994,19 +4036,6 @@ users, replacing the existing ``'User'`` values::
39944036 new_web_user_roles = 'Provisional User'
39954037 new_email_user_roles = 'Provisional User'
39964038
3997- Note that some older trackers might also want to change the ``page.html``
3998- template as follows::
3999-
4000- <p class="classblock"
4001- - tal:condition="python:request.user.username != 'anonymous'">
4002- + tal:condition="python:request.user.hasPermission('View', 'user')">
4003- <b>Administration</b><br>
4004- <tal:block tal:condition="python:request.user.hasPermission('Edit', None)">
4005- <a href="home?:template=classlist">Class List</a><br>
4006-
4007- (note that the "-" indicates a removed line, and the "+" indicates an added
4008- line).
4009-
40104039
40114040Changes to the Web User Interface
40124041---------------------------------
@@ -4167,6 +4196,7 @@ that shows either one or the other. We'll use a new form variable,
41674196 </tal:block>
41684197 </table>
41694198
4199+
41704200Setting up a "wizard" (or "druid") for controlled adding of issues
41714201~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41724202
0 commit comments