From ed0ac82d8fd5683d2b407892b75ab8c9d0537b92 Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Mon, 18 Nov 2019 19:24:25 +0100 Subject: [PATCH] - Add "About" page with - Copyright information - License - Credits - Add meta.py for project-wide meta information like version, copyright, etc. - meta_processor to provide meta vars directly in template - Change footer to new structure - Update requirements --- requirements.txt | 3 +- schoolapps/dashboard/urls.py | 1 + schoolapps/dashboard/views.py | 8 ++- schoolapps/meta.py | 56 +++++++++++++++++++++ schoolapps/schoolapps/settings.py | 1 + schoolapps/templates/common/about.html | 61 +++++++++++++++++++++++ schoolapps/templates/partials/footer.html | 58 ++++++++++++--------- 7 files changed, 161 insertions(+), 27 deletions(-) create mode 100644 schoolapps/meta.py create mode 100644 schoolapps/templates/common/about.html diff --git a/requirements.txt b/requirements.txt index f0c4a37de..3a4eea3ad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,11 +2,10 @@ mysqlclient django django-auth-ldap django-dbsettings -django_pdb +django-pdb django-material django-filter django_react_templatetags -kanboard PyPDF2 martor django_widget_tweaks \ No newline at end of file diff --git a/schoolapps/dashboard/urls.py b/schoolapps/dashboard/urls.py index 36bc9f13e..e93f4900a 100755 --- a/schoolapps/dashboard/urls.py +++ b/schoolapps/dashboard/urls.py @@ -4,5 +4,6 @@ from . import views urlpatterns = [ path('', views.index, name='dashboard'), path('test/', views.test_notification, name='test'), + path('about/', views.about, name='about') ] diff --git a/schoolapps/dashboard/views.py b/schoolapps/dashboard/views.py index d98d00107..cef8fb8e0 100755 --- a/schoolapps/dashboard/views.py +++ b/schoolapps/dashboard/views.py @@ -2,6 +2,8 @@ from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect from django.urls import reverse from django.http import HttpResponseNotFound + +from meta import OPEN_SOURCE_COMPONENTS from .models import Activity, register_notification # from .apps import DashboardConfig from mailer import send_mail_with_template @@ -53,5 +55,9 @@ def test_notification(request): return redirect(reverse('dashboard')) +def about(request): + return render(request, "common/about.html", context={"components": OPEN_SOURCE_COMPONENTS}) + + def error_404(request, exception): - return render(request, 'common/404.html') \ No newline at end of file + return render(request, 'common/404.html') diff --git a/schoolapps/meta.py b/schoolapps/meta.py new file mode 100644 index 000000000..b523f3a10 --- /dev/null +++ b/schoolapps/meta.py @@ -0,0 +1,56 @@ +with open("../COPYRIGHT", "r") as f: + COPYRIGHT = f.read() + +COPYRIGHT_SHORT = "© 2018–2019 Mitglieder der Computer-AG, Katharineum zu Lübeck" + +VERSION = '1.1-dev "Aebli"' + +LICENSE_APACHE_2 = "Apache 2.0 License" +LICENSE_BSD = "2-Clause BSD License" +LICENSE_BSD_3 = "3-Clause BSD License" +LICENSE_MIT = "MIT License" +LICENSE_GPL_V2 = "GNU General Public License v2.0" +LICENSE_GPL_V3 = "GNU General Public License v3.0" + +OPEN_SOURCE_COMPONENTS = [ + # ("Docker (u.a. Engine, CLI, docker-compose)", "https://github.com/docker", LICENSE_APACHE_2, + # "https://github.com/docker/docker/blob/master/LICENSE"), + ("Django", "https://www.djangoproject.com/", "Django BSD License", + "https://github.com/django/django/blob/master/LICENSE"), + ("Python 3", "https://www.python.org/", "PSF LICENSE AGREEMENT FOR PYTHON", + "https://docs.python.org/3/license.html"), + ("jQuery", "https://jquery.com/", LICENSE_MIT, "https://github.com/jquery/jquery/blob/master/LICENSE.txt"), + ("pip", "https://pypi.org/project/pip/", LICENSE_MIT, "https://github.com/pypa/pip/blob/master/LICENSE.txt"), + ("Requests", "https://requests.kennethreitz.org/", LICENSE_APACHE_2, + "https://github.com/psf/requests/blob/master/LICENSE"), + ("django-widget-tweaks", "https://github.com/jazzband/django-widget-tweaks", LICENSE_MIT, + "https://github.com/jazzband/django-widget-tweaks/blob/master/LICENSE"), + ("Materialize CSS", "https://materializecss.com/", LICENSE_MIT, + "https://github.com/Dogfalo/materialize/blob/master/LICENSE"), + ("Material Design Icons", "http://google.github.io/material-design-icons/", LICENSE_APACHE_2, + "https://github.com/google/material-design-icons/blob/master/LICENSE"), + ("highlight.js", "https://highlightjs.org/", LICENSE_BSD_3, + "https://github.com/highlightjs/highlight.js/blob/master/LICENSE"), + ("React", "https://reactjs.org/", LICENSE_MIT, "https://github.com/facebook/react/blob/master/LICENSE"), + ("mysqlclient", "https://github.com/PyMySQL/mysqlclient-python", LICENSE_GPL_V2, + "https://github.com/PyMySQL/mysqlclient-python/blob/master/LICENSE"), + ("django-auth-ldap", "https://github.com/django-auth-ldap/django-auth-ldap", LICENSE_BSD, + "https://github.com/django-auth-ldap/django-auth-ldap/blob/master/LICENSE"), + ("django-dbsettings", "https://github.com/zlorf/django-dbsettings", LICENSE_BSD_3, + "https://github.com/zlorf/django-dbsettings/blob/master/LICENSE"), + ("Django PDB", "https://github.com/HassenPy/django-pdb", "Public Domain", ""), + ("Django Material", "https://github.com/viewflow/django-material", LICENSE_BSD_3, + "https://github.com/viewflow/django-material/blob/master/LICENSE.txt"), + ("Django Filter", "https://github.com/carltongibson/django-filter", LICENSE_BSD_3, + "https://github.com/carltongibson/django-filter/blob/master/LICENSE"), + ("django-react-templatetags", "https://github.com/Frojd/django-react-templatetags", LICENSE_MIT, + "https://github.com/Frojd/django-react-templatetags/blob/develop/LICENSE"), + ("martor", "https://github.com/agusmakmun/django-markdown-editor", LICENSE_GPL_V3, + "https://github.com/agusmakmun/django-markdown-editor/blob/master/LICENSE"), + ("Babel", "https://babeljs.io/", LICENSE_MIT, "https://github.com/babel/babel/blob/master/LICENSE") +] +OPEN_SOURCE_COMPONENTS.sort(key=lambda elem: elem[0].lower()) + + +def meta_processor(request): + return {'COPYRIGHT': COPYRIGHT, "COPYRIGHT_SHORT": COPYRIGHT_SHORT, "VERSION": VERSION} diff --git a/schoolapps/schoolapps/settings.py b/schoolapps/schoolapps/settings.py index 3a8ae4521..dab3036dc 100755 --- a/schoolapps/schoolapps/settings.py +++ b/schoolapps/schoolapps/settings.py @@ -78,6 +78,7 @@ TEMPLATES = [ 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'django_react_templatetags.context_processors.react_context_processor', + 'meta.meta_processor', ], }, }, diff --git a/schoolapps/templates/common/about.html b/schoolapps/templates/common/about.html new file mode 100644 index 000000000..026317fa4 --- /dev/null +++ b/schoolapps/templates/common/about.html @@ -0,0 +1,61 @@ +{% include "partials/header.html" %} +<main> + + <div class="card"> + <div class="card-content"> + <span class="card-title">Entwickler und Copyright</span> + <p>{{ COPYRIGHT|linebreaksbr }}</p> + <br> + <p> + GitHub: + <a href="https://github.com/Katharineum/tinventory">https://github.com/Katharineum/tinventory</a> + </p> + <p> + Kontakt: + <a href="mailto:support@katharineum.de">support@katharineum.de</a> + </p> + </div> + </div> + + <div class="card"> + <div class="card-content"> + <span class="card-title">Lizenz</span> + Dieses Programm ist Freie Software: Sie können es unter den Bedingungen + der GNU General Public License, wie von der Free Software Foundation, + Version 3 der Lizenz, weiter verteilen und/oder modifizieren. + + Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch + OHNE JEDE GEWÄHR,; sogar ohne die implizite + Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÃœR EINEN BESTIMMTEN ZWECK. + Siehe die GNU General Public License für weitere Einzelheiten. + + Im folgenden finden Sie eine Kopie der GNU General Public License Version 3. Weitere Informationen sowie die + Lizenz finden Sie auch unter + <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a> + . + </div> + </div> + <div class="card"> + <div class="card-content"> + <span class="card-title">Verwendete Open-Source-Komponenten</span> + Folgende Open-Source-Komponenten wurden in SchoolApps benutzt: + + <ul class="collection"> + {% for component in components %} + <li class="collection-item"> + <h6>{{ component.0 }}</h6> + <p style="margin-bottom: 10px;"> + <a href="{{ component.1 }}">{{ component.1 }}</a> + · Lizensiert unter der + <a href="{{ component.3 }}">{{ component.2 }}</a> + </p> + </li> + {% endfor %} + </ul> + + Ein Anspruch auf Vollständigkeit wird nicht erhoben. + </div> + </div> +</main> + +{% include "partials/footer.html" %} \ No newline at end of file diff --git a/schoolapps/templates/partials/footer.html b/schoolapps/templates/partials/footer.html index 99589b618..9b442d064 100755 --- a/schoolapps/templates/partials/footer.html +++ b/schoolapps/templates/partials/footer.html @@ -5,52 +5,62 @@ <div class="container"> <div class="row no-margin footer-row-large"> <div class="col l6 s12 no-pad-left height-inherit"> - <p class="white-text valign-bot no-margin"> - Version 1.1-dev "Aebli" · - Licensed under <a class="blue-text text-lighten-4" - href="http://www.gnu.org/licenses/gpl-3.0-standalone.html">GNU GPL 3.0</a> + <p class="white-text valign-bot"> + <a href="{% url "about" %}" class="blue-text text-lighten-4">Ãœber Schoolapps · Entwickler, Copyright + und Lizenz + </a> </p> </div> <div class="col xl15 l6 offset-xl01 s12 no-pad-right"> <ul class="no-margin right"> <a class="blue-text text-lighten-4 btn-flat no-pad-left" href="https://katharineum-zu-luebeck.de"><i - class="material-icons footer-icon left">home</i> Homepage</a> + class="material-icons footer-icon left">home</i> Homepage + </a> <a class="blue-text text-lighten-4 btn-flat" href="https://forum.katharineum.de"><i - class="material-icons footer-icon left">account_balance</i> Forum</a> + class="material-icons footer-icon left">account_balance</i> Forum + </a> <a class="blue-text text-lighten-4 btn-flat" href="https://nimbus.katharineum.de"><i - class="material-icons footer-icon left">cloud</i> Nimbus</a> + class="material-icons footer-icon left">cloud</i> Nimbus + </a> <a class="blue-text text-lighten-4 btn-flat no-pad-right" href="https://webmail.katharineum.de"><i - class="material-icons footer-icon left">email</i> Webmail</a> + class="material-icons footer-icon left">email</i> Webmail + </a> </ul> </div> </div> <div class="row no-margin footer-row-small"> - <span class="white-text no-margin make-it-higher"> - Version 1.1-dev "Aebli" · - Licensed under <a class="blue-text text-lighten-4" - href="http://www.gnu.org/licenses/gpl-3.0-standalone.html">GNU GPL 3.0</a> - </span> + <span class="white-text make-it-higher"> + <a href="{% url "about" %}" class="blue-text text-lighten-4">Ãœber Schoolapps · Entwickler, Copyright + und Lizenz + </a> + </span> <ul class="no-margin footer-ul"> - <a class="blue-text text-lighten-4 btn-flat no-pad-left" href="https://katharineum-zu-luebeck.de"><i - class="material-icons footer-icon left">home</i> Homepage</a> - <a class="blue-text text-lighten-4 btn-flat" href="https://forum.katharineum.de"><i - class="material-icons footer-icon left">account_balance</i> Forum</a> - <a class="blue-text text-lighten-4 btn-flat" href="https://nimbus.katharineum.de"><i - class="material-icons footer-icon left">cloud</i> Nimbus</a> - <a class="blue-text text-lighten-4 btn-flat no-pad-right" href="https://webmail.katharineum.de"><i - class="material-icons footer-icon left">email</i> Webmail</a> - </ul> + <a class="blue-text text-lighten-4 btn-flat no-pad-left" href="https://katharineum-zu-luebeck.de"><i + class="material-icons footer-icon left">home</i> Homepage + </a> + <a class="blue-text text-lighten-4 btn-flat" href="https://forum.katharineum.de"><i + class="material-icons footer-icon left">account_balance</i> Forum + </a> + <a class="blue-text text-lighten-4 btn-flat" href="https://nimbus.katharineum.de"><i + class="material-icons footer-icon left">cloud</i> Nimbus + </a> + <a class="blue-text text-lighten-4 btn-flat no-pad-right" href="https://webmail.katharineum.de"><i + class="material-icons footer-icon left">email</i> Webmail + </a> + </ul> </div> </div> <div class="footer-copyright"> <div class="container"> - <span class="left">© 2018–{% now "Y" %} Computer-AG, Katharineum zu Lübeck</span> + <span class="left">Version {{ VERSION }} · {{ COPYRIGHT_SHORT }}</span> <span class="right"> <span id="doit"></span> <a class="blue-text text-lighten-4" href="https://katharineum-zu-luebeck.de/impressum/">Impressum</a> · - <a class="blue-text text-lighten-4" href="https://katharineum-zu-luebeck.de/datenschutzerklaerung/">Datenschutzerklärung</a> + <a class="blue-text text-lighten-4" href="https://katharineum-zu-luebeck.de/datenschutzerklaerung/"> + Datenschutzerklärung + </a> </span> </div> </div> -- GitLab