Пример #1
0
    def __init__(self, inner_content, page=None, may_revise=False,
                 actionless=False, alert=None, description=None, 
                 showtitle=False, **context):
        pageactions = []
        if not actionless and page:
            pageactions += [(page, _("view"), False)]
            if may_revise:
                pageactions += [('edit', _("edit"), True)]
            pageactions += [('revisions/%s' % page, _("history"), False)]
            pageactions += [('discussions', _("talk"), True)]
            if c.is_wiki_mod:
                pageactions += [('settings', _("settings"), True)]

        action = context.get('wikiaction', (page, 'wiki'))
        
        if alert:
            context['infotext'] = alert
        elif c.wikidisabled:
            context['infotext'] = _("this wiki is currently disabled, only mods may interact with this wiki")
        
        self.pageactions = pageactions
        self.page = page
        self.base_url = c.wiki_base_url
        self.action = action
        self.description = description
        
        if showtitle:
            self.pagetitle = action[1]
        else:
            self.pagetitle = None
        
        self.inner_content = inner_content
        
        Reddit.__init__(self, extra_js_config={'wiki_page': page}, 
                        show_wiki_actions=True, **context)
Пример #2
0
    def __init__(self,
                 content,
                 page=None,
                 may_revise=False,
                 actionless=False,
                 alert=None,
                 description=None,
                 showtitle=False,
                 **context):
        pageactions = []
        if not actionless and page:
            pageactions += [(page, _("view"), False, 'wikiview')]
            if may_revise:
                pageactions += [('edit', _("edit"), True, 'wikiedit')]
            pageactions += [('revisions/%s' % page, _("history"), False,
                             'wikirevisions')]
            pageactions += [('discussions', _("talk"), True, 'wikidiscussions')
                            ]
            if c.is_wiki_mod and may_revise:
                pageactions += [('settings', _("settings"), True,
                                 'wikisettings')]

        action = context.get('wikiaction', (page, 'wiki'))

        if alert:
            context['infotext'] = alert
        elif c.wikidisabled:
            context['infotext'] = _(
                "this wiki is currently disabled, only mods may interact with this wiki"
            )

        self.pageactions = pageactions
        self.page = page
        self.base_url = c.wiki_base_url
        self.action = action
        self.description = description

        if showtitle:
            self.pagetitle = action[1]
        else:
            self.pagetitle = None

        page_classes = None

        if page and "title" not in context:
            context["title"] = _("%(page)s - %(site)s") % {
                "site": c.site.name,
                "page": page
            }
            page_classes = ['wiki-page-%s' % page.replace('/', '-')]

        Reddit.__init__(self,
                        extra_js_config={'wiki_page': page},
                        show_wiki_actions=True,
                        page_classes=page_classes,
                        content=content,
                        short_title=page,
                        **context)
Пример #3
0
    def __init__(
        self,
        content,
        page=None,
        may_revise=False,
        actionless=False,
        alert=None,
        description=None,
        showtitle=False,
        **context
    ):
        pageactions = []
        if not actionless and page:
            pageactions += [(page, _("view"), False)]
            if may_revise:
                pageactions += [("edit", _("edit"), True)]
            pageactions += [("revisions/%s" % page, _("history"), False)]
            pageactions += [("discussions", _("talk"), True)]
            if c.is_wiki_mod and may_revise:
                pageactions += [("settings", _("settings"), True)]

        action = context.get("wikiaction", (page, "wiki"))

        if alert:
            context["infotext"] = alert
        elif c.wikidisabled:
            context["infotext"] = _("this wiki is currently disabled, only mods may interact with this wiki")

        self.pageactions = pageactions
        self.page = page
        self.base_url = c.wiki_base_url
        self.action = action
        self.description = description

        if showtitle:
            self.pagetitle = action[1]
        else:
            self.pagetitle = None

        page_classes = None

        if page and "title" not in context:
            context["title"] = _("%(page)s - %(site)s") % {"site": c.site.name, "page": page}
            page_classes = ["wiki-page-%s" % page.replace("/", "-")]

        Reddit.__init__(
            self,
            extra_js_config={"wiki_page": page},
            show_wiki_actions=True,
            page_classes=page_classes,
            content=content,
            short_title=page,
            **context
        )
Пример #4
0
    def __init__(self,
                 inner_content,
                 page=None,
                 may_revise=False,
                 actionless=False,
                 alert=None,
                 description=None,
                 showtitle=False,
                 **context):
        pageactions = []
        if not actionless and page:
            pageactions += [(page, _("view"), False)]
            if may_revise:
                pageactions += [('edit', _("edit"), True)]
            pageactions += [('revisions/%s' % page, _("history"), False)]
            pageactions += [('discussions', _("talk"), True)]
            if c.is_wiki_mod:
                pageactions += [('settings', _("settings"), True)]

        action = context.get('wikiaction', (page, 'wiki'))

        if alert:
            context['infotext'] = alert
        elif c.wikidisabled:
            context['infotext'] = _(
                "this wiki is currently disabled, only mods may interact with this wiki"
            )

        self.pageactions = pageactions
        self.page = page
        self.base_url = c.wiki_base_url
        self.action = action
        self.description = description

        if showtitle:
            self.pagetitle = action[1]
        else:
            self.pagetitle = None

        self.inner_content = inner_content

        Reddit.__init__(self,
                        extra_js_config={'wiki_page': page},
                        show_wiki_actions=True,
                        **context)
Пример #5
0
    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)
Пример #6
0
    def __init__(self, content, page=None, may_revise=False, actionless=False, alert=None, **context):
        pageactions = []
        title = c.site.name
        if not actionless and page:
            title = '%s - %s' % (title, page)
            pageactions += [(page, _("view"), False)]
            if may_revise:
                pageactions += [('edit', _("edit"), True)]
            pageactions += [('revisions/%s' % page, _("history"), False)]
            pageactions += [('discussions', _("talk"), True)]
            if c.is_wiki_mod:
                pageactions += [('settings', _("settings"), True)]

        action = context.get('wikiaction', (page, 'wiki'))
        context['title'] = title
        
        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, page=page, **context)
        Reddit.__init__(self, extra_js_config={'wiki_page': page}, 
                        show_wiki_actions=True, **context)
Пример #7
0
    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)
Пример #8
0
 def __init__(self, content):
     Reddit.__init__(self, title=_("traffic stats"), content=content)
Пример #9
0
 def __init__(self, content):
     Reddit.__init__(self, title=_("traffic stats"), content=content)