Skip to content

Commit d4853e7

Browse files
author
Richard Jones
committed
Added the missing keyword/topic interface to classic template (blush)
Cleaned up the classhelp API Fixed some stuff in the customisation doc example.
1 parent 45f5cec commit d4853e7

File tree

9 files changed

+65
-32
lines changed

9 files changed

+65
-32
lines changed

TODO.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ pending web: search "refinement"
4545
pending web: UNIX init.d script for roundup-server
4646
pending web: rewritten documentation (can come after the beta though so stuff
4747
is settled) ... including relevant file names in customisation doc
48-
pending admin: have "set" command be applicable to all items in a class
49-
pending admin: add "unset" command
5048
pending dist: include the HTML in docs
5149

5250
bug web: request.url is incorrect in cgi-bin environments
@@ -78,6 +76,8 @@ done web: fix double-submit by having new-item-submit redirect at end
7876
done web: daemonify roundup-server (fork, logfile, pidfile)
7977
done web: modify cgitb to display PageTemplate errors better
8078
done web: have roundup.cgi pick up instance config from the environment
79+
done admin: have "set" command be applicable to all items in a class, and also
80+
be able to unset properties (ie. set to None)
8181

8282
rejected instance: the use of non-Python configuration files (ConfigParser)
8383

doc/customizing.txt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.27 $
5+
:Version: $Revision: 1.28 $
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
@@ -974,15 +974,15 @@ template issue item edit form - from the "issue.item" template)::
974974
<th nowrap>Superseder</th>
975975
<td>
976976
<span tal:replace="structure python:context.superseder.field(showid=1, size=20)" />
977-
<span tal:replace="structure python:db.issue.classhelp('id,title', label='list', width=500)" />
977+
<span tal:replace="structure python:db.issue.classhelp('id,title')" />
978978
<span tal:condition="context/superseder">
979979
<br>View: <span tal:replace="structure python:context.superseder.link(showid=1)" />
980980
</span>
981981
</td>
982982
<th nowrap>Nosy List</th>
983983
<td>
984984
<span tal:replace="structure context/nosy/field" />
985-
<span tal:replace="structure python:db.user.classhelp('username,realname,address,phone', label='list', width=500)" />
985+
<span tal:replace="structure python:db.user.classhelp('username,realname,address,phone')" />
986986
</td>
987987
</tr>
988988

@@ -1293,7 +1293,7 @@ To get everything to line up properly we will put everything in a table,
12931293
and put a nice big header on it so the user has an idea what is happening::
12941294

12951295
<table class="form">
1296-
<tr class="strong-header"><td colspan=2>Category</td></tr>
1296+
<tr><th class="header" colspan=2>Category</th></tr>
12971297

12981298
Next we need the actual field that the user is going to enter the new
12991299
category. The "context.name.field(size=60)" bit tells roundup to generate a
@@ -1303,7 +1303,7 @@ this is that when the user types something in to the form, a new category
13031303
will be created with that name::
13041304

13051305
<tr>
1306-
<td nowrap>Name</td>
1306+
<th nowrap>Name</th>
13071307
<td tal:content="structure python:context.name.field(size=60)">name</td>
13081308
</tr>
13091309

@@ -1326,10 +1326,10 @@ So putting it all together, and closing the table and form we get::
13261326
<input type="hidden" name=":required" value="name">
13271327

13281328
<table class="form">
1329-
<tr class="strong-header"><td colspan=2>Category</td></tr>
1329+
<tr><th class="header" colspan=2>Category</th></tr>
13301330

13311331
<tr>
1332-
<td nowrap>Name</td>
1332+
<th nowrap>Name</th>
13331333
<td tal:content="structure python:context.name.field(size=60)">name</td>
13341334
</tr>
13351335

@@ -1362,8 +1362,7 @@ it is entirely up to your sense of aesthetics::
13621362

13631363
<th nowrap>Category</th>
13641364
<td><span tal:replace="structure context/category/field" />
1365-
<span tal:replace="structure python:db.category.classhelp('name',
1366-
label='list', width=500)" />
1365+
<span tal:replace="structure db/category/classhelp" />
13671366
</td>
13681367

13691368
First we define a nice header so that the user knows what the next section

