Hi,
Here's my master plan to improve some of the navigation in the XE wiki:
1) Create new Quick Links Panels with important links (AllDocs, etc)
and add it by default above the Navigation panel
2) Modify the Navigation Panel to support excluding pages and spaces.
It would work as follows:
- Create a NavigationPanelExclusionsClass class and a
NavigationPanelExclusionsClassSheet. The class would contain one big
textarea to enter regex of docs and spaces to exclude (one per line)
- Modify the Navigation Panel code to look for all documents in the
wiki having a NavigationPanelExclusionsClass object and use the
content to verify if a page should be added to the Navigation Panel
or not
- Create a XWiki.NavigationPanelExclusions document (with an
NavigationPanelExclusionsClass object attached) in XE to exclude some
pages/spaces by default (the same that are currently excluded but in
a hard coded way in the Navigation Panel). Also add the list of pages
that are in the Quick Link panels to the exclusion list.
I believe this point 2) will greatly enhance the value of the
Navigation Panel which will then be able to be used effectively on
some wiki-specific spaces for example. BTW we might want to also have
inclusion lists and not only exclusion lists so the
NavigationPanelExclusionsClass could have 2 fields and be renamed to
NavigationPanelSelectionClass or something like that.
3) Improve performances of the Navigation Panel. Right now it's
called on every single page display and does a huge query on the DB
so if the wiki has lots of documents it slows everything down. I'd
like to propose 2 improvements:
a) Use a cache (see below) in which we put the doc list
b) Limit the number of pages to be displayed to the first 100 (for
example) and add some text in the Navigation Panel (like: "Displaying
only the last 100 documents accessed - Use the AllDocs page to view
all pages")
4) Add a Cache service which can be used both by XWiki Core and by
Velocity/Groovy scripts (by making it a plugin for now). It would
work as follows:
- A singleton factory that allows getting and creating cache instances
- The ability to specify if the cache is an application cache
(lifetime of the JVM), or a user session cache (we might also need a
request level cache but let's see that later)
- The ability to specify a maximum cache size and an eviction policy
(No eviction, LRU, etc)
- The ability (and this is key) to specify to what notification even
the cache should be registered to. For example we can imagine the
following events:
- DocumentModificationEvent
- DocumentRenameEvent
- DocumentCreationEvent
- DocumentDeletionEvent
- ObjectAdditionEvent
- etc.
What this means is that XWiki core use the cache factory to notify
all caches registered with these events when they happen and the
caches can then have a method to tell their users that the cache
needs to be refreshed.
We would use this in the Navigation Panel so that whenever a new
document is created, renamed or deleted we would reload the cache
with a query against the DB. Something like:
#if (!$xwiki.cache.isRegistered("NavigationPanel"))
$xwiki.cache.register("NavigationPanel", 100, true,
["DocumentRenameEvent", "DocumentCreationEvent",
"DocumentDeletionEvent"];
#end
#set ($cache = $xwiki.cache.get("NavigationPanel"))
#if ($cache.requiresRefresh())
// do the DB query and add to the cache here
#end
// Display the pages from the cache here.
So WDYT?
Thanks
-Vincent