Back to index

moin  1.9.0~rc2
EditedSystemPages.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     EditedSystemPages - list system pages that has been edited in this wiki.
00004 
00005     @copyright: 2004 Nir Soffer <nirs@freeshell.org>
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 class EditedSystemPages:
00010 
00011     def __init__(self, macro):
00012         self.macro = macro
00013         self.request = macro.request
00014         self.formatter = macro.formatter
00015 
00016     def renderInPage(self):
00017         """ Render macro in page context
00018 
00019         The parser should decide what to do if this macro is placed in a
00020         paragraph context.
00021         """
00022         from MoinMoin.Page import Page
00023 
00024         # Get page list for current user (use this as admin), filter
00025         # pages that are both underlay and standard pages.
00026         def filterfn(name):
00027             page = Page(self.request, name)
00028             return (page.isStandardPage(includeDeleted=0) and
00029                     page.isUnderlayPage(includeDeleted=0))
00030 
00031         # Get page filtered page list. We don't need to filter by
00032         # exists, because our filter check this already.
00033         pages = self.request.rootpage.getPageList(filter=filterfn, exists=0)
00034 
00035         # Format as numberd list, sorted by page name
00036         pages.sort()
00037         result = []
00038         f = self.formatter
00039         result.append(f.number_list(1))
00040         for name in pages:
00041             result.append(f.listitem(1))
00042             result.append(f.pagelink(1, name, generated=1))
00043             result.append(f.text(name))
00044             result.append(f.pagelink(0, name))
00045             result.append(f.listitem(0))
00046         result.append(f.number_list(0))
00047 
00048         return ''.join(result)
00049 
00050 
00051 def macro_EditedSystemPages(macro):
00052     """ Temporary glue code to use with moin current macro system """
00053     return EditedSystemPages(macro).renderInPage()
00054