|
@@ -46,41 +46,42 @@ def logout():
|
46
|
46
|
Auth(session).do_logout()
|
47
|
47
|
return render_template('login.html')
|
48
|
48
|
|
49
|
|
-@app.route('/view/list/<tipo>/', methods=['GET', 'POST'])
|
50
|
|
-def viewlist(tipo):
|
51
|
|
- if tipo == "curso":
|
52
|
|
- return render_template("formacurso.html")
|
53
|
49
|
|
54
|
|
- return render_template("listuser.html", tipo=tipo, admin=1)
|
|
50
|
+@app.route('/<user>/<action>/<tipo>', methods=['GET', 'POST'])
|
|
51
|
+def dispatcher(user, action, tipo):
|
|
52
|
+ if not user in ["admin", "estudiante", "enfermera", "encargado", "facultad"]:
|
|
53
|
+ return render_template('login.html') # Mejor error
|
|
54
|
+ if not action in ["list", "view", "edit", "add"]:
|
|
55
|
+ return render_template('login.html') # Mejor error
|
|
56
|
+ if not tipo in ["enfermera", "admin", "estudiante", "madre", "facultad", "curso"]:
|
|
57
|
+ return render_template('login.html') # Mejor error
|
55
|
58
|
|
56
|
|
-@app.route('/list/<tipo>/', methods=['GET', 'POST'])
|
57
|
|
-def list(tipo):
|
58
|
|
- if tipo in ["enfermera", "admin", "estudiante", "madre", "facultad", "curso"]:
|
59
|
|
- return jsonify(globals()[tipo].list())
|
60
|
59
|
|
|
60
|
+@app.route('/be/<user>/<action>/<tipo>', methods=['GET', 'POST'])
|
|
61
|
+def dispatcher(user, action, tipo):
|
|
62
|
+ if not user in ["admin", "estudiante", "enfermera", "encargado", "facultad"]:
|
|
63
|
+ return render_template('login.html') # Mejor error
|
|
64
|
+ if not action in ["list", "view", "edit", "add"]:
|
|
65
|
+ return render_template('login.html') # Mejor error
|
|
66
|
+ if not tipo in ["enfermera", "admin", "estudiante", "madre", "facultad", "curso"]:
|
|
67
|
+ return render_template('login.html') # Mejor error
|
61
|
68
|
|
62
|
|
-@app.route('/forma/<accion>/<tipo>/', methods=['GET', 'POST'])
|
63
|
|
-@app.route('/forma/<accion>/<tipo>/<id>', methods=['GET', 'POST'])
|
64
|
|
-def formas(accion,tipo,id=None):
|
65
|
69
|
|
66
|
|
- if not tipo in ["enfermera", "admin", "estudiante", "madre", "facultad"]:
|
67
|
|
- return # Redirigirlo a una pagina de errorCallback
|
68
|
|
- if not accion in ["edit", "add"]:
|
69
|
|
- return # Redirigirlo a una pagina de errorCallback
|
70
|
|
- return render_template('forma.html', tipo=tipo, accion=accion, id=id)
|
|
70
|
+ return render_template("formacurso.html")
|
71
|
71
|
|
|
72
|
+# @app.route('/view/list/<tipo>/', methods=['GET', 'POST'])
|
|
73
|
+# def viewlist(tipo):
|
|
74
|
+# if tipo == "curso":
|
|
75
|
+# return render_template("formacurso.html")
|
|
76
|
+#
|
|
77
|
+# return render_template("listuser.html", tipo=tipo, admin=1)
|
|
78
|
+
|
|
79
|
+@app.route('/list/<tipo>/', methods=['GET', 'POST'])
|
|
80
|
+def list(tipo):
|
|
81
|
+ if tipo in ["enfermera", "admin", "estudiante", "madre", "facultad", "curso"]:
|
|
82
|
+ return jsonify(globals()[tipo].list())
|
72
|
83
|
|
73
|
|
-@app.route('/formaDatos/<accion>/<tipo>/', methods=['GET', 'POST'])
|
74
|
|
-@app.route('/formaDatos/<accion>/<tipo>/<id>', methods=['GET', 'POST'])
|
75
|
|
-def formaEst(accion, tipo, id=None):
|
76
|
|
-# data = json.loads('formaEstudiantes.json')
|
77
|
|
- #getattr(globals()["enfermera"], "list")()
|
78
|
|
- if not tipo in ["enfermera", "admin", "estudiante", "madre", "facultad"]:
|
79
|
|
- return # Redirigirlo a una pagina de errorCallback
|
80
|
|
- if not accion in ["edit", "add"]:
|
81
|
|
- return # Redirigirlo a una pagina de errorCallback
|
82
|
84
|
|
83
|
|
- return jsonify(getattr(globals()[tipo], accion)())
|
84
|
85
|
|
85
|
86
|
@app.route('/dashAdmin', methods=['GET', 'POST'])
|
86
|
87
|
def dashAdmin():
|