summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: efe0382)
raw | patch | inline | side by side (parent: efe0382)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 29 Jul 2001 08:27:40 +0000 (08:27 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 29 Jul 2001 08:27:40 +0000 (08:27 +0000) |
drill-down)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@134 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@134 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/cgi_client.py | patch | blob | history | |
roundup/htmltemplate.py | patch | blob | history | |
roundup/hyperdb.py | patch | blob | history |
diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py
index a30bc48a7a394544b4cc6e5cdd8d8ea0d3745e8f..1c000403a418b316e517b61f92a963ae0a7e6264 100644 (file)
--- a/roundup/cgi_client.py
+++ b/roundup/cgi_client.py
-# $Id: cgi_client.py,v 1.7 2001-07-29 07:01:39 richard Exp $
+# $Id: cgi_client.py,v 1.8 2001-07-29 08:27:40 richard Exp $
import os, cgi, pprint, StringIO, urlparse, re, traceback
def index_filterspec(self):
''' pull the index filter spec from the form
+
+ Links and multilinks want to be lists - the rest are straight
+ strings.
'''
- # all the other form args are filters
+ props = self.db.classes[self.classname].getprops()
+ # all the form args not starting with ':' are filters
filterspec = {}
for key in self.form.keys():
if key[0] == ':': continue
+ prop = props[key]
value = self.form[key]
- if type(value) == type([]):
- value = [arg.value for arg in value]
+ if prop.isLinkType or prop.isMultilinkType:
+ if type(value) == type([]):
+ value = [arg.value for arg in value]
+ else:
+ value = value.value.split(',')
+ l = filterspec.get(key, [])
+ l = l + value
+ filterspec[key] = l
else:
- value = value.value.split(',')
- l = filterspec.get(key, [])
- l = l + value
- filterspec[key] = l
+ filterspec[key] = value.value
return filterspec
-
default_index_sort = ['-activity']
default_index_group = ['priority']
default_index_filter = []
#
# $Log: not supported by cvs2svn $
+# Revision 1.7 2001/07/29 07:01:39 richard
+# Added vim command to all source so that we don't get no steenkin' tabs :)
+#
# Revision 1.6 2001/07/29 04:04:00 richard
# Moved some code around allowing for subclassing to change behaviour.
#
index 036ad190cc67a1b66a9b85bbd05aab1c6b07672f..7d574fdec53276788732de73072dea0051c6fd4c 100644 (file)
--- a/roundup/htmltemplate.py
+++ b/roundup/htmltemplate.py
-# $Id: htmltemplate.py,v 1.8 2001-07-29 07:01:39 richard Exp $
+# $Id: htmltemplate.py,v 1.9 2001-07-29 08:27:40 richard Exp $
import os, re, StringIO, urllib, cgi, errno
import hyperdb, date
class Base:
- def __init__(self, db, templates, classname, nodeid=None, form=None):
+ def __init__(self, db, templates, classname, nodeid=None, form=None,
+ filterspec=None):
# TODO: really not happy with the way templates is passed on here
self.db, self.templates = db, templates
self.classname, self.nodeid = classname, nodeid
- self.form = form
+ self.form, self.filterspec = form, filterspec
self.cl = self.db.classes[self.classname]
self.properties = self.cl.getprops()
to be edited
'''
def __call__(self, property, size=None, height=None, showid=0):
- if not self.nodeid and self.form is None:
+ if not self.nodeid and self.form and self.filterspec is None:
return '[Field: not called from item]'
propclass = self.properties[property]
if self.nodeid:
value = self.cl.get(self.nodeid, property)
+ elif self.filterspec is not None:
+ if propclass.isMultilinkType:
+ value = self.filterspec.get(property, [])
+ else:
+ value = self.filterspec.get(property, '')
else:
# TODO: pull the value from the form
if propclass.isMultilinkType: value = []
propclass = self.properties[property]
if self.nodeid:
value = self.cl.get(self.nodeid, property)
+ elif self.filterspec is not None:
+ value = self.filterspec.get(property, [])
else:
value = []
if propclass.isLinkType or propclass.isMultilinkType:
k = linkcl.labelprop()
for optionid in linkcl.list():
option = linkcl.get(optionid, k)
- if optionid in value:
+ if optionid in value or option in value:
checked = 'checked'
else:
checked = ''
columns=[], sort=[], group=[], show_display_form=1, nodeids=None,
col_re=re.compile(r'<property\s+name="([^>]+)">')):
globals = {
- 'plain': Plain(db, templates, classname, form={}),
- 'field': Field(db, templates, classname, form={}),
- 'menu': Menu(db, templates, classname, form={}),
- 'link': Link(db, templates, classname, form={}),
- 'count': Count(db, templates, classname, form={}),
- 'reldate': Reldate(db, templates, classname, form={}),
- 'download': Download(db, templates, classname, form={}),
- 'checklist': Checklist(db, templates, classname, form={}),
- 'list': List(db, templates, classname, form={}),
- 'history': History(db, templates, classname, form={}),
- 'submit': Submit(db, templates, classname, form={}),
- 'note': Note(db, templates, classname, form={})
+ 'plain': Plain(db, templates, classname, filterspec=filterspec),
+ 'field': Field(db, templates, classname, filterspec=filterspec),
+ 'menu': Menu(db, templates, classname, filterspec=filterspec),
+ 'link': Link(db, templates, classname, filterspec=filterspec),
+ 'count': Count(db, templates, classname, filterspec=filterspec),
+ 'reldate': Reldate(db, templates, classname, filterspec=filterspec),
+ 'download': Download(db, templates, classname, filterspec=filterspec),
+ 'checklist': Checklist(db, templates, classname, filterspec=filterspec),
+ 'list': List(db, templates, classname, filterspec=filterspec),
+ 'history': History(db, templates, classname, filterspec=filterspec),
+ 'submit': Submit(db, templates, classname, filterspec=filterspec),
+ 'note': Note(db, templates, classname, filterspec=filterspec)
}
cl = db.classes[classname]
properties = cl.getprops()
w = client.write
+ w('<form>')
try:
template = open(os.path.join(templates, classname+'.filter')).read()
all_filters = []
if template and filter:
# display the filter section
- w('<form>')
w('<table width=100% border=0 cellspacing=0 cellpadding=2>')
w('<tr class="location-bar">')
w(' <th align="left" colspan="2">Filter specification...</th>')
w('</tr>')
replace = IndexTemplateReplace(globals, locals(), filter)
w(replace.go(template))
- if columns:
- w('<input type="hidden" name=":columns" value="%s">'%','.join(columns))
- if filter:
- w('<input type="hidden" name=":filter" value="%s">'%','.join(filter))
- if sort:
- w('<input type="hidden" name=":sort" value="%s">'%','.join(sort))
- if group:
- w('<input type="hidden" name=":group" value="%s">'%','.join(group))
- for k, v in filterspec.items():
- if type(v) == type([]): v = ','.join(v)
- w('<input type="hidden" name="%s" value="%s">'%(k, v))
w('<tr class="location-bar"><td width="1%%"> </td>')
w('<td><input type="submit" value="Redisplay"></td></tr>')
w('</table>')
- w('</form>')
+
+ # If the filters aren't being displayed, then hide their current
+ # value in the form
+ if not filter:
+ for k, v in filterspec.items():
+ if type(v) == type([]): v = ','.join(v)
+ w('<input type="hidden" name="%s" value="%s">'%(k, v))
+
+ # make sure that the sorting doesn't get lost either
+ if sort:
+ w('<input type="hidden" name=":sort" value="%s">'%','.join(sort))
# XXX deviate from spec here ...
# load the index section template and figure the default columns from it
return
# now add in the filter/columns/group/etc config table form
- w('<p><form>')
+ w('<p>')
w('<table width=100% border=0 cellspacing=0 cellpadding=2>')
- for k,v in filterspec.items():
- if type(v) == type([]): v = ','.join(v)
- w('<input type="hidden" name="%s" value="%s">'%(k, v))
- if sort:
- w('<input type="hidden" name=":sort" value="%s">'%','.join(sort))
names = []
for name in cl.getprops().keys():
if name in all_filters or name in all_columns:
#
# $Log: not supported by cvs2svn $
+# Revision 1.8 2001/07/29 07:01:39 richard
+# Added vim command to all source so that we don't get no steenkin' tabs :)
+#
# Revision 1.7 2001/07/29 05:36:14 richard
# Cleanup of the link label generation.
#
diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index 4dd8364fb8b3776406f40415662bf772b8952b2a..bc1013f4967dc286b31566395c56e8ede77ed8f5 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
-# $Id: hyperdb.py,v 1.7 2001-07-29 07:01:39 richard Exp $
+# $Id: hyperdb.py,v 1.8 2001-07-29 08:27:40 richard Exp $
# standard python modules
import cPickle, re, string
"""Return the name of the key property for this class or None."""
return self.key
- def labelprop(self, nodeid):
+ def labelprop(self):
''' Return the property name for a label for the given node.
This method attempts to generate a consistent label for the node.
u.append(entry)
l.append((1, k, u))
elif propclass.isStringType:
- v = v[0]
if '*' in v or '?' in v:
# simple glob searching
v = v.replace('?', '.')
#
# $Log: not supported by cvs2svn $
+# Revision 1.7 2001/07/29 07:01:39 richard
+# Added vim command to all source so that we don't get no steenkin' tabs :)
+#
# Revision 1.6 2001/07/29 05:36:14 richard
# Cleanup of the link label generation.
#