From: richard Date: Sun, 12 Jan 2003 02:22:27 +0000 (+0000) Subject: applied patch for nicer history display (sf feature 638280) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3ba6c9d0d775d560de73b629c3b407bf35ad1236;p=roundup.git applied patch for nicer history display (sf feature 638280) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1440 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index b8e070b..43ae260 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,7 @@ are given with the most recent entry first. - allow additional control over the roundupdb email sending (explicit cc addresses, different from address and different nosy list property) (thanks John Rouillard) +- applied patch for nicer history display (sf feature 638280) 2003-01-10 0.5.4 diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index 8ffa328..1d8779c 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -480,7 +480,7 @@ class HTMLItem(HTMLPermissions): if isinstance(prop, klass): return htmlklass(self._client, self._nodeid, prop, item, value) - raise KeyErorr, item + raise KeyError, item def __getattr__(self, attr): ''' convenience access to properties ''' @@ -511,11 +511,23 @@ class HTMLItem(HTMLPermissions): _('Action'), _('Args'), ''] + current = {} comments = {} history = self._klass.history(self._nodeid) history.sort() if direction == 'descending': history.reverse() + for prop_n in self._props: + prop = self[prop_n] + if isinstance(prop, HTMLProperty): + current[prop_n] = prop.plain() + # make link if hrefable + if prop_n in self._props and isinstance(self._props[prop_n], hyperdb.Link): + classname = self._props[prop_n].classname + if os.path.exists(os.path.join(self._db.config.TEMPLATES, classname + '.item')): + current[prop_n] = '%s'%(classname, + self._klass.get(self._nodeid, prop_n, None), current[prop_n]) + for id, evt_date, user, action, args in history: date_s = str(evt_date).replace("."," ") arg_s = '' @@ -610,27 +622,46 @@ class HTMLItem(HTMLPermissions): label = None if label is not None: if hrefable: - cell.append('%s: %s\n'%(k, - classname, args[k], label)) + old = '%s'%(classname, args[k], label) else: - cell.append('%s: %s' % (k,label)) + old = label; + cell.append('%s: %s' % (k,old)) + if k in current: + cell[-1] += ' -> %s'%current[k] + current[k] = old elif isinstance(prop, hyperdb.Date) and args[k]: d = date.Date(args[k]) cell.append('%s: %s'%(k, str(d))) + if k in current: + cell[-1] += ' -> %s'%current[k] + current[k] = str(d) elif isinstance(prop, hyperdb.Interval) and args[k]: d = date.Interval(args[k]) cell.append('%s: %s'%(k, str(d))) + if k in current: + cell[-1] += ' -> %s'%current[k] + current[k] = str(d) elif isinstance(prop, hyperdb.String) and args[k]: cell.append('%s: %s'%(k, cgi.escape(args[k]))) + if k in current: + cell[-1] += ' -> %s'%current[k] + current[k] = cgi.escape(args[k]) elif not args[k]: - cell.append('%s: (no value)\n'%k) + if k not in current: + cell.append('%s: (no value)'%k) + else: + cell.append('%s: %s'%(k, current[k])) + current[k] = '(no value)' else: - cell.append('%s: %s\n'%(k, str(args[k]))) + cell.append('%s: %s'%(k, str(args[k]))) + if k in current: + cell[-1] += ' -> %s'%current[k] + current[k] = str(args[k]) else: # property no longer exists comments['no_exist'] = _('''The indicated property