From 3cc71a4040dab6bfe9c062000275c4a6977a8f1f Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Sat, 24 Apr 2021 07:39:48 -0700 Subject: [PATCH] add dashboard url to code --- scripts/dashboard/dashboard.py | 34 ++++++++++++------------- scripts/dashboard/templates/header.html | 14 +++++----- scripts/dashboard/templates/map.html | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/dashboard/dashboard.py b/scripts/dashboard/dashboard.py index 4fa9efa..98058c3 100644 --- a/scripts/dashboard/dashboard.py +++ b/scripts/dashboard/dashboard.py @@ -81,7 +81,7 @@ def get_loc_data(): last_known_loc_list.append(e['call']) display_number = display_number - 1 tmp_loc = tmp_loc + ''' - ''' + e['call'] + ''' + ''' + e['call'] + '''  ''' + str(e['lat']) + '''   ''' + str(e['lon']) + '''   ''' + loc_time + '''  @@ -203,7 +203,7 @@ def user_setting_write(dmr_id, input_ssid, input_icon, input_comment, input_aprs def index(): value = Markup('The HTML String') #return get_data() - return render_template('index.html', title = dashboard_title, logo = logo, emergency = check_emergency(), api = use_api) + return render_template('index.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, emergency = check_emergency(), api = use_api) @app.route('/bulletin_board') def dash_bb(): return get_bb_data() @@ -215,11 +215,11 @@ def dash_loc(): @app.route('/help/') def help(): #return get_data() - return render_template('help.html', title = dashboard_title, logo = logo, description = description, api = use_api, data_call_type = data_call_type, data_call_id = data_call_id, aprs_ssid = aprs_ssid) + return render_template('help.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, description = description, api = use_api, data_call_type = data_call_type, data_call_id = data_call_id, aprs_ssid = aprs_ssid) @app.route('/about/') def about(): #return get_data() - return render_template('about.html', title = dashboard_title, logo = logo, contact_name = contact_name, api = use_api, contact_call = contact_call, contact_email = contact_email, contact_website = contact_website) + return render_template('about.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, contact_name = contact_name, api = use_api, contact_call = contact_call, contact_email = contact_email, contact_website = contact_website) @app.route('/external_apps') def external_apps(): @@ -283,7 +283,7 @@ def external_apps():

 

''' ## content = 'yo' - return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(content), api = use_api) + return render_template('generic.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, content = Markup(content), api = use_api) @app.route('/view_map') def view_map(): @@ -390,7 +390,7 @@ def view_map(): content = """

Station not found.

#

#

""" - return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(content)) + return render_template('generic.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, content = Markup(content)) if not track_call: folium_map = folium.Map(location=(map_center_lat, map_center_lon), tiles=map_theme, zoom_start=int(zoom_level)) @@ -431,7 +431,7 @@ def view_map(): """ + loc_comment + """ - Track Station + Track Station @@ -459,7 +459,7 @@ def view_map(): @app.route('/map/') def map(): - return render_template('map.html', title = dashboard_title, logo = logo, api = use_api) + return render_template('map.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, api = use_api) @app.route('/user', methods = ['GET', 'POST']) def user_settings(): @@ -651,7 +651,7 @@ def user_settings():

''' - return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(user_result), api = use_api) + return render_template('generic.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, content = Markup(user_result), api = use_api) @app.route('/mailbox') def mailbox(): @@ -659,7 +659,7 @@ def mailbox(): if not recipient: mail_content = """

The Mailbox is a place where users can leave messages via DMR SMS. A user can leave a message for someone else by sending a specially formatted SMS to """ + data_call_id + """. - The message recipient can then use the mailbox to check for messages. You can also check for APRS mesages addressed to your DMR radio. Enter your call sign (without APRS SSID) below to check for messages. See the help page for more information.

+ The message recipient can then use the mailbox to check for messages. You can also check for APRS mesages addressed to your DMR radio. Enter your call sign (without APRS SSID) below to check for messages. See the """ + dashboard_title + """ - Bulletin Board Feed - """ + rss_link + """ + """ + dashboard_url + """ This is the Bulletin Board feed from """ + dashboard_title + """""" for entry in dash_bb: if type(entry['time']) == str: @@ -749,7 +749,7 @@ def bb_rss(): post_data = post_data + """ """ + entry['call'] + ' - ' + str(entry['dmr_id']) + """ - """ + rss_link + """ + """ + dashboard_url + """ """ + entry['bulletin'] + """ - """ + loc_time + """ """ + datetime.fromtimestamp(entry['time']).strftime('%a, %d %b %y') +""" @@ -768,7 +768,7 @@ def mail_rss(): """ + dashboard_title + """ - Mailbox Feed for """ + recipient + """ - """ + rss_link + """ + """ + dashboard_url + """ This is a Mailbox feed from """ + dashboard_title + """ for """ + recipient + """.""" for entry in mailbox_file: if type(entry['time']) == str: @@ -779,7 +779,7 @@ def mail_rss(): post_data = post_data + """ """ + entry['call'] + ' - ' + str(entry['dmr_id']) + """ - """ + rss_link + """ + """ + dashboard_url + """ """ + entry['message'] + """ - """ + loc_time + """ """ + datetime.fromtimestamp(entry['time']).strftime('%a, %d %b %y') +""" @@ -791,7 +791,7 @@ def mail_rss(): def api(api_mode=None): if request.method == 'GET': api_content = '

API Enabled: ' + str(use_api) + '

' - return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(api_content), api = use_api) + return render_template('generic.html', title = dashboard_title, dashboard_url = dashboard_url, logo = logo, content = Markup(api_content), api = use_api) if use_api == 'True' or use_api == "true": access_systems = ast.literal_eval(os.popen('cat ' + access_systems_file).read()) authorized_users = ast.literal_eval(os.popen('cat ' + authorized_users_file).read()) @@ -958,7 +958,7 @@ if __name__ == '__main__': time_format = parser.get('GPS_DATA', 'TIME_FORMAT') # RSS feed link, shows in the link section of each RSS item. - rss_link = parser.get('GPS_DATA', 'DASHBOARD_URL') + dashboard_url = parser.get('GPS_DATA', 'DASHBOARD_URL') # Default APRS comment for users. default_comment = parser.get('GPS_DATA', 'USER_APRS_COMMENT') diff --git a/scripts/dashboard/templates/header.html b/scripts/dashboard/templates/header.html index 81dfd41..20404c0 100644 --- a/scripts/dashboard/templates/header.html +++ b/scripts/dashboard/templates/header.html @@ -4,15 +4,15 @@ - - - - + + + + {% if api %} - + {% endif %} - - + +
diff --git a/scripts/dashboard/templates/map.html b/scripts/dashboard/templates/map.html index 35e169f..3eecbde 100644 --- a/scripts/dashboard/templates/map.html +++ b/scripts/dashboard/templates/map.html @@ -2,7 +2,7 @@ {% include 'header.html' %}

Red: Last location received. Blue: Location history.

 

-

+

 

{% include 'footer.html' %}