summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65bd3b3)
raw | patch | inline | side by side (parent: 65bd3b3)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 31 Aug 2002 12:07:48 +0000 (12:07 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 31 Aug 2002 12:07:48 +0000 (12:07 +0000) |
Added convenience method for submit buttons
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1016 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1016 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/cgi/templating.py | patch | blob | history |
index d109d8839275d1e57e603c22f5bfc75c3f00c913..a01fa7c768b2740d13e176a2e2eb12b0e22989f2 100644 (file)
-import sys, cgi, urllib
+import sys, cgi, urllib, os
from roundup import hyperdb, date
from roundup.i18n import _
'properties=%s\', \'%s\', \'%s\')"><b>(%s)</b></a>'%(self.classname,
properties, width, height, label)
+ def submit(self, label="Submit New Entry"):
+ ''' Generate a submit button (and action hidden element)
+ '''
+ return ' <input type="hidden" name=":action" value="new">\n'\
+ ' <input type="submit" name="submit" value="%s">'%label
+
def history(self):
return 'New node - no history'
# no good
raise AttributeError, attr
+
+ def submit(self, label="Submit Changes"):
+ ''' Generate a submit button (and action hidden element)
+ '''
+ return ' <input type="hidden" name=":action" value="edit">\n'\
+ ' <input type="submit" name="submit" value="%s">'%label
# XXX this probably should just return the history items, not the HTML
def history(self, direction='descending'):
# try to get the relevant property and treat it
# specially
try:
- prop = props[k]
- except:
+ prop = self.props[k]
+ except KeyError:
prop = None
if prop is not None:
if args[k] and (isinstance(prop, hyperdb.Multilink) or
comments[classname] = _('''The linked class
%(classname)s no longer exists''')%locals()
labelprop = linkcl.labelprop(1)
-# hrefable = os.path.exists(
-# os.path.join(self.instance.TEMPLATES,
-# classname+'.item'))
+ hrefable = os.path.exists(
+ os.path.join(self.db.config.TEMPLATES,
+ classname+'.item'))
if isinstance(prop, hyperdb.Multilink) and \
len(args[k]) > 0:
exists</strike>''')
subml.append('<strike>%s</strike>'%label)
else:
-# if hrefable:
- subml.append('<a href="%s%s">%s</a>'%(
- classname, linkid, label))
+ if hrefable:
+ subml.append('<a href="%s%s">%s</a>'%(
+ classname, linkid, label))
ml.append(sublabel + ', '.join(subml))
cell.append('%s:\n %s'%(k, ', '.join(ml)))
elif isinstance(prop, hyperdb.Link) and args[k]: