示例#1
0
    def GET(self, result=''):
        per = users.get_permission_by_douid(user.douban_id)
        rights = per[0].rights
        if rights > 1:
            results_per_page = 10
            default_order = 'id'

            i = web.input(start=0, order=default_order, desc='desc', query='')
            start = int(i.start)

            results, num_results = help.query(query=i.query, 
                offset=start, limit=results_per_page, order=i.order + ' ' + i.desc)

            pager = web.storage(paging.get_paging(start, num_results, 
                results_per_page=results_per_page, window_size=1))

            results = list(results)
            user_list = []
            for i in xrange(len(results)):
                if users.get_douban_users_by_doubanid(results[i].douban_id):
                    user_list += users.get_douban_users_by_doubanid(results[i].douban_id)
                else:
                    user_list += []

            return view.template_admin(view.admin_feedback(results, user_list, pager))
示例#2
0
    def GET(self, c=''):
        per = users.get_permission_by_douid(user.douban_id)
        rights = per[0].rights
        if rights > 2:
            results_per_page = 10
            default_order = 'id'

            i = web.input(start=0, order=default_order, desc='desc', query='', c ='')
            start = int(i.start)
            c = i.c

            results, num_results = admin.confirm_log_query(query=i.query, 
                offset=start, limit=results_per_page, order=i.order + ' ' + i.desc, c=c)

            pager = web.storage(paging.get_paging(start, num_results, 
                results_per_page=results_per_page, window_size=1))

            results = list(results)

            if c == '1' or c == '':
                user_list = []
                for i in xrange(len(results)):
                    user_list += users.get_douban_users_by_doubanid(results[i].douban_id)
            elif c == '0':
                user_list = []

            return view.template_admin(view.admin_confirm(results, user_list, pager, c))
示例#3
0
    def GET(self, context):
        i = web.input(start=0, order=default_order, desc='desc', query='')
        start = int(i.start)
        context = context or 'all'
        user_id = session.is_logged() and session.get_user_id()

        results, num_results = applicants.query(query=i.query,
                                                context=context,
                                                offset=start,
                                                limit=results_per_page,
                                                order=i.order + ' ' + i.desc,
                                                user_id=user_id)

        pager = web.storage(
            paging.get_paging(start,
                              num_results,
                              results_per_page=results_per_page,
                              window_size=1))

        counts = applicants.get_counts()

        user = session.get_session()

        stats = applicants.get_stats()

        return view.layout(view.applicants(results, context, pager, i), user,
                           context, counts, i.query, stats)
示例#4
0
    def GET(self, result=''):
        per = users.get_permission_by_douid(user.douban_id)
        rights = per[0].rights

        if rights > 1:
            results_per_page = 8 #每页显示8条记录
            default_order = 'id'

            i = web.input(start=0, order=default_order, desc='desc', query='', result='')
            start = int(i.start)
            result = i.result

            results, num_results = users.get_applys(query=i.query, 
                offset=start, limit=results_per_page, order=i.order + ' ' + i.desc, user_id=None, result=result)

            pager = web.storage(paging.get_paging(start, num_results, 
                results_per_page=results_per_page, window_size=1))

            apply_list = list(results)

            admin_list = []
            for i in xrange(len(apply_list)):
                admin_list += users.get_users_by_id(apply_list[i].operator)

            user_list = []
            for i in xrange(len(apply_list)):
                user_list += users.get_douban_users_by_doubanid(apply_list[i].douban_id)

            return view.template_admin(view.admin_apply_for_permission(apply_list, pager, admin_list, user_list, result))
        else:
            raise web.notfound
示例#5
0
 def GET(self):
     i = web.input(start=0, sql_query='')
     start = int(i.start)
     
     results, count, columns = recipients.get(i.sql_query, offset=start, limit=results_per_page)
     pager = web.storage(paging.get_paging(start, count, 
         results_per_page=results_per_page, window_size=1))
     
     return view.recipients_preview(results, columns, pager, i)
