Commit 8cbe0793 authored by Julian Rother's avatar Julian Rother
Browse files

Added new panel button

parent 4370c3dc
......@@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `featured` (
`internal` text NOT NULL DEFAULT '',
`type` varchar(32) NOT NULL DEFAULT '',
`param` text NOT NULL DEFAULT '',
`order` INTEGER NOT NULL DEFAULT 0,
`order` INTEGER UNIQUE,
`visible` INTEGER NOT NULL DEFAULT 0,
`deleted` INTEGER NOT NULL DEFAULT 0,
`time_created` datetime NOT NULL,
......
......@@ -326,8 +326,12 @@ def index():
JOIN courses ON courses.id = lectures.course_id
WHERE streams.active AND (? OR (streams.visible AND courses.visible AND courses.listed AND lectures.visible))
''', ismod())
featured = query('SELECT * FROM featured WHERE NOT deleted AND (? OR visible) ORDER BY `order`', ismod())
return render_template('index.html', latestvideos=livestreams+latestvideos, upcomming=upcomming, featured=featured)
featured = query('SELECT * FROM featured WHERE (? OR visible) ORDER BY `order`', ismod())
newfeatured = 0
if featured:
newfeatured = featured[-1]['order'] + 1
featured = filter(lambda x: not x['deleted'], featured)
return render_template('index.html', latestvideos=livestreams+latestvideos, upcomming=upcomming, featured=featured, newfeatured=newfeatured)
@app.route('/course')
@register_navbar('Videos', icon='film')
......@@ -523,7 +527,7 @@ def edit(prefix='', ignore=[]):
assert column in tabs[table][2]
modify('INSERT INTO changelog (`table`,id_value, id_key, field, value_new, value_old, `when`, who, executed) VALUES (?,?,?,?,?,(SELECT %s FROM %s WHERE %s = ?),?,?,1)'%(column, tabs[table][0], tabs[table][1]),
table, id, tabs[table][1], column, val, id, datetime.now(), session['user']['dbid'])
modify('UPDATE %s SET %s = ?, time_updated = ? WHERE %s = ?'%(tabs[table][0], column, tabs[table][1]), val, datetime.now(), id)
modify('UPDATE %s SET %s = ?, time_updated = ? WHERE `%s` = ?'%(tabs[table][0], column, tabs[table][1]), val, datetime.now(), id)
modify('COMMIT')
if 'ref' in request.values:
return redirect(request.values['ref'])
......@@ -549,7 +553,7 @@ def create(table):
continue
assert column in tabs[table][2]+tabs[table][3]
assert column not in defaults
columns.append(column)
columns.append('`'+column+'`')
values.append(val)
id = modify('INSERT INTO %s (%s) VALUES (%s)'%(tabs[table][0],
','.join(columns), ','.join(['?']*len(values))), *values)
......
......@@ -53,6 +53,15 @@
<div class="row">
<div class="col-xs-12">
<ul class="list-inline pull-right">
<li style="padding-right: 0px;">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Neues Panel <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='plain', ref=request.url, order=newfeatured) }}">Nur Text</a></li>
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='image', ref=request.url, order=newfeatured) }}">Text mit Bild</a></li>
</ul>
</div>
</li>
<li style="padding-right: 0px;">
<a class="btn btn-default" href="{{ url_for('create', table='announcements', text='Neue Ankündigung', time_publish=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0), time_expire=datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)+timedelta(days=7), ref=request.url) }}">Neue Ankündigung</a>
</li>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment