]> git.ipfire.org Git - ipfire.org.git/commitdiff
docs: Move file listing handler
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jul 2023 10:51:07 +0000 (10:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jul 2023 10:51:07 +0000 (10:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/docs/files/index.html [moved from src/templates/wiki/files/index.html with 100% similarity]
src/web/__init__.py
src/web/docs.py
src/web/wiki.py

index 5c45458eee7b1118c49efec8b7f0974b34c90f8e..8fd73cabda513193bfc41b12a365bdde02e50d4c 100644 (file)
@@ -214,7 +214,8 @@ templates_docs_DATA = \
 templates_docsdir = $(templatesdir)/docs
 
 templates_docs_files_DATA = \
-       src/templates/docs/files/detail.html
+       src/templates/docs/files/detail.html \
+       src/templates/docs/files/index.html
 
 templates_docs_filesdir = $(templates_docsdir)/files
 
@@ -350,11 +351,6 @@ templates_voip_modulesdir = $(templates_voipdir)/modules
 
 templates_wikidir = $(templatesdir)/wiki
 
-templates_wiki_files_DATA = \
-       src/templates/wiki/files/index.html
-
-templates_wiki_filesdir = $(templates_wikidir)/files
-
 templates_wiki_messages_DATA = \
        src/templates/wiki/messages/page-changed.txt
 
index 4e50a2c3c71542bb759e5f1265435a404947a466..81733e4e89afa481e13c159837f358194ffbef2f 100644 (file)
@@ -151,6 +151,7 @@ class Application(tornado.web.Application):
                        (r"/docs/([A-Za-z0-9\-_\/]+)?/_(watch|unwatch)", docs.WatchHandler),
                        (r"/docs/((?:[A-Za-z0-9\-_\/]+)?(?:.*)\.(?:\w+))/_delete", docs.DeleteFileHandler),
                        (r"/docs((?:[A-Za-z0-9\-_\/]+)?(?:.*)\.(?:\w+))$", docs.FileHandler),
+                       (r"/docs([A-Za-z0-9\-_\/]+)?/_files", docs.FilesHandler),
                        (r"/docs([A-Za-z0-9\-_\/]+)?", docs.PageHandler),
 
                        # Downloads
@@ -353,9 +354,6 @@ class Application(tornado.web.Application):
                        (r"/actions/restore", wiki.ActionRestoreHandler),
                        (r"/actions/upload", wiki.ActionUploadHandler),
 
-                       # Media
-                       (r"([A-Za-z0-9\-_\/]+)?/_files", wiki.FilesHandler),
-
                        # Serve any static files
                        (r"/static/(.*)", tornado.web.StaticFileHandler, { "path" : self.settings.get("static_path") }),
 
index 27f89281883f8b81b40325b94b22410efa9a056a..e3f684753721d0af7f83a15ea031ed6bd30a5d45 100644 (file)
@@ -89,6 +89,21 @@ class PageHandler(base.BaseHandler):
                self.render("docs/page.html", page=page, latest_revision=latest_revision)
 
 
+class FilesHandler(base.BaseHandler):
+       @tornado.web.authenticated
+       def get(self, path):
+               if path is None:
+                       path = "/"
+
+               # Check permissions
+               if not self.backend.wiki.check_acl(path, self.current_user):
+                       raise tornado.web.HTTPError(403, "Access to %s not allowed for %s" % (path, self.current_user))
+
+               files = self.backend.wiki.get_files(path)
+
+               self.render("docs/files/index.html", path=path, files=files)
+
+
 class FileHandler(base.BaseHandler):
        @property
        def action(self):
index ba914ba12a23764f9e5caffc6f922b0702f23aed..8d6faad070b2223a91b12bb160fa6d1c06dfc988 100644 (file)
@@ -62,21 +62,6 @@ class ActionRestoreHandler(base.BaseHandler):
                self.redirect(page.page)
 
 
-class FilesHandler(base.BaseHandler):
-       @tornado.web.authenticated
-       def get(self, path):
-               if path is None:
-                       path = "/"
-
-               # Check permissions
-               if not self.backend.wiki.check_acl(path, self.current_user):
-                       raise tornado.web.HTTPError(403, "Access to %s not allowed for %s" % (path, self.current_user))
-
-               files = self.backend.wiki.get_files(path)
-
-               self.render("wiki/files/index.html", path=path, files=files)
-
-
 class WikiListModule(ui_modules.UIModule):
        def render(self, pages, link_revision=False, show_breadcrumbs=True,
                        show_author=True, show_changes=False):