Exemple #1
0
    def GET(self):
        user_name = xauth.current_name()

        xmanager.add_visit_log(user_name, "/fs_upload")

        year = xutils.get_argument("year", time.strftime("%Y"))
        month = xutils.get_argument("month", time.strftime("%m"))
        if len(month) == 1:
            month = '0' + month

        dirname = os.path.join(xconfig.DATA_DIR, "files", user_name, "upload",
                               year, month)
        pathlist = fsutil.listdir_abs(dirname)

        return xtemplate.render("fs/fs_upload.html",
                                show_aside=False,
                                html_title=T("文件"),
                                pathlist=pathlist,
                                year=int(year),
                                month=int(month),
                                path=dirname,
                                dirname=dirname,
                                get_webpath=get_webpath,
                                upload_link_by_month=upload_link_by_month,
                                get_display_name=get_display_name)
Exemple #2
0
    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)
Exemple #3
0
    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)