Exemplo n.º 1
0
 def GET(self):
     f = mww.MyForm(self.reset_user_password_form(),
                    '/cumt/ResetUserPassword')
     s = mww.ListGroup(session.get_session().actions).render()
     l = mww.Panel('Settings', s)
     r = mww.Panel('Reset User Password', f.render_css())
     return render.l3r9(left=l.render(), right=r.render())
Exemplo n.º 2
0
 def GET(self):
     if session.get_session().privilege != 0:
         # already login
         raise web.seeother('/cumt/Profile')
     form = mww.MyForm(self.login_form(), '/cumt/Login')
     r = mww.Panel('Login', form.render_css()).render()
     return render.l12(page=r)
Exemplo n.º 3
0
 def GET(self):
     f = mww.MyForm(self.register_detail_form(), '/cumt/Profile')
     f.form.fill(
         utils.extract_info_from_storage_by_list(session.get_session(),
                                                 PROPERTY_LIST))
     s = mww.ListGroup(session.get_session().actions).render()
     l = mww.Panel('Settings', s)
     r = mww.Panel('Profile', f.render_css())
     return render.l3r9(left=l.render(), right=r.render())
Exemplo n.º 4
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())
Exemplo n.º 5
0
 def POST(self):
     f = mww.MyForm(self.login_form(), '/cumt/Login')
     ipt = web.input(_unicode=False)
     if not f.form.validates(ipt):
         # show = ipt.get('show','all')
         show = web.input(show='all').show
         r = mww.Panel('Login', f.render_css()).render()
         return render.l12(page=r)
     else:
         session.login(f.form.d.email)
         raise web.seeother('/cumt/SendApplication')
Exemplo n.º 6
0
 def POST(self):
     f = mww.MyForm(self.register_form(), '/cumt/SignUp')
     ipt = web.input(_unicode=True)
     if not f.form.validates(ipt):
         show = web.input(show='all').show
         r = mww.Panel(u'注册', f.render_css()).render()
         return render.l12(page=r)
     else:
         users.create_account(email=f.form.d.email,
                              password=f.form.d.password,
                              privilege=1)
         session.login(f.form.d.email)
         raise web.seeother('/cumt/SendApplication')
Exemplo n.º 7
0
 def POST(self):
     ipt = web.input(_unicode=True)
     f = mww.MyForm(self.register_detail_form(), '/cumt/Profile')
     if not f.form.validates(ipt):
         s = mww.ListGroup(session.get_session().actions).render()
         l = mww.Panel('Settings', s)
         r = mww.Panel('Profile', f.render_css())
         return render.l3r9(left=l.render(), right=r.render())
     else:
         users.update(
             session.get_session().uid,
             **utils.extract_info_from_storage_by_list(ipt, PROPERTY_LIST))
         session.login(session.get_session().email)
         return render.single_panel(title="Profile Change", body="success!")
Exemplo n.º 8
0
    def POST(self):
        ipt  = web.input(_unicode=True)
        if 'article' in ipt and articles.name_exist_p(ipt.article):
            article_info = articles.get_article_by_name(ipt.article)
            s = mww.ListGroup(session.get_session().actions).render()
            l = mww.Panel('Settings',s)
            aaf = mww.MyForm(self.alter_article_form()(article_info),'/cumt/AlterArticle')
            asf = mww.MyForm(self.article_select_form(),'/cumt/AlterArticle')
            asf.form.fill(ipt)
            r1 = mww.Panel('Article Select',asf.render_css())
            r2 = mww.Panel('Alter Article',aaf.render_css())
            return render.l3r9(left=l.render(),right=r1.render()+r2.render())

        elif 'name' in ipt and 'parent' in ipt and 'has_child_p' in ipt and articles.parent_sans_p(ipt.parent):
            # TODO result check
            articles.update(ipt.aid,content = ipt.content,title=ipt.title,parent=ipt.parent,has_child_p=ipt.has_child_p)
            web.config._title_list = articles.gen_title_list()
            return "success"
        else:
            myf = mww.MyForm(self.article_select_form(),'/cumt/AlterArticle')
            s = mww.ListGroup(session.get_session().actions).render()
            l = mww.Panel('Settings',s)
            r = mww.Panel('Article Select',myf.render_css())
            return render.l3r9(left=l.render(),right=r.render())
Exemplo n.º 9
0
 def POST(self):
     if session.get_session().privilege != 1:
         raise web.seeother('/cumt/ApplicationRoute')
     result = check_time()
     if result:
         return result
     ipt = web.input(_unicode=True)
     f = mww.MyForm(self.registration_form(), '/cumt/Application')
     if not f.form.validates(ipt):
         p = mww.Panel('Application', f.render_css())
         return render.l12(page=p.render())
     regid = users.add_reg(session.get_session().uid, f.form.d)
     p = mww.Panel(u'提交申请',
                   u'申请已提交,点击<a href="/cumt/Application">这里</a>进行修改')
     return render.l12(page=p.render())
Exemplo n.º 10
0
 def POST(self):
     ipt = web.input(_unicode=True)
     f = self.add_article_form()
     myf = mww.MyForm(f,'/cumt/AddArticle')
     if not f.validates(ipt):
         s = mww.ListGroup(session.get_session().actions).render()
         l = mww.Panel('Settings',s)
         r = mww.Panel('Add New Article',myf.render_css())
         return render.l3r9(left=l.render(),right=r.render())
     else:
         if f.d.parent == "NEW_TOPIC":
             articles.add_article(f.d.name, f.d.title, f.d.content, "NOPARENT" )
         else:
             articles.add_article(f.d.name, f.d.title, f.d.content, f.d.parent )
         web.config._title_list = articles.gen_title_list()
         return "success"
Exemplo n.º 11
0
 def POST(self):
     ipt = web.input(_unicode=True)
     f = self.del_article_form()
     myf = mww.MyForm(f,'/cumt/DelArticle')
     if not f.validates(ipt):
         s = mww.ListGroup(session.get_session().actions).render()
         l = mww.Panel('Settings',s)
         r = mww.Panel('Del A Article',myf.render_css())
         return render.l3r9(left=l.render(),right=r.render())
     else:
         a = articles.get_article_by_name(ipt.name)
         leaves = articles.get_articles_by_parent(a.parent)
         assert len(leaves) > 1
         #parent = articles.get_article_by_name(a.parent)
         articles.del_article_by_name(ipt.name)
         web.config._title_list = articles.gen_title_list()
         return 'success'
Exemplo n.º 12
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())
Exemplo n.º 13
0
 def GET(self):
     myf = mww.MyForm(self.del_article_form(),'/cumt/DelArticle')
     s = mww.ListGroup(session.get_session().actions).render()
     l = mww.Panel('Settings',s)
     r = mww.Panel('Del A Article',myf.render_css())
     return render.l3r9(left=l.render(),right=r.render())
Exemplo n.º 14
0
 def GET(self):
     myf = mww.MyForm(self.user_search_form(), '/cumt/UserManage')
     s = mww.ListGroup(session.get_session().actions).render()
     l = mww.Panel('Settings', s)
     r = mww.Panel('User Management', myf.render_css())
     return render.l3r9(left=l.render(), right=r.render())