Skip to content
Snippets Groups Projects
Commit efed38e6 authored by Andreas Valder's avatar Andreas Valder
Browse files

closes #51

parent df29c74f
No related branches found
No related tags found
No related merge requests found
...@@ -561,10 +561,18 @@ def auth(): # For use with nginx auth_request ...@@ -561,10 +561,18 @@ def auth(): # For use with nginx auth_request
@register_navbar('Changelog', icon='book') @register_navbar('Changelog', icon='book')
@mod_required @mod_required
def changelog(): def changelog():
changelog = query('SELECT * FROM changelog LEFT JOIN users ON (changelog.who = users.id) ORDER BY `when` DESC LIMIT 50') if 'page' in request.args:
page = max(0, int(request.args['page']))
else:
page = 0
if 'pagesize' in request.args:
pagesize = min(500, int(request.args['pagesize']))
else:
pagesize = 50
changelog = query('SELECT * FROM changelog LEFT JOIN users ON (changelog.who = users.id) ORDER BY `when` DESC LIMIT ? OFFSET ?',pagesize,page*pagesize)
for entry in changelog: for entry in changelog:
entry['path'] = '.'.join([entry['table'], entry['id_value'], entry['field']]) entry['path'] = '.'.join([entry['table'], entry['id_value'], entry['field']])
return render_template('changelog.html', changelog=changelog) return render_template('changelog.html', changelog=changelog, page=page, pagesize=pagesize)
@app.route('/files/<filename>') @app.route('/files/<filename>')
def files(filename): def files(filename):
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
<p>Hier werden alle Änderungen an Kursen/Veranstaltungen/Videos etc. geloggt und können Rückgängig gemacht werden.</p> <p>Hier werden alle Änderungen an Kursen/Veranstaltungen/Videos etc. geloggt und können Rückgängig gemacht werden.</p>
<div style="margin-top: 10px;" class="col-xs-12">
<a href="{{url_for('changelog', page=page-1) }}" class="pull-left btn btn-default">{{ "<<" }}</a>
<a href="{{url_for('changelog', page=page+1) }}" class="pull-right btn btn-default">{{ ">>" }}</a>
</div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-condensed"> <table class="table table-condensed">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment