Skip to content

Commit ef57248

Browse files
author
Johannes Gijsbers
committed
Final touches to fix query editing. It should work now.
1 parent 3a61bd0 commit ef57248

File tree

4 files changed

+50
-37
lines changed

4 files changed

+50
-37
lines changed

doc/customizing.txt

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

5-
:Version: $Revision: 1.92 $
5+
:Version: $Revision: 1.93 $
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
@@ -2432,43 +2432,48 @@ that when you click on "Search Issues" it will be looking for a
24322432
``issue.search.html`` file to display. So that is the file that we will
24332433
change.
24342434

2435-
This file should begin to look familiar, by now. It is a simple HTML
2436-
form using a table to define structure. You can add the new category
2437-
search code anywhere you like within that form::
2438-
2439-
<tr>
2440-
<th>Category:</th>
2441-
<td>
2442-
<select name="category">
2443-
<option value="">don't care</option>
2444-
<option value="">------------</option>
2445-
<option tal:repeat="s db/category/list"
2446-
tal:attributes="value s/name"
2447-
tal:content="s/name">category to filter on</option>
2448-
</select>
2449-
</td>
2450-
<td><input type="checkbox" name=":columns" value="category"
2451-
checked></td>
2452-
<td><input type="radio" name=":sort" value="category"></td>
2453-
<td><input type="radio" name=":group" value="category"></td>
2454-
</tr>
2455-
2456-
Most of this is straightforward to anyone who knows HTML. It is just
2457-
setting up a select list followed by a checkbox and a couple of radio
2458-
buttons.
2435+
If you look at this file it should be starting to seem familiar, although it
2436+
does use some new macros. You can add the new category search code anywhere you
2437+
like within that form::
2438+
2439+
<tr tal:define="name string:category;
2440+
db_klass string:category;
2441+
db_content string:name;">
2442+
<th>Priority:</th>
2443+
<td metal:use-macro="search_select"></td>
2444+
<td metal:use-macro="column_input"></td>
2445+
<td metal:use-macro="sort_input"></td>
2446+
<td metal:use-macro="group_input"></td>
2447+
</tr>
24592448

2460-
The ``tal:repeat`` part repeats the tag for every item in the "category"
2461-
table and sets "s" to each category in turn.
2449+
The definitions in the <tr> opening tag are used by the macros:
24622450

2463-
The ``tal:attributes`` part is setting up the ``value=`` part of the
2464-
option tag to be the name part of "s", which is the current category in
2465-
the loop.
2451+
- search_select expands to a drop-down box with all categories using db_klass
2452+
and db_content.
2453+
- column_input expands to a checkbox for selecting what columns should be
2454+
displayed.
2455+
- sort_input expands to a radio button for selecting what property should be
2456+
sorted on.
2457+
- group_input expands to a radio button for selecting what property should be
2458+
group on.
24662459

2467-
The ``tal:content`` part is setting the contents of the option tag to be
2468-
the name part of "s" again. For objects more complex than category,
2469-
obviously you would put an id in the value, and the descriptive part in
2470-
the content; but for categories they are the same.
2460+
The category search code above would expand to the following::
24712461

2462+
<tr>
2463+
<th>Category:</th>
2464+
<td>
2465+
<select name="category">
2466+
<option value="">don't care</option>
2467+
<option value="">------------</option>
2468+
<option value="1">scipy</option>
2469+
<option value="2">chaco</option>
2470+
<option value="3">weave</option>
2471+
</select>
2472+
</td>
2473+
<td><input type="checkbox" name=":columns" value="category"></td>
2474+
<td><input type="radio" name=":sort" value="category"></td>
2475+
<td><input type="radio" name=":group" value="category"></td>
2476+
</tr>
24722477

24732478
Adding category to the default view
24742479
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

roundup/cgi/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.126 2003-07-21 22:56:54 richard Exp $
1+
# $Id: client.py,v 1.127 2003-08-10 10:30:56 jlgijsbers Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -1361,7 +1361,10 @@ def searchAction(self, wcre=re.compile(r'[\s,]+')):
13611361
if queryname:
13621362
# parse the environment and figure what the query _is_
13631363
req = HTMLRequest(self)
1364-
url = req.indexargs_href('', {})
1364+
1365+
# The [1:] strips off the '?' character, it isn't part of the
1366+
# query string.
1367+
url = req.indexargs_href('', {})[1:]
13651368

13661369
# handle editing an existing query
13671370
try:

templates/classic/html/issue.search.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ <h2>Issue searching</h2>
167167
tal:attributes="value request/form/:queryname/value | default"></td>
168168
</tr>
169169

170+
<tr>
171+
<td>&nbsp;</td>
172+
<td><input type="submit" value="Search"></td>
173+
</tr>
174+
170175
<tr><td>&nbsp;</td>
171176
<td colspan="4" class="help">
172177
*: The "all text" field will look in message bodies and issue titles<br>

templates/classic/html/user.item.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ <h2>
8585
<td><a tal:attributes="href string:query${query/id}"
8686
tal:content="query/name"></a></td>
8787
<td>
88-
<a tal:attributes="href python:'%s%s'%(query['klass'], query['url'])">display</a>
88+
<a tal:attributes="href string:${query/klass}?${query/url}">display</a>
8989
</td>
9090
<td>
9191
<a tal:attributes="href string:?:remove:queries=${query/id}&:action=edit">remove</a>

0 commit comments

Comments
 (0)