ventilaar
/
twitter_zuil
Archived
1
Fork 0

changed moderator table styles, scherm is working now was broken

This commit is contained in:
ventilaar 2020-11-04 13:12:36 +01:00
parent cf12eaec25
commit 83345c58c5
9 changed files with 136 additions and 35 deletions

View File

@ -247,7 +247,7 @@ def func_publish_twitter(berichtid):
DATA = (jsonresponse['id'], jsonresponse['created_at']) DATA = (jsonresponse['id'], jsonresponse['created_at'])
cur.execute(QUERY, DATA) 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) DATA = (jsonresponse['id'], berichtid)
cur.execute(QUERY, DATA) cur.execute(QUERY, DATA)
conn.commit() conn.commit()

View File

@ -1,6 +1,13 @@
import database_connector import database_connector
from flask import Flask, request, render_template, session, redirect, url_for, flash 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 test var, het het nogmaal gesproken op False
""" """
@ -20,9 +27,28 @@ stel flask in
app = Flask(__name__) 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('/') @app.route('/')
def root(): 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)

41
static/scherm_style.css Normal file
View File

@ -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
}

View File

@ -22,16 +22,16 @@
<th>Twitter ID</th> <th>Twitter ID</th>
</tr> </tr>
<tr> <tr style="text-align: center;">
<th>{{ bericht[0] }}</th> <td>{{ bericht[0] }}</td>
<th>{{ bericht[3] }}</th> <td>{{ bericht[3] }}</td>
<th>{{ bericht[1] }}</th> <td>{{ bericht[1] }}</td>
<th>{{ bericht[5] }}</th> <td>{{ bericht[5] }}</td>
<th>{{ bericht[2] }}</th> <td>{{ bericht[2] }}</td>
<th>{{ bericht[7] }}</th> <td>{{ bericht[7] }}</td>
<th>{{ bericht[6] }}</th> <td>{{ bericht[6] }}</td>
<th>{{ bericht[4] }}</th> <td>{{ bericht[4] }}</td>
<th>{{ bericht[8] }}</th> <td>{{ bericht[8] }}</td>
</tr> </tr>
</table> </table>
</body> </body>

View File

@ -23,16 +23,22 @@
<th>Twitter ID</th> <th>Twitter ID</th>
</tr> </tr>
{% for row in berichten %} {% for row in berichten %}
<tr> <tr style="text-align: center;">
<th><a href="/bericht/{{ row[0] }}">{{ row[0] }}</a></th> <td><a href="/bericht/{{ row[0] }}">{{ row[0] }}</a></td>
<th>{{ row[3] }}</th> <td>{{ row[3] }}</td>
<th>{{ row[1] }}</th> <td>{{ row[1] }}</td>
<th>{{ row[5] }}</th> <td>{{ row[5] }}</td>
<th>{{ row[2] }}</th> <td>{{ row[2] }}</td>
<th>{{ row[7] }}</th> <td>{{ row[7] }}</td>
<th>{{ row[6] }}</th> <td>{{ row[6] }}</td>
<th>{{ row[4] }}</th> <td>{{ row[4] }}</td>
<th>{{ row[8] }}</th> <td>
{% if row[8] != None%}
<a href="https://twitter.com/nszuiltest33332/status/{{ row[8] }}">
{% endif %}
{{ row[8] }}
</a>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -16,9 +16,9 @@
<th>Locatie naam</th> <th>Locatie naam</th>
</tr> </tr>
{% for row in locaties %} {% for row in locaties %}
<tr> <tr style="text-align: center;">
<th>{{ row[0] }}</th> <td>{{ row[0] }}</td>
<th>{{ row[1] }}</th> <td>{{ row[1] }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -19,17 +19,17 @@
<th>Last seen</th> <th>Last seen</th>
</tr> </tr>
{% for row in moderators %} {% for row in moderators %}
<tr> <tr style="text-align: center;">
<th>{{ row[0] }}</th> <td>{{ row[0] }}</td>
<th>{{ row[1] }}</th> <td>{{ row[1] }}</td>
<th>{{ row[2] }}</th> <td>{{ row[2] }}</td>
<th>{{ row[3] }}</th> <td>{{ row[3] }}</td>
<th>{{ row[4] }}</th> <td>{{ row[4] }}</td>
<th> <td>
<form method="POST" action="/moderators/removemoderator"> <form method="POST" action="/moderators/removemoderator">
<button type="submit" name="delete" value="{{ row[0] }}">Delete</button> <button type="submit" name="delete" value="{{ row[0] }}">Delete</button>
</form> </form>
</th> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -3,8 +3,36 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>NS Scherm</title> <title>NS Scherm</title>
<meta http-equiv="refresh" content="3; url=/">
<link rel="stylesheet" href="{{ url_for('static', filename='scherm_style.css') }}"/>
</head> </head>
<body> <body>
<table class="tabel-lokaal">
<tr>
<th class="tabel-lokaal-header">Berichten uit {{ locatie[1] }}</th>
</tr>
{% for row in localeberichten %}
<tr>
<td class="regel-text">
<p class="descriptie-text"><i>{{ row[0] }}</i></p>
<p class="descriptie-naam">Door <i>{{ row[1] }}</i></p>
</td>
</tr>
{% endfor %}
</table>
<table class="tabel-all">
<tr>
<th class="tabel-all-header">Berichten uit heel nederland</th>
</tr>
{% for row in allberichten %}
<tr>
<td class="regel-text">
<p class="descriptie-text"><i>{{ row[0] }}</i></p>
<p class="descriptie-naam">Door <i>{{ row[1] }}</i> uit <i>{{ row[2] }}</i></p>
</td>
</tr>
{% endfor %}
</table>
<h3 style="text-align: center">Meer berichten kunt u terug zien op twitter.com/nszuiltest33332</h3>
</body> </body>
</html> </html>

View File

@ -6,7 +6,7 @@ import secrets
""" """
pas de locatie id aan zoals weergeven in moderator scherm pas de locatie id aan zoals weergeven in moderator scherm
""" """
locatieid = 1 locatieid = 2
""" """
test var, het het nogmaal gesproken op False test var, het het nogmaal gesproken op False