Exemplo n.º 1
0
    def getAllPluginArguments(self, tag):
        """Returns all the parsed plugins that have tag.

        Is restarted every time htmlFormat is called.
        The result is a list looking like this:
            [{'tag': 'ident1'}, ..., {'tag': 'identN'}]
        """
        page_id = server.getCurrentPage()
        return self.current_plugins[page_id].get(tag) or {}
Exemplo n.º 2
0
    def setLogin(self, username, password):
        login_ok = UserModel.Users.checkLogin(username, password)
        if login_ok:
            session = amiweb.session()
            session['logged_in'] = True
            session['username'] = username
            self.setViewEditMode("on")

            AmiCache.expireEditPages()
            page = Model.Pages.getPageById(getCurrentPage())
            ns = {'template': self.template, 'full_link': page.getFullLink()}
            return render("skeletonz/view/whole_sites/login_ok.tmpl", ns)
Exemplo n.º 3
0
    def setLogout(self, id):
        session = amiweb.session()
        try:
            id = int(id)
        except:
            id = getCurrentPage()
        session['logged_in'] = False
        session['username'] = None
        AmiCache.expireEditPages()
        page = Model.Pages.getPageById(id)

        url = "%s/%s" % (BASE_URL, page.getFullLink())
        raise amiweb.HTTPFound(url)
Exemplo n.º 4
0
    def deletePage(self, id):
        #TODO: Refactor this (and other methods) to plugins/wikipages
        page = Model.Pages.getPageById(id)
        url_mapper.expirePagePath(page.getFullLink())

        current_page = Model.Pages.getPageById(getCurrentPage())
        page_name = Model.Pages.getPageById(id).name
        Model.Pages.deletePageById(id)

        AmiCache.expireAllPages()

        #Find the right plugin args
        args = getFormatManager().getPluginArguments('page', page_name)
        html = wiki_filter.wikiWords(args, True, current_page)
        return html
Exemplo n.º 5
0
    def htmlFormat(self, text, edit_mode, wrap_in_p=True, page=None):
        page_id = server.getCurrentPage()

        if not self.current_plugins.has_key(page_id):
            self.current_plugins[page_id] = {}

        old_edit_mode = None
        if hasattr(self, 'edit_mode'):
            old_edit_mode = self.edit_mode

        self.edit_mode = edit_mode
        self.page = page

        result = AmiFormat.htmlFormat(self, text)

        if not wrap_in_p:
            result = self._removeFrontP(result)

        if old_edit_mode:
            self.edit_mode = old_edit_mode
        return result
Exemplo n.º 6
0
 def checkCurrentPagePermissions(self):
     page_id = getCurrentPage()
     if not self.checkPagePremission(page_id):
         raise amiweb.AppError("You don't have permissions for this!")
Exemplo n.º 7
0
 def showLogin(self):
     page = Model.Pages.getPageById(getCurrentPage())
     ns = {'template': self.template, 'full_link': page.getFullLink()}
     return render("skeletonz/view/whole_sites/login.tmpl", ns)
Exemplo n.º 8
0
 def _registerPluginArgs(self, tag, args):
     page_id = server.getCurrentPage()
     if self.current_plugins[page_id].has_key(tag):
         self.current_plugins[page_id][tag].append(args)
     else:
         self.current_plugins[page_id][tag] = [args]
Exemplo n.º 9
0
 def resetPagePlugins(self):
     page_id = server.getCurrentPage()
     if self.current_plugins.has_key(page_id):
         del self.current_plugins[page_id]