2016-09-15 18:04:12 +08:00
|
|
|
from flask import session,render_template,request,redirect
|
2016-09-12 16:56:45 +08:00
|
|
|
from webViews.view import normalView
|
|
|
|
from webViews.dockletrequest import dockletRequest
|
|
|
|
|
|
|
|
|
|
|
|
class beansapplicationView(normalView):
|
|
|
|
template_path = "beansapplication.html"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def get(self):
|
|
|
|
result = dockletRequest.post('/beans/applymsgs/').get('applymsgs')
|
|
|
|
return self.render(self.template_path, applications = result)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def post(self):
|
|
|
|
return self.get()
|
2016-09-15 18:04:12 +08:00
|
|
|
|
|
|
|
class beansapplyView(normalView):
|
|
|
|
template_path = "error.html"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def post(self):
|
|
|
|
data = {"number":request.form["number"],"reason":request.form["reason"]}
|
|
|
|
result = dockletRequest.post('/beans/apply/',data)
|
|
|
|
success = result.get("success")
|
|
|
|
if success == "true":
|
|
|
|
return redirect("/beans/application/")
|
|
|
|
else:
|
|
|
|
return self.render(self.template_path, message = result.get("message"))
|
|
|
|
|
2018-03-04 15:20:46 +08:00
|
|
|
@classmethod
|
2016-09-15 18:04:12 +08:00
|
|
|
def get(self):
|
|
|
|
return self.post()
|
2016-09-17 17:50:09 +08:00
|
|
|
|
|
|
|
class beansadminView(normalView):
|
2018-03-04 15:20:46 +08:00
|
|
|
username = ""
|
2016-09-17 17:50:09 +08:00
|
|
|
msgid = ""
|
|
|
|
cmd = ""
|
|
|
|
template_path = "error.html"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def get(self):
|
2018-03-04 15:20:46 +08:00
|
|
|
data = {"username":self.username, "msgid":self.msgid}
|
2016-09-17 17:50:09 +08:00
|
|
|
result = dockletRequest.post('/beans/admin/'+self.cmd+"/",data)
|
|
|
|
success = result.get("success")
|
|
|
|
if success == "true":
|
|
|
|
return redirect("/user/list/")
|
|
|
|
else:
|
|
|
|
return self.render(self.template_path, message = result.get("message"))
|