def GET(self): type = xutils.get_argument("type", self.default_type) parent_id = xutils.get_argument("parent_id", "") key = xutils.get_argument("key", "") title = u"最新笔记" show_create = True if type == "public": show_create = False else: xauth.check_login() title = NOTE_TYPE_DICT.get(type, u"最新笔记") search_title = u"笔记" file = NOTE_DAO.get_by_id(parent_id) if file != None: title = file.name search_title = file.name return xtemplate.render("note/page/timeline.html", title = title, type = type, file = file, key = key, show_create = show_create, search_action = "/note/timeline", search_placeholder = T(u"搜索" + search_title), search_ext_dict = dict(parent_id = parent_id), show_aside = False)
def GET(self): type = xutils.get_argument("type", self.default_type) parent_id = xutils.get_argument("parent_id") key = xutils.get_argument("key", "") title = T("最新笔记") show_create = True if type == "public": title = T("公共笔记") show_create = False else: xauth.check_login() if type == "gallery": title = T("相册") file = None if parent_id != None: file = NOTE_DAO.get_by_id(parent_id) title = file.name return xtemplate.render("note/timeline.html", title=title, type=type, file=file, key=key, show_create=show_create, search_action="/note/timeline", search_placeholder=T("搜索笔记"), show_aside=False)
def GET(self): type = xutils.get_argument("type") title = T("最近创建") if type == "public": title = T("公共笔记") else: xauth.check_login() if type == "gallery": title = T("相册") return xtemplate.render("note/tools/timeline.html", title = title, show_aside = False)
def GET(self): type = xutils.get_argument("type", self.note_type) parent_id = xutils.get_argument("parent_id", "") key = xutils.get_argument("key", "") title = u"最新笔记" # 检查登录态 if self.check_login: xauth.check_login() if type == "search" and key == "": raise web.found("/search") user_name = xauth.current_name() title = NOTE_TYPE_DICT.get(type, u"最新笔记") title_link = None note_priority = 0 search_title = u"笔记" file = NOTE_DAO.get_by_id(parent_id) xmanager.add_visit_log(user_name, "/note/%s" % self.note_type) if file != None: # title = file.name title = "笔记目录" search_title = file.name title_link = PathLink(file.name, file.url) note_priority = file.priority pathlist = [] parent_link = get_parent_link(user_name, type, note_priority) if parent_link != None: pathlist.append(parent_link) if title_link != None: pathlist.append(title_link) return xtemplate.render("note/page/timeline.html", title=title, type=type, file=file, key=key, pathlist=pathlist, show_create=self.show_create, search_action="/note/timeline", search_placeholder=T(u"搜索" + search_title), search_ext_dict=dict(parent_id=parent_id), parent_link=parent_link, title_link=title_link, CREATE_BTN_TEXT_DICT=CREATE_BTN_TEXT_DICT, show_aside=False)
def render(self): """图形界面入口""" if self.require_admin: xauth.check_login("admin") input = self.get_input() error = u("") output = u("") try: self.page = self.get_page() self.category_name = CATEGORY_NAME_DICT.get(self.category, '上级目录') output = self.handle(input) or u("") if self.get_format() == "text": web.header("Content-Type", "text/plain; charset:utf-8") return self.output + output # 复杂对象交给框架处理 if isinstance(output, (dict, list)): return output # 处理侧边栏显示 if self.aside_html != "" or len( self.option_links) > 0 or self.category: self.show_aside = True except web.webapi.Redirect: # 跳转的异常 pass except: error = xutils.print_exc() web.ctx.status = "500 Internal Server Error" return render("plugins/base_plugin.html", model=self, script_name=globals().get("script_name"), fpath=self.fpath, description=self.description, error=error, html_title=self.title, title=self.title, method=self.method, rows=self.rows, input=input, output=self.output + output, css_style=self.css_style, show_aside=self.show_aside, show_search=self.show_search, html=self.html, search_action=self.search_action, search_placeholder=self.search_placeholder)
def GET(self, path): # path = xutils.unquote(path) if not self.is_path_allowed(path): xauth.check_login("admin") data_prefix = config.DATA_DIR if not path.startswith("static"): newpath = os.path.join(data_prefix, path) else: newpath = path # 兼容static目录数据 if not os.path.exists(newpath): # len("static/") = 7 newpath = os.path.join(data_prefix, newpath[7:]) path = newpath if not os.path.isfile(path): # 静态文件不允许访问文件夹 web.ctx.status = "404 Not Found" return "Not Readable %s" % path return self.handle_get(path)
def render(self): """图形界面入口""" if self.require_admin: xauth.check_login("admin") input = self.get_input() error = "" output = u("") try: self.page = self.get_page() output = self.handle(input) or "" if self.get_format() == "text": web.header("Content-Type", "text/plain; charset:utf-8") return self.output + output # 复杂对象交给框架处理 if isinstance(output, (dict, list)): return output # 处理侧边栏显示 if self.aside_html != "" or len( self.option_links) > 0 or self.category: self.show_aside = True except: error = xutils.print_exc() return render("plugins/base_plugin.html", model=self, script_name=globals().get("script_name"), description=self.description, error=error, html_title=self.title, title=self.title, method=self.method, rows=self.rows, input=input, output=self.output + output, css_style=self.css_style, show_aside=self.show_aside, html=self.html, search_action=self.search_action, search_placeholder=self.search_placeholder)