示例#6
0
文件: base.py 项目: alexksikes/sGeo
 def GET(self):
     i = web.input(q='', s=0, usa=False)
     if not i.q:
         raise web.seeother('/')
     
     place_query, center_hits, nearby_hits = places.get_nearby(i.q, usa_only=i.usa, 
         offset=int(i.s), limit=MAX_NEARBY_RESULTS)
     pager = paging.get_paging(int(i.s), nearby_hits['total'], 
         results_per_page=MAX_NEARBY_RESULTS, window_size=WINDOW_SIZE)
     recent_queries = places.get_recent_queries()
     
     return view.layout(view.search(place_query, center_hits, nearby_hits, pager, recent_queries))
示例#7
0
    def GET(self):
        i = web.input(start=0, sql_query='')
        start = int(i.start)

        results, count, columns = recipients.get(i.sql_query,
                                                 offset=start,
                                                 limit=results_per_page)
        pager = web.storage(
            paging.get_paging(start,
                              count,
                              results_per_page=results_per_page,
                              window_size=1))

        return view.recipients_preview(results, columns, pager, i)
示例#8
0
    def GET(self):
        i = web.input(q='', s=0, usa=False)
        if not i.q:
            raise web.seeother('/')

        place_query, center_hits, nearby_hits = places.get_nearby(
            i.q, usa_only=i.usa, offset=int(i.s), limit=MAX_NEARBY_RESULTS)
        pager = paging.get_paging(int(i.s),
                                  nearby_hits['total'],
                                  results_per_page=MAX_NEARBY_RESULTS,
                                  window_size=WINDOW_SIZE)
        recent_queries = places.get_recent_queries()

        return view.layout(
            view.search(place_query, center_hits, nearby_hits, pager,
                        recent_queries))
示例#9
0
    def GET(self):
        #得到当前用户的权限
        per = users.get_permission_by_douid(user.douban_id)
        rights = per[0].rights
        if rights > 1:
            results_per_page = 8 #每页显示8个用户
            default_order = 'id'

            i = web.input(start=0, order=default_order, desc='desc', query='')
            start = int(i.start)
            # context = context or 'all'
            # user_id = session.is_logged() and session.get_user_id()

            results, num_results = admin.query(query=i.query, 
                offset=start, limit=results_per_page, order=i.order + ' ' + i.desc, user_id=None)

            pager = web.storage(paging.get_paging(start, num_results, 
                results_per_page=results_per_page, window_size=1))

            u = user

            #查询用户权限表
            douban_id_list = []
            users_list = list(results)
            for i in xrange(len(users_list)):
                douban_id_list += users_list[i].douban_id.split()

            permissions = []
            for i in xrange(len(douban_id_list)):
                permissions += users.get_permission_by_douid(douban_id_list[i])

            admin_list = []
            for i in xrange(len(permissions)):
                if permissions[i].operator:
                    admin_list += users.get_users_by_id(permissions[i].operator)
                else:
                    admin_list += "s"

            timestrf = misc.timestrf

            return view.template_admin(view.admin_users(users_list, pager, u, permissions, rights, timestrf, admin_list))
        else:
            raise web.notfound()
示例#10
0
文件: browse.py 项目: Paaskehare/MLSS
 def GET(self, context):
     i = web.input(start=0, order=default_order, desc='desc', query='')
     start = int(i.start)
     context = context or 'all'
     user_id = session.is_logged() and session.get_user_id()
     
     results, num_results = applicants.query(query=i.query, context=context, 
         offset=start, limit=results_per_page, order=i.order + ' ' + i.desc, 
         user_id=user_id)
     
     pager = web.storage(paging.get_paging(start, num_results, 
         results_per_page=results_per_page, window_size=1))
     
     counts = applicants.get_counts()
     
     user = session.get_session()
     
     stats = applicants.get_stats()
     
     return view.layout(
         view.applicants(results, context, pager, i), 
         user, context, counts, i.query, stats)