def GET_wiki_discussions(self, page, num, after, reverse, count): page_url = add_sr("%s/%s" % (c.wiki_base_url, page.name)) links = url_links(page_url) builder = IDBuilder([ link._fullname for link in links ], num = num, after = after, reverse = reverse, count = count, skip = False) listing = LinkListing(builder).listing() return WikiDiscussions(listing, page=page.name, may_revise=this_may_revise(page)).render()
def __init__(self, content, edit_by, edit_date, diff=None): self.page_content = wikimarkdown(content) if content else '' self.page_content_md = content self.diff = diff self.edit_by = edit_by self.edit_date = edit_date self.base_url = c.wiki_base_url self.may_revise = this_may_revise(c.page_obj) Templated.__init__(self)
def __init__(self, content, diff=None, **context): if not content and not context.get('alert'): if this_may_revise(c.page_obj): context['alert'] = _( "this page is empty, edit it to add some content.") content = WikiView(content, context.get('edit_by'), context.get('edit_date'), diff=diff) WikiBase.__init__(self, content, **context)
def GET_wiki_page(self, pv, page_name): message = None if c.errors.get(('PAGE_NAME_NORMALIZED', 'page')): url = join_urls(c.wiki_base_url, page_name) return self.redirect(url) page, version, version2 = pv if not page: if c.render_style in extensions.API_TYPES: self.handle_error(404, 'PAGE_NOT_CREATED') return WikiNotFound(page=page_name).render() if version: edit_by = version.get_author() edit_date = version.date else: edit_by = page.get_author() edit_date = page._get('last_edit_date') diffcontent = None if not version: content = page.content if c.is_wiki_mod and page.name in page_descriptions: message = page_descriptions[page.name] else: message = _("viewing revision from %s") % timesince(version.date) if version2: t1 = timesince(version.date) t2 = timesince(version2.date) timestamp1 = _("%s ago") % t1 timestamp2 = _("%s ago") % t2 message = _("comparing revisions from %(date_1)s and %(date_2)s") \ % {'date_1': t1, 'date_2': t2} diffcontent = make_htmldiff(version.content, version2.content, timestamp1, timestamp2) content = version2.content else: message = _("viewing revision from %s ago") % timesince(version.date) content = version.content return WikiPageView(content, alert=message, v=version, diff=diffcontent, may_revise=this_may_revise(page), edit_by=edit_by, edit_date=edit_date, page=page.name).render()
def __init__(self, content, actionless=False, alert=None, **context): pageactions = [] if not actionless and c.page: pageactions += [(c.page, _("view"), False)] if this_may_revise(c.page_obj): pageactions += [('edit', _("edit"), True)] pageactions += [('revisions/%s' % c.page, _("history"), False)] pageactions += [('discussions', _("talk"), True)] if c.is_wiki_mod: pageactions += [('settings', _("settings"), True)] action = context.get('wikiaction', (c.page, 'wiki')) context['title'] = c.site.name if alert: context['infotext'] = alert elif c.wikidisabled: context['infotext'] = _("this wiki is currently disabled, only mods may interact with this wiki") context['content'] = WikiBasePage(content, action, pageactions, **context) Reddit.__init__(self, **context)
def __init__(self, content, actionless=False, alert=None, **context): pageactions = [] if not actionless and c.page: pageactions += [(c.page, _("view"), False)] if this_may_revise(c.page_obj): pageactions += [('edit', _("edit"), True)] pageactions += [('revisions/%s' % c.page, _("history"), False)] pageactions += [('discussions', _("talk"), True)] if c.is_wiki_mod: pageactions += [('settings', _("settings"), True)] action = context.get('wikiaction', (c.page, 'wiki')) context['title'] = c.site.name if alert: context['infotext'] = alert elif c.wikidisabled: context['infotext'] = _( "this wiki is currently disabled, only mods may interact with this wiki" ) context['content'] = WikiBasePage(content, action, pageactions, **context) Reddit.__init__(self, **context)
def __init__(self, content, diff=None, **context): if not content and not context.get('alert'): if this_may_revise(c.page_obj): context['alert'] = _("this page is empty, edit it to add some content.") content = WikiView(content, context.get('edit_by'), context.get('edit_date'), diff=diff) WikiBase.__init__(self, content, **context)
def GET_wiki_revisions(self, num, after, reverse, count, page): revisions = page.get_revisions() builder = WikiRevisionBuilder(revisions, num=num, reverse=reverse, count=count, after=after, skip=not c.is_wiki_mod, wrap=default_thing_wrapper()) listing = WikiRevisionListing(builder).listing() return WikiRevisions(listing, page=page.name, may_revise=this_may_revise(page)).render()