Details
- Applies to
- 1.5.5a, 1.3.1 (different patch files--see below)
- Purpose
Patches the RecentChanges macro to be less confusing. (see: MoinMoinBugs/RecentChangesIsBroken)
- Description
Many people find the set of revisions the current RecentChanges macro displays to be very confusing. This patch makes the following changes:
For a given time range (by bookmark or days), all revisions to a page are always shown, grouped by day. (old behavior: only the latest day's changes are shown)
New is displayed if the oldest revision for a day was a page create. (icon links to a view of the page)
Deleted is displayed if the newest revision for a day was a page delete. (no link)
Updated is displayed in all other cases (icon links to a diff for all of the changes represented by that line item)
Patch
In addition to applying the patch, I recommend that the moinmaster RecentChanges page be modified to remove the explanation at the bottom of the page. With this patch applied, I believe no explanation for the RecentChanges page is neccessary.
1 --- MoinMoin/macro/RecentChanges.py.155a.old Sun Oct 22 16:17:52 2006
2 +++ MoinMoin/macro/RecentChanges.py Sun Oct 15 23:04:18 2006
3 @@ -44,6 +44,7 @@
4
5 return wikiutil.make_breakable(comment, _MAX_COMMENT_LENGTH)
6
7 +# Format a single page's day's worth of page edits.
8 def format_page_edits(macro, lines, bookmark_usecs):
9 request = macro.request
10 _ = request.getText
11 @@ -51,34 +52,67 @@
12 line = lines[0]
13 pagename = line.pagename
14 tnow = time.time()
15 - is_new = lines[-1].action == 'SAVENEW'
16 - # check whether this page is newer than the user's bookmark
17 - hilite = line.ed_time_usecs > (bookmark_usecs or line.ed_time_usecs)
18 +
19 page = Page(request, line.pagename)
20
21 - html_link = ''
22 - if not page.exists():
23 +# request.write("pagename=%s<br>\n " % line.pagename)
24 +
25 + latestrev = None
26 + oldestrevline = None
27 + for line in lines:
28 +# request.write("- rev=%s<br>\n" % line.rev)
29 + # Determine the first & last _real_ page revision
30 + # (i.e. attachnew/del == 999999; we don't care about these)
31 + lrev = int(line.rev)
32 + if lrev != 99999999:
33 + if latestrev == None:
34 + latestrev = lrev
35 + oldestrevline = line
36 +
37 + if latestrev and not page.get_rev(-1, latestrev)[2]:
38 + # If the latest page revision was a delete,
39 # indicate page was deleted
40 html_link = request.theme.make_icon('deleted')
41 - elif is_new:
42 - # show "NEW" icon if page was created after the user's bookmark
43 - if hilite:
44 - img = request.theme.make_icon('new')
45 - html_link = wikiutil.link_tag(request, wikiutil.quoteWikinameURL(pagename),
46 - img, formatter=macro.formatter)
47 - elif hilite:
48 - # show "UPDATED" icon if page was edited after the user's bookmark
49 - img = request.theme.make_icon('updated')
50 - html_link = wikiutil.link_tag(request,
51 - wikiutil.quoteWikinameURL(pagename) + "?action=diff&date=%d" % bookmark_usecs,
52 +# request.write("- DELETED<br>\n")
53 + elif oldestrevline and oldestrevline.action == 'SAVENEW':
54 + # the oldest change was a create, show it as "new"
55 + img = request.theme.make_icon('new')
56 + html_link = wikiutil.link_tag(request, wikiutil.quoteWikinameURL(pagename),
57 img, formatter=macro.formatter)
58 +# request.write("- NEW<br>\n")
59 else:
60 - # show "DIFF" icon else
61 - img = request.theme.make_icon('diffrc')
62 - html_link = wikiutil.link_tag(request,
63 - wikiutil.quoteWikinameURL(line.pagename) + "?action=diff",
64 - img, formatter=macro.formatter)
65 + # else call it modified.
66 + img = request.theme.make_icon('updated')
67 + html_link = ''
68 +
69 + if latestrev:
70 + # Try to link from the latest rev to one-before the oldest rev.
71 + # Need to figure out what the next-oldest revision is.
72 + oldestrev = int(oldestrevline.rev)
73 + found = False
74 + prehistoric_rev = None
75 + for rev in page.getRevList():
76 + if found:
77 + prehistoric_rev = rev
78 + break
79 + elif rev == oldestrev:
80 + found = True
81 +
82 + if prehistoric_rev:
83 + html_link = wikiutil.link_tag(request,
84 + wikiutil.quoteWikinameURL(pagename)
85 + + "?action=diff&rev1=%d&rev2=%d" % (prehistoric_rev, latestrev),
86 + img, formatter=macro.formatter)
87 +# request.write("- DIFF between %d and %d<br>\n" % (prehistoric_rev, latestrev))
88
89 + if not html_link:
90 + # There wasn't anything to diff (probably just attachment changes)
91 + # so just link to the page.
92 + html_link = wikiutil.link_tag(request, wikiutil.quoteWikinameURL(pagename),
93 + img, formatter=macro.formatter)
94 +
95 +# request.write("- MOD<br>\n")
96 +# request.write("<br>\n")
97 # print name of page, with a link to it
98 force_split = len(page.page_name) > _MAX_PAGENAME_LENGTH
99
100 @@ -278,7 +312,6 @@
101 request.write(request.theme.recentchanges_header(d))
102
103 pages = {}
104 - ignore_pages = {}
105
106 today = request.user.getTime(tnow)[0:3]
107 this_day = today
108 @@ -296,8 +329,6 @@
109 if ((this_day != day or (not hilite and not max_days))) and len(pages) > 0:
110 # new day or bookmark reached: print out stuff
111 this_day = day
112 - for page in pages:
113 - ignore_pages[page] = None
114 pages = pages.values()
115 pages.sort(cmp_lines)
116 pages.reverse()
117 @@ -324,10 +355,7 @@
118 elif this_day != day:
119 # new day but no changes
120 this_day = day
121 -
122 - if line.pagename in ignore_pages:
123 - continue
124 -
125 +
126 # end listing by default if user has a bookmark and we reached it
127 if not max_days and not hilite:
128 msg = _('[Bookmark reached]')
129 @@ -342,8 +370,6 @@
130 # end of loop reached: print out stuff
131 # XXX duplicated code from above
132 # but above does not trigger if we have the first day in wiki history
133 - for page in pages:
134 - ignore_pages[page] = None
135 pages = pages.values()
136 pages.sort(cmp_lines)
137 pages.reverse()
easier_RecentChanges-1.5.5a.patch
Moin 1.3.1
For those still using an ancient version of Moin, I've posted a version of the patch for Moin 1.3.1:
easier_RecentChanges-1.3.1.patch
-- BradeyHonsinger 2009-03-16 20:32:06
Discussion
See: MoinMoinBugs/RecentChangesIsBroken
Sometimes if you unpack a zip file or do use packages you can get a few hundreds log entries per page. Are those always shown? -- ReimarBauer 2007-09-10 17:08:22
Plan
- Priority:
- Assigned to:
- Status: