diff --git a/db_schema.sql b/db_schema.sql index 2dc1f8c376208f0e0a152ab0f7d41be9f29699eb..85036ec2148f7d5e7f6b6884b18ba8d2cb012e0f 100644 --- a/db_schema.sql +++ b/db_schema.sql @@ -97,7 +97,8 @@ CREATE TABLE IF NOT EXISTS `lectures_data` ( `time_created` datetime NOT NULL, `time_updated` datetime NOT NULL, `jumplist` text NOT NULL DEFAULT '', - `titlefile` varchar(255) NOT NULL DEFAULT '' + `titlefile` varchar(255) NOT NULL DEFAULT '', + `live` INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE IF NOT EXISTS `places` ( `place` varchar(20) NOT NULL PRIMARY KEY, diff --git a/edit.py b/edit.py index 07f5be79d38e58879f0f2a4ddccd051061f65a32..a00f7a6d6801ddf4ad505c0dc5929f44fa6b0e06 100644 --- a/edit.py +++ b/edit.py @@ -40,7 +40,8 @@ editable_tables = { 'time': {'type': 'datetime'}, 'duration': {'type': 'duration'}, 'jumplist': {'type': ''}, - 'deleted': {'type': 'boolean'}}, + 'deleted': {'type': 'boolean'}, + 'live': {'type': 'boolean'}}, 'creationtime_fields': ['course_id', 'time_created', 'time_updated'] }, 'videos': { 'table': 'videos_data', diff --git a/templates/index.html b/templates/index.html index 4840d59550a349bce16e318733689ff1635834fc..fbb2cbc3de210ccef6341a03ef077f6e66965da0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,4 +1,4 @@ -{% from 'macros.html' import preview, featured_content %} +{% from 'macros.html' import preview, featured_content, livelabel %} {% extends "base.html" %} {% set page_border = 0 %} {% if ismod() %} @@ -111,7 +111,7 @@ <ul class="list-group" style="margin: 0px;"> {% for i in g.list %} <li class="list-group-item list-group-item-condensed"> - {{i.time|time}} <a href="{{url_for('course', id=i.course_id)}}">{{i.course.title}}</a>: <a href="{{url_for('course', id=i.course_id)}}#lecture-{{i.id}}">{{i.title}}</a> + {{i.time|time}} <a href="{{url_for('course', id=i.course_id)}}">{{i.course.title}}</a>: <a href="{{url_for('course', id=i.course_id)}}#lecture-{{i.id}}">{{i.title}}</a> {{livelabel(i.live, False)}} </li> {% endfor %} </ul> diff --git a/templates/macros.html b/templates/macros.html index a11428be24a50ca1649862cf4bac312ba6ef2674..7930f1a3e3216751eba8c89552dd4c787f477644 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,3 +1,9 @@ +{% macro livelabel(live=None, nowlive=None) %} +{% if live or nowlive %} +<span class="label {% if nowlive %}label-danger{% else %}label-default{% endif %}">Live</span> +{% endif %} +{% endmacro %} + {% macro preview(lecture) %} <li class="list-group-item"> <a href="{{url_for('lecture', course=lecture.course.handle, id=lecture['id'])}}" title="{{ lecture.course.title }}" style="color: #000"> @@ -5,7 +11,7 @@ <div class="row"> <img class="col-xs-4" style="max-height: 120px; height: auto; width:170px" src="{{ config.VIDEOPREFIX }}/thumbnail/l_{{ lecture['id'] }}.jpg" alt="Vorschaubild"> <div class="col-xs-4"> - <span>{% if lecture.livehandle %}<span class="label label-danger">Live</span> {% endif %}<strong>{{ lecture.course.short }}</strong>{% if ismod() %} <i>({{lecture.course_id}})</i>{% endif %}</span><br> + <span><strong>{{ lecture.course.short }}</strong>{{livelabel(lecture.live, lecture.livehandle)}}{% if ismod() %} <i>({{lecture.course_id}})</i>{% endif %}</span><br> <span>{% if ismod() %}ID: {{lecture.id}}{% endif %}</span><br> <span>{{ lecture['time'] }}</span> {% if lecture['speaker'] %} @@ -23,8 +29,8 @@ <img style="width: 100%;" src="{{ config.VIDEOPREFIX }}/thumbnail/l_{{ lecture['id'] }}.jpg" alt="Vorschaubild"> </li> <li> - {% if lecture.livehandle %}<span class="label label-danger">Live</span> {% endif %} <strong>{{ lecture.course.title }}</strong> + {{livelabel(lecture.live, lecture.livehandle)}} </li> <li>{{ lecture['time'] }}</li> {% if lecture['speaker'] %} @@ -169,7 +175,7 @@ $('#embedcodebtn').popover( {% endif %} </div> <ul class="list-unstyled col-sm-3 col-xs-12"> - <li>{% if videos|selectattr("livehandle")|list|length %}<span class="label label-danger">Live</span> {% endif %}{{ moderator_editor(['lectures',lecture.id,'title'], lecture.title) }}</li> + <li>{{ moderator_editor(['lectures',lecture.id,'title'], lecture.title) }}{{livelabel(lecture.live, videos|selectattr("livehandle")|list|length)}}</li> {% if lecture.speaker or ismod() %}<li>Gehalten von {{ moderator_editor(['lectures',lecture.id,'speaker'], lecture.speaker) }}</li>{% endif %} <li>{{ moderator_editor(['lectures',lecture.id,'time'], lecture.time) }} </li> <li>Dauer: {{ moderator_editor(['lectures',lecture.id,'duration'], lecture.duration) }} min</li> @@ -182,6 +188,7 @@ $('#embedcodebtn').popover( {% if ismod() %} <li>{{ moderator_editor(['lectures',lecture.id,'internal'], lecture.internal) }}</li> <li>Sichtbar: {{ moderator_checkbox(['lectures',lecture.id,'visible'], lecture.visible) }}</li> + <li>Livestream geplant: {{ moderator_checkbox(['lectures',lecture.id,'live'], lecture.live) }}</li> <li>Hörsaal: {{ moderator_editor(['lectures',lecture.id,'place'], lecture.place) }} </li> {% endif %} </ul>