Code

applied patch for nicer history display (sf feature 638280)
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Sun, 12 Jan 2003 02:22:27 +0000 (02:22 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Sun, 12 Jan 2003 02:22:27 +0000 (02:22 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1440 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
roundup/cgi/templating.py

index b8e070b2d086dcb9b5cee9fe6473801f52aaeda1..43ae26017fdccedb113d58e5e3f11e3a04599535 100644 (file)
@@ -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
index 8ffa328e3593273c82190483fb31282ac1d6090d..1d8779c0f1d35db79d8b4ab16ce573e505749b28 100644 (file)
@@ -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):
              _('<th>Action</th>'),
              _('<th>Args</th>'),
             '</tr>']
+        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] = '<a href="%s%s">%s</a>'%(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: <a href="%s%s">%s</a>\n'%(k,
-                                        classname, args[k], label))
+                                    old = '<a href="%s%s">%s</a>'%(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'] = _('''<em>The indicated property