roundup/cgi/templating.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,24 @@ def filter(self, request=None):
348348
for x in self._klass.filter(None, filterspec, sort, group)]
349349
return l
350350

351-
def classhelp(self, properties, label='?', width='400', height='400'):
352-
'''pop up a javascript window with class help
353-
354-
This generates a link to a popup window which displays the
355-
properties indicated by "properties" of the class named by
356-
"classname". The "properties" should be a comma-separated list
357-
(eg. 'id,name,description').
358-
359-
You may optionally override the label displayed, the width and
360-
height. The popup window will be resizable and scrollable.
351+
def classhelp(self, properties=None, label='list', width='500',
352+
height='400'):
353+
''' Pop up a javascript window with class help
354+
355+
This generates a link to a popup window which displays the
356+
properties indicated by "properties" of the class named by
357+
"classname". The "properties" should be a comma-separated list
358+
(eg. 'id,name,description'). Properties defaults to all the
359+
properties of a class (excluding id, creator, created and
360+
activity).
361+
362+
You may optionally override the label displayed, the width and
363+
height. The popup window will be resizable and scrollable.
361364
'''
365+
if properties is None:
366+
properties = self._klass.getprops(protected=0).keys()
367+
properties.sort()
368+
properties = ','.join(properties)
362369
return '<a href="javascript:help_window(\'%s?:template=help&' \
363370
':contentonly=1&properties=%s\', \'%s\', \'%s\')"><b>'\
364371
'(%s)</b></a>'%(self.classname, properties, width, height, label)

roundup/templates/classic/dbinit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: dbinit.py,v 1.27 2002-09-11 01:18:24 richard Exp $
18+
# $Id: dbinit.py,v 1.28 2002-09-11 02:49:56 richard Exp $
1919

2020
import os
2121

@@ -93,15 +93,15 @@ def open(name=None):
9393
# SECURITY SETTINGS
9494
#
9595
# new permissions for this schema
96-
for cl in 'issue', 'file', 'msg', 'user':
96+
for cl in 'issue', 'file', 'msg', 'user', 'keyword':
9797
db.security.addPermission(name="Edit", klass=cl,
9898
description="User is allowed to edit "+cl)
9999
db.security.addPermission(name="View", klass=cl,
100100
description="User is allowed to access "+cl)
101101

102102
# Assign the access and edit permissions for issue, file and message
103103
# to regular users now
104-
for cl in 'issue', 'file', 'msg':
104+
for cl in 'issue', 'file', 'msg', 'keyword':
105105
p = db.security.getPermission('View', cl)
106106
db.security.addPermissionToRole('User', p)
107107
p = db.security.getPermission('Edit', cl)

roundup/templates/classic/html/home

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
-->
77
<span tal:replace="structure python:db.issue.renderWith('index',
88
sort=('-', 'activity'), group=('+', 'priority'), filter=['status'],
9-
columns=['id','activity','title','creator','assignedto', 'status'],
9+
columns=['id','activity','topic','title','creator','assignedto', 'status'],
1010
filterspec={'status':['-1','1','2','3','4','5','6','7']})" />
1111

roundup/templates/classic/html/issue.index

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<th tal:condition="request/show/priority">Priority</th>
66
<th tal:condition="request/show/id">ID</th>
77
<th tal:condition="request/show/activity">Activity</th>
8+
<th tal:condition="request/show/topic">Topic</th>
89
<th tal:condition="request/show/title">Title</th>
910
<th tal:condition="request/show/status">Status</th>
1011
<th tal:condition="request/show/creator">Created&nbsp;By</th>
@@ -22,6 +23,7 @@
2223
<td tal:condition="request/show/id" tal:content="i/id"></td>
2324
<td tal:condition="request/show/activity"
2425
tal:content="i/activity/reldate"></td>
26+
<td tal:condition="request/show/topic" tal:content="i/topic"></td>
2527
<td tal:condition="request/show/title">
2628
<a tal:attributes="href string:issue${i/id}"
2729
tal:content="python:str(i.title) or '[no title]'">title</a>

roundup/templates/classic/html/issue.item

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<th nowrap>Superseder</th>
2323
<td>
2424
<span tal:replace="structure python:context.superseder.field(showid=1, size=20)" />
25-
<span tal:replace="structure python:db.issue.classhelp('id,title', label='list', width=500)" />
25+
<span tal:replace="structure python:db.issue.classhelp('id,title')" />
2626
<span tal:condition="context/superseder" tal:repeat="sup context/superseder">
2727
<br>View: <a tal:attributes="href string:issue${sup/id}"
2828
tal:content="sup/id"></a>
@@ -31,15 +31,18 @@
3131
<th nowrap>Nosy List</th>
3232
<td>
3333
<span tal:replace="structure context/nosy/field" />
34-
<span tal:replace="structure python:db.user.classhelp('username,realname,address,phone', label='list', width=500)" />
34+
<span tal:replace="structure python:db.user.classhelp('username,realname,address,phone')" />
3535
</td>
3636
</tr>
3737

3838
<tr>
3939
<th nowrap>Assigned To</th>
4040
<td tal:content="structure context/assignedto/menu">assignedto menu</td>
41-
<td>&nbsp;</td>
42-
<td>&nbsp;</td>
41+
<th nowrap>Topics</th>
42+
<td>
43+
<span tal:replace="structure context/topic/field" />
44+
<span tal:replace="structure db/keyword/classhelp" />
45+
</td>
4346
</tr>
4447

4548
<tr>

roundup/templates/classic/html/issue.search

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@
3434
<td>&nbsp;</td>
3535
</tr>
3636

37+
<tr>
38+
<th>Topic:</th>
39+
<td>
40+
<select name="topic">
41+
<option value="">don't care</option>
42+
<option value="">------------</option>
43+
<option tal:repeat="s db/keyword/list" tal:attributes="value s/name"
44+
tal:content="s/name">topic to filter on</option>
45+
</select>
46+
</td>
47+
<td><input type="checkbox" name=":columns" value="topic" checked></td>
48+
<td><input type="radio" name=":sort" value="topic"></td>
49+
<td><input type="radio" name=":group" value="topic"></td>
50+
</tr>
51+
3752
<tr>
3853
<th>Created:</th>
3954
<td><input name="activity"></td>

roundup/templates/classic/html/page

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@
3434
<b>Issues</b><br>
3535
<a tal:condition="python:request.user.hasPermission('Edit', 'issue')"
3636
href="issue?:template=item">New Issue<br></a>
37-
<a href="issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,activity,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=-1">Unassigned Issues</a><br>
38-
<a href="issue?:sort=-activity&:group=priority&:filter=status&:columns=id,activity,title,creator,assignedto,status&status=-1,1,2,3,4,5,6,7">All Issues</a><br>
37+
<a href="issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,activity,topic,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=-1">Unassigned Issues</a><br>
38+
<a href="issue?:sort=-activity&:group=priority&:filter=status&:columns=id,activity,topic,title,creator,assignedto,status&status=-1,1,2,3,4,5,6,7">All Issues</a><br>
3939
<a href="issue?:template=search">Search Issues</a>
4040
</p>
4141

42+
<p class="classblock"
43+
tal:condition="python:request.user.hasPermission('View', 'keyword')">
44+
<b>Keywords</b><br>
45+
<a tal:condition="python:request.user.hasPermission('Edit', 'keyword')"
46+
href="keyword?:template=item">New Keyword<br></a>
47+
</p>
48+
4249
<p class="classblock"
4350
tal:condition="python:request.user.hasPermission('Edit', None)">
4451
<b>Admin</b><br>
@@ -59,7 +66,7 @@
5966

6067
<p class="userblock" tal:condition="python:request.user.username != 'anonymous'">
6168
<b>Hello,</b><br><b tal:content="request/user/username">username</b><br>
62-
<a tal:attributes="href string:issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,activity,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=${request/user/id}">My Issues</a><br>
69+
<a tal:attributes="href string:issue?:sort=-activity&:group=priority&:filter=status,assignedto&:columns=id,topic,activity,title,creator,status&status=-1,1,2,3,4,5,6,7&assignedto=${request/user/id}">My Issues</a><br>
6370
<a tal:attributes="href string:user${request/user/id}">My Details</a><br>
6471
<a tal:attributes="href python:request.indexargs_href('',
6572
{':action':'logout'})">Logout</a>

0 commit comments

Comments
 (0)