From: richard Date: Sat, 31 Aug 2002 12:07:48 +0000 (+0000) Subject: Fixed history and its nihilism X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a00a40e19fdbd91e869a7dc70ff809baf1d5b99f;p=roundup.git Fixed history and its nihilism Added convenience method for submit buttons git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1016 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index d109d88..a01fa7c 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -1,4 +1,4 @@ -import sys, cgi, urllib +import sys, cgi, urllib, os from roundup import hyperdb, date from roundup.i18n import _ @@ -203,6 +203,12 @@ class HTMLClass: 'properties=%s\', \'%s\', \'%s\')">(%s)'%(self.classname, properties, width, height, label) + def submit(self, label="Submit New Entry"): + ''' Generate a submit button (and action hidden element) + ''' + return ' \n'\ + ' '%label + def history(self): return 'New node - no history' @@ -265,6 +271,12 @@ class HTMLItem: # no good raise AttributeError, attr + + def submit(self, label="Submit Changes"): + ''' Generate a submit button (and action hidden element) + ''' + return ' \n'\ + ' '%label # XXX this probably should just return the history items, not the HTML def history(self, direction='descending'): @@ -305,8 +317,8 @@ class HTMLItem: # 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 @@ -320,9 +332,9 @@ class HTMLItem: 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: @@ -349,9 +361,9 @@ class HTMLItem: exists''') subml.append('%s'%label) else: -# if hrefable: - subml.append('%s'%( - classname, linkid, label)) + if hrefable: + subml.append('%s'%( + classname, linkid, label)) ml.append(sublabel + ', '.join(subml)) cell.append('%s:\n %s'%(k, ', '.join(ml))) elif isinstance(prop, hyperdb.Link) and args[k]: