""" web widgets for MURSAT1 Dashboard """ import time import ephem from MmdLocation import Location def createJavaArray (point_list, name): astring = '''var {0} = new Array (\n'''.format (name) astring = '{0}\tnew Array ('.format (astring) last = 'west' for point in point_list: if point[0][0] == '-': if last == 'east': astring = astring[:-1] astring = '{0}\n\t\t),\n\tnew Array ('.format (astring) last = 'west' else: last = 'east' astring = '{0}\n\t\tnew OpenLayers.LonLat ({1}, {2}).transform (from, to),'.format (astring, point[0], point[1]) if astring[-1] == ',': astring = astring[:-1] astring = '{0}\n\t\t)\n\t);'.format (astring) return astring def dms2degdec (lonlat): parts = lonlat.split (':') if len (parts) != 3: return 0.0 degrees = float (parts[0]) fraction = (float (parts[1]) * 60.0 + float (parts[2])) / 3600 if parts[0][0] == '-': return degrees - fraction return degrees + fraction def computeTrajectory (longitude, latitude, elevation): """ test for static TLE to trajectory computation """ line0 = "ARISSAT-1/RADIOSCAF-B" line1 = "1 37772U 98067CK 11220.22334818 .00031592 00000-0 37647-3 0 118" line2 = "2 37772 51.6391 258.8215 0013530 58.1430 19.7106 15.60689826 619" sat = ephem.readtle (line0, line1, line2) graz = ephem.Observer () graz.long, graz.lat, graz.elevation = longitude, latitude, elevation sat.compute (graz) point_list = [(str (dms2degdec (sat.sublong.__str__ ())), str (dms2degdec (sat.sublat.__str__ ())))] # calculate points for next three hours for i in range (60 * 3): graz.date += ephem.minute sat.compute (graz) point_list.append ( (str (dms2degdec (sat.sublong.__str__ ())), str (dms2degdec (sat.sublat.__str__ ()))) ) return point_list[0][0], point_list[0][1], createJavaArray (point_list, 'curves') def loginFormWidget (): html = '''
Email *
Password *
Firstname *
Lastname *
Callsign
Confirm Password *
Check to enter location
Name
Longitude *
Latitude *
Altitude
Debug Info ========== SESSION: SessionId: {0} IP: {1} Email: {2} Status: {3} Expires: {4} Renewal: {5} Now: {6} ===== USER: User's Location Name: {7} Longitude: {8} Latitude: {9} ========== SATELLITE: Latest SSP: {10}