From 83345c58c56e4868fd4707da6a7216b192348c7f Mon Sep 17 00:00:00 2001
From: ventilaar
Date: Wed, 4 Nov 2020 13:12:36 +0100
Subject: [PATCH] changed moderator table styles, scherm is working now was
broken
---
moderator_gui.py | 2 +-
scherm_web.py | 28 +++++++++++++++++++++++++-
static/scherm_style.css | 41 +++++++++++++++++++++++++++++++++++++++
templates/bericht.html | 20 +++++++++----------
templates/berichten.html | 26 +++++++++++++++----------
templates/locaties.html | 6 +++---
templates/moderators.html | 16 +++++++--------
templates/scherm.html | 30 +++++++++++++++++++++++++++-
zuil_web.py | 2 +-
9 files changed, 136 insertions(+), 35 deletions(-)
create mode 100644 static/scherm_style.css
diff --git a/moderator_gui.py b/moderator_gui.py
index 9f33a0b..b3929f3 100644
--- a/moderator_gui.py
+++ b/moderator_gui.py
@@ -247,7 +247,7 @@ def func_publish_twitter(berichtid):
DATA = (jsonresponse['id'], jsonresponse['created_at'])
cur.execute(QUERY, DATA)
- QUERY = 'UPDATE berichten SET twitterid = (%s) WHERE berichtid = (%s)'
+ QUERY = 'UPDATE berichten SET twitterid = (%s), statusid = 5 WHERE berichtid = (%s)'
DATA = (jsonresponse['id'], berichtid)
cur.execute(QUERY, DATA)
conn.commit()
diff --git a/scherm_web.py b/scherm_web.py
index 68c1965..3f08c35 100644
--- a/scherm_web.py
+++ b/scherm_web.py
@@ -1,6 +1,13 @@
import database_connector
from flask import Flask, request, render_template, session, redirect, url_for, flash
+
+"""
+pas de locatie id aan zoals weergeven in moderator scherm
+"""
+locatieid = 1
+
+
"""
test var, het het nogmaal gesproken op False
"""
@@ -20,9 +27,28 @@ stel flask in
app = Flask(__name__)
+def func_huidigelocatie():
+ cur.execute('SELECT * FROM locaties WHERE locatieid = (%s)', [locatieid])
+ return cur.fetchone()
+
+def func_getlocaleberichten():
+ cur.execute('SELECT berichten.bericht, berichten.naamposter FROM berichten WHERE locatieid = (%s) AND '
+ 'statusid = 5 ORDER BY datumontvangen DESC LIMIT 25', [locatieid])
+ return cur.fetchall()
+
+def func_getallberichten():
+ cur.execute('SELECT berichten.bericht, berichten.naamposter, locaties.naam FROM berichten '
+ 'LEFT OUTER JOIN locaties ON berichten.locatieid = locaties.locatieid '
+ 'WHERE statusid = 5 ORDER BY datumontvangen DESC LIMIT 25', [locatieid])
+ return cur.fetchall()
+
+
@app.route('/')
def root():
- return render_template('scherm.html')
+ locatie = func_huidigelocatie()
+ localeberichten = func_getlocaleberichten()
+ allberichten = func_getallberichten()
+ return render_template('scherm.html', locatie=locatie, localeberichten=localeberichten, allberichten=allberichten)
diff --git a/static/scherm_style.css b/static/scherm_style.css
new file mode 100644
index 0000000..181f5d2
--- /dev/null
+++ b/static/scherm_style.css
@@ -0,0 +1,41 @@
+body {
+ background-color: #ffcc00;
+}
+
+table, th, td {
+ border: 1px solid black;
+ border-collapse: collapse;
+}
+
+.tabel-lokaal {
+ float: left;
+ width: 50%;
+}
+
+.tabel-lokaal-header {
+ font-size: 200%;
+}
+
+.tabel-all-header {
+ font-size: 200%;
+}
+
+.descriptie-text {
+ margin: 3px;
+ font-size: 125%
+}
+
+.descriptie-naam {
+ margin: 3px;
+ font-size: 110%
+}
+
+.tabel-all {
+ float: left;
+ width: 50%;
+}
+
+.regel-text {
+ text-align: center
+}
+
diff --git a/templates/bericht.html b/templates/bericht.html
index 534e20e..70dadd3 100644
--- a/templates/bericht.html
+++ b/templates/bericht.html
@@ -22,16 +22,16 @@
Twitter ID |
-
- {{ bericht[0] }} |
- {{ bericht[3] }} |
- {{ bericht[1] }} |
- {{ bericht[5] }} |
- {{ bericht[2] }} |
- {{ bericht[7] }} |
- {{ bericht[6] }} |
- {{ bericht[4] }} |
- {{ bericht[8] }} |
+
+ {{ bericht[0] }} |
+ {{ bericht[3] }} |
+ {{ bericht[1] }} |
+ {{ bericht[5] }} |
+ {{ bericht[2] }} |
+ {{ bericht[7] }} |
+ {{ bericht[6] }} |
+ {{ bericht[4] }} |
+ {{ bericht[8] }} |
-
+
+
+
+
+ {% for row in localeberichten %}
+
+
+ {{ row[0] }}
+ Door {{ row[1] }}
+ |
+
+ {% endfor %}
+
+
+
+
+
+ {% for row in allberichten %}
+
+
+ {{ row[0] }}
+ Door {{ row[1] }} uit {{ row[2] }}
+ |
+
+ {% endfor %}
+
+ Meer berichten kunt u terug zien op twitter.com/nszuiltest33332
diff --git a/templates/berichten.html b/templates/berichten.html
index f0859f1..648c390 100644
--- a/templates/berichten.html
+++ b/templates/berichten.html
@@ -23,16 +23,22 @@
Twitter ID |
{% for row in berichten %}
-
- {{ row[0] }} |
- {{ row[3] }} |
- {{ row[1] }} |
- {{ row[5] }} |
- {{ row[2] }} |
- {{ row[7] }} |
- {{ row[6] }} |
- {{ row[4] }} |
- {{ row[8] }} |
+
+ {{ row[0] }} |
+ {{ row[3] }} |
+ {{ row[1] }} |
+ {{ row[5] }} |
+ {{ row[2] }} |
+ {{ row[7] }} |
+ {{ row[6] }} |
+ {{ row[4] }} |
+
+ {% if row[8] != None%}
+
+ {% endif %}
+ {{ row[8] }}
+
+ |
{% endfor %}
diff --git a/templates/locaties.html b/templates/locaties.html
index 8cd5fca..e817144 100644
--- a/templates/locaties.html
+++ b/templates/locaties.html
@@ -16,9 +16,9 @@
Locatie naam |
{% for row in locaties %}
-
- {{ row[0] }} |
- {{ row[1] }} |
+
+ {{ row[0] }} |
+ {{ row[1] }} |
{% endfor %}
diff --git a/templates/moderators.html b/templates/moderators.html
index 0627dfd..81ca8a0 100644
--- a/templates/moderators.html
+++ b/templates/moderators.html
@@ -19,17 +19,17 @@
Last seen |
{% for row in moderators %}
-
- {{ row[0] }} |
- {{ row[1] }} |
- {{ row[2] }} |
- {{ row[3] }} |
- {{ row[4] }} |
-
+ |
+ {{ row[0] }} |
+ {{ row[1] }} |
+ {{ row[2] }} |
+ {{ row[3] }} |
+ {{ row[4] }} |
+
-
+ |
{% endfor %}
diff --git a/templates/scherm.html b/templates/scherm.html
index be7db79..59991c8 100644
--- a/templates/scherm.html
+++ b/templates/scherm.html
@@ -3,8 +3,36 @@
NS Scherm
+
+