From 5c1c4f38731a64241c5334e03569059bdce03855 Mon Sep 17 00:00:00 2001
From: Magnus Giesbert <magnus@fsmpi.rwth-aachen.de>
Date: Sat, 11 Jun 2022 00:30:32 +0200
Subject: [PATCH] =?UTF-8?q?F=C3=BCge=20Kategorien=20f=C3=BCr=20DokuWiki=20?=
 =?UTF-8?q?hinzu?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 models/database.py                               | 9 +++++++++
 tasks.py                                         | 2 +-
 templates/documentation-configuration-types.html | 3 ++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/models/database.py b/models/database.py
index 411ad1b..b8e8855 100644
--- a/models/database.py
+++ b/models/database.py
@@ -332,6 +332,15 @@ class Protocol(DatabaseModel):
     def get_wiki_title(self):
         return "Protokoll:{}-{:%Y-%m-%d}".format(
             self.protocoltype.short_name, self.date)
+            
+    def get_dokuwiki_pagetitle(self):
+        """ Uses dokuwiki namespaces in the pagetitle as a standin for a categories 
+
+            The default namespace 'protokoll', is used if protocoltype.wiki_category is empty.
+        """
+        category = self.protocoltype.wiki_category or "protokoll"
+        return "{}:{}-{:%Y-%m-%d}".format(
+            category, self.protocoltype.short_name, self.date)
 
     def get_etherpad_link(self):
         if self.pad_identifier is None:
diff --git a/tasks.py b/tasks.py
index 5cd829b..c139168 100644
--- a/tasks.py
+++ b/tasks.py
@@ -639,7 +639,7 @@ def push_to_dokuwiki_async(protocol_id, content, summary):
         with xmlrpc.client.ServerProxy(config.WIKI_API_URL) as proxy:
             try:
                 if not proxy.wiki.putPage(
-                    protocol.get_wiki_title(), content,
+                    protocol.get_dokuwiki_pagetitle(), content,
                     {"sum":
                         "Automatisch generiert vom Protokollsystem 3."}):
                     return _make_error(
diff --git a/templates/documentation-configuration-types.html b/templates/documentation-configuration-types.html
index aefef37..bf920c7 100644
--- a/templates/documentation-configuration-types.html
+++ b/templates/documentation-configuration-types.html
@@ -61,7 +61,8 @@
 	<p>
 	Zu beachten ist, dass der Anzeigename des Sitzungstyps nur im Protokolltyp angepasst werden kann und im Protokoll ein Teil der Überschrift ist.
 	{% if config.WIKI_ACTIVE %}
-		Je Typ kann angegeben werdem, ob das Protokoll im Status veröffentlicht in das Wiki exportiert werden soll, wobei eien Kategorie anzugeben ist.
+		Je Typ kann angegeben werden, ob das Protokoll im Status veröffentlicht in das Wiki exportiert werden soll, wobei eine Kategorie anzugeben ist.
+		Wenn ein Dokuwiki genutzt wird, wird die Kategorie als <a href="https://www.dokuwiki.org/de:namespaces">Namensraum</a> verwendet (default Kategorie ist "Protokoll").
 	{% endif %}
 	{% if config.PRINTING_ACTIVE %}
 		Auch kann der Standarddrucker festgelegt werden, der für den Protokolltyp genutzt werden soll.
-- 
GitLab