diff -r -c10 roundup-1.3.3.original/roundup/cgi/templating.py roundup-1.3.3/roundup/cgi/templating.py
*** roundup-1.3.3.original/roundup/cgi/templating.py	2007-02-24 09:48:35.000000000 +0000
--- roundup-1.3.3/roundup/cgi/templating.py	2007-02-24 09:49:06.000000000 +0000
***************
*** 13,33 ****
  - HTMLRequest.default(self, sort, group, filter, columns, **filterspec):
    """Set the request's view arguments to the given values when no
       values are found in the CGI environment.
    """
  - have menu() methods accept filtering arguments
  '''
  
  __docformat__ = 'restructuredtext'
  
  
! import sys, cgi, urllib, os, re, os.path, time, errno, mimetypes, csv
  import calendar, textwrap
  
  from roundup import hyperdb, date, support
  from roundup import i18n
  from roundup.i18n import _
  
  try:
      import cPickle as pickle
  except ImportError:
      import pickle
--- 13,33 ----
  - HTMLRequest.default(self, sort, group, filter, columns, **filterspec):
    """Set the request's view arguments to the given values when no
       values are found in the CGI environment.
    """
  - have menu() methods accept filtering arguments
  '''
  
  __docformat__ = 'restructuredtext'
  
  
! import sys, cgi, urllib, os, re, os.path, time, errno, mimetypes, csv, difflib
  import calendar, textwrap
  
  from roundup import hyperdb, date, support
  from roundup import i18n
  from roundup.i18n import _
  
  try:
      import cPickle as pickle
  except ImportError:
      import pickle
***************
*** 1021,1046 ****
                              current[k] = str(d)
  
                      elif isinstance(prop, hyperdb.Interval) and args[k]:
                          val = str(date.Interval(args[k],
                              translator=self._client))
                          cell.append('%s: %s'%(self._(k), val))
                          if current.has_key(k):
                              cell[-1] += ' -> %s'%current[k]
                              current[k] = val
  
!                     elif isinstance(prop, hyperdb.String) and args[k]:
!                         val = cgi.escape(args[k])
!                         cell.append('%s: %s'%(self._(k), val))
                          if current.has_key(k):
!                             cell[-1] += ' -> %s'%current[k]
!                             current[k] = val
  
                      elif isinstance(prop, hyperdb.Boolean) and args[k] is not None:
                          val = args[k] and ''"Yes" or ''"No"
                          cell.append('%s: %s'%(self._(k), val))
                          if current.has_key(k):
                              cell[-1] += ' -> %s'%current[k]
                              current[k] = val
  
                      elif not args[k]:
                          if current.has_key(k):
--- 1021,1047 ----
                              current[k] = str(d)
  
                      elif isinstance(prop, hyperdb.Interval) and args[k]:
                          val = str(date.Interval(args[k],
                              translator=self._client))
                          cell.append('%s: %s'%(self._(k), val))
                          if current.has_key(k):
                              cell[-1] += ' -> %s'%current[k]
                              current[k] = val
  
!                     elif isinstance(prop, hyperdb.String):
                          if current.has_key(k):
!                             new_string = args[k] or '' 
!                             cell.append(self._string_history_diff(k,new_string,current[k]))
!                             current[k] = new_string
!                         else:
!                             cell.append('%s: %s'%(self._(k), cgi.escape(args[k])))
  
                      elif isinstance(prop, hyperdb.Boolean) and args[k] is not None:
                          val = args[k] and ''"Yes" or ''"No"
                          cell.append('%s: %s'%(self._(k), val))
                          if current.has_key(k):
                              cell[-1] += ' -> %s'%current[k]
                              current[k] = val
  
                      elif not args[k]:
                          if current.has_key(k):
***************
*** 1083,1102 ****
--- 1084,1117 ----
               self._('History'),
               '</th></tr><tr>',
               self._('<th>Date</th>'),
               self._('<th>User</th>'),
               self._('<th>Action</th>'),
               self._('<th>Args</th>'),
              '</tr>']
          l.append('</table>')
          return '\n'.join(l)
  
+     def _string_history_diff(self,k,new,current):
+         if '\n' in new or '\n' in current:
+             difftext = []
+             for diffline in difflib.ndiff(new.split('\n'),current.split('\n')):
+                 try:
+                     cls = _ndiff_classes[diffline[:1]]
+                 except KeyError:
+                     pass
+                 else:
+                     difftext.append("<span class='%s'>%s</span><br/>" % (cls,cgi.escape(diffline[2:])))
+             return '%s:<div class="diff">%s</div>'%(self._(k),'\n'.join(difftext))
+         else:
+             return '%s: %s -> %s'%(self._(k),cgi.escape(new),cgi.escape(current))
+ 
      def renderQueryForm(self):
          ''' Render this item, which is a query, as a search form.
          '''
          # create a new request and override the specified args
          req = HTMLRequest(self._client)
          req.classname = self._klass.get(self._nodeid, 'klass')
          name = self._klass.get(self._nodeid, 'name')
          req.updateFromURL(self._klass.get(self._nodeid, 'url') +
              '&@queryname=%s'%urllib.quote(name))
  
***************
*** 1130,1149 ****
--- 1145,1166 ----
              "@note": self._("Copy of %(class)s %(id)s") % {
                  "class": self._(self._classname), "id": self._nodeid},
          }
          for name in self._props.keys():
              if name not in exclude:
                  query[name] = self[name].plain()
          return self._classname + "?" + "&".join(
              ["%s=%s" % (key, urllib.quote(value))
                  for key, value in query.items()])
  
+ _ndiff_classes = { '+': 'diffadd', '-':'diffdel', ' ':'diffcommon' }
+ 
  class _HTMLUser(_HTMLItem):
      '''Add ability to check for permissions on users.
      '''
      _marker = []
      def hasPermission(self, permission, classname=_marker,
              property=None, itemid=None):
          '''Determine if the user has the Permission.
  
          The class being tested defaults to the template's class, but may
          be overidden for this test by suppling an alternate classname.
Only in roundup-1.3.3/roundup/cgi: templating.py.orig
diff -r -c10 roundup-1.3.3.original/templates/classic/html/style.css roundup-1.3.3/templates/classic/html/style.css
*** roundup-1.3.3.original/templates/classic/html/style.css	2007-02-24 09:48:36.000000000 +0000
--- roundup-1.3.3/templates/classic/html/style.css	2007-02-24 09:52:03.000000000 +0000
***************
*** 310,329 ****
--- 310,343 ----
    text-align: left;
    font-size: 90%;
  }
  
  table.history td {
    font-size: 90%;
    vertical-align: top;
    empty-cells: show;
  }
  
+ /* style for diffs in history */
+ .diff {
+   margin-left: 1em;
+ }
+ .diffadd {
+   background-color: #ffd;
+ }
+ .diffdel {
+   text-decoration: line-through;
+ }
+ .diffcommon {
+   color: #888;
+ }
+ 
  
  /* style for class list */
  table.classlist {
    border-spacing: 0;
    border-collapse: separate;
    width: 100%;
  }
  
  table.classlist th.header{
    padding-top: 10px;
Only in roundup-1.3.3/templates/classic/html: style.css~

 	  	 
