Finishing up our Veracity module overview, let’s look at a few “fitting in” considerations.
How’d We End Up in the Menu?
server_files/ui/modules/yourmodule folder contains a
menu.js file, that file will be loaded via a
<script> tag in the footer of every Veracity web page.
Whatever you want to add/change in the Veracity menu, do it here. In our case (and most cases), we just append an item to the
topmenu, which is (surprise!) Veracity’s top-level menu:
1 2 3 4 5 6 7 8 9
Notice that you can count on jQuery being available to your code.
What About the Activity Stream?
Wiki page changes show up in Veracity’s activity stream, alongside commits, bug updates, etc. The activity stream interface is a simple one: you need to create an object supporting three methods:
name(): returns a string describing this particular activity component, for debug logging. Totally up to you.
dagsUsed(): returns an array of database DAG IDs, for caching. Include any DAGs your activity stream might query. In our case, it’s
getActivity(): where all of the work happens
getActivity() returns an array of objects, with (at least) the following members:
what: A short description of the object that changed, updated, etc.
title: Usually redundant to “what”. Used for Atom entry titles.
action: What happened to that thing (created, updated, deleted, fixed…)
who: The Veracity user ID to whom this activity should be attributed (a committer, the editor of this particular Wiki change, etc.)
when: The (Unix timestamp) time when this activity occurred.
link: Optional, a link to the object, its history, etc.
Bug updates, for example, contain (among other things):
1 2 3 4 5 6 7 8
You should return the most recent N items. The activity stream wrappers will sort them in with other activity sources before returning the JSON or Atom stream.
In the wiki’s case, we build records like so:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
The first time a page is seen, we report it as “created”; thereafter, as “edited”. If the title changes along the way, we note that instead.
That’s about it, as module high points go. Further questions are very much welcome at the Veracity Q/A site.