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

Merge branch 'development' into...

Merge branch 'development' into '13-as-a-moderator-i-want-to-be-able-to-amend-and-remove-existing-locations-spaces-features'

# Conflicts:
#   project_server.py
parents ac6fc809 5d4d64c8
No related branches found
No related tags found
2 merge requests!45Resolve "As a moderator, I want to be able to amend (and remove) existing locations/spaces/features.",!44Updating functions.
......@@ -17,6 +17,14 @@ def connect_db(db_file=DATABASE):
print("Error connecting to database.")
return conn
@app.route("/", methods=['GET'])
def returnIndex():
return render_template("test.html")
@app.route("/Manage_Coworking_Spaces", methods=['GET'])
def returnManageCoworkingSpaces():
return render_template("Manage_Coworking_Spaces.html")
@app.route("/SearchRecord", methods=['POST'])
def searchRecord():
......
header{
background-color: black;
display: block;
color: black;
margin-left: auto;
margin-right: inherit;
width: 100%;
height: 75%;
}
.card{
margin: 0 auto;
float: none;
margin-bottom: 10px;
}
#logo{
width: 10%;
}
body{
font-family: 'Sora', sans-serif;
background-color: #212529;
color: white;
<<<<<<< HEAD
}
=======
}
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
......@@ -145,7 +145,7 @@ function deleteRecord(e) {
// Creating a form data-type to transfer multiple parameters to the server.
var params = 'recordName='+recordName;
var xhttp = new XMLHttpRequest();
xhttp.open("POST", '/DeleteRecord', true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
......
<!DOCTYPE html>
<html lang="EN" dir="ltr">
<head>
<meta charSet="UTF-8">
<title> Manage Coworking Spaces </title>
<link rel="stylesheet" href="CSS/Manage_Coworking_Spaces.css">
</head>
<body onLoad="pageLoad()">
<header id="pageHeader" class="pageHeader">
<div id="headerDiv">
<a href="Manage_Coworking_Spaces.html">
<img id="headerImg" class="headerImg"
src="Media/Tramshed-Logo-Main-Black.png"></img></a>
<a id="headerText" class="headerText"
href="Manage_Coworking_Spaces.html">
Manage Coworking Spaces</a>
</div>
<nav id="headerNav" class="navBar">
<ul class="Left">
<li><a href="Manage_Coworking_Spaces.html">
<img id="navImg" class="navImg"
src="Media/Tramshed-Logo-Main-White.png"></img></a></li>
<li><a href="Manage_Coworking_Spaces.html">Home</a></li>
<li><a href="Manage_Coworking_Spaces.html">Locations</a></li>
</ul>
<ul class="Right">
<li><a href="Manage_Coworking_Spaces.html">Manage</a></li>
<li><a href="Manage_Coworking_Spaces.html">Login</a></li>
<li><div class="navHamburger">
<span></span>
<span></span>
<span></span>
</div></li>
</ul>
</nav>
</header>
<main id="pageMain">
<form id="recordForm" title="Record Form">
<label>Name: <input id="recordName" class="formTextInput"
name="record_name" type="text"></label><br>
<label>Address: <input id="recordAddress" class="formTextInput"
name="record_address" type="text"></label><br>
<label>Main Photograph: <input id="recordMainPhotos" class="formTextInput"
name="record_MP" type="text"></label><br>
<label>Additional Photographs: <input id="recordAdditionalPhotos" class="formTextInput"
name="record_AP" type="text"></label><br>
<label>Description: <input id="recordDescription" class="formTextInput"
name="record_description" type="text"></label><br>
<label>Website: <input id="recordWebsite" class="formTextInput"
name="record_website" type="text"></label><br>
<label>Email: <input id="recordEmail" class="formTextInput"
name="record_email" type="text"></label><br>
<label>Phone Number: <input id="recordPhoneNumber" class="formTextInput"
name="record_PN" type="text"></label><br>
<label>Opening Hours: <input id="recordOpeningHours" class="formTextInput"
name="record_OH" type="text"></label><br>
<label>Checkin Instructions: <input id="recordCheckinInstructions" class="formTextInput"
name="record_CI" type="text"></label>
<br><br>
<button id="searchButton" type="submit">Search</button>
<button id="addButton" type="submit">Add</button>
<button id="editButton" type="submit">Edit</button>
<button id="deleteButton" type="submit">Delete</button>
</form>
<br>
<span id="DEBUGserverMessage"> </span>
<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>
</main>
<footer id="pageFooter">
<nav id="footerNav" class="navBar">
<ul class="Center">
<li><a href="Manage_Coworking_Spaces.html">Left</a></li>
</ul>
<ul class="Center">
<li><a href="Manage_Coworking_Spaces.html">Center</a></li>
</ul>
<ul class="Center">
<li><a href="Manage_Coworking_Spaces.html">Right</a></li>
</ul>
</nav>
</footer>
<script src="JS/Manage_Coworking_Spaces.js"></script>
</body>
</html>
static/Media/logo.png

22.5 KiB

......@@ -12,7 +12,7 @@
<a class="nav-link" href="locations.html">Coworking locations</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Manage_Coworking_Spaces.html">Manage locations</a>
<a class="nav-link" href="/Manage_Coworking_Spaces">Manage locations</a>
</li>
</ul>
</div>
......@@ -31,7 +31,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="landingstyle.css">
<link rel="stylesheet" href="CSS/landingstyle.css">
<title>Tramshed Tech</title>
<img id="tramshed" src="Media/tramshed.jpg">
<div class="bg-dark p-3">
......
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<header class="masthead bg-dark text-white text-center">
<div class="container-fluid">
<img id="logo" src="Media/logo.png"/>
<h1 id="header">Tramshed Tech</h1>
</div>
</header>
<body>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="CSS/loginstyle.css">
<title>Login</title>
<div id="card" class="card text-dark w-25 text-center">
<div class="card-body text-center">
<form>
<!-- Email input -->
<div class="form-outline mb-4">
<<<<<<< HEAD
<input type="email" id="recordEmail" class="form-control" />
=======
<input type="email" id="form2Example1" class="form-control" />
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
<label class="form-label" for="form2Example1">Email address</label>
</div>
<!-- Password input -->
<div class="form-outline mb-4">
<<<<<<< HEAD
<input type="password" id="recordPassword" class="form-control" />
=======
<input type="password" id="form2Example2" class="form-control" />
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
<label class="form-label" for="form2Example2">Password</label>
</div>
<!-- 2 column grid layout for inline styling -->
<div class="row mb-4">
<div class="col d-flex justify-content-center">
<!-- Checkbox -->
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="form2Example31" checked />
<label class="form-check-label" for="form2Example31"> Remember me </label>
</div>
</div>
<div class="col">
<!-- Simple link -->
<a href="#!">Forgot password?</a>
</div>
<!-- Submit button -->
<button onclick="window.location.href='landingpage.html';" type="button" class="btn btn-light">
<span class="spinner-grow spinner-grow-sm"></span>
Sign in
</button>
<!-- Register buttons -->
<div class="text-center">
<p>Not a member? <a href="#!">Register</a></p>
</form>
</body>
<<<<<<< HEAD
</html>
=======
</html>
>>>>>>> 9c7255d510762a8f16afeba2657cad4a0f8b8239
{%extends "base_template.html"%}
{%block headblock%}
<title> Manage Coworking Spaces </title>
<link rel="stylesheet" href="/static/CSS/Manage_Coworking_Spaces.css">
{%endblock%}
{%block onLoadblock%}
pageLoad()
{%endblock%}
{%block headerblock%}
<div id="headerDiv">
<a href="Manage_Coworking_Spaces.html">
<img id="headerImg" class="headerImg"
src="/static/Media/Tramshed-Logo-Main-Black.png"></img></a>
<a id="headerText" class="headerText"
href="Manage_Coworking_Spaces">
Manage Coworking Spaces</a>
</div>
<nav id="headerNav" class="navBar">
<ul class="Left">
<li><a href="Manage_Coworking_Spaces">Home</a></li>
<li><a href="Locations">Locations</a></li>
</ul>
<ul class="Right">
<li><a href="Manage_Coworking_Spaces">Manage</a></li>
<li><a href="Manage_Coworking_Spaces">Login</a></li>
<li><div class="navHamburger">
<span></span>
<span></span>
<span></span>
</div></li>
</ul>
</nav>
{%endblock%}
{%block mainblock%}
<form id="recordForm" title="Record Form">
<label>Name: <input id="recordName" class="formTextInput"
name="record_name" type="text"></label><br>
<label>Address: <input id="recordAddress" class="formTextInput"
name="record_address" type="text"></label><br>
<label>Main Photograph: <input id="recordMainPhotos" class="formTextInput"
name="record_MP" type="text"></label><br>
<label>Additional Photographs: <input id="recordAdditionalPhotos" class="formTextInput"
name="record_AP" type="text"></label><br>
<label>Description: <input id="recordDescription" class="formTextInput"
name="record_description" type="text"></label><br>
<label>Website: <input id="recordWebsite" class="formTextInput"
name="record_website" type="text"></label><br>
<label>Email: <input id="recordEmail" class="formTextInput"
name="record_email" type="text"></label><br>
<label>Phone Number: <input id="recordPhoneNumber" class="formTextInput"
name="record_PN" type="text"></label><br>
<label>Opening Hours: <input id="recordOpeningHours" class="formTextInput"
name="record_OH" type="text"></label><br>
<label>Checkin Instructions: <input id="recordCheckinInstructions" class="formTextInput"
name="record_CI" type="text"></label>
<br><br>
<button id="searchButton" type="submit">Search</button>
<button id="addButton" type="submit">Add</button>
<button id="editButton" type="submit">Edit</button>
<button id="deleteButton" type="submit">Delete</button>
</form>
<br>
<span id="DEBUGserverMessage"> </span>
<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>
{%endblock%}
{%block footerblock%}
<nav id="footerNav" class="navBar">
<ul class="Center">
<li><a href="Manage_Coworking_Spaces.html">Left</a></li>
</ul>
<ul class="Center">
<li><a href="Manage_Coworking_Spaces.html">Center</a></li>
</ul>
<ul class="Center">
<li><a href="Manage_Coworking_Spaces.html">Right</a></li>
</ul>
</nav>
{%endblock%}
{%block jsblock%}
/static/JS/Manage_Coworking_Spaces.js
{%endblock%}
<!DOCTYPE html>
<html lang="EN" dir="ltr">
<head>
<meta charSet="UTF-8">
{%block headblock%}
{%endblock%}
</head>
<body onLoad="{%block onLoadblock%}{%endblock%}">
<header id="pageHeader" class="pageHeader">
{%block headerblock%}
{%endblock%}
</header>
<main id="pageMain">
{%block mainblock%}
{%endblock%}
</main>
<footer id="pageFooter">
{%block footerblock%}
{%endblock%}
</footer>
<script src="{%block jsblock%}{%endblock%}"></script>
</body>
</html>
{%extends "base_template.html"%}
{%block mainblock%}
test
{%endblock%}
import os
import sqlite3
from flask import Flask, redirect, request, render_template, jsonify
app = Flask(__name__)
DATABASE = "login.db"
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
@app.route("/SearchRecord", methods=['POST'])
def searchRecord():
if request.method =='POST':
try:
recordEmail = request.form.get('recordEmail', default="Error")
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
cur.execute("SELECT * FROM login WHERE Email=?;", [recordEmail])
recordData = cur.fetchall()
except:
print(f"Error: {recordData}")
conn.close()
finally:
conn.close()
print(f"{str(recordData)} Record found.")
return str(recordData)
@app.route("/AddRecord", methods=['POST'])
def addRecord():
if (request.method == 'POST'):
recordEmail = request.form['recordEmail']
recordPassword = request.form['recordPassword']
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
cur.execute("INSERT INTO login ('Email', 'Password')\
VALUES (?,?)", (recordEmail, recordPassword))
conn.commit()
conn.close()
infoMessage = (f'{recordData} Record added.')
print(infoMessage)
return (infoMessage)
if __name__ == "__main__":
app.run(debug=True)
\ No newline at end of file
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