From 502b6a813a6f90c2e7adb5781b1beecd559014d9 Mon Sep 17 00:00:00 2001 From: Jogi Hofmüller Date: Wed, 3 Aug 2011 11:19:44 +0000 Subject: - added functionality for location - user's default location is save - map centers on user's location iff available git-svn-id: https://svn.spreadspace.org/mur.sat@96 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- tools/mmd/MmdWidgets.py | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'tools/mmd/MmdWidgets.py') diff --git a/tools/mmd/MmdWidgets.py b/tools/mmd/MmdWidgets.py index ec77eb0..4f0d582 100644 --- a/tools/mmd/MmdWidgets.py +++ b/tools/mmd/MmdWidgets.py @@ -3,6 +3,7 @@ web widgets for MURSAT1 Dashboard """ import time +from MmdLocation import Location def loginFormWidget (): html = ''' @@ -49,10 +50,12 @@ def registerFormWidget (): Lastname*: Email*: Callsign: - Longitude: - Latitude: Password*: Confirm Password*: + You can enter your prefered location if you wish + Name: + Longitude: + Latitude: @@ -96,7 +99,10 @@ def confirmRegistrationWidget (user): Thank you for participating in this project by registerting here! We are looking forward to receiving your reports from MURSAT1.
- Sessions here stay valid for 24 hours after your last click. If your session expires, just use your email and password to logon again using this link: http://hofos.at/mmd/?cmd=login. + Sessions here stay valid for 48 hours after your last click. If your session expires, just use your email and password to logon again using this link: http://hofos.at/mmd/?cmd=login. +
+
+ Greetings from the MURSAT1 team
'''.format (user.firstname, user.lastname) @@ -145,14 +151,18 @@ def logWidget (): return html -def osmWidget (longitude = 15.4426, latitude = 47.06576): +def osmWidget (satellite, user): + user_location = user.getDefaultLocation () + if not user_location: + user_location = Location () html = '''
- '''.format (longitude, latitude) + + '''.format (satellite['longitude'], satellite['latitude'], user_location.longitude, user_location.latitude) return html @@ -189,6 +201,9 @@ def statusWidget (session): def indexWidget (lcol, rcol, status, debug_info = False): if debug_info: + user_location = debug_info.user.getDefaultLocation () + if not user_location: + user_location = Location () debug = '''
      Debug Info
@@ -200,6 +215,9 @@ def indexWidget (lcol, rcol, status, debug_info = False):
      Expires: {4}
      Renewal: {5}
      Now: {6}
+     User's Location Name: {7}
+     Longitude: {8}
+     Latitude: {9}
     
'''.format ( debug_info.session_id, @@ -208,7 +226,10 @@ def indexWidget (lcol, rcol, status, debug_info = False): debug_info.status, debug_info.expires, debug_info.renewal, - time.strftime ('%s')) + time.strftime ('%s'), + user_location.name, + user_location.longitude, + user_location.latitude) else: debug = '' -- cgit v1.2.3