Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1fafef2
implementation of BluePrint, fixed local dependencies of pytest "test…
JanEisermann Mar 13, 2026
f19cf8d
implementation of BluePrint, fixed local dependencies of pytest "test…
JanEisermann Mar 13, 2026
7ed2570
moved file_exists to mslib.utils, moved the constants to the beginnin…
JanEisermann Mar 13, 2026
c62ad8b
added Blueprints for mscolab
JanEisermann Mar 17, 2026
b11e00b
fixxed flake8 errors
JanEisermann Mar 17, 2026
ce2ef58
fixed incompleted address errors
JanEisermann Mar 20, 2026
18ff5ed
added Jan Eisermann to the authors list
JanEisermann Mar 23, 2026
2f8f139
moved methods to the rigth blueprint path and added description to th…
JanEisermann Mar 23, 2026
570f809
moved Jan Eisermann to the right place in the author list
JanEisermann Mar 23, 2026
80c25b7
moved each blueprint in mscolab and mswms into its own directory (inc…
JanEisermann Mar 24, 2026
aea0401
corrected the directory path in the doc string
JanEisermann Mar 25, 2026
efb2dc6
renamed from status.html to status_password.html
JanEisermann Mar 25, 2026
47e7c3e
added doc string
JanEisermann Mar 25, 2026
b9393d8
corrected doc string
JanEisermann Mar 25, 2026
db4a8bc
moved into blueprins.docs.templates (mscolab and mswms)
JanEisermann Mar 25, 2026
f4ef61f
moved the routes into the respective blueprints.
JanEisermann Mar 25, 2026
0a6b15e
added content.html to mslib.mswms.blueprints.gallery.templates.gallery
JanEisermann Mar 25, 2026
d6f1716
moved APP.routes('/') from mslib/mscolab/server.py to docs Blueprint
JanEisermann Mar 25, 2026
ed5d2de
moved APP.routes('/') from mslib/mswms/wms to docs Blueprint
JanEisermann Mar 25, 2026
4fa09d5
moved static directory to blueprints
JanEisermann Mar 26, 2026
d7227ea
moved static directory to blueprints
JanEisermann Mar 26, 2026
cb54df2
fixed the Mission Support System
JanEisermann Mar 27, 2026
c843548
fixed the Mission Support System Gallary
JanEisermann Mar 27, 2026
a1de8d0
fixed URL for reset_request
JanEisermann Mar 27, 2026
067fb8d
changed imprint = None and gdpr = None
JanEisermann Mar 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ in alphabetic order by first name
- Debajyoti Dasgupta <debajyotidasgupta6@gmail.com>
- Hrithik Kumar Verma <vermahrithik812@gmail.com>
- Isabell Krisch <isabellkrisch@gmail.com>
- Jan Eisermann <j.eisermann@fz-juelich.de>
- Jatin Jain <jatinalwar2001@gmail.com>
- Jens-Uwe Grooß <j.-u.grooss@fz-juelich.de>
- Jörn Ungermann <j.ungermann@fz-juelich.de>
Expand Down
123 changes: 20 additions & 103 deletions mslib/mscolab/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,49 +29,43 @@
import sqlalchemy

from flask_migrate import Migrate
from flask import Flask
from flask import Flask, current_app

import mslib

from flask import render_template, send_from_directory, send_file, url_for, abort
from flask import url_for
from flask_sqlalchemy import SQLAlchemy

from mslib.mscolab.blueprints.docs import DOCS_BP
from mslib.mscolab.conf import mscolab_settings
from mslib.utils import prefix_route, release_info
from mslib.msui.icons import icons
from mslib.utils.get_content import get_content
from mslib.utils.file_exists import file_exists
from xstatic.main import XStatic

message, update = release_info.check_for_new_release()
if update:
logging.warning(message)


def file_exists(filepath=None):
try:
return os.path.isfile(filepath)
except TypeError:
return False


DOCS_SERVER_PATH = os.path.dirname(os.path.abspath(mslib.__file__))
DOCS_STATIC_DIR = os.path.join(DOCS_SERVER_PATH, 'static')
DOCS_BLUEPRINTS_DIR = os.path.join(DOCS_SERVER_PATH, 'blueprints')
DOCS_STATIC_DIR = os.path.join(DOCS_BLUEPRINTS_DIR, 'static')
DOCS_IMG_DIR = os.path.join(DOCS_STATIC_DIR, 'img')
DOCS_DOCS_DIR = os.path.join(DOCS_STATIC_DIR, 'docs')
DOCS_TEMPLATES_DIR = os.path.join(DOCS_STATIC_DIR, 'templates')
# This can be used to set a location by SCRIPT_NAME for testing. e.g. export SCRIPT_NAME=/demo/
SCRIPT_NAME = os.environ.get('SCRIPT_NAME', '/')


message, update = release_info.check_for_new_release()
if update:
logging.warning(message)


# in memory database for testing
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'
APP = Flask(__name__, template_folder=os.path.join(DOCS_STATIC_DIR, 'templates'))
APP = Flask(__name__, template_folder=os.path.join(DOCS_TEMPLATES_DIR))
APP.config.from_object(mscolab_settings)
# Expose docs path for callers/tests and make it part of Flask config for consistency.
APP.config['DOCS_SERVER_PATH'] = DOCS_SERVER_PATH
APP.route = prefix_route(APP.route, SCRIPT_NAME)

APP.jinja_env.globals.update(file_exists=file_exists)
APP.jinja_env.globals["imprint"] = APP.config['IMPRINT']
APP.jinja_env.globals["gdpr"] = APP.config['GDPR']


def _xstatic(name):
mod_names = [
Expand Down Expand Up @@ -102,86 +96,9 @@ def create_app(imprint=None, gdpr=None):
APP.jinja_env.globals.update(file_exists=file_exists)
APP.jinja_env.globals["imprint"] = imprint_file
APP.jinja_env.globals["gdpr"] = gdpr_file

@APP.route('/xstatic/<name>/<path:filename>')
def files(name, filename):
base_path = _xstatic(name)
if base_path is None:
abort(404)
if not filename:
abort(404)
return send_from_directory(base_path, filename)

@APP.route('/mss_theme/img/<path:filename>')
def mss_theme(filename):
base_path = os.path.join(DOCS_IMG_DIR)
return send_from_directory(base_path, filename)

APP.jinja_env.globals.update(get_topmenu=get_topmenu)

@APP.route("/index")
def index():
return render_template("/index.html")

@APP.route("/mss/about")
@APP.route("/mss")
def about():
_file = os.path.join(DOCS_DOCS_DIR, 'about.md')
img_url = url_for('overview')
md_overrides = ('![image](/mss/overview.png)', f'![image]({img_url})')

html_overrides = ('<img alt="image" src="/mss/overview.png" />',
'<img class="mx-auto d-block img-fluid" alt="image" src="/mss/overview.png" />')
content = get_content(_file, md_overrides=md_overrides, html_overrides=html_overrides)
return render_template("/content.html", act="about", content=content)

@APP.route("/mss/install")
def install():
_file = os.path.join(DOCS_DOCS_DIR, 'installation.md')
content = get_content(_file)
return render_template("/content.html", act="install", content=content)

@APP.route("/mss/help")
def help(): # noqa: A001
_file = os.path.join(DOCS_DOCS_DIR, 'help.md')
html_overrides = ('<img alt="Waypoint Tutorial" '
'src="https://mss.readthedocs.io/en/stable/_images/tutorial_waypoints.gif" />',
'<img class="mx-auto d-block img-fluid" alt="Waypoint Tutorial" '
'src="https://mss.readthedocs.io/en/stable/_images/tutorial_waypoints.gif" />')
content = get_content(_file, html_overrides=html_overrides)
return render_template("/content.html", act="help", content=content)

@APP.route("/mss/imprint")
def imprint():
if file_exists(imprint_file):
content = get_content(imprint_file)
return render_template("/content.html", act="imprint", content=content)
else:
return ""

@APP.route("/mss/gdpr")
def gdpr():
if file_exists(gdpr_file):
content = get_content(gdpr_file)
return render_template("/content.html", act="gdpr", content=content)
else:
return ""

@APP.route('/mss/favicon.ico')
def favicons():
base_path = icons("16x16", "favicon.ico")
return send_file(base_path)

@APP.route('/mss/logo.png')
def logo():
base_path = icons("64x64", "mss-logo.png")
return send_file(base_path)

@APP.route('/mss/overview.png')
def overview():
base_path = os.path.join(DOCS_IMG_DIR, 'wise12_overview.png')
return send_file(base_path)

APP.register_blueprint(DOCS_BP)
return APP


Expand All @@ -205,10 +122,10 @@ def overview():

def get_topmenu():
menu = [
(url_for('index'), 'Mission Support System',
((url_for('about'), 'About'),
(url_for('install'), 'Install'),
(url_for('help'), 'Help'),
(url_for('docs.index'), 'Mission Support System',
((url_for('docs.about'), 'About'),
(url_for('docs.install'), 'Install'),
(url_for('docs.help'), 'Help'),
)),
]
return menu
Loading
Loading