summaryrefslogtreecommitdiff
path: root/tools/mmd/MmdCommands.py
blob: 1af94221f1095299b4dd41ddf3ae33c3b462d203 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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