From 6eb381431aa0fff4a000ed23b8014e0ccb255324 Mon Sep 17 00:00:00 2001
From: Beaumont Mogridge <mogridgeb@cardiff.ac.uk>
Date: Tue, 6 Dec 2022 09:51:59 +0000
Subject: [PATCH] adding files

---
 main.py                  |  6 +++---
 static/spaces.js         | 17 +++++++++++++++++
 static/testSearch.html   |  2 +-
 templates/OurSpaces.html |  6 +++---
 templates/Space.html     |  4 +++-
 5 files changed, 27 insertions(+), 8 deletions(-)
 create mode 100644 static/spaces.js

diff --git a/main.py b/main.py
index 58fd4f5..b7cffb6 100644
--- a/main.py
+++ b/main.py
@@ -11,7 +11,7 @@ def Load():
 			Name = "CodeBase";
 			conn = sqlite3.connect(DATABASE)
 			cur = conn.cursor()
-			cur.execute("SELECT * FROM coworking_spaces WHERE Name = 'CodeBase';")
+			cur.execute("SELECT * FROM 'coworking_spaces' WHERE Name =?;", [Name])
 			data = cur.fetchall()
 			print(data)
 		#	cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name])
@@ -26,9 +26,9 @@ def Load():
 		#	Website = cur.fetchall()
 		#	cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name])
 		#	Opening_Hours = cur.fetchall()
-			return render_template('Space.html', data = data)
-			return str(data)
 			conn.close()
+			return render_template('Space.html', data = data)
+
 
 
 
diff --git a/static/spaces.js b/static/spaces.js
new file mode 100644
index 0000000..1c95d0b
--- /dev/null
+++ b/static/spaces.js
@@ -0,0 +1,17 @@
+function loadSpaceInfo() {
+  var xhttp = new XMLHttpRequest();
+  xhttp.open("PUT", '/Load/CodeBase', true);
+  xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+  xhttp.onreadystatechange = function() {
+    if (xhttp.readyState === 4 && xhttp.status === 200) {
+      console.log(xhttp.responseText);
+      // Below is the message to output onto the workspace page,
+
+      document.getElementById("loadText").innerHTML = xhttp.responseText;
+    } else {
+//      console.error(`Status Text: ${xhttp.statusText}.`);
+//      console.error(`Ready State: ${xhttp.readyState}.`);
+    }
+  };
+  xhttp.send();
+}
diff --git a/static/testSearch.html b/static/testSearch.html
index 1e51c29..c650c95 100644
--- a/static/testSearch.html
+++ b/static/testSearch.html
@@ -8,4 +8,4 @@
 
   <li><a href="/Load/CodeBase">view CodeBase</a></li>
 
-</head
+</header>
diff --git a/templates/OurSpaces.html b/templates/OurSpaces.html
index 218f8d2..8dced38 100644
--- a/templates/OurSpaces.html
+++ b/templates/OurSpaces.html
@@ -1,4 +1,4 @@
-<head>
+		<head>
 	<link rel="stylesheet" href="framework.css">
 </head>
 
@@ -27,11 +27,11 @@
 </div>
 
 <div class="Image box">
-<img scr= {% block imageBlock%} {%endblock%}>
+{% block imageBlock%}<img scr=  >{%endblock%}
 </div>
 
 <div class="AddImage box">
-<img scr="{% block addimageBlock%} {%endblock%}">
+{% block addimageBlock%}<img scr=" ">{%endblock%}
 </div>
 
 <div class="times box">
diff --git a/templates/Space.html b/templates/Space.html
index 62c2459..6714b6a 100644
--- a/templates/Space.html
+++ b/templates/Space.html
@@ -4,9 +4,11 @@
   <h1 id="name"></h1><br>
   <td>data</td>
   <img src= Main_Photo><br>
-<<script type="text/javascript">
+<script type="text/javascript">
   document.getElementById("name").innerHTML= data;
 </script>
+<script defer src+"Space.js"></script>
+<p id="loadText">temp text</p>
 <table border = 1>
    <thead>
       <td>Name</td>
-- 
GitLab