Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 3120:ac1803a09920 | 3124:8b0669b96c8d |
|---|---|
| 1 =================== | 1 =================== |
| 2 Customising Roundup | 2 Customising Roundup |
| 3 =================== | 3 =================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.161.2.5 $ | 5 :Version: $Revision: 1.161.2.6 $ |
| 6 | 6 |
| 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: | 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: |
| 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx | 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx |
| 9 | 9 |
| 10 .. contents:: | 10 .. contents:: |
| 2612 | 2612 |
| 2613 | 2613 |
| 2614 Adding a new field to the classic schema | 2614 Adding a new field to the classic schema |
| 2615 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 2615 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2616 | 2616 |
| 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 | |
| 2617 This example shows how to add a new constrained property (i.e. a | 2657 This example shows how to add a new constrained property (i.e. a |
| 2618 selection of distinct values) to your tracker. | 2658 selection of distinct values) to your tracker. |
| 2619 | 2659 |
| 2620 | 2660 |
| 2621 Introduction | 2661 Introduction |
| 3941 db.issue.audit('create', assignedtoMustBeFixer) | 3981 db.issue.audit('create', assignedtoMustBeFixer) |
| 3942 | 3982 |
| 3943 So now, if an edit action attempts to set "assignedto" to a user that | 3983 So now, if an edit action attempts to set "assignedto" to a user that |
| 3944 doesn't have the "Fixer" Permission, the error will be raised. | 3984 doesn't have the "Fixer" Permission, the error will be raised. |
| 3945 | 3985 |
| 3986 | |
| 3946 Users may only edit their issues | 3987 Users may only edit their issues |
| 3947 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 3988 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 3948 | 3989 |
| 3949 Users registering themselves are granted Provisional access - meaning they | 3990 Users registering themselves are granted Provisional access - meaning they |
| 3950 have access to edit the issues they submit, but not others. We create a new | 3991 have access to edit the issues they submit, but not others. We create a new |
| 3951 Role called "Provisional User" which is granted to newly-registered users, | 3992 Role called "Provisional User" which is granted to newly-registered users, |
| 3952 and has limited access. One of the Permissions they have is the new "Edit | 3993 and 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 | 3994 Own" on issues (regular users have "Edit".) |
| 3954 an auditor. | |
| 3955 | 3995 |
| 3956 First up, we create the new Role and Permission structure in | 3996 First up, we create the new Role and Permission structure in |
| 3957 ``schema.py``:: | 3997 ``schema.py``:: |
| 3958 | 3998 |
| 3999 # | |
| 3959 # New users not approved by the admin | 4000 # New users not approved by the admin |
| 4001 # | |
| 3960 db.security.addRole(name='Provisional User', | 4002 db.security.addRole(name='Provisional User', |
| 3961 description='New user registered via web or email') | 4003 description='New user registered via web or email') |
| 3962 | 4004 |
| 3963 # These users need to be able to view and create issues but only edit | 4005 # These users need to be able to view and create issues but only edit |
| 3964 # and view their own | 4006 # and view their own |
| 3973 code=own_issue, description='Can only view own issues') | 4015 code=own_issue, description='Can only view own issues') |
| 3974 db.security.addPermissionToRole('Provisional User', p) | 4016 db.security.addPermissionToRole('Provisional User', p) |
| 3975 | 4017 |
| 3976 # Assign the Permissions for issue-related classes | 4018 # Assign the Permissions for issue-related classes |
| 3977 for cl in 'file', 'msg', 'query', 'keyword': | 4019 for cl in 'file', 'msg', 'query', 'keyword': |
| 3978 db.security.addPermissionToRole('User', 'View', cl) | 4020 db.security.addPermissionToRole('Provisional User', 'View', cl) |
| 3979 db.security.addPermissionToRole('User', 'Edit', cl) | 4021 db.security.addPermissionToRole('Provisional User', 'Edit', cl) |
| 3980 db.security.addPermissionToRole('User', 'Create', cl) | 4022 db.security.addPermissionToRole('Provisional User', 'Create', cl) |
| 3981 for cl in 'priority', 'status': | 4023 for cl in 'priority', 'status': |
| 3982 db.security.addPermissionToRole('User', 'View', cl) | 4024 db.security.addPermissionToRole('Provisional User', 'View', cl) |
| 3983 | 4025 |
| 3984 # and give the new users access to the web and email interface | 4026 # and give the new users access to the web and email interface |
| 3985 db.security.addPermissionToRole('Provisional User', 'Web Access') | 4027 db.security.addPermissionToRole('Provisional User', 'Web Access') |
| 3986 db.security.addPermissionToRole('Provisional User', 'Email Access') | 4028 db.security.addPermissionToRole('Provisional User', 'Email Access') |
| 3987 | 4029 |
| 3991 | 4033 |
| 3992 [main] | 4034 [main] |
| 3993 ... | 4035 ... |
| 3994 new_web_user_roles = 'Provisional User' | 4036 new_web_user_roles = 'Provisional User' |
| 3995 new_email_user_roles = 'Provisional User' | 4037 new_email_user_roles = 'Provisional User' |
| 3996 | |
| 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 | 4038 |
| 4010 | 4039 |
| 4011 Changes to the Web User Interface | 4040 Changes to the Web User Interface |
| 4012 --------------------------------- | 4041 --------------------------------- |
| 4013 | 4042 |
| 4165 <tr><td colspan="3" tal:content="msg/content"></td></tr> | 4194 <tr><td colspan="3" tal:content="msg/content"></td></tr> |
| 4166 </tal:block> | 4195 </tal:block> |
| 4167 </tal:block> | 4196 </tal:block> |
| 4168 </table> | 4197 </table> |
| 4169 | 4198 |
| 4199 | |
| 4170 Setting up a "wizard" (or "druid") for controlled adding of issues | 4200 Setting up a "wizard" (or "druid") for controlled adding of issues |
| 4171 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 4201 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4172 | 4202 |
| 4173 1. Set up the page templates you wish to use for data input. My wizard | 4203 1. Set up the page templates you wish to use for data input. My wizard |
| 4174 is going to be a two-step process: first figuring out what category | 4204 is going to be a two-step process: first figuring out what category |
