diff options
author | Jogi Hofmüller <jogi@mur.at> | 2011-08-02 09:50:21 +0000 |
---|---|---|
committer | Jogi Hofmüller <jogi@mur.at> | 2011-08-02 09:50:21 +0000 |
commit | 7fa0052ae497ffef76ebe05e40589e0659505461 (patch) | |
tree | a3d683664757d36672e096a5f8a988df56cd4841 /tools/mmd/MmdWidgets.py | |
parent | - login works now (diff) |
- logout works now
- added debug info at the bottom of the page
- have nices status line now
git-svn-id: https://svn.spreadspace.org/mur.sat@91 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools/mmd/MmdWidgets.py')
-rw-r--r-- | tools/mmd/MmdWidgets.py | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/tools/mmd/MmdWidgets.py b/tools/mmd/MmdWidgets.py index 6ff3f3d..cfd4a7d 100644 --- a/tools/mmd/MmdWidgets.py +++ b/tools/mmd/MmdWidgets.py @@ -31,6 +31,15 @@ def loginWidget (user): return html +def logoutWidget (): + html = ''' + <div> + You have been logged out. + </div> + ''' + + return html + def registerFormWidget (): html = ''' Please fill in the form below and click on register. You will receive a confirmation email. @@ -158,22 +167,37 @@ def osmWidget (longitude = 15.4426, latitude = 47.06576): def statusWidget (session): if session.status == 'auth': - inout = '''<span id="logout"><a href="?cmd=logout">logout</a></span>''' + inout = '''Status: logged in as {0}. <span id="logout"><a href="?cmd=logout">logout</a></span>'''.format (session.user.email) else: - inout = '''<span id="login"><a href="?cmd=loginForm">login</a></span>''' + inout = '''Status: logged out. <span id="login"><a href="?cmd=loginForm">login</a></span>''' 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}. {3} + {0}. Local time is {1}. </div> - '''.format (session.user.email, session.session_id, time.strftime ('%c'), inout) + '''.format (inout, time.strftime ('%c')) return html -def indexWidget (lcol, rcol, status): +def indexWidget (lcol, rcol, status, debug_info = False): + if debug_info: + debug = ''' + <pre class="debug"> + Debug Info + ========== + SessionId: {0} + IP: {1} + Email: {2} + Status: {3} + Expires: {4} + </pre> + '''.format (debug_info.session_id, debug_info.ip, debug_info.user.email, debug_info.status, debug_info.expires) + else: + debug = '' + html = ''' <!Doctype html> <html> @@ -195,16 +219,17 @@ def indexWidget (lcol, rcol, status): <div id="dev"> Development version! </div> + {3} </body> </html> - '''.format (status, lcol, rcol) + '''.format (status, lcol, rcol, debug) return html def dataWidget (longitude = 15.44226, latitude = 47.06576): html = ''' <div id="datahead"> - Current Data + Current Satellite Data </div> <div>Time: 00 D 00 H 00 M 00 S</div> <div>Longitude: {0}</div> |