Mercurial > p > roundup > code
diff doc/customizing.txt @ 3124:8b0669b96c8d maint-0.8
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 28 Jan 2005 05:11:29 +0000 |
| parents | ac1803a09920 |
| children | f0051e4bc8b7 |
line wrap: on
line diff
--- a/doc/customizing.txt Fri Jan 28 04:10:22 2005 +0000 +++ b/doc/customizing.txt Fri Jan 28 05:11:29 2005 +0000 @@ -2,7 +2,7 @@ Customising Roundup =================== -:Version: $Revision: 1.161.2.5 $ +:Version: $Revision: 1.161.2.6 $ .. This document borrows from the ZopeBook section on ZPT. The original is at: http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx @@ -2614,6 +2614,46 @@ Adding a new field to the classic schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +This example shows how to add a simple field (a due date) to the default +classic schema. It does not add any additional behaviour, such as enforcing +the due date, or causing automatic actions to fire if the due date passes. + + +1. modify the schema:: + + issue = IssueClass(db, "issue", + assignedto=Link("user"), topic=Multilink("keyword"), + priority=Link("priority"), status=Link("status"), + due_dat=Date()) + +2. add an edit field to the issue.item.html template:: + + <tr> + <th>Due Date</th> + <td tal:content="structure context/due_date/field" /> + </tr> + +3. add the property to the issue.index.html page:: + + (in the heading row) + <th tal:condition="request/show/due_date">Due Date</th> + (in the data row) + <td tal:condition="request/show/priority" tal:content="i/due_date" /> + +4. add the property to the issue.search.html page:: + + <tr tal:define="name string:due_date"> + <th i18n:translate="">Due Date:</th> + <td metal:use-macro="search_input"></td> + <td metal:use-macro="column_input"></td> + <td metal:use-macro="sort_input"></td> + <td metal:use-macro="group_input"></td> + </tr> + + +Adding a new constrained field to the classic schema +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + This example shows how to add a new constrained property (i.e. a selection of distinct values) to your tracker. @@ -3943,6 +3983,7 @@ So now, if an edit action attempts to set "assignedto" to a user that doesn't have the "Fixer" Permission, the error will be raised. + Users may only edit their issues ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3950,13 +3991,14 @@ have access to edit the issues they submit, but not others. We create a new Role called "Provisional User" which is granted to newly-registered users, and has limited access. One of the Permissions they have is the new "Edit -Own" on issues (regular users have "Edit".) We back up the permissions with -an auditor. +Own" on issues (regular users have "Edit".) First up, we create the new Role and Permission structure in ``schema.py``:: + # # New users not approved by the admin + # db.security.addRole(name='Provisional User', description='New user registered via web or email') @@ -3975,11 +4017,11 @@ # Assign the Permissions for issue-related classes for cl in 'file', 'msg', 'query', 'keyword': - db.security.addPermissionToRole('User', 'View', cl) - db.security.addPermissionToRole('User', 'Edit', cl) - db.security.addPermissionToRole('User', 'Create', cl) + db.security.addPermissionToRole('Provisional User', 'View', cl) + db.security.addPermissionToRole('Provisional User', 'Edit', cl) + db.security.addPermissionToRole('Provisional User', 'Create', cl) for cl in 'priority', 'status': - db.security.addPermissionToRole('User', 'View', cl) + db.security.addPermissionToRole('Provisional User', 'View', cl) # and give the new users access to the web and email interface db.security.addPermissionToRole('Provisional User', 'Web Access') @@ -3994,19 +4036,6 @@ new_web_user_roles = 'Provisional User' new_email_user_roles = 'Provisional User' -Note that some older trackers might also want to change the ``page.html`` -template as follows:: - - <p class="classblock" - - tal:condition="python:request.user.username != 'anonymous'"> - + tal:condition="python:request.user.hasPermission('View', 'user')"> - <b>Administration</b><br> - <tal:block tal:condition="python:request.user.hasPermission('Edit', None)"> - <a href="home?:template=classlist">Class List</a><br> - -(note that the "-" indicates a removed line, and the "+" indicates an added -line). - Changes to the Web User Interface --------------------------------- @@ -4167,6 +4196,7 @@ </tal:block> </table> + Setting up a "wizard" (or "druid") for controlled adding of issues ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
