add user setting query, improve dashboard
This commit is contained in:
parent
f4010939dc
commit
ee7c7eccf1
@ -1478,8 +1478,13 @@ class routerHBP(HBSYSTEM):
|
||||
lon_min = ba2num(bptc_decode(_data)[46:52])
|
||||
lat_min_dec = str(ba2num(bptc_decode(_data)[24:38])).zfill(4)
|
||||
lon_min_dec = str(ba2num(bptc_decode(_data)[52:66])).zfill(4)
|
||||
aprs_lat = str(str(lat_deg) + str(lat_min) + '.' + str(lat_min_dec)[0:2]).zfill(7) + lat_dir
|
||||
aprs_lon = str(str(lon_deg) + str(lon_min) + '.' + str(lon_min_dec)[0:2]).zfill(8) + lon_dir
|
||||
# Old MD-380 coordinate format, keep here until new is confirmed working.
|
||||
#aprs_lat = str(str(lat_deg) + str(lat_min) + '.' + str(lat_min_dec)[0:2]).zfill(7) + lat_dir
|
||||
#aprs_lon = str(str(lon_deg) + str(lon_min) + '.' + str(lon_min_dec)[0:2]).zfill(8) + lon_dir
|
||||
# Fix for MD-380 by G7HIF
|
||||
aprs_lat = str(str(lat_deg) + str(lat_min).zfill(2) + '.' + str(lat_min_dec)[0:2]).zfill(7) + lat_dir
|
||||
aprs_lon = str(str(lon_deg) + str(lon_min).zfill(2) + '.' + str(lon_min_dec)[0:2]).zfill(8) + lon_dir
|
||||
|
||||
# Form APRS packet
|
||||
#logger.info(aprs_loc_packet)
|
||||
logger.info('Lat: ' + str(aprs_lat) + ' Lon: ' + str(aprs_lon))
|
||||
|
@ -425,8 +425,13 @@ class DATA_SYSTEM(HBSYSTEM):
|
||||
lon_min = ba2num(bptc_decode(_data)[46:52])
|
||||
lat_min_dec = str(ba2num(bptc_decode(_data)[24:38])).zfill(4)
|
||||
lon_min_dec = str(ba2num(bptc_decode(_data)[52:66])).zfill(4)
|
||||
aprs_lat = str(str(lat_deg) + str(lat_min) + '.' + str(lat_min_dec)[0:2]).zfill(7) + lat_dir
|
||||
aprs_lon = str(str(lon_deg) + str(lon_min) + '.' + str(lon_min_dec)[0:2]).zfill(8) + lon_dir
|
||||
# Old MD-380 coordinate format, keep here until new is confirmed working.
|
||||
#aprs_lat = str(str(lat_deg) + str(lat_min) + '.' + str(lat_min_dec)[0:2]).zfill(7) + lat_dir
|
||||
#aprs_lon = str(str(lon_deg) + str(lon_min) + '.' + str(lon_min_dec)[0:2]).zfill(8) + lon_dir
|
||||
# Fix for MD-380 by G7HIF
|
||||
aprs_lat = str(str(lat_deg) + str(lat_min).zfill(2) + '.' + str(lat_min_dec)[0:2]).zfill(7) + lat_dir
|
||||
aprs_lon = str(str(lon_deg) + str(lon_min).zfill(2) + '.' + str(lon_min_dec)[0:2]).zfill(8) + lon_dir
|
||||
|
||||
# Form APRS packet
|
||||
#logger.info(aprs_loc_packet)
|
||||
logger.info('Lat: ' + str(aprs_lat) + ' Lon: ' + str(aprs_lon))
|
||||
|
@ -71,7 +71,7 @@ def get_loc_data():
|
||||
last_known_loc_list.append(e['call'])
|
||||
display_number = display_number - 1
|
||||
tmp_loc = tmp_loc + '''<tr>
|
||||
<td style="text-align: center;"><a href="view_map?track=''' + e['call'] + '''&map_size=full"><strong>''' + e['call'] + '''</strong></a></td>
|
||||
<td style="text-align: center;"><a href="view_map?track=''' + e['call'] + '''"target="_blank"><strong>''' + e['call'] + '''</strong></a></td>
|
||||
<td style="text-align: center;"><strong> ''' + str(e['lat']) + ''' </strong></td>
|
||||
<td style="text-align: center;"><strong> ''' + str(e['lon']) + ''' </strong></td>
|
||||
<td style="text-align: center;"> ''' + e['time'] + ''' </td>
|
||||
@ -322,6 +322,77 @@ def view_map():
|
||||
def map():
|
||||
return render_template('map.html', title = dashboard_title, logo = logo)
|
||||
|
||||
@app.route('/user')
|
||||
def user_settings():
|
||||
user_id = request.args.get('user_id')
|
||||
if not user_id:
|
||||
user_result = """
|
||||
<form action="user" method="get">
|
||||
<table style="margin-left: auto; margin-right: auto;">
|
||||
<tbody>
|
||||
<tr style="height: 62px;">
|
||||
<td style="text-align: center; height: 62px;">
|
||||
<h2><strong><label for="user_id">DMR ID:</label></strong></h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px;"><input id="user_id" name="user_id" type="text" /></td>
|
||||
</tr>
|
||||
<tr style="height: 27px;">
|
||||
<td style="text-align: center; height: 27px;"><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
"""
|
||||
else:
|
||||
try:
|
||||
#return render_template('map.html', title = dashboard_title, logo = logo)
|
||||
user_settings = ast.literal_eval(os.popen('cat ../../user_settings.txt').read())
|
||||
call = user_settings[int(user_id)][0]['call']
|
||||
ssid = user_settings[int(user_id)][1]['ssid']
|
||||
icon = user_settings[int(user_id)][2]['icon']
|
||||
comment = user_settings[int(user_id)][3]['comment']
|
||||
if ssid == '':
|
||||
ssid = aprs_ssid
|
||||
if icon == '':
|
||||
icon = '\['
|
||||
#for result in user_settings:
|
||||
#return user_settings[int(user_id)][0]
|
||||
#return user_id
|
||||
#return user_settings
|
||||
user_result = """<h2 style="text-align: center;"> Settings for ID: """ + user_id + """</h2>
|
||||
<table style="margin-left: auto; margin-right: auto; width: 419.367px;" border="1">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 82px;"><strong>Callsign:</strong></td>
|
||||
<td style="width: 319.367px; text-align: center;">""" + user_settings[int(user_id)][0]['call'] + """</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 82px;"><strong>SSID:</strong></td>
|
||||
<td style="width: 319.367px; text-align: center;">""" + ssid + """</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 82px;"><strong>Icon:</strong></td>
|
||||
<td style="width: 319.367px; text-align: center;">""" + icon + """</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 82px;"><strong>Comment:</strong></td>
|
||||
<td style="width: 319.367px; text-align: center;">""" + comment + """</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p style="text-align: center;"><button onclick="history.back()">Back</button>
|
||||
</p>
|
||||
"""
|
||||
except:
|
||||
user_result = '''<h2 style="text-align: center;">User ID not found.</h2>
|
||||
<p style="text-align: center;"><button onclick="history.back()">Back</button>
|
||||
</p>'''
|
||||
|
||||
return render_template('user_settings.html', title = dashboard_title, logo = logo, user_result = Markup(user_result))
|
||||
|
||||
@app.route('/bulletin_rss.xml')
|
||||
def bb_rss():
|
||||
try:
|
||||
|
@ -6,9 +6,11 @@
|
||||
<tr>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='/';"> D-APRS Dashboard </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='/map';"> Station Map </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='/user';"> User Settings </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='/help';"> D-APRS Help </button></td>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='/about';"> Gateway Contact </button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
|
||||
|
8
scripts/dashboard/templates/user_settings.html
Normal file
8
scripts/dashboard/templates/user_settings.html
Normal file
@ -0,0 +1,8 @@
|
||||
{% include 'page.html' %}
|
||||
{% include 'header.html' %}
|
||||
<p> </p>
|
||||
Use this tool to find the stored APRS settings for your DMR ID. When a position is sent, the stored settings will be used to format the APRS packet.
|
||||
{{user_result}}
|
||||
<p> </p>
|
||||
{% include 'footer.html' %}
|
||||
|
Loading…
Reference in New Issue
Block a user