diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..51285967a7d9722c5bdee4f6a81c154a56aa0846 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,19 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/admin/00_index.rst b/docs/admin/00_index.rst new file mode 100644 index 0000000000000000000000000000000000000000..f66e0fd37c36254125691eb357d0418fa46e8e6b --- /dev/null +++ b/docs/admin/00_index.rst @@ -0,0 +1,7 @@ +Importing timetables and substitutions from Untis +================================================= + +.. toctree:: + :glob: + + * diff --git a/docs/admin/10_features.rst b/docs/admin/10_features.rst new file mode 100644 index 0000000000000000000000000000000000000000..051a4901ab79dc7a4aaa9f811d1f8cf929012e28 --- /dev/null +++ b/docs/admin/10_features.rst @@ -0,0 +1,36 @@ +Untis data and their relation to AlekSIS +======================================== + +Untis is a proprietary timetable management software which is popular +in the German-speaking area, but used internationally. AlekSIS provides +functionality to automatically import data from Untis into data models +of the core and `Chronos`, the timetable and substitution app of AlekSIS. + +Currently, we only support importing data from the MySQL database of +`Untis MultiUser`. This is done through configurable background tasks +which are executed in a specific interval or at specific points in time. + +Supported Untis features +------------------------ + +Not all features of Untis are supported in AlekSIS. The following +information form Untis can be imported into AlekSIS: + +* Terms +* Holidays +* Classes, teachers, subjects +* Rooms, supervision areas (corridors in Untis) +* Lesson and break times +* Timetable data (lessons, supervisions) +* Absences, absence reasons +* Substitutions, extra lessons, cancellations +* Events + +Currently, the following features are known not to be supported: + +* Students, student groups, student choices +* Exams +* Calendars +* Prebookings +* Statistical data +* Special rooms (subject and group rooms) diff --git a/docs/admin/20_configuration.rst b/docs/admin/20_configuration.rst new file mode 100644 index 0000000000000000000000000000000000000000..be9cf3eb2ed22e8059783760d42814f759b9d9f1 --- /dev/null +++ b/docs/admin/20_configuration.rst @@ -0,0 +1,105 @@ +Setting up the Untis integration +================================ + +Requirements +------------ + +To use the importer, you must have a current Untis MultiUser +license (version 2019 and above) and a MySQL database which +is reachable by the AlekSIS server. How to configure Untis +to use this database is described in the `Untis MultiUser Manual`_. + +In addition to the technical requirements of AlekSIS itself, +a few extra system packages are required: + +.. code-block:: shell + + apt install libmariadb-dev + +The MySQL (or MariaDB) server must be reachable from the AlekSIS +server, and a user account in the database is needed. It is sufficient +to create this user with ``SELECT`` permissions. On the MySQL shell, +you can create such a user with something like: + +.. code-block:: sql + + CREATE USER `aleksis`@`aleksisserver` IDENTIFIED BY 'securepassword'; + GRANT SELECT ON `untis`.* TO `aleksis`@`aleksisserver`; + FLUSH PRIVILEGES; + +.. _Untis MultiUser Manual: https://help.Untis.at/hc/de/article_attachments/360004504079/Untis_MultiUser.pdf + +Configure database connection +----------------------------- + +In the AlekSIS configuration file, you have to set following settings: + +.. code-block:: toml + + [untis.database] + enabled = true + name = "untis" + user = "aleksis" + password = "securepassword" + host = "mysqlserver" + port = 3306 + +Customise how data are imported +------------------------------- + +The way data are imported can be configured from the menu under +`Admin → Configuration → Untis`. The following preferences are available: + +* **Update values of existing subjects:** This will update the values of + already existing subjects if Untis has different data. +* **Update short name of existing persons:** This will update the short + name of already existing persons if Untis has different data. +* **Update name of existing persons:** This will update the name of + already existing persons if Untis has different data. +* **Update short name of existing groups:** This will update the short name + of already existing groups if Untis has different data. +* **Update name of existing groups:** This will update the name of already + existing groups if Untis has different data. +* **Overwrite group owners:** This will update the group owners of already + existing groups if Untis has different data. +* **Update name of existing rooms:** This will update the name of already + existing rooms if Untis has different data. +* **Update existing supervision areas:** This will update the values of + already existing supervision areas if Untis has different data. +* **Use course groups:** This will build or search course groups (groups + for each subject in a class) instead of setting the classes as groups. + +Scheduling import tasks +----------------------- + +The integration provides different background tasks to import the data from Untis: + +* ``untis_import_mysql_current_term``: This will import all data from the **current** + Untis term. +* ``untis_import_mysql_future_terms``: This will import all data from all **future** + Untis terms, but not from the current. +* ``untis_import_mysql_all_terms``: This will import all data from **all** Untis + terms which are in the database. +* ``untis_import_mysql_current_next_term``: This will import all data from the + **current and the directly following** Untis term. +* ``untis_import_mysql_current_future_terms``: This will import all data from the + **current and all future** Untis terms. + +We suggest using ``untis_import_mysql_current_next_term`` as a task because this will +ensure that all current data are up-to-date, but also that the next timetable version +is also already imported when it becomes reelvant. + +In general, all tasks will do nothing if there is no matching Untis term. + +To use these tasks, you have to add them as periodic tasks. + +How existing data is matched +---------------------------- + +If there are already existing data in AlekSIS' database, the Untis import will +always try to combine these data. The main data field used for this is the +``short name`` field. If the data were imported one time, each object in +Chronos will save the respective ID from Untis to make sure that the data are +properly updated at the next import. + +The import is thus idempotent. diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000000000000000000000000000000000000..4bb4608ad4036e6f67698ad5e2f098497f002020 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,207 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +import os +import sys + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import django + +sys.path.insert(0, os.path.abspath("..")) +os.environ["DJANGO_SETTINGS_MODULE"] = "aleksis.core.settings" +os.environ["LOCAL_SETTINGS_FILE"] = os.path.abspath(os.path.join("..", "local.cfg")) +django.setup() + +# -- Project information ----------------------------------------------------- + +project = "AlekSIS-App-Untis" +copyright = "2018-2022 The AlekSIS team" +author = "The AlekSIS Team" + +# The short X.Y version +version = "2.2" +# The full version, including alpha/beta/rc tags +release = "2.2.1.dev0" + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinxcontrib_django", + "sphinx_autodoc_typehints", + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = ".rst" + +# The master toctree document. +master_doc = "index" + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = None + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "sphinx_material" + +html_favicon = "../aleksis/core/static/img/aleksis-icon.png" +html_logo = "../aleksis/core/static/img/aleksis-banner.svg" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + "repo_url": f"https://edugit.org/AlekSIS/official/{project}", + "repo_name": "EduGit", + "repo_type": "gitlab", + "theme_color": "#0d5eaf", + "color_primary": "#0d5eaf", + "color_accent": "#0d5eaf", + "globaltoc_depth": 2, + "globaltoc_collapse": False, +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +html_sidebars = { + "**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"] +} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = f"{project}doc" + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, f"{project}.tex", f"{project} Documentation", author, "manual"), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [(master_doc, "aleksis", f"{project} Documentation", [author], 1)] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ( + master_doc, + project, + f"{project} Documentation", + author, + project, + "One line description of project.", + "Miscellaneous", + ), +] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ["search.html"] + + +# -- Extension configuration ------------------------------------------------- + +# -- Options for intersphinx extension --------------------------------------- + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "https://docs.python.org/": None, + "https://docs.djangoproject.com/en/stable": "https://docs.djangoproject.com/en/stable/_objects", +} diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..0ea1f9703203d1c416aba82c5be96bd29502692c --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,24 @@ +.. AlekSIS documentation master file, created by + sphinx-quickstart on Thu Aug 15 10:49:03 2019. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to AlekSIS-App-Untis' documentation! +============================================ + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + user/00_index + admin/00_index + dev/00_index + ref/00_index + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000000000000000000000000000000000000..27f573b87af11e2cbbd9f54eb1ee285a58550146 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/pyproject.toml b/pyproject.toml index 6ea0c9af899421ae38f83de26669a93e5a947ad8..1255f71d1e55f2b76143ad1776e56acda17d3929 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ aleksis-core = "^2.0rc" aleksis-app-chronos = "^2.0rc" [tool.poetry.dev-dependencies] -aleksis-builddeps = "^5" +aleksis-builddeps = "^6" [tool.poetry.plugins."aleksis.app"] untis = "aleksis.apps.untis.apps:UntisConfig"