""" web widgets for MURSAT1 Dashboard """ import time from MmdLocation import Location def loginFormWidget (): html = ''' Please enter your email and password in the form below.
Email:
Password:
Don't have an account yet? Register here! ''' return html def loginWidget (user): html = '''

Hello {0} {1}!

You are now logged on to MMD.
'''.format (user.firstname, user.lastname) return html def logoutWidget (): html = '''
You have been logged out.
''' return html def registerFormWidget (): html = ''' Please fill in the form below and click on register. You will receive a confirmation email.
Firstname*:
Lastname*:
Email*:
Callsign:
Password*:
Confirm Password*:
You can enter your prefered location if you wish
Name:
Longitude:
Latitude:
Fields marked with a * are mandatory. ''' return html def registerWidget (): html = '''

Thank you for registering!

You will receive an email containing a link to complete your registration. This link will stay valid for 24 hours.
Regards from the MURSAT1 team
''' return html def completeRegistrationWidget (code): html = '''

Completing registration!

By clicking confirm you confirm you registration to the MURSAT1 Mission Dashboard. If you received an email that brought you here but never registered, you might want to cancel the registration or simply do nothing since a registration code is only valid vor 24 hrs.
Greetings from the MURSAT1 Team!
'''.format (code) return html def confirmRegistrationWidget (user): html = '''

Dear {0} {1}!

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 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) return html def cancelRegistrationWidget (): html = '''

We are sorry!

Your registration has been canceled and all the data has been deleted from our records.
Regards from the MURSAT1 team
''' return html def errorWidget (error_message): html = '''

An error occured!

Error: {0}
Description: {1}
'''.format (error_message['error'], error_message['description']) 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 (satellite, user): user_location = user.getDefaultLocation () if not user_location: user_location = Location () html = '''
'''.format (satellite['longitude'], satellite['latitude'], user_location.longitude, user_location.latitude) return html def statusWidget (session): if session.status == 'auth': inout = '''Status: logged in as {0}. logout'''.format (session.user.email) else: inout = '''Status: logged out. login''' html = ''' mur.sat logo MURSAT1 Mission Dashboard
{0}. Local time is {1}.
'''.format (inout, time.strftime ('%c')) return html 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
     ==========
     SessionId: {0}
     IP: {1}
     Email: {2}
     Status: {3}
     Expires: {4}
     Renewal: {5}
     Now: {6}
     User's Location Name: {7}
     Longitude: {8}
     Latitude: {9}
    
'''.format ( debug_info.session_id, debug_info.ip, debug_info.user.email, debug_info.status, debug_info.expires, debug_info.renewal, time.strftime ('%s'), user_location.name, user_location.longitude, user_location.latitude) else: debug = '' html = ''' MURSAT1 Dashboard
{0}
{1}
{2}
Development version!
{3} '''.format (status, lcol, rcol, debug) return html def dataWidget (longitude = 15.44226, latitude = 47.06576): html = '''
Current Satellite Data
Time: 00 D 00 H 00 M 00 S
Longitude: {0}
Latitude: {1}

Submit a report
View Log of reports

Checkout the project page!
'''.format (longitude, latitude) return html if __name__ == "__main__": pass # vim: ft=html tw=0 ts=2 expandtab # EOF