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 @@
Berichten uit {{ locatie[1] }} | +
---|
+ {{ row[0] }} +Door {{ row[1] }} + |
+
Berichten uit heel nederland | +
---|
+ {{ row[0] }} +Door {{ row[1] }} uit {{ row[2] }} + |
+
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 @@
{% for row in berichten %} -
{% 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 @@
{% for row in locaties %} -
{% 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 @@
{% for row in moderators %} -
{% 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 @@
+ +