def GET(self): parent_id = xutils.get_argument("parent_id", "0") user_name = xauth.current_name() if parent_id == "0": parent_note = NOTE_DAO.get_root() else: parent_note = NOTE_DAO.get_by_id(parent_id) if parent_note is None: raise web.seeother("/unauthorized") parent_name = parent_note.name if parent_note.type == "gallery": fpath = fsutil.get_gallery_path(parent_note) pathlist = fsutil.listdir_abs(fpath) return xtemplate.render("note/batch/gallery.html", note=parent_note, dirname=fpath, pathlist=pathlist) notes = NOTE_DAO.list_by_parent(user_name, parent_id, 0, 200) parent = Storage(url="/note/%s" % parent_id, name=parent_name) current = Storage(url="#", name="整理") return xtemplate.render("note/batch/management.html", pathlist=NOTE_DAO.list_path(parent_note), files=notes, show_path=True, current=current, parent=parent)
def GET(self): parent_id = xutils.get_argument("parent_id", "0") user_name = xauth.current_name() if parent_id == "0" or parent_id is None: parent_note = NOTE_DAO.get_root() notes = NOTE_DAO.list_group(user_name, orderby = "name", skip_archived = True) parent = Storage(url = "/note/group", name = parent_note.name) else: parent_note = NOTE_DAO.get_by_id(parent_id) if parent_note == None: raise web.notfound() notes = NOTE_DAO.list_by_parent(user_name, parent_id, 0, 200, orderby = "ctime_desc") parent = Storage(url = "/note/%s" % parent_id, name = parent_note.name) if parent_note is None: raise web.seeother("/unauthorized") parent_name = parent_note.name if parent_note.type == "gallery": fpath = fsutil.get_gallery_path(parent_note) pathlist = fsutil.listdir_abs(fpath) return xtemplate.render("note/page/batch/gallery_management.html", note = parent_note, dirname = fpath, pathlist = pathlist) current = Storage(url = "#", name = "整理") return xtemplate.render("note/page/batch/management.html", pathlist = NOTE_DAO.list_path(parent_note), files = notes, show_path = True, parent_id = parent_id, current = current, parent = parent)
def view_gallery_func(file, kw): fpath = os.path.join(xconfig.UPLOAD_DIR, file.creator, str(file.parent_id), str(file.id)) filelist = [] # 处理相册 # print(file) fpath = fsutil.get_gallery_path(file) # print(fpath) if fpath != None: filelist = fsutil.list_files(fpath, webpath=True) file.path = fpath kw.show_aside = False kw.path = fpath kw.filelist = filelist
def handle_note_files(kw, file): fpath = os.path.join(xconfig.UPLOAD_DIR, file.creator, str(file.parent_id), str(file.id)) filelist = [] # 处理相册 if file.type == "gallery": print(file) fpath = fsutil.get_gallery_path(file) print(fpath) if fpath != None: filelist = fsutil.list_files(fpath, webpath = True) file.path = fpath kw.show_aside = False kw.path = fpath kw.filelist = filelist file.path = fpath