diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py
index 89b7ad5d..d415ae71 100644
--- a/app/classes/shared/helpers.py
+++ b/app/classes/shared/helpers.py
@@ -454,6 +454,18 @@ class Helpers:
return data
+ @staticmethod
+ def generate_tree(folder, html=""):
+ for filename in os.listdir(folder):
+ print(filename)
+ rel = os.path.join(folder, filename)
+ if os.path.isdir(rel):
+ html += '
\n{}\n'.format(filename)
+ html += helper.generate_tree(rel)
+ html += '
'
+ else:
+ html += '{}'.format(filename)
+ return html
helper = Helpers()
diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py
index fcf5c192..d9ca5408 100644
--- a/app/classes/web/panel_handler.py
+++ b/app/classes/web/panel_handler.py
@@ -62,8 +62,23 @@ class PanelHandler(BaseHandler):
elif page == 'file_edit':
template = "panel/file_edit.html"
- elif page == 'files_menu':
- template = "panel/files_menu.html"
+ elif page == 'files':
+ server_id = self.get_argument('id', None)
+
+ if server_id is None:
+ self.redirect("/panel/error?error=Invalid Server ID")
+ return False
+ else:
+ server_id = bleach.clean(server_id)
+
+ # does this server id exist?
+ if not db_helper.server_id_exists(server_id):
+ self.redirect("/panel/error?error=Invalid Server ID")
+ return False
+
+ page_data['tree_html'] = helper.generate_tree(db_helper.get_server_data_by_id(server_id)['path'])
+
+ template = "panel/files.html"
elif page == "remove_server":
server_id = self.get_argument('id', None)
diff --git a/app/frontend/templates/main_menu.html b/app/frontend/templates/main_menu.html
index 8e6b6d97..3745a667 100644
--- a/app/frontend/templates/main_menu.html
+++ b/app/frontend/templates/main_menu.html
@@ -64,6 +64,14 @@
{% end %}
+
+
diff --git a/app/frontend/templates/panel/files_menu.html b/app/frontend/templates/panel/files.html
similarity index 74%
rename from app/frontend/templates/panel/files_menu.html
rename to app/frontend/templates/panel/files.html
index 0f883903..1d8e18b8 100644
--- a/app/frontend/templates/panel/files_menu.html
+++ b/app/frontend/templates/panel/files.html
@@ -27,7 +27,68 @@
-
+
+
+
+ -
+ Files
+
+ {{ data['tree_html'] }}
+
+
+
+
+
+
+
+
+
+
+
+
+ --a>
-
+ -->