summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 73ac29e)
raw | patch | inline | side by side (parent: 73ac29e)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 10 Jul 2002 00:17:46 +0000 (00:17 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 10 Jul 2002 00:17:46 +0000 (00:17 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@849 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/htmltemplate.py | patch | blob | history |
index a2bc439745fe31a9cd8cf5b72b4dd6e8107f2f95..b6bbb4823ffa1b43e685906096c3e6565fee753e 100644 (file)
--- a/roundup/htmltemplate.py
+++ b/roundup/htmltemplate.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: htmltemplate.py,v 1.97 2002-07-09 05:20:09 richard Exp $
+# $Id: htmltemplate.py,v 1.98 2002-07-10 00:17:46 richard Exp $
__doc__ = """
Template engine.
return self.do_link(property, is_download=1)
- def do_checklist(self, property, **args):
+ def do_checklist(self, property, sortby=None):
''' for a Link or Multilink property, display checkboxes for the
available choices to permit filtering
+
+ sort the checklist by the argument (+/- property name)
'''
propclass = self.properties[property]
if (not isinstance(propclass, hyperdb.Link) and not
linkcl = self.db.classes[propclass.classname]
l = []
k = linkcl.labelprop(1)
+
+ # build list of options and then sort it, either
+ # by id + label or <sortby>-value + label;
+ # a minus reverses the sort order, while + or no
+ # prefix sort in increasing order
+ reversed = 0
+ if sortby:
+ if sortby[0] == '-':
+ reversed = 1
+ sortby = sortby[1:]
+ elif sortby[0] == '+':
+ sortby = sortby[1:]
+ options = []
for optionid in linkcl.list():
+ if sortby:
+ sortval = linkcl.get(optionid, sortby)
+ else:
+ sortval = int(optionid)
option = cgi.escape(str(linkcl.get(optionid, k)))
+ options.append((sortval, option, optionid))
+ options.sort()
+ if reversed:
+ options.reverse()
+
+ # build checkboxes
+ for sortval, option, optionid in options:
if optionid in value or option in value:
checked = 'checked'
else:
return '<a href="javascript:help_window(\'classhelp?classname=%s&' \
'properties=%s\', \'%s\', \'%s\')"><b>(%s)</b></a>'%(classname,
properties, width, height, label)
- #return '<a href="classhelp?classname=%s&properties=%s" target="classhelp"><b>(%s)</b></a>'%(classname,
- # properties, label)
def do_email(self, property, escape=0):
'''display the property as one or more "fudged" email addrs
#
# $Log: not supported by cvs2svn $
+# Revision 1.97 2002/07/09 05:20:09 richard
+# . added email display function - mangles email addrs so they're not so easily
+# scraped from the web
+#
# Revision 1.96 2002/07/09 04:19:09 richard
# Added reindex command to roundup-admin.
# Fixed reindex on first access.