Skip to content
Snippets Groups Projects
Commit a6f51012 authored by Liam Driscoll's avatar Liam Driscoll
Browse files

Merge branch '24-hotfix-development-directory' into 'development'

Tidying up directory.

Closes #24

See merge request !49
parents ed8ad830 944b5a69
No related branches found
No related tags found
1 merge request!49Tidying up directory.
DELETE FROM 'coworking_spaces' WHERE Name = 'Name';
--DROP TABLE IF EXISTS coworking_spaces;
--CREATE TABLE IF NOT EXISTS 'coworking_spaces' (
--`Name` TEXT NOT NULL,
--`Address` TEXT NOT NULL,
--`Main_Photo` TEXT NOT NULL,
--`Additional_photos` TEXT NOT NULL,
--`Description` TEXT NOT NULL,
--`Website` TEXT NOT NULL,
--`Email` TEXT NOT NULL,
--`Phone_Number` TEXT NOT NULL,
--`Opening_Hours` TEXT NOT NULL,
--`Checkin_Instructions` TEXT NOT NULL,
--);
--INSERT INTO 'coworking_spaces'('Name','Address', 'Main_Photo', 'Additional_photos','Description','Website','Email','Phone_Number','Opening_Hours','Checkin_Instructions') VALUES ('Codebase CodeBase Edinburgh' , '37a Castle Terrace, Edinburgh, EH1 2EL ', 'https://images.squarespace-cdn.com/content/v1/55439320e4b0f92b5d6c4c8b/1646867535415-4JI39H286BUMT26H4FHN/C36A1915.jpg?format=2500w',' https://images.squarespace-cdn.com/content/v1/55439320e4b0f92b5d6c4c8b/1646868533510-J1OT4PEG5VM9FCBF8BJE/15.10.19_-_CREATIVE_BRIDGE_C02_-_DAY01_-_LQ-19+%281%29.jpg?format=2500w','https://images.squarespace-cdn.com/content/v1/55439320e4b0f92b5d6c4c8b/1646868421127-07KQ4N1OHTDDKQME686A/15.10.19_-_CREATIVE_BRIDGE_C02_-_DAY01_-_LQ-52+%281%29.jpg?format=2500w', 'Hi. We’re CodeBase. We've been exploring the world of startups and innovation for over five years now. We're not really sure how to best describe what we do, but we think the words "tech cluster" probably do it best. Please get in touch! We’re friendly people who are geeky about building tech startups, managing disruption and innovation.', 'https://www.thisiscodebase.com','info@thisiscodebase.com','(+44) 0131 560 2003', '08:00 - 17:00',' Use the email address or phone number to call ahead and book a desk, let them know you're a Tramshed member');
File deleted
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="C:/Users/c21070842/OneDrive - Cardiff University/Desktop/tramshed-tech-client-project-team-15/db.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="1"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="150"/><column_width id="3" width="2218"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><current_table name="4,16:maincoworking_spaces"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="coworking_spaces" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_"><sort/><column_widths><column index="1" value="139"/><column index="2" value="300"/><column index="3" value="300"/><column index="4" value="300"/><column index="5" value="300"/><column index="6" value="299"/><column index="7" value="265"/><column index="8" value="199"/><column index="9" value="169"/><column index="10" value="300"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table></browse_table_settings></tab_browse><tab_sql><sql name="SQL 1">DELETE FROM coworking_spaces WHERE Name = 'Name';
</sql><current_tab id="0"/></tab_sql></sqlb_project>
body{
background-color: white;
color: black;
}
header{
background-color: white;
color: black;
display: block;
margin-left: auto;
margin-right: auto;
float: center;
}
from flask import Flask, request, render_template, redirect
import sqlite3
app = Flask(__name__)
DATABASE = "db.db"
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
@app.route("/Load/CodeBase")
def Load():
Name = "Codebase";
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
print(Name)
# getAddress(Name)
cur.execute("SELECT * FROM 'coworking_spaces' WHERE Name =?;", [Name])
data = cur.fetchall()
print(data)
# cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name])
# Address = cur.fetchall()
# print(Address)
# cur.execute("SELECT Main_Photo FROM coworking_spaces WHERE Name =? ;", [Name])
# Main_Photo = cur.fetchall()
# print(Main_Photo)
# cur.execute("SELECT Additional_photos FROM coworking_spaces WHERE Name =? ;", [Name])
# Additional_photos = cur.fetchall()
# print(Additional_photos)
# cur.execute("SELECT Description FROM coworking_spaces WHERE Name =? ;", [Name])
# Description = cur.fetchall()
# print(Description)
# cur.execute("SELECT Website FROM coworking_spaces WHERE Name =? ;", [Name])
# Website = cur.fetchall()
# print(Website)
# cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name])
# Opening_Hours = cur.fetchall()
# print(Opening_Hours)
conn.close()
return render_template('Space.html', data = data)
# pageAddress = Address, pageMain_Photo = Main_Photo, pageAdditional_photos = Additional_photos, pageDescription = Description, pageWebsite = Website, pageOpening_Hours = Opening_Hours )
if __name__ == "__main__":
app.run(debug=True)
...@@ -27,6 +27,39 @@ def returnManageCoworkingSpaces(): ...@@ -27,6 +27,39 @@ def returnManageCoworkingSpaces():
if (request.method == 'GET'): if (request.method == 'GET'):
return render_template("Manage_Coworking_Spaces.html") return render_template("Manage_Coworking_Spaces.html")
@app.route("/Load/CodeBase")
def Load():
Name = "Codebase";
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
print(Name)
# getAddress(Name)
cur.execute("SELECT * FROM 'coworking_spaces' WHERE Name =?;", [Name])
data = cur.fetchall()
print(data)
# cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name])
# Address = cur.fetchall()
# print(Address)
# cur.execute("SELECT Main_Photo FROM coworking_spaces WHERE Name =? ;", [Name])
# Main_Photo = cur.fetchall()
# print(Main_Photo)
# cur.execute("SELECT Additional_photos FROM coworking_spaces WHERE Name =? ;", [Name])
# Additional_photos = cur.fetchall()
# print(Additional_photos)
# cur.execute("SELECT Description FROM coworking_spaces WHERE Name =? ;", [Name])
# Description = cur.fetchall()
# print(Description)
# cur.execute("SELECT Website FROM coworking_spaces WHERE Name =? ;", [Name])
# Website = cur.fetchall()
# print(Website)
# cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name])
# Opening_Hours = cur.fetchall()
# print(Opening_Hours)
conn.close()
return render_template('Space.html', data = data)
# pageAddress = Address, pageMain_Photo = Main_Photo, pageAdditional_photos = Additional_photos, pageDescription = Description, pageWebsite = Website, pageOpening_Hours = Opening_Hours )
@app.route("/SearchRecord", methods=['POST', 'GET']) @app.route("/SearchRecord", methods=['POST', 'GET'])
def searchRecord(): def searchRecord():
......
function SpacesLoad() {
document.getElementById('nextButton').addEventListener('click',loadValidatedQuestion);
}
// Loads an validated question when called.
function loadpaceInfo() {
var xhttp = new XMLHttpRequest();
xhttp.open("PUT", '/LoadValidatedQuestion', 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 Question Validation page,
// after it has been approved or rejected by a moderator.
document.getElementById("quizText").innerHTML = xhttp.responseText;
} else {
// console.error(`Status Text: ${xhttp.statusText}.`);
// console.error(`Ready State: ${xhttp.readyState}.`);
}
};
xhttp.send();
}
// Function to call multiple functions.
function quizLoad() {
onQuizPageLoad();
loadValidatedQuestion();
}
function submitAnswer(e) {
// Removes the standard form processing.
e.preventDefault();
e.stopPropagation();
var quizText = document.getElementById("quizText").textContent;
var quizAnswer = document.forms["quizForm"]["quizAnswer"].value;
params = 'quizText='+quizText+'&quizAnswer='+quizAnswer;
var xhttp = new XMLHttpRequest();
xhttp.open("POST", '/SubmitAnswer', 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 Question Validation page,
// after it has been approved or rejected by a moderator.
document.getElementById("DEBUGserverMessage").innerHTML = xhttp.responseText;
loadValidatedQuestion()
} else {
// console.error(`Status Text: ${xhttp.statusText}.`);
// console.error(`Ready State: ${xhttp.readyState}.`);
}
};
xhttp.send(params);
}
<head>
<link rel="stylesheet" href="framework.css">
</head>
<body class="body">
<header>
<li><a href="/Load/CodeBase">view CodeBase</a></li>
</header>
{%extends "base_template.html"%}
{%block mainblock%}
test
{%endblock%}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment