예제 #1
0
    def GET(self):
        ipt = web.input(_unicode=True)
        if 'uid' not in ipt:
            return "Argument Error"
        if users.uid_exist_p(ipt.uid):
            user = users.get_user_by_uid(ipt.uid)
        else:
            return "User Not Exist!"

        _s = session.get_session()
        _p = _s.privilege
        # if attendant, only allowed to check himself.
        if _p == 1:
            if _s.uid != user.uid:
                return "Action Not Allowed!"

        # check done. do the real work
        schema_user = [['uid', u"用户编号", 'col-sm-1'],
                       ['email', u"邮箱", 'col-sm-1'],
                       ['telephone', u'手机号码', 'col-sm-1'],
                       ['gender', u'性别', 'col-sm-1'],
                       ['studentid', u'学号', 'col-sm-1'],
                       ['college', u'学院', 'col-sm-1'],
                       ['name', u'姓名', 'col-sm-1']]

        t_user = mww.MyVerticalTable(schema_user,
                                     user,
                                     class_='table table-striped table-hover')
        s = mww.ListGroup(session.get_session().actions).render()
        l = mww.Panel('Settings', s)
        r = mww.Panel('Detailed Information', t_user.render())
        return render.l3r9(left=l.render(), right=r.render())
예제 #2
0
 def GET(self):
     if session.get_session().privilege != 1:
         raise web.seeother('/cumt/ApplicationRoute')
     result = check_time()
     if result:
         return result
     f = mww.MyForm(self.registration_form(),'/cumt/Application')
     user = users.get_user_by_uid(session.get_session().uid)
     f.form.fill(user)
     p = mww.Panel(u'提交申请',f.render_css())
     return render.l12( page = p.render())
예제 #3
0
 def GET(self):
     if session.get_session().privilege != 1:
         raise web.seeother('/cumt/ApplicationRoute')
     result = check_time()
     if result:
         return result
     f = mww.MyForm(self.registration_form(), '/cumt/Application')
     user = users.get_user_by_uid(session.get_session().uid)
     f.form.fill(user)
     p = mww.Panel(u'提交申请', f.render_css())
     return render.l12(page=p.render())
예제 #4
0
def journal_record_trans_to_display(r):
    _findex= make_findex(r.fid)
    findex = '''<a href="/FileDetail?fid=%s">%s</a>''' % (r.fid,_findex)
    u = users.get_user_by_uid(r.by_uid)
    if u.privilege == 5:
        by = 'admin'
    elif u.privilege == 2:
        by = 'officer'
    else:
        by = 'user'
    return Storage(
        findex = findex,
        by = by,
        **r
    )
예제 #5
0
 def POST(self):
     ipt = web.input(_unicode=True)
     #print ipt
     f = self.user_search_form()
     myf = mww.MyForm(f,'/cumt/UserManage')
     if not f.validates(ipt):
         return "Argument Error"
     if len(ipt.uid)>0:
         if users.uid_exist_p(ipt.uid):
             us = [users.get_user_by_uid(ipt.uid)]
         else:
             us = []
     elif len(ipt.name)>0:
         us = users.get_users_by_name(ipt.name)
     elif len(ipt.email)>0:
         if users.email_exist_p(ipt.email):
             us = [users.get_user_by_email(ipt.email)]
         else:
             us = []
     elif ipt.country == 'All':
         us = users.get_all_users()
     elif ipt.country == 'China':
         us = users.get_users_by_country('China')
     elif ipt.country == 'Other':
         us = users.get_users_by_country_not('China')
     else:
         us = []
     schema = [['uid',"Index"],
               ['name',"Name"],
               ['country',"Country"],
               ['email',"Email"],
               ['operations',"Operations"]]
     t = mww.Table(schema,
                   map(user_record_trans_to_display,us),
                   class_='table table-striped table-hover')
     s = mww.ListGroup(session.get_session().actions).render()
     l = mww.Panel('Settings',s)
     r = mww.Panel('User Management',myf.render_css()+t.render())
     return render.l3r9(left=l.render(),right=r.render())
예제 #6
0
 def POST(self):
     ipt = web.input(_unicode=True)
     #print ipt
     f = self.user_search_form()
     myf = mww.MyForm(f, '/cumt/UserManage')
     if not f.validates(ipt):
         return "Argument Error"
     if len(ipt.uid) > 0:
         if users.uid_exist_p(ipt.uid):
             us = [users.get_user_by_uid(ipt.uid)]
         else:
             us = []
     elif len(ipt.name) > 0:
         us = users.get_users_by_name(ipt.name)
     elif len(ipt.email) > 0:
         if users.email_exist_p(ipt.email):
             us = [users.get_user_by_email(ipt.email)]
         else:
             us = []
     elif ipt.country == 'All':
         us = users.get_all_users()
     elif ipt.country == 'China':
         us = users.get_users_by_country('China')
     elif ipt.country == 'Other':
         us = users.get_users_by_country_not('China')
     else:
         us = []
     schema = [['uid', "Index"], ['name', "Name"], ['country', "Country"],
               ['email', "Email"], ['operations', "Operations"]]
     t = mww.Table(schema,
                   map(user_record_trans_to_display, us),
                   class_='table table-striped table-hover')
     s = mww.ListGroup(session.get_session().actions).render()
     l = mww.Panel('Settings', s)
     r = mww.Panel('User Management', myf.render_css() + t.render())
     return render.l3r9(left=l.render(), right=r.render())