"""
web widgets for MURSAT1 Dashboard
"""
import time
def loginFormWidget ():
html = '''
Please enter your email and password in the form below.
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.
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 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.
'''.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 (longitude = 15.4426, latitude = 47.06576):
html = '''
'''.format (longitude, 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 = '''
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:
debug = '''