You can see recent changes hierarchically below a particular page as follows. **Make sure to copy from the edit screen instead of from the displayed page because [] stuff isn't displaying correctly.**
Add the following method to the ZWikiPage class:
def get_flat_offspring_page_names(self, REQUEST=None):
"""Return a flat list of all my offspring page names."""
myid = self.id()
nesting = WikiNesting(self.aq_parent)
return nesting.get_flat_offspring_page_names([myid])
Also add this method to the ZWikiPage class:
def get_flat_offspring_pages_sorted_by_mod_time(self, REQUEST=None):
"""Return a flat list of all my offspring pages sorted by modification time."""
pages = []
for pname in self.get_flat_offspring_page_names():
pages.append(getattr(self,pname))
pages.sort(lambda p1, p2: cmp(p1.bobobase_modification_time().ISO(), p2.bobobase_modification_time().ISO()))
pages.reverse()
return pages
Finally, add the following method to the WikiNesting? class:
def get_flat_offspring_page_names(self, pages, did=None):
"""Return flat list showing all offspring of a list of wiki pagenames.
did is used for recursion, to prune already elaborated pages."""
if did is None: did = {}
flat_list = []
for p in pages:
been_there = did.has_key(p)
did[p] = None
if not been_there:
flat_list.append(p)
if self.childmap.has_key(p):
children = self.childmap[p]
if children:
for p2 in self.get_flat_offspring_page_names(children, did=did):
flat_list.append(p2)
return flat_list
Now you can set up a very simple RecentChangesBySubject? ZWikiPage as follows :
<form method="GET" action="RecentChangesBySubject">
Enter a page name to see all pages below it in the table of contents sorted by modification time.
<p>
<b>Page:</b> <input name="subject" type="text" size="30">
<input type="submit" name="submit" value="See Recent Changes">
</form>
<p>
<dtml-if "_.has_key('subject')">
<dtml-if "_.has_key(subject)">
<dtml-var "subject"> pages, most recently changed first (you may bookmark this URL for future reference).<p>
<dtml-call "REQUEST.set('the_page', _.getitem(subject))">
<dtml-call "REQUEST.set('the_offspring_pages_sorted_by_mod_time', the_page.get_flat_offspring_pages_sorted_by_mod_time())">
<table border="0">
<tr><td><b>Page</b></td><td><b>Size</b></td><td><b>Last modified</b></td></tr>
<dtml-in "the_offspring_pages_sorted_by_mod_time">
<tr><td>
[<dtml-var "_.getitem('sequence-item').id()">]
</td><td align="right">
<dtml-var "_.getitem('sequence-item').getSize()">
</td><td>
<dtml-var "_.getitem('sequence-item').bobobase_modification_time()">
</td></tr>
<dtml-if sequence-end>
</table>
<p>(<dtml-var sequence-number> pages)
</dtml-if>
</dtml-in>
<dtml-else>
<dtml-if "subject != ''">
There is no <dtml-var "subject"> page
</dtml-if>
</dtml-if>
</dtml-if>
You can put hyperinks to this page (with the appropriate parameter set) on the standard header by adding this code to standard_wiki_header:
<p align="right"> <small>
<a href="<dtml-var wiki_page_url>/map"> Entire table of contents</a>
- <a href="<dtml-var wiki_page_url>/offspring"> <dtml-var id> contents</a>
- <a href="&dtml-wiki_base_url;/RecentChangesBySubject?subject=<dtml-var id>"> <dtml-var id> Recent Changes</a>
</small>
Make sure that the created RecentChangesBySubject? page's page_type property is set to htmldtml -EdwardKreis
See also: ZwikiModification
Nifty --DeanG, Fri, 21 Nov 2003 13:20:13 -0800 reply
Is this still valid?
There are a number of angles here: A.:
- RC within this page and it's children
- RC within this page and it's subtopics (different than #1?)
B:
- RC with a form add Catalog search on expr= , in this case Subject Feature = keyword, badge, category.