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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
"""
web widgets for MURSAT1 Dashboard
"""
import time
def loginFormWidget ():
html = '''
Please enter your email/callsign and your password in the form below.
<form method="post">
<table>
<tr><td class="formfield">Email:</td><td><input type="text" name="email" /></td></tr>
<tr><td class="formfield">Password:</td><td><input type="password" name="password" /></td></tr>
<tr><td class="formfield"><input type="submit" value="Login" /></td><td></td></tr>
</table>
<input type="hidden" name="cmd" value="login" />
</form>
Don't have an account yet? <a href="mmd?cmd=registerForm">Register</a> here!
'''
return html
def loginWidget (email):
html = '''
login request for {0}
'''.format (email)
return html
def registerFormWidget ():
html = '''
Please fill in the form below an click on Register. You will receive a confirmation email.
<form method="post">
<table>
<tr><td class="formfield">Firstname*:</td><td><input type="text" name="firstname" /></td></tr>
<tr><td class="formfield">Lastname*: </td><td><input type="text" name="lastname" /></td></tr>
<tr><td class="formfield">Email*: </td><td><input type="text" name="email" /></td></tr>
<tr><td class="formfield">Callsign: </td><td><input type="text" name="callsign" /></td></tr>
<tr><td class="formfield">Longitude: </td><td><input type="text" name="latitude" /></td></tr>
<tr><td class="formfield">Latitude: </td><td><input type="text" name="longitude" /></td></tr>
<tr><td class="formfield">Password*: </td><td><input type="password" name="password" /></td></tr>
<tr><td class="formfield">Confirm Password*: </td><td><input type="password" name="confirm" /></td></tr>
<tr><td class="formfield"><input type="submit" value="Register" /></td><td></td></tr>
</table>
<input type="hidden" name="cmd" value="register" />
</form>
Fields marked with a * are mandatory.
'''
return html
def registerWidget ():
html = '''
you could be registered iff I had finished this code
'''
return html
def submitFormWidget ():
html = '''
sorry, no form yet!
'''
return html
def submitWidget ():
html = '''
need processing of data
'''
return html
def logWidget ():
html = '''
Log data, lot's of log data ...
'''
return html
def osmWidget (longitude = 15.4426, latitude = 47.06576):
html = '''
<div id="osm"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
var from = new OpenLayers.Projection ("EPSG:4326");
var to = new OpenLayers.Projection ("EPSG:900913");
var lonlat = new OpenLayers.LonLat ({0}, {1}).transform (from, to);
// create a map
map = new OpenLayers.Map ("osm");
map.addLayer (new OpenLayers.Layer.OSM ());
// set a marker
var markers = new OpenLayers.Layer.Markers ("Markers");
map.addLayer (markers);
markers.addMarker (new OpenLayers.Marker (lonlat));
// center the map
map.setCenter (lonlat, 2);
</script>
'''.format (longitude, latitude)
return html
def statusWidget (ip, user = 'Anonymous'):
html = '''
<a href="mmd">
<img src="http://sat.mur.at/pics/sat-logo-notext.png" alt="mur.sat logo" />
</a>
MURSAT1 Mission Dashboard
<div id="info">
Hello {0} with session id '{1}'! Local time is {2}
</div>
'''.format (user, ip, time.strftime ('%c'))
return html
def indexWidget (lcol, rcol, status):
html = '''
<!Doctype html>
<html>
<head>
<title>MURSAT1 Dashboard</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="mmd.css" />
</head>
<body>
<div id="status">
{0}
</div>
<div id="lcol">
{1}
</div>
<div id="rcol">
{2}
</div>
<div id="dev">
Development version!
</div>
</body>
</html>
'''.format (status, lcol, rcol)
return html
def dataWidget (longitude = 15.44226, latitude = 47.06576):
html = '''
<div id="datahead">
Current Data
</div>
<div>Time: 00 D 00 H 00 M 00 S</div>
<div>Longitude: {0}</div>
<div>Latitude: {1}</div>
<hr />
<div><a href="mmd?cmd=submitForm">Submit</a> a report</div>
<div><a href="mmd?cmd=loginForm">Login</a> to your personal account</div>
<div>View <a href="mmd?cmd=viewlog">Log</a> of reports</div>
<hr />
<div>Checkout the <a href="http://sat.mur.at/">project page</a>!</div>
'''.format (longitude, latitude)
return html
if __name__ == "__main__":
pass
# vim: ft=html tw=0 ts=2 expandtab
# EOF
|