Skip to content

Commit f48f118

Browse files
author
Gordon B. McMillan
committed
Fixes/improvements to the search form & saved queries.
1 parent f01fcdc commit f48f118

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

roundup/cgi_client.py

Lines changed: 12 additions & 4 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: cgi_client.py,v 1.142 2002-07-18 11:17:30 gmcm Exp $
18+
# $Id: cgi_client.py,v 1.143 2002-07-20 19:29:10 gmcm Exp $
1919

2020
__doc__ = """
2121
WWW request handler (also used in the stand-alone server).
@@ -491,8 +491,6 @@ def list(self, sort=None, group=None, filter=None, columns=None,
491491
'''
492492
cn = self.classname
493493
cl = self.db.classes[cn]
494-
self.pagehead(_('%(instancename)s: Index of %(classname)s')%{
495-
'classname': cn, 'instancename': self.instance.INSTANCE_NAME})
496494
if sort is None: sort = self.index_sort()
497495
if group is None: group = self.index_arg(':group')
498496
if filter is None: filter = self.index_arg(':filter')
@@ -531,7 +529,9 @@ def list(self, sort=None, group=None, filter=None, columns=None,
531529

532530
# create a query
533531
d = {}
534-
d['name'] = self.form[':name'].value
532+
d['name'] = nm = self.form[':name'].value
533+
if not nm:
534+
d['name'] = nm = 'New Query'
535535
d['klass'] = self.form[':classname'].value
536536
d['url'] = url
537537
qid = self.db.getclass('query').create(**d)
@@ -543,6 +543,9 @@ def list(self, sort=None, group=None, filter=None, columns=None,
543543
queries.append(qid)
544544
usercl.set(uid, queries=queries)
545545

546+
self.pagehead(_('%(instancename)s: Index of %(classname)s')%{
547+
'classname': cn, 'instancename': self.instance.INSTANCE_NAME})
548+
546549
index = htmltemplate.IndexTemplate(self, self.instance.TEMPLATES, cn)
547550
try:
548551
index.render(filterspec, search_text, filter, columns, sort,
@@ -1610,6 +1613,11 @@ def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')):
16101613

16111614
#
16121615
# $Log: not supported by cvs2svn $
1616+
# Revision 1.142 2002/07/18 11:17:30 gmcm
1617+
# Add Number and Boolean types to hyperdb.
1618+
# Add conversion cases to web, mail & admin interfaces.
1619+
# Add storage/serialization cases to back_anydbm & back_metakit.
1620+
#
16131621
# Revision 1.141 2002/07/17 12:39:10 gmcm
16141622
# Saving, running & editing queries.
16151623
#

roundup/htmltemplate.py

Lines changed: 11 additions & 4 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: htmltemplate.py,v 1.102 2002-07-18 23:07:08 richard Exp $
18+
# $Id: htmltemplate.py,v 1.103 2002-07-20 19:29:10 gmcm Exp $
1919

2020
__doc__ = """
2121
Template engine.
@@ -1196,17 +1196,21 @@ def filter_section(self, search_text, filter, columns, group, all_columns, sort,
11961196
w(' <td>&nbsp;</td>\n')
11971197
w(' <td colspan=6><input type="submit" name="Query" value="Redisplay"></td>\n')
11981198
w(' </tr>\n')
1199-
if self.db.getclass('user').getprops().has_key('queries'):
1199+
if (self.db.getclass('user').getprops().has_key('queries')
1200+
and not self.client.user in (None, "anonymous")):
12001201
w(' <tr class="location-bar">\n')
12011202
w(' <td colspan=7><hr></td>\n')
12021203
w(' </tr>\n')
12031204
w(' <tr class="location-bar">\n')
12041205
w(' <td align=right class="form-label">Name</td>\n')
1205-
w(' <td colspan=6><input type="text" name=":name" value=""></td>\n')
1206+
w(' <td colspan=2 class="form-text"><input type="text" name=":name" value=""></td>\n')
1207+
w(' <td colspan=4 rowspan=2 class="form-help">If you give the query a name '
1208+
'and click <b>Save</b>, it will appear on your menu. Saved queries may be '
1209+
'edited by going to <b>My Details</b> and clicking on the query name.</td>')
12061210
w(' </tr>\n')
12071211
w(' <tr class="location-bar">\n')
12081212
w(' <td>&nbsp;</td><input type="hidden" name=":classname" value="%s">\n' % self.classname)
1209-
w(' <td colspan=6><input type="submit" name="Query" value="Save"></td>\n')
1213+
w(' <td colspan=2><input type="submit" name="Query" value="Save"></td>\n')
12101214
w(' </tr>\n')
12111215
w('</table>\n')
12121216

@@ -1364,6 +1368,9 @@ def render(self, form):
13641368

13651369
#
13661370
# $Log: not supported by cvs2svn $
1371+
# Revision 1.102 2002/07/18 23:07:08 richard
1372+
# Unit tests and a few fixes.
1373+
#
13671374
# Revision 1.101 2002/07/18 11:17:30 gmcm
13681375
# Add Number and Boolean types to hyperdb.
13691376
# Add conversion cases to web, mail & admin interfaces.

0 commit comments

Comments
 (0)