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'])
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()

View File

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

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>
</tr>
<tr>
<th>{{ bericht[0] }}</th>
<th>{{ bericht[3] }}</th>
<th>{{ bericht[1] }}</th>
<th>{{ bericht[5] }}</th>
<th>{{ bericht[2] }}</th>
<th>{{ bericht[7] }}</th>
<th>{{ bericht[6] }}</th>
<th>{{ bericht[4] }}</th>
<th>{{ bericht[8] }}</th>
<tr style="text-align: center;">
<td>{{ bericht[0] }}</td>
<td>{{ bericht[3] }}</td>
<td>{{ bericht[1] }}</td>
<td>{{ bericht[5] }}</td>
<td>{{ bericht[2] }}</td>
<td>{{ bericht[7] }}</td>
<td>{{ bericht[6] }}</td>
<td>{{ bericht[4] }}</td>
<td>{{ bericht[8] }}</td>
</tr>
</table>
</body>

View File

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

View File

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

View File

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

View File

@ -3,8 +3,36 @@
<head>
<meta charset="UTF-8">
<title>NS Scherm</title>
<meta http-equiv="refresh" content="3; url=/">
<link rel="stylesheet" href="{{ url_for('static', filename='scherm_style.css') }}"/>
</head>
<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>
</html>

View File

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