From 661172e6ce30235851fdee0736df0e532e997bd4 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 12 Feb 2021 19:31:27 +0200 Subject: the files show but there are still things to fix --- loggedin.js | 1 + php/database.php | 3 ++- php/readdir.php | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/loggedin.js b/loggedin.js index 68564fb..08ca296 100644 --- a/loggedin.js +++ b/loggedin.js @@ -105,6 +105,7 @@ function load_dir() { f.visuals.remove(); files = []; + alert(this.responseText); var json = JSON.parse(this.responseText); for (const f of json) { add_file_visuals(f.name, f.is_directory, f.mimetype); diff --git a/php/database.php b/php/database.php index 98946ce..fb3d35d 100644 --- a/php/database.php +++ b/php/database.php @@ -118,7 +118,8 @@ require_once "node.php"; node_links.name as name, node_links.note as note, nodes.is_directory as is_directory, - nodes.code as code + nodes.code as code, + nodes.type as mimetype from node_links inner join nodes on nodes.node_id=node_links.node_id diff --git a/php/readdir.php b/php/readdir.php index b913cb1..e46d4ad 100644 --- a/php/readdir.php +++ b/php/readdir.php @@ -4,6 +4,7 @@ $user=$_SESSION["user_object"]; //echo '[ { "name": "file1.txt", "mimetype": "text/plain", "is_directory": false }, { "name": "file2.pdf", "mimetype": "application/pdf", "is_directory": false }, { "name": "dir", "mimetype": "", "is_directory": true } ] '; - echo get_directory("/",$user); - error_log(print_r(get_directory("/",$user)).gettype(get_directory("/",$user))); + $ret=get_directory("/",$user); + $json=json_encode($ret); + echo $json; ?> -- cgit v1.2.3