diff --git a/server.py b/server.py index 718633bc7d1f3ce368eb440bbe0989a7d6d5458d..99ceb60be9bdd77897399fbc45712371fe4dcdc6 100644 --- a/server.py +++ b/server.py @@ -386,7 +386,13 @@ def suggest_chapter(lectureid): time = request.values['time'] text = request.values['text'] assert(time and text) - time = int(time) + try: + x = datetime.strptime(time,'%H:%M:%S') + time= timedelta(hours=x.hour,minutes=x.minute,seconds=x.second).total_seconds() + time = int(time) + except ValueError: + flash('Falsches Zeitformat, "%H:%M:%S" wird erwartet. Z.B. "01:39:42" für eine Kapitel bei Stunde 1, Minute 39, Sekunde 42') + submitter = None if not ismod(): submitter = request.environ['REMOTE_ADDR'] diff --git a/templates/lecture.html b/templates/lecture.html index 8c10cea3938669e9094248ef580cb99b44043028..9a2cf3e497b1ce98db3db62f223c3ec9992f7333 100644 --- a/templates/lecture.html +++ b/templates/lecture.html @@ -16,6 +16,7 @@ </div> <div class="col-sm-6 col-xs-12"> <ul class="list-inline pull-right"> + <li><button class="btn btn-default" id="hintnewchapter">Kapitelmarker vorschlagen</button></li> <li>{{ video_embed_btn(lecture.id) }}</li> <li class="dropdown">{{ video_download_btn(videos) }}</li> </ul> @@ -25,8 +26,21 @@ <div class="col-xs-12" style="padding: 0px"> {{ player(lecture, videos) }} </div> + <div class="col-xs-12" style="padding-top: 10px;"> + </div> </div> </div> </div> +<script> +$(function() { + $( "#hintnewchapter" ).popover( + { + html:true, + title:'Kapitelmarkierung vorschlagen', + content:'<form method="post" action="{{url_for('suggest_chapter', ref=request.url, lectureid=lecture.id)}}"><input placeholder="00:00.000" name="time" type="text"><br><input placeholder="Kapitel" name="text" type="texz"><br><input type="submit" value="Vorschlagen"></form>' + + }) +}); +</script> {% endblock %}