diff --git a/project_server.py b/project_server.py index af115bce1e4207ef4c5ad703820af8d3cdc7cdc2..0b8c9b01d17918636d95ffe2bdb9f0db766db18d 100644 --- a/project_server.py +++ b/project_server.py @@ -1,8 +1,9 @@ import os -import csv +import sqlite3 from flask import Flask, redirect, request, render_template, jsonify app = Flask(__name__) +DATABASE = "project_db.db" ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) @@ -26,10 +27,12 @@ def addRecord(): recordCheckinInstructions = request.form['recordCheckinInstructions'] recordData = [recordName, recordAddress, recordMainPhotos, recordAdditionalPhotos, recordDescription, recordWebsite, recordEmail, recordPhoneNumber, recordOpeningHours, recordCheckinInstructions] - with open('coworking_spaces.csv', 'a') as addToFile: - csvWriter = csv.writer(addToFile) - csvWriter.writerow(recordData) - addToFile.close() + conn = sqlite3.connect(DATABASE) + cur = conn.cursor() + cur.execute("INSERT INTO coworking_spaces ('Name', 'Address', 'Main_Photo', 'Additional_Photos', 'Description', 'Website', 'Email', 'Phone_Number', 'Opening_Hours', 'Checkin_Instructions')\ + VALUES (?,?,?,?,?,?,?,?,?,?)", (recordName, recordAddress, recordMainPhotos, recordAdditionalPhotos, recordDescription, recordWebsite, recordEmail, recordPhoneNumber, recordOpeningHours, recordCheckinInstructions)) + conn.commit() + conn.close() infoMessage = (f'{recordData} Record added.') diff --git a/static/Manage_Coworking_Spaces.css b/static/Manage_Coworking_Spaces.css index 45f7b3fc7235e7db8221659b381317165b18d223..b9b1e4a439d856607d7bba1fe3a0af72c13b3a42 100644 --- a/static/Manage_Coworking_Spaces.css +++ b/static/Manage_Coworking_Spaces.css @@ -47,25 +47,42 @@ a { /* [#1] Page header styling. Uses [#2]. header #pageHeader - main #headerMain + div #headerDiv nav #headerNav .navBar ul .Right, ul .Left li a */ -#headerMain { +#headerDiv { text-align: center; background-color: white; padding: 20px 0px; + display: flex; + align-items: center; + justify-content: flex-start; } -#headerMain a { +#headerDiv a { font-size: 30px; font-weight: bold; color: black; } +#headerText { + width: 100%; + margin-left: -220px; +} + +#headerImg { + width: 180px; + height: 65px; + margin-top: -10px; + margin-right: 20px; + margin-bottom: -17.5px; + margin-left: 20px; +} + #headerNav { width: 100%; position: absolute; @@ -76,6 +93,11 @@ header #pageHeader padding: 7.5px 10px; } +#headerNav img { + width: 55px; + height: 20px; +} + /* [#2] Page navigation styling. Used in [#1] and [#4]. */ .navBar { @@ -101,15 +123,27 @@ header #pageHeader /* [#3] Page main styling. main #pageMain + form #recordForm + label + input .formTextInput + button #addButton */ #pageMain {} +#recordForm { + margin-left: 5px; +} + +#recordForm .formTextInput { + margin-top: 5px; + width: 50%; +} + /* [#4] Page footer styling. Uses [#2]. footer #pageFooter - main #footerMain nav #footerNav .navBar ul .Center li a diff --git a/static/Manage_Coworking_Spaces.html b/static/Manage_Coworking_Spaces.html index 52f9ea310c31e22ce615946a554b14cccfe092e3..b75f594479ff9ae3ef051a4da1da84380c07387b 100644 --- a/static/Manage_Coworking_Spaces.html +++ b/static/Manage_Coworking_Spaces.html @@ -9,12 +9,19 @@ <body onLoad="pageLoad()"> <header id="pageHeader" class="pageHeader"> - <main id="headerMain"> - <a href="Manage_Coworking_Spaces.html">Manage Coworking Spaces</a> - </main> + <div id="headerDiv"> + <a href="Manage_Coworking_Spaces.html"> + <img id="headerImg" class="headerImg" + src="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">Home</a></li> + <li><a href="Manage_Coworking_Spaces.html"> + <img id="navImg" class="navImg" + src="Tramshed-Logo-Main-White.png"></img></a></li> <li><a href="Manage_Coworking_Spaces.html">Left</a></li> <li><a href="Manage_Coworking_Spaces.html">Home</a></li> <li><a href="Manage_Coworking_Spaces.html">Left</a></li> @@ -31,29 +38,28 @@ </nav> </header> - <main id="recordSection"> - <br> + <main id="pageMain"> <form id="recordForm" title="Record Form"> - <label>Name: <input name="record_name" id="recordName" - type="text"></label><br> - <label>Address: <input name="record_address" id="recordAddress" - type="text"></label><br> - <label>Main Photograph: <input name="record_MP" id="recordMainPhotos" - type="text"></label><br> - <label>Additional Photographs: <input name="record_AP" id="recordAdditionalPhotos" - type="text"></label><br> - <label>Description: <input name="record_description" id="recordDescription" - type="text"></label><br> - <label>Website: <input name="record_website" id="recordWebsite" - type="text"></label><br> - <label>Email: <input name="record_email" id="recordEmail" - type="text"></label><br> - <label>Phone Number: <input name="record_PN" id="recordPhoneNumber" - type="text"></label><br> - <label>Opening Hours: <input name="record_OH" id="recordOpeningHours" - type="text"></label><br> - <label>Checkin Instructions: <input name="record_CI" id="recordCheckinInstructions" - type="text"></label> + <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="addButton" type="submit">Add</button> @@ -68,19 +74,17 @@ </main> <footer id="pageFooter"> - <main id="footerMain"> - <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> - </main> + <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="Manage_Coworking_Spaces.js"></script> diff --git a/static/Manage_Coworking_Spaces.js b/static/Manage_Coworking_Spaces.js index cd99c349a737f789d40218bbba02f7717693ef13..b0860b59f5a19e5aaaeeb579c41aa987018fc0a6 100644 --- a/static/Manage_Coworking_Spaces.js +++ b/static/Manage_Coworking_Spaces.js @@ -3,21 +3,20 @@ function onSubmitLoad() { document.getElementById('addButton').addEventListener('click',addRecord); } - function headerLoad() { - let headerMain = document.querySelector('#headerMain'); - let headerMainHeight = headerMain.offsetHeight; + let headerDiv = document.querySelector('#headerDiv'); + let headerDivHeight = headerDiv.offsetHeight; let headerNav = document.querySelector('#headerNav'); let headerNavHeight = headerNav.offsetHeight; - let pageHeaderHeight = headerMainHeight + headerNavHeight; + let pageHeaderHeight = headerDivHeight + headerNavHeight; document.getElementById("pageHeader").style.height = pageHeaderHeight + "px"; } window.onscroll = function() {parallaxNavScroll()}; function parallaxNavScroll() { - let headerMain = document.querySelector('#headerMain'); - let headerHeight = headerMain.offsetHeight; + let headerDiv = document.querySelector('#headerDiv'); + let headerHeight = headerDiv.offsetHeight; if (document.body.scrollTop > headerHeight || document.documentElement.scrollTop > headerHeight) { document.getElementById("headerNav").style.top = "0"; document.getElementById("headerNav").style.position = "fixed"; diff --git a/static/Tramshed-Logo-Main-Black.png b/static/Tramshed-Logo-Main-Black.png new file mode 100644 index 0000000000000000000000000000000000000000..455f7390c61fde648e50fd2a762d15feba6337dd Binary files /dev/null and b/static/Tramshed-Logo-Main-Black.png differ diff --git a/static/Tramshed-Logo-Main-White.png b/static/Tramshed-Logo-Main-White.png new file mode 100644 index 0000000000000000000000000000000000000000..b446f08b72112aef326461887d89437c3eeb901d Binary files /dev/null and b/static/Tramshed-Logo-Main-White.png differ