New Recent Changes class
—
!!1!
!
>New recent changes class
—
!!2!
!
—
!!3!
!
The current recent changes helper is pretty simple,
and relies on automatic summary to do the dirty work.
!
!4!
!
—
!!5!
!
Bil Kleb made the following request:
!
!6!
!
—
!!7!
!
1.
Filter out the changes made by
/^Automatic/
authors
—
!!8!
!
—
!!9!
!
2.
Chunk changes to a given page by day,
i.e,
collapse
—
!!10!
!
!
!11!
!
!
!12!
!
!
!13!
!
!
!14!
!
—
!!15!
!
to something like usemod produces:
!
!16!
!
!
!17!
!
!
!18!
!
!
!19!
!
!
!20!
!
—
!!21!
!
where
“diff”
shows you that last diff and
“changes”
shows you all the changes to this page
—
!!22!
!
—
!!23!
!
This would require the following changes:
!
!24!
!
—
!!25!
!
1)
Re-write the AutomaticRecentchanges so that it creates the page itself rather than passing off to an AutomaticSummary class.
!
!26!
!
—
!!27!
!
That would involve:
a)
registering with the wiki to be notified of page changes
( wiki.watch_for(
:page_revised
)
{
|event,
page,
revision|
do_something_with(
page,
revision
)
}
b)
when a revision event occurs,
update some data structure of the recent revisions
c)
converting the data structure into a textile representation and writing to the wiki
( wiki.revise pagename,
content,
author )
!
!28!
!
—
!!29!
!
2)
Create some new
‘view’
types that would have the
‘diff’
and the
‘changes’
laid out as you would like.
!
!30!
!
—
!!31!
!
New views can be created in the views directory of the wiki.
If the wiki receives a request for a url
http://whatever.com/diff/feedback it will look in the views folder for a file called Page_diff.rhtml.
This is expected to be an Erb file.
The
ruby in the erb file is bound to the context of the View class,
so has local variables:
pagename
(String)
, page
(Page)
, renderedview
(String
html from textile), and access to the methods of the View and the Wiki classes. !!32!!-
—
!!33!
!
3)
(Maybe)
the changes and diff probably want to point to a specific set of changes
/ diff.
That would mean would need to work out a way of getting a
‘revision’
variable from the url,
through to the view method in the view class.
!
!34!
!
—
!!35!
!
I guess the format for the url could be:
a)
http://whaterver.com/diff/3/feedback
or
b)
http://whaterver.com/diff/feedback?revision=3 !
!36!
!
—
!!37!
!
I guess I visually prefer a)
but b)
would be easier to code.
!
!38!
!
—
!!39!
!
Would then need to change:
lib/soks-servlet.rb/WikiServlet#service to extract the desired revision number from the request
(e.g.
by looking at request.query[
‘revision’
])
and then edit the call to view.view to have an extra parameter
(e.g.
view(pagename,
view,
person,
revision)
).
!
!40!
!
—
!!41!
!
Then modify lib/soks-view.rb/View#view to accept the extra parameter.
It would then be available as a local variable in the Page_diff.rhtml
—
!!42!
!
!
!43!
!
—
!!44!
!
Our Soks Wiki went
“live”
yesterday within a group of about 40 people and the recent changes page has nearly become useless in it’s current form.
I have it set to only show 100 changes for performance reasons,
and these folks generated that many changes per hour(
!)
figuring this Wiki stuff out.
(Note:
the number of changes would probably be lower if they were able to preview before saving.
However,
it was interesting to see some of their intermediate page changes.
) They are talking about going live within our entire center
(~3,500 people)
on Monday.
..
Bil !
!45!
!
—
!!46!
!
—
!
!47!
!
—
!!48!
!
Ok,
the cvs version now has a few improvements that are getting toward this:
Automatic helpers are exlcuded,
runs of changes by the same person are merged,
and the changes are arranged under day headings.
No direct link to specific diffs yet.
tamc2 !
!49!
!
—
!!50!
!
>Updated 19 March via cvs,
excellent so far.
Thanks.
—
Bil !
!51!
!