示例#1
0
    def post(self, wiki_page_url):
#        wikiPage = WikiPage.by_url(wiki_page_url)
#        
#        if wikiPage:
#            wikiPage.update_content(self.request.get(self._id_content))
#        else:
#            WikiPage.create_wikipage(wiki_page_url, self.request.get(self._id_content), self.user)
        WikiPage.create_wikipage(wiki_page_url, self.request.get(self._id_content), self.user)
        
        self.redirect(wiki_page_url.replace(self._edit_url_mode_prefix, ''))
示例#2
0
 def get(self, wiki_page_url):
     super(WikiMainPage, self).get()
     
     super(WikiMainPage, self).set_main_user_options()
     
     wikiPages = WikiPage.by_url(wiki_page_url)
     
     if wikiPages and len(wikiPages):
         # Set top-main-options about page options
         super(WikiMainPage, self).set_main_history_option(wiki_page_url, prefix=True)
         if self.user:
             super(WikiMainPage, self).set_main_edit_option(wiki_page_url, prefix=True)
             
         version = self.request.get('v')
         
         if version.isdigit() and int(version) > 0 and int(version) <= len(wikiPages):
             version = len(wikiPages) - int(version)
         else:
             version = 0
         self.template_values[self._tp_wikiPageContent] = wikiPages[version].wikiContent.replace('\n', '<br>')
     else:
         if not self.user:
             self.template_values[self._tp_pageNotExistError] = True
         else:
             self.redirect(self._edit_url_mode_prefix + wiki_page_url)
         
     self.render_front(self.set_template_values(self.template_values))
示例#3
0
    def get(self, wiki_page_url):
        super(HistoryPage, self).get()

        super(HistoryPage, self).set_main_user_options()

        wikiPages = WikiPage.by_url(wiki_page_url)

        if len(wikiPages):
            # Set top-main-options about page options
            super(HistoryPage, self).set_main_view_option(wiki_page_url)
            if self.user:
                super(HistoryPage, self).set_main_edit_option(wiki_page_url, prefix=True)

            self.template_values["wikiPages"] = wikiPages
        else:
            if not self.user:
                self.template_values[self._tp_pageNotExistError] = True

        self.render_front(self.set_template_values(self.template_values))