def nojs(self, nr=0): if nr != 0: nr = int(nr) htmldata = "" html_template = get_template_content(NOJS_FILE) template = Template(html_template) def build_link(sign): # copy the current get variables but use a different page number link = "/media/nojs?nr=" + str(nr + sign * ITEMS_PER_PAGE) return link # insert links to previous and next page prev_html = ('<a href="{0}" title="previous page"><- previous page' + '</a> \n').format(build_link(1)) if nr <= ITEMS_PER_PAGE: next_html = "" else: next_html = ('<a href="{0}" title="next page">next page ->' + '</a>\n').format(build_link(-1)) htmldata = "<ul>\n" + self.load(nr) + "\n</ul>" new_html = template.substitute( navprev=prev_html, navnext=next_html, media=htmldata) return new_html
def index(self, bot_xmpp_button=False, bot_irc_button=False, server_button=False): # start or stop processes if bot_xmpp_button: self.start_stop_wstbot_xmpp() elif bot_irc_button: self.start_stop_wstbot_irc() elif server_button: self.start_stop_server() # show page template = Template(get_template_content("controlinterface.html")) # xmpp text bot_xmpp_button_text = "Start XMPP Wstbot" if self.process_running(self.wstbot_xmpp_proc): bot_xmpp_button_text = "Stop XMPP Wstbot" # irc text bot_irc_button_text = "Start IRC Wstbot" if self.process_running(self.wstbot_irc_proc): bot_irc_button_text = "Stop IRC Wstbot" # server text server_button_text = "Start Wstbot Server" if self.process_running(self.wstbot_server_proc): server_button_text = "Stop Wstbot Server" # format page = template.substitute(bot_xmpp_button_text=bot_xmpp_button_text, bot_irc_button_text=bot_irc_button_text, server_button_text=server_button_text) return page
def index(self, nr=0, ascending=False, search_text=None): html_template = get_template_content(DEFAULT_FILE) template = Template(html_template) self.is_search = False if search_text is None else True htmldata = self.load(nr, ascending=ascending, search_text=search_text) new_html = template.substitute(media=htmldata, nr=self.nr, search=self.is_search) return new_html
def get(): updater = SiteinfoUpdater(get_template_content("siteinfo.html")) return updater
def index(self): html_template = get_template_content(DEFAULT_FILE) template = Template(html_template) return template.substitute(actionUrl=(self.get_request_url() + "submit"))
def index(self): return get_template_content("index.html")