22Customising Roundup
33===================
44
5- :Version: $Revision: 1.216 $
5+ :Version: $Revision: 1.217 $
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
@@ -2892,28 +2892,42 @@ Schema changes are automatically applied to the database on the next
28922892tracker access (note that roundup-server would need to be restarted as it
28932893caches the schema).
28942894
2895- 1. modify the ``schema.py``::
2895+ 1. Modify the ``schema.py``::
28962896
28972897 issue = IssueClass(db, "issue",
28982898 assignedto=Link("user"), topic=Multilink("keyword"),
28992899 priority=Link("priority"), status=Link("status"),
29002900 due_date=Date())
29012901
2902- 2. add an edit field to the ``issue.item.html`` template::
2902+ 2. Add an edit field to the ``issue.item.html`` template::
29032903
29042904 <tr>
29052905 <th>Due Date</th>
29062906 <td tal:content="structure context/due_date/field" />
2907- </tr>
2907+ </tr>
2908+
2909+ If you want to show only the date part of due_date then do this instead::
2910+
2911+ <tr>
2912+ <th>Due Date</th>
2913+ <td tal:content="structure python:context.due_date.field(format='%Y-%m-%d')" />
2914+ </tr>
29082915
2909- 3. add the property to the ``issue.index.html`` page::
2916+ 3. Add the property to the ``issue.index.html`` page::
29102917
29112918 (in the heading row)
29122919 <th tal:condition="request/show/due_date">Due Date</th>
29132920 (in the data row)
2914- <td tal:condition="request/show/due_date" tal:content="i/due_date" />
2921+ <td tal:condition="request/show/due_date"
2922+ tal:content="i/due_date" />
2923+
2924+ If you want format control of the display of the due date you can
2925+ enter the following in the data row to show only the actual due date::
2926+
2927+ <td tal:condition="request/show/due_date"
2928+ tal:content="python:i.due_date.pretty('%Y-%m-%d')"> </td>
29152929
2916- 4. add the property to the ``issue.search.html`` page::
2930+ 4. Add the property to the ``issue.search.html`` page::
29172931
29182932 <tr tal:define="name string:due_date">
29192933 <th i18n:translate="">Due Date:</th>
@@ -2923,10 +2937,12 @@ caches the schema).
29232937 <td metal:use-macro="group_input"></td>
29242938 </tr>
29252939
2926- 5. if you wish for the due date to appear in the standard views listed
2927- in the sidebar of the web interface then you'll need to add "due_date"
2928- to the columns and columns_showall lists in your ``page.html``.
2929-
2940+ 5. If you wish for the due date to appear in the standard views listed
2941+ in the sidebar of the web interface then you'll need to add "due_date"
2942+ to the columns and columns_showall lists in your ``page.html``::
2943+
2944+ columns string:id,activity,due_date,title,creator,status;
2945+ columns_showall string:id,activity,due_date,title,creator,assignedto,status;
29302946
29312947Adding a new constrained field to the classic schema
29322948~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3391,7 +3407,7 @@ be able to give a summary of the total time spent on a particular issue.
33913407 <tr>
33923408 <th>Time Log</th>
33933409 <td colspan=3><input type="text" name="timelog-1@period" />
3394- <br /> (enter as '3y 1m 4d 2:40:02' or parts thereof)
3410+ (enter as '3y 1m 4d 2:40:02' or parts thereof)
33953411 </td>
33963412 </tr>
33973413
@@ -3404,6 +3420,17 @@ be able to give a summary of the total time spent on a particular issue.
34043420 On submission, the "-1" timelog item will be created and assigned a
34053421 real item id. The "times" property of the issue will have the new id
34063422 added to it.
3423+
3424+ The full entry will now look like this::
3425+
3426+ <tr>
3427+ <th>Time Log</th>
3428+ <td colspan=3><input type="text" name="timelog-1@period" />
3429+ (enter as '3y 1m 4d 2:40:02' or parts thereof)
3430+ <input type="hidden" name="@link@times" value="timelog-1" />
3431+ </td>
3432+ </tr>
3433+
34073434
340834354. We want to display a total of the timelog times that have been
34093436 accumulated for an issue. To do this, we'll need to actually write
@@ -3450,15 +3477,15 @@ be able to give a summary of the total time spent on a particular issue.
34503477 displayed in the template as text like "+ 1y 2:40" (1 year, 2 hours
34513478 and 40 minutes).
34523479
3453- 8 . If you're using a persistent web server - ``roundup-server`` or
3480+ 6 . If you're using a persistent web server - ``roundup-server`` or
34543481 ``mod_python`` for example - then you'll need to restart that to pick up
34553482 the code changes. When that's done, you'll be able to use the new
34563483 time logging interface.
34573484
34583485An extension of this modification attaches the timelog entries to any
34593486change message entered at the time of the timelog entry:
34603487
3461- 1 . Add a link to the timelog to the msg class:
3488+ A . Add a link to the timelog to the msg class in ``schema.py`` :
34623489
34633490 msg = FileClass(db, "msg",
34643491 author=Link("user", do_journal='no'),
@@ -3467,19 +3494,51 @@ change message entered at the time of the timelog entry:
34673494 summary=String(),
34683495 files=Multilink("file"),
34693496 messageid=String(),
3470- inreplyto=String()
3497+ inreplyto=String(),
34713498 times=Multilink("timelog"))
34723499
3473- 2 . Add a new hidden field that links that new timelog item (new
3500+ B . Add a new hidden field that links that new timelog item (new
34743501 because it's marked as having id "-1") to the new message.
3475- It looks like this::
3476-
3477- <input type="hidden" name="msg-1@link@times" value="timelog-1" />
3502+ The link is placed in ``issue.item.html`` in the same section that
3503+ handles the timelog entry.
3504+
3505+ It looks like this after this addition::
3506+
3507+ <tr>
3508+ <th>Time Log</th>
3509+ <td colspan=3><input type="text" name="timelog-1@period" />
3510+ (enter as '3y 1m 4d 2:40:02' or parts thereof)
3511+ <input type="hidden" name="@link@times" value="timelog-1" />
3512+ <input type="hidden" name="msg-1@link@times" value="timelog-1" />
3513+ </td>
3514+ </tr>
34783515
34793516 The "times" property of the message will have the new id added to it.
34803517
3481- 3. Add the timelog listing from step 5. to the ``msg.item.html`` template
3482- so that the timelog entry appears on the message view page.
3518+ C. Add the timelog listing from step 5. to the ``msg.item.html`` template
3519+ so that the timelog entry appears on the message view page. Note that
3520+ the call to totalTimeSpent is not used here since there will only be one
3521+ single timelog entry for each message.
3522+
3523+ I placed it after the Date entry like this::
3524+
3525+ <tr>
3526+ <th i18n:translate="">Date:</th>
3527+ <td tal:content="context/date"></td>
3528+ </tr>
3529+ </table>
3530+
3531+ <table class="otherinfo" tal:condition="context/times">
3532+ <tr><th colspan="3" class="header">Time Log</th></tr>
3533+ <tr><th>Date</th><th>Period</th><th>Logged By</th></tr>
3534+ <tr tal:repeat="time context/times">
3535+ <td tal:content="time/creation"></td>
3536+ <td tal:content="time/period"></td>
3537+ <td tal:content="time/creator"></td>
3538+ </tr>
3539+ </table>
3540+
3541+ <table class="messages">
34833542
34843543
34853544Tracking different types of issues
0 commit comments