diff --git a/WorkSpaces.sql b/WorkSpaces.sql new file mode 100644 index 0000000000000000000000000000000000000000..f39b959d2e6c5e95c5327ab851f54c9b46893a60 --- /dev/null +++ b/WorkSpaces.sql @@ -0,0 +1 @@ +DELETE FROM 'coworking_spaces' WHERE Name = 'Name'; diff --git a/db.db b/db.db new file mode 100644 index 0000000000000000000000000000000000000000..5f9d80005cbae66644b07bf7ed1162f834562839 Binary files /dev/null and b/db.db differ diff --git a/db.sqbpro b/db.sqbpro new file mode 100644 index 0000000000000000000000000000000000000000..6e22bb5eea95a2dafb59a2c37a66b45cdb72323a --- /dev/null +++ b/db.sqbpro @@ -0,0 +1,3 @@ +<?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> diff --git a/main.py b/main.py new file mode 100644 index 0000000000000000000000000000000000000000..6eac520462150af4679512574dab9126d633c8f6 --- /dev/null +++ b/main.py @@ -0,0 +1,45 @@ +from flask import Flask, request, render_template, redirect + +import sqlite3 + +DATABASE = "db.db" +ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) + +app = Flask(__name__) +@app.route("/Load/CodeBase", methods = ['GET','POST']) +def Load(): + if request.method =='GET': + return render_template('Space.html') + if request.method =='POST': + try: + Name = "CodeBase"; + conn = sqlite3.connect(DATABASE) + cur = conn.cursor() + document.getElementById("name").innerHTML= Name; + cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name]) + Address = cur.fetch(); + cur.execute("SELECT Main_Photo FROM coworking_spaces WHERE Name =? ;", [Name]) + Main_Photo = cur.fetch(); + cur.execute("SELECT Additional_photos FROM coworking_spaces WHERE Name =? ;", [Name]) + Additional_photos = cur.fetch(); + cur.execute("SELECT Description FROM coworking_spaces WHERE Name =? ;", [Name]) + Description = cur.fetch(); + cur.execute("SELECT Website FROM coworking_spaces WHERE Name =? ;", [Name]) + Website = cur.fetch(); + cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name]) + Opening_Hours = cur.fetch(); + except: + print('error', data) + conn.close() + finally: + conn.close() + return str(data) + + + + + + + +if __name__ == "__main__": + app.run(debug=True) diff --git a/static/testSearch.html b/static/testSearch.html new file mode 100644 index 0000000000000000000000000000000000000000..1e51c2984be75e2ed33b144deace08a2032b0013 --- /dev/null +++ b/static/testSearch.html @@ -0,0 +1,11 @@ +<head> + <link rel="stylesheet" href="framework.css"> +</head> + +<body class="body"> + +<header> + + <li><a href="/Load/CodeBase">view CodeBase</a></li> + +</head diff --git a/templates/OurSpaces.html b/templates/OurSpaces.html new file mode 100644 index 0000000000000000000000000000000000000000..218f8d279a43fe01866badee261002292617f336 --- /dev/null +++ b/templates/OurSpaces.html @@ -0,0 +1,40 @@ +<head> + <link rel="stylesheet" href="framework.css"> +</head> + +<body class="body"> + +<header> + {% block titleBlock%} + <h1> the working space name</h1> + <img src="header.png"/> + {%endblock%} +</header> + +<div class="Address box"> +{% block addressBlock%} +<h2>Address info</h2> +<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d4957.954181608377!2d-2.999839445369478!3d51.58698324808131!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4871e6cc3bd82553%3A0x684c1227f14b4a15!2sNational%20Software%20Academy%20(Cardiff%20University)!5e0!3m2!1sen!2suk!4v1669722978098!5m2!1sen!2suk" + width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> +{%endblock%} +</div> + +<div class="Description box"> + {% block descriptionBlock%} +<h2>About us</h2> +<h3>description</h3> + {%endblock%} +</div> + +<div class="Image box"> +<img scr= {% block imageBlock%} {%endblock%}> +</div> + +<div class="AddImage box"> +<img scr="{% block addimageBlock%} {%endblock%}"> +</div> + +<div class="times box"> +<h2>{% block timeBlock%} times {%endblock%}</h2> +</div> +</body> diff --git a/templates/Space.html b/templates/Space.html new file mode 100644 index 0000000000000000000000000000000000000000..71be495e2909bef0b6b7a366550df337afdaf1a6 --- /dev/null +++ b/templates/Space.html @@ -0,0 +1,36 @@ +{%extends 'OurSpaces.html'%} +<form id='myForm' action='/Load/CodeBase>' method ='post'> + {% block titleBlock%} + <p id="name"></p> + <img src= Main_Photo ><br>"/> + <script> +document.getElementById("name").innerHTML = Name; +</script> + {%endblock%} + + {% block addressBlock%} + <h2><input type = "text" name = "Name"><br></h2> + <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d4957.954181608377!2d-2.999839445369478!3d51.58698324808131!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4871e6cc3bd82553%3A0x684c1227f14b4a15!2sNational%20Software%20Academy%20(Cardiff%20University)!5e0!3m2!1sen!2suk!4v1669722978098!5m2!1sen!2suk" + width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> + {%endblock%} + + {% block descriptionBlock%} +<h2>About us</h2> +<h3><input type = "text" name = "Description"><br></h3> + {%endblock%} + + {% block imageBlock%} + "<input type = "text" name = "Main_Photos">"<br> + {%endblock%} + + {% block addimageBlock%} + "<input type = "text" name = "Additional_photos">"<br> + {%endblock%} + + {% block timeBlock%} <input type = "text" name = "Opening_Hours"> {%endblock%} + +<span id='txt'></span> + + + +</form>