def RECENT_CHANGES(request) : wikidpage = pagestore.getNewPage(cloneSource=None, name=None) wikidpage.name = "Recent Modifications" wikidpage.content = "Recent Changes\n====================\n\n" displayFields = " fields ID page type page modified name" wikidpage.content += """Today\n-----\n\n:::anything where modified = today%s:::\n\n""" % displayFields wikidpage.content += """Yesterday\n---------\n\n:::anything where modified = yesterday%s:::\n\n""" % displayFields wikidpage.content += """This week\n---------\n\n:::anything where modified < "yesterday" and modified >= "this monday"%s:::\n\n""" % displayFields wikidpage.content += """This month\n------------\n\n:::anything where modified >= "this month" and modified < "this monday"%s:::\n\n""" % displayFields return wikidpage
def ALL_PAGES(request) : wikidpage = pagestore.getNewPage(cloneSource=None, name=None) wikidpage.content = "All Pages\n=========\n\n" # Get a list of contexts wikidbaseContexts = wikidbase.core.context.getContexts() for nContext in wikidbaseContexts : displayTerm = wikidbaseContexts[nContext].contextNameVariations.getMostCommon() wikidpage.content += """%s\n%s\n:::%s:::\n\n""" % (displayTerm.capitalize(), "-"*len(displayTerm), nContext) displayTerm = "General Pages" wikidpage.content += """%s\n%s\n:::%s:::\n\n""" % (displayTerm.capitalize(), "-"*len(displayTerm), "pages") wikidpage.name = "All Pages" debugOutput("wikidpage.content: %s" % wikidpage.content) return wikidpage
def QUERY(request) : wikidpage = pagestore.getNewPage(cloneSource=None, name=None) wikidpage.content = "Results\n=========\n\n" queryString = request.REQUEST["query"] # Have a look at the query to see if we can help the user find stuff. query = wikidbase.core.query.SimpleQueryBuilder().buildQuery(queryString) if not query.contexts : if not query.conditionalClause : queryString = """anything where body contains "%s" """ % queryString else : queryString = "anything %s" % queryString # TODO: parse, say: person nick as person where body contains "nick" wikidpage.content += """\n:::%s:::\n\n""" % (queryString) wikidpage.name = "Query" return wikidpage