Esempio n. 1
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
Esempio n. 2
0
    def changeTemplate(self, id):
        try:
            exec "from templates.%s import template as m" % json.read(id)
            old_template_name = getConfig().CURRENT_TEMPLATE.NAME
            getConfig().CURRENT_TEMPLATE = m

            AmiCache.expireAllPages()

            rc = server.getRootController()

            site_template = m.SiteTemplate()
            site_edit_template = SiteEditTemplate(m.SiteTemplate)

            site_template.markChildren()

            rc.root_obj.template = site_template
            rc.root_obj.siteedit.template = site_edit_template
            initTemplate(site_template, 'addToSiteTemplate')
            initTemplate(site_edit_template, 'addToSiteEditTemplate')

            server.setTemplateStaticPaths(rc, old_template_name)

        except Exception, inst:
            print "'%s' is not a valid template" % inst
Esempio n. 3
0
 def restoreSnapshot(self, filename):
     s = backup.SnapShot()
     s.restoreZip(filename)
     AmiCache.expireAllPages()
     return "ok"
Esempio n. 4
0
 def restart_cache(self):
     url_mapper.expirePageMemo()
     AmiCache.expireAllPages()
     AmiCache.cacheAllPages()
     return "ok"
Esempio n. 5
0
 def deletePage(self, id):
     Model.Pages.deletePageById(id)
     AmiCache.expireAllPages()
     return "ok"