summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 01f46c2)
raw | patch | inline | side by side (parent: 01f46c2)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 25 Jul 2001 03:39:47 +0000 (03:39 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Wed, 25 Jul 2001 03:39:47 +0000 (03:39 +0000) |
got it defaulting to 'name', then 'title' and then a "random" property (first
one returned by getprops().keys().
Needs to be moved onto the Class I think...
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@77 57a73879-2fb5-44c3-a270-3262357dd7e2
one returned by getprops().keys().
Needs to be moved onto the Class I think...
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@77 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/htmltemplate.py | patch | blob | history |
index b4087fdaf2f0903aba4588c7e9aa97e50b35f29e..cdbdc3fb7d4993af0e8b686e60a7ff5607b4cfb3 100644 (file)
--- a/roundup/htmltemplate.py
+++ b/roundup/htmltemplate.py
-# $Id: htmltemplate.py,v 1.2 2001-07-22 12:09:32 richard Exp $
+# $Id: htmltemplate.py,v 1.3 2001-07-25 03:39:47 richard Exp $
import os, re, StringIO, urllib, cgi
value = str(value)
elif propclass.isLinkType:
linkcl = self.db.classes[propclass.classname]
- if value: value = str(linkcl.get(value, linkcl.getkey()))
+ k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
+ if value: value = str(linkcl.get(value, k))
else: value = '[unselected]'
elif propclass.isMultilinkType:
linkcl = self.db.classes[propclass.classname]
k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
value = ', '.join([linkcl.get(i, k) for i in value])
else:
s = 'Plain: bad propclass "%s"'%propclass
linkcl = self.db.classes[propclass.classname]
l = ['<select name="%s">'%property]
k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
for optionid in linkcl.list():
option = linkcl.get(optionid, k)
s = ''
height = height or min(len(list), 7)
l = ['<select multiple name="%s" size="%s">'%(property, height)]
k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
for optionid in list:
option = linkcl.get(optionid, k)
s = ''
linkcl = self.db.classes[propclass.classname]
l = ['<select name="%s">'%property]
k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
for optionid in linkcl.list():
option = linkcl.get(optionid, k)
s = ''
height = height or min(len(list), 7)
l = ['<select multiple name="%s" size="%s">'%(property, height)]
k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
for optionid in list:
option = linkcl.get(optionid, k)
s = ''
else: value = ''
if propclass.isLinkType:
linkcl = self.db.classes[propclass.classname]
+ k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
linkvalue = linkcl.get(value, k)
return '<a href="%s%s">%s</a>'%(linkcl, value, linkvalue)
if propclass.isMultilinkType:
linkcl = self.db.classes[propclass.classname]
+ k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
l = []
for value in value:
linkvalue = linkcl.get(value, k)
linkcl = self.db.classes[propclass.classname]
l = []
k = linkcl.getkey()
+ # if the linked-to class doesn't have a key property, then try
+ # 'name', then 'title' and then just use a random one.
+ if not k:
+ linkprops = linkcl.getprops()
+ if linkprops.has_key('name'):
+ k = 'name'
+ elif linkprops.has_key('title'):
+ k = 'title'
+ else:
+ k = linkprops.keys()[0]
for optionid in linkcl.list():
option = linkcl.get(optionid, k)
if optionid in value:
#
# $Log: not supported by cvs2svn $
+# Revision 1.2 2001/07/22 12:09:32 richard
+# Final commit of Grande Splite
+#
# Revision 1.1 2001/07/22 11:58:35 richard
# More Grande Splite
#