Example #1
0
def execute(pagename, request):
    util = NgoWikiUtil(request)

    if not util.is_super_user():
        return

    util.open_database()

    try:
        util.init_database()

        pages = request.rootpage.getPageList(user='', exists='')
        for name in pages:
            if name.find(u'Category') == -1:
                page = Page(request, name)
                page_uuid = util.insert_page(page)["id"]

                pageinfo = util.parse_page(page)
                pageinfo["id"] = page_uuid
                util.update_page_meta(pageinfo)
    finally:
        util.close_database(True)
Example #2
0
    def do_action_finish(self, success):
        if success:
            pg = Page(self.request, self.newpagename)

            ngowikiutil = NgoWikiUtil(self.request)
            ngowikiutil.open_database()
            try:
                pageinfo = ngowikiutil.parse_page(pg)
                pagerecord = ngowikiutil.select_page_by_path(self.pagename)
                page_uuid = None
                if pagerecord == None:
                    page_uuid = ngowikiutil.insert_page(pg)["id"]
                else:
                    page_uuid = pagerecord["id"]
                    ngowikiutil.update_page(page_uuid, pg)
                pageinfo["id"] = page_uuid
                ngowikiutil.update_page_meta(pageinfo)
            finally:
                ngowikiutil.close_database(True)

            url = pg.url(self.request)
            self.request.http_redirect(url, code=301)
        else:
            self.render_msg(self.make_form(), "dialog")
Example #3
0
            request.theme.add_msg(unicode(msg), "error")
            # And show the editor again
            pg.sendEditor(preview=savetext, comment=comment, staytop=1)
            return

        # Send new page after successful save
        request.reset()
        pg = Page(request, pagename)

        ngowikiutil = NgoWikiUtil(request)
        ngowikiutil.open_database()
        try:
            pageinfo = ngowikiutil.parse_page(pg)
            pagerecord = ngowikiutil.select_page_by_path(pg.page_name)
            page_uuid = None
            if pagerecord == None:
                page_uuid = ngowikiutil.insert_page(pg)["id"]
            else:
                page_uuid = pagerecord["id"]
                ngowikiutil.update_page(page_uuid, pg)
            pageinfo["id"] = page_uuid
            ngowikiutil.update_page_meta(pageinfo)
            ngowikiutil.update_idea_status(page_uuid, ideastatus)
        finally:
            ngowikiutil.close_database(True)

        # sets revision number to default for further actions
        request.rev = 0
        request.theme.add_msg(savemsg, "info")
        pg.send_page()