Attachment 'easier_RecentChanges-1.3.1.patch'

Download

   1 Index: MoinMoin/macro/RecentChanges.py
   2 ===================================================================
   3 --- MoinMoin/macro/RecentChanges.py	(revision 712)
   4 +++ MoinMoin/macro/RecentChanges.py	(working copy)
   5 @@ -47,33 +47,68 @@
   6      line = lines[0]
   7      pagename = line.pagename
   8      tnow = time.time()
   9 -    is_new = lines[-1].action == 'SAVENEW'
  10 -    # check whether this page is newer than the user's bookmark
  11 -    hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs)
  12 +
  13      page = Page(request, line.pagename)
  14  
  15 -    html_link = ''
  16 -    if not page.exists():
  17 +    #request.write("pagename=%s<br>\n " % line.pagename)
  18 +    
  19 +    latestrev = None
  20 +    oldestrevline = None
  21 +    for line in lines:
  22 +        #request.write("- rev=%s<br>\n" % line.rev)
  23 +        # Determine the first & last _real_ page revision
  24 +        # (i.e. attachnew/del == 999999; we don't care about these)
  25 +        lrev = int(line.rev)
  26 +        if lrev != 99999999:
  27 +            if latestrev == None:
  28 +                latestrev = lrev
  29 +            oldestrevline = line
  30 +
  31 +    if latestrev and not page.get_rev(rev=latestrev)[2]:
  32 +        # If the latest page revision was a delete, 
  33          # indicate page was deleted
  34          html_link = request.theme.make_icon('deleted')
  35 -    elif is_new:
  36 -        # show "NEW" icon if page was created after the user's bookmark
  37 -        if hilite:
  38 -            if page.exists():
  39 -                html_link = request.theme.make_icon('new')
  40 -    elif hilite:
  41 -        # show "UPDATED" icon if page was edited after the user's bookmark
  42 +        #request.write("- DELETED<br>\n")
  43 +    elif oldestrevline and oldestrevline.action == 'SAVENEW':
  44 +        # the oldest change was a create, show it as "new"
  45 +        img = request.theme.make_icon('new')
  46 +        html_link = wikiutil.link_tag(request, wikiutil.quoteWikinameURL(pagename),
  47 +                                       img, formatter=macro.formatter)
  48 +        #request.write("- NEW<br>\n")
  49 +    else:
  50 +        # else call it modified.
  51          img = request.theme.make_icon('updated')
  52 -        html_link = wikiutil.link_tag(request,
  53 -                                      wikiutil.quoteWikinameURL(pagename) + "?action=diff&date=%d" % bookmark_usecs,
  54 -                                      img, formatter=macro.formatter, pretty_url=1)
  55 -    else:
  56 -        # show "DIFF" icon else
  57 -        img = request.theme.make_icon('diffrc')
  58 -        html_link = wikiutil.link_tag(request,
  59 -                                      wikiutil.quoteWikinameURL(line.pagename) + "?action=diff",
  60 -                                      img, formatter=macro.formatter, pretty_url=1)
  61 +        html_link = ''
  62  
  63 +        if latestrev:
  64 +            # Try to link from the latest rev to one-before the oldest rev.
  65 +            # Need to figure out what the next-oldest revision is.
  66 +            oldestrev = int(oldestrevline.rev)
  67 +            found = False
  68 +            prehistoric_rev = None
  69 +            for rev in page.getRevList():
  70 +                if found:
  71 +                    prehistoric_rev = rev
  72 +                    break
  73 +                elif rev == oldestrev:
  74 +                    found = True
  75 +
  76 +            if prehistoric_rev:
  77 +                html_link = wikiutil.link_tag(request,
  78 +                                  wikiutil.quoteWikinameURL(pagename) 
  79 +                                  + "?action=diff&rev1=%d&rev2=%d" % (prehistoric_rev, latestrev),
  80 +                                  img, formatter=macro.formatter)
  81 +                #request.write("- DIFF between %d and %d<br>\n" % (prehistoric_rev, latestrev))
  82 + 
  83 +        if not html_link:
  84 +            # There wasn't anything to diff (probably just attachment changes)
  85 +            # so just link to the page.
  86 +            html_link = wikiutil.link_tag(request, wikiutil.quoteWikinameURL(pagename),
  87 +                                          img, formatter=macro.formatter)
  88 +            
  89 +        #request.write("- MOD<br>\n")
  90 +    #request.write("<br>\n")
  91 +
  92      # print name of page, with a link to it
  93      force_split = len(page.page_name) > _MAX_PAGENAME_LENGTH
  94      
  95 @@ -323,7 +358,9 @@
  96              this_day = day
  97  
  98          if ignore_pages.has_key(line.pagename):
  99 -            continue
 100 +            # Don't ignore pages just because we've already seen a change
 101 +            #continue
 102 +            pass
 103          
 104          # end listing by default if user has a bookmark and we reached it
 105          if not max_days and not hilite:

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-03-16 20:31:26, 4.4 KB) [[attachment:easier_RecentChanges-1.3.1.patch]]
  • [get | view] (2006-10-24 05:28:50, 5.5 KB) [[attachment:easier_RecentChanges-1.5.5a.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.