From 82f837989f1c2d9995db2311b36d1e94c66f70cc Mon Sep 17 00:00:00 2001 From: Jogi Hofmüller Date: Fri, 29 Jul 2011 13:29:00 +0000 Subject: initial revision git-svn-id: https://svn.spreadspace.org/mur.sat@71 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- tools/mmd/MmdCommands.py | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tools/mmd/MmdCommands.py (limited to 'tools/mmd/MmdCommands.py') diff --git a/tools/mmd/MmdCommands.py b/tools/mmd/MmdCommands.py new file mode 100644 index 0000000..1af9422 --- /dev/null +++ b/tools/mmd/MmdCommands.py @@ -0,0 +1,66 @@ +""" +command methods for MURSAT1 Dashboard +""" + +from cgi import parse_qs, escape +from MmdWidgets import * + +def loginForm (data): + """ + display the login form + """ + return indexWidget (dataWidget (), loginFormWidget (), statusWidget (data['ip'])) + +def login (data): + """ + evaluate data from loginForm + """ + email = escape (data['qs'].get ('email', [''])[0]) + # check for account + # verify password + return indexWidget (dataWidget (), loginWidget (email), statusWidget (data['ip'], data['user'])) + +def registerForm (data): + """ + display the register form + """ + return indexWidget (dataWidget (), registerFormWidget (), statusWidget (data['ip'])) + +def register (data): + """ + evaluate data from registerForm + """ + return indexWidget (dataWidget (), loginWidget (), statusWidget (data['ip'])) + +def submitForm (data): + """ + display the form for data submission + """ + return indexWidget (dataWidget (), submitFormWidget (), statusWidget (data['ip'], data['user'])) + +def submit (data): + """ + evaluate data from submitForm + """ + return indexWidget (dataWidget (), submitWidget (), statusWidget (data['ip'])) + +def viewlog (data): + """ + show latest log entries/submissions + """ + return indexWidget (dataWidget (), logWidget (), statusWidget (data['ip'], data['user'])) + +def index (data): + """ + display the index page + """ + return indexWidget (dataWidget (), osmWidget (), statusWidget (data['ip'], data['user'])) + +def msdbtest (env): + body = '' + for key, value in sorted (env.items()): + body = '{0}{1}: {2}\n'.format (body, key, value) + return body + +# vim: tw=0 ts=2 expandtab +# EOF -- cgit v1.2.3