Commit b04b9298 authored by Andreas Valder's avatar Andreas Valder
Browse files

overworked moderator backend, added id ankers

parent 3c079b08
......@@ -196,6 +196,7 @@ def course(id=None, handle=None):
lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible) ORDER BY time, duration DESC', course['id'], ismod())
for lecture in lectures:
lecture['auth'] = []
lecture['course'] = course
for auth in auths:
if auth['lecture_id'] == lecture['id']:
lecture['auth'].append(auth)
......
var moderatorinterface = {
init: function () {
$(function () {
var editable = $('.modeditable');
var moderator = {
api: {
init: function () {
},
set: function(path,value,reload=false) {
var req = {};
req[path] = value;
moderator.api.set_multi(req,reload)
},
set_multi: function(dict,reload=false) {
$.ajax({
method: "POST",
url: "/edit",
dataType: "text",
contentType: "application/json",
data: JSON.stringify(dict),
success: function () {
if (reload) {
window.location.reload();
}
}
});
},
add_new: function(value,type,reload=false) {
$.ajax({
method: "POST",
url: "/new/"+type,
dataType: "text",
contentType: "application/json",
data: JSON.stringify(value),
success: function () {
if (reload) {
window.location.reload();
}
}
})
},
gethttp: function (url){
$.ajax({
method: "GET",
url: url,
dataType: "text",
})
}
},
editor: {
init: function() {
var editable = $('.moderator_editor');
for (var i=0; i<editable.length; i++) {
var e = $(editable[i]);
$('.modeditablesign',e).popover(
$('.moderator_editor_sign',e).popover(
{
title: e.data('path'),
html: true,
......@@ -14,17 +58,57 @@ var moderatorinterface = {
content: function() {
return '<div class="row form-group">'+
'<span class="col-xs-12">'+
'<textarea class="form-control editorvalue" rows="3" data-path="'+$(this.parentElement).data('path')+'">'+this.parentElement.getElementsByClassName('modeditablevalue')[0].innerHTML+'</textarea>'+
'<textarea class="form-control editor_value" rows="3" data-path="'+$(this.parentElement).data('path')+'">'+this.parentElement.getElementsByClassName('moderator_editor_value')[0].innerHTML+'</textarea>'+
'</span>'+
'<span class="col-xs-12">'+
'<input class="btn btn-default pull-right editorbtn" type="submit" data-path="'+$(this.parentElement).data('path')+'" value="save" onClick="moderatorinterface.edit(this)">'+
'<input class="btn btn-default pull-right" type="submit" data-path="'+$(this.parentElement).data('path')+'" value="save" onClick="moderator.editor.editbtnclick(this)">'+
'</span>'+
'</div>';
}
}
);
}
$('.modeditacl').popover(
},
editbtnclick: function (src) {
var path = $($(src)[0]).data('path');
var value = $('.editor_value',src.parentElement.parentElement).val();
// var value = $(".editor_value")[0].value;
var editable = $('.moderator_editor');
for (var i=0; i<editable.length; i++) {
var e = $(editable[i]);
if (e.data('path') == path) {
$('.moderator_editor_sign',e).click();
$(".moderator_editor_value",e).html(value);
}
}
moderator.api.set(path,value);
},
changeboxclick: function(src) {
var value = $(src)[0].checked;
var path = $(src).data('path');
moderator.api.set(path,value ? 1 : 0);
},
deletebtnclick: function(src) {
if (confirm('Realy delete this?')) {
moderator.api.set($(src).data('path'),1,true);
}
}
},
acleditor: {
acls: [],
setacls: function(value) {
var idlist = [];
for (i in value) {
if (idlist.indexOf(value[i]['auth_id']) == -1) {
idlist[idlist.length] = value[i]['auth_id'];
moderator.acleditor.acls[moderator.acleditor.acls.length] = value[i];
}
}
},
init: function () {
$('.modmoderator_acleditor').popover(
{
title: "acls",
html: true,
......@@ -36,139 +120,67 @@ var moderatorinterface = {
var id = $(this).data('id');
var type = $(this).data('type');
html += '<div width="300px" class="row" data-id="'+id+'" data-type="'+type+'">';
html += '<select onchange="moderatorinterface.selectacl(this)" size="6" class="col-xs-12 acllist">';
html += '<select onchange="moderator.acleditor.selectacl(this)" size="6" class="col-xs-12 acllist">';
var idlist = [];
for (i in moderatorinterface.acls) {
if ((moderatorinterface.acls[i][type+'_id'] == id)) {
for (i in moderator.acleditor.acls) {
if ((moderator.acleditor.acls[i][type+'_id'] == id)) {
var auth = {};
auth.type = moderatorinterface.acls[i]['auth_type'];
auth.user = moderatorinterface.acls[i]['auth_user'];
auth.password = moderatorinterface.acls[i]['auth_passwd'];
auth.id = moderatorinterface.acls[i]['auth_id'];
auth.type = moderator.acleditor.acls[i]['auth_type'];
auth.user = moderator.acleditor.acls[i]['auth_user'];
auth.password = moderator.acleditor.acls[i]['auth_passwd'];
auth.id = moderator.acleditor.acls[i]['auth_id'];
idlist[idlist.length] = auth.id;
html += '<option data-auth_id="'+auth.id+'">#'+auth.id+' '+auth.type+' '+ ( auth.type == "password" ? ' ("'+auth.user+'":"'+auth.password+'")' : '' ) +'</option>';
}
console.log(moderatorinterface.acls[i]['deleted']);
}
html += '</select>';
html += '<select class="col-xs-12 authtype" onchange="moderatorinterface.acltypechange(this)"><option value="public">public</option><option selected value="password">password</option></select>';
html += '<select class="col-xs-12 authtype" onchange="moderator.acleditor.acltypechange(this)"><option value="public">public</option><option selected value="password">password</option></select>';
html += '<input class="col-xs-12 passwordinput authuser" type="text" placeholder="username">';
html += '<input class="col-xs-12 passwordinput authpassword" type="text" placeholder="password">';
html += '<button class="col-xs-6" onclick="moderatorinterface.addacl(this)">Add</button>';
//html += '<button class="col-xs-4" onclick="moderatorinterface.delacl(this)">Update</button>';
html += '<button class="col-xs-6" onclick="moderatorinterface.delacl(this)">Delete</button>';
html += '<button class="col-xs-6" onclick="moderator.acleditor.addbtnclick(this)">Add</button>';
//html += '<button class="col-xs-4" onclick="moderator.acleditor.updatebtnclick(this)">Update</button>';
html += '<button class="col-xs-6" onclick="moderator.acleditor.delbtnclick(this)">Delete</button>';
html += '</div>';
return html;
}
}
);
})
},
selectacl: function (element) {
},
selectacl: function (element) {
},
delacl: function (element) {
moderatorinterface.set("auth."+$(".acllist option:selected", element.parentElement).data('auth_id')+".deleted",1,true);
},
addacl: function (element) {
var auth = {};
auth.type = $(".authtype", element.parentElement).val();
if (auth.type == "password") {
auth.user = $(".authuser", element.parentElement).val();
auth.password = $(".authpassword", element.parentElement).val();
}
moderatorinterface.set('')
dict = {}
dict['auth_type'] = auth.type;
dict['auth_user'] = auth.user;
dict['auth_passwd'] = auth.password;
dict[$(element.parentElement).data('type')+'_id'] = $(element.parentElement).data('id');
moderatorinterface.add_new(dict,'auth',true);
var option = $('<option>', {
"text": auth.type+' '+( auth.type == "password" ? ' ("'+auth.user+'":"'+auth.password+'")' : '' ) ,
"data-auth": JSON.stringify(auth)
});
$(".acllist",element.parentElement).append(option);
},
acltypechange: function (element) {
$(".passwordinput",element.parentElement).toggle();
},
edit: function (src) {
var path = $($(src)[0]).data('path');
var value = $(".editorvalue")[0].value;
var editable = $('.modeditable');
for (var i=0; i<editable.length; i++) {
var e = $(editable[i]);
if (e.data('path') == path) {
$('.modeditablesign',e).click();
$(".modeditablevalue",e).html(value);
},
delbtnclick: function (element) {
moderator.api.set("auth."+$(".acllist option:selected", element.parentElement).data('auth_id')+".deleted",1,true);
},
addbtnclick: function (element) {
var auth = {};
auth.type = $(".authtype", element.parentElement).val();
if (auth.type == "password") {
auth.user = $(".authuser", element.parentElement).val();
auth.password = $(".authpassword", element.parentElement).val();
}
dict = {}
dict['auth_type'] = auth.type;
dict['auth_user'] = auth.user;
dict['auth_passwd'] = auth.password;
dict[$(element.parentElement).data('type')+'_id'] = $(element.parentElement).data('id');
moderator.api.add_new(dict,'auth',true);
var option = $('<option>', {
"text": auth.type+' '+( auth.type == "password" ? ' ("'+auth.user+'":"'+auth.password+'")' : '' ) ,
"data-auth": JSON.stringify(auth)
});
$(".acllist",element.parentElement).append(option);
},
acltypechange: function (element) {
$(".passwordinput",element.parentElement).toggle();
}
moderatorinterface.set(path,value);
},
change: function(src) {
var value = $(src)[0].checked;
var path = $(src).data('path');
moderatorinterface.set(path,value ? 1 : 0);
},
set: function(path,value,reload=false) {
var req = {};
req[path] = value;
moderatorinterface.set_multi(req,reload)
},
set_multi: function(dict,reload=false) {
$.ajax({
method: "POST",
url: "/edit",
dataType: "text",
contentType: "application/json",
data: JSON.stringify(dict),
success: function () {
if (reload) {
window.location.reload();
}
}
})
},
add_new: function(dict,table,reload=false) {
$.ajax({
method: "POST",
url: "/new/"+table,
dataType: "text",
contentType: "application/json",
data: JSON.stringify(dict),
success: function () {
if (reload) {
window.location.reload();
}
}
})
},
delete: function(src) {
if (confirm('Realy delete this?')) {
moderatorinterface.set($(src).data('path'),1,true);
}
},
gethttp: function (url){
$.ajax({
method: "GET",
url: url,
dataType: "text",
})
},
acls: [],
setacls: function(value) {
var idlist = [];
for (i in value) {
if (idlist.indexOf(value[i]['auth_id']) == -1) {
idlist[idlist.length] = value[i]['auth_id'];
moderatorinterface.acls[moderatorinterface.acls.length] = value[i];
}
}
init: function () {
moderator.api.init();
moderator.editor.init();
moderator.acleditor.init();
}
};
$( document ).ready( moderatorinterface.init() );
$( document ).ready( function () { moderator.init(); } );
......@@ -2,7 +2,7 @@
{% set global_acls = [] %}
{% set min_announcement_level = min_announcement_level|default(1) %}
{% set levels = {0: ('info', 'Nur auf Hauptseite sichtbar'), 1: ('info', 'Überall sichtbar (Hinweis)'), 2: ('warning', 'Überall sichtbar (Warnung)'), 3: ('danger', 'Überall sichtbar (Wichtig)')} %}
{% from 'macros.html' import valueeditor, valuecheckbox, valuedeletebtn %}
{% from 'macros.html' import moderator_editor, moderator_checkbox, moderator_delete %}
<!DOCTYPE html>
<html>
......@@ -142,7 +142,9 @@
</body>
{% if ismod() %}
<script>
moderatorinterface.setacls({{global_acls|tojson|safe}})
$( function () {
moderator.acleditor.setacls({{global_acls|tojson|safe}});
});
</script>
{% endif %}
</html>
{% from 'macros.html' import lecture_list_item %}
{% from 'macros.html' import valueeditor %}
{% from 'macros.html' import valuedeletebtn %}
{% from 'macros.html' import valuecheckbox %}
{% from 'macros.html' import moderator_editor %}
{% from 'macros.html' import moderator_delete %}
{% from 'macros.html' import moderator_checkbox %}
{% from 'macros.html' import preview %}
{% from 'macros.html' import editacl %}
{% from 'macros.html' import moderator_acleditor %}
{% extends "base.html" %}
{% block content %}
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">{{ valueeditor(['courses',course.id,'title'], course.title)}}
<h1 class="panel-title">{{ moderator_editor(['courses',course.id,'title'], course.title)}} {% if ismod() %}<i>({{course.id}})</i>{% endif %}
<ul class="pull-right list-inline">
<li>{{ valuedeletebtn(['courses',course.id,'deleted']) }}</li>
<li>{{ editacl('course',course.id,course.auth, global_acls) }}</li>
<li>{{ moderator_delete(['courses',course.id,'deleted']) }}</li>
<li>{{ moderator_acleditor('course',course.id,course.auth, global_acls) }}</li>
</ul>
</h1>
</div>
......@@ -20,9 +20,9 @@
<div class="col-xs-12">
<table class="table-top-aligned table-condensed">
<tbody>
<tr><td>Semester:</td><td>{{ valueeditor(['courses',course.id,'semester'], course.semester) }}</td></tr>
<tr><td>Veranstalter:</td><td>{{ valueeditor(['courses',course.id,'organizer'], course.organizer) }}</td></tr>
<tr><td>Bemerkungen:</td><td>{{ valueeditor(['courses',course.id,'description'], course.description) }}</td></tr>
<tr><td>Semester:</td><td>{{ moderator_editor(['courses',course.id,'semester'], course.semester) }}</td></tr>
<tr><td>Veranstalter:</td><td>{{ moderator_editor(['courses',course.id,'organizer'], course.organizer) }}</td></tr>
<tr><td>Bemerkungen:</td><td>{{ moderator_editor(['courses',course.id,'description'], course.description) }}</td></tr>
</tbody>
</table>
</div>
......@@ -30,13 +30,13 @@
<div class="col-xs-12" style="margin-top: 20px">
<table class="table-condensed table-top-aligned">
<tbody>
<tr><td>Sichtbar:</td><td>{{ valuecheckbox(['courses',course.id,'visible'], course.visible) }}</td></tr>
<tr><td>Gelistet:</td><td>{{ valuecheckbox(['courses',course.id,'listed'], course.listed) }}</td></tr>
<tr><td>Downloadable:</td><td>{{ valuecheckbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr>
<tr><td>Short:</td><td>{{ valueeditor(['courses',course.id,'short'], course.short) }}</td></tr>
<tr><td>Handle:</td><td>{{ valueeditor(['courses',course.id,'handle'], course.handle) }}</td></tr>
<tr><td>Thema:</td><td>{{ valueeditor(['courses',course.id,'subject'], course.subject) }}</td></tr>
<tr><td>Zuständig:</td><td>{{ valueeditor(['courses',course.id,'responsible'], course.responsible) }}</td></tr>
<tr><td>Sichtbar:</td><td>{{ moderator_checkbox(['courses',course.id,'visible'], course.visible) }}</td></tr>
<tr><td>Gelistet:</td><td>{{ moderator_checkbox(['courses',course.id,'listed'], course.listed) }}</td></tr>
<tr><td>Downloadable:</td><td>{{ moderator_checkbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr>
<tr><td>Short:</td><td>{{ moderator_editor(['courses',course.id,'short'], course.short) }}</td></tr>
<tr><td>Handle:</td><td>{{ moderator_editor(['courses',course.id,'handle'], course.handle) }}</td></tr>
<tr><td>Thema:</td><td>{{ moderator_editor(['courses',course.id,'subject'], course.subject) }}</td></tr>
<tr><td>Zuständig:</td><td>{{ moderator_editor(['courses',course.id,'responsible'], course.responsible) }}</td></tr>
</tbody>
</table>
</div>
......
{% from 'macros.html' import valuedeletebtn %}
{% from 'macros.html' import moderator_delete %}
{% extends "base.html" %}
{% block content %}
<div class="panel-group">
......@@ -87,7 +87,7 @@
<span class="col-xs-1">
<span class="pull-right">
{% if (i.type == 'lecture') %}
{{ valuedeletebtn(['lectures',i.id,'deleted']) }}
{{ moderator_delete(['lectures',i.id,'deleted']) }}
{% endif%}
{% if (i.type == 'import') %}
<button class="btn btn-default newlecture" onclick="moderatorinterface.gethttp('{{ url_for('create', table='lecture', course_id=course.id, time=i.time, title=i.title, place=i.place) }}')">anlegen</a>
......
......@@ -14,8 +14,8 @@
{% for msg in get_announcements() %}
<div class="alert alert-{{levels.get(msg.level, ('info', ''))[0]}}" role="alert">
<div>
<div class="pull-right">{{ valuedeletebtn(('announcements',msg.id,'deleted')) }}</div>
<div>{{ valueeditor(('announcements',msg.id,'text'), msg.text) }}</div>
<div class="pull-right">{{ moderator_delete(('announcements',msg.id,'deleted')) }}</div>
<div>{{ moderator_editor(('announcements',msg.id,'text'), msg.text) }}</div>
</div>
<div>
<ul class="list-inline">
......@@ -39,10 +39,10 @@
</ul>
</li>
<li>
Aktiv von {{ valueeditor(('announcements',msg.id,'time_publish'), msg.time_publish) }}
Aktiv von {{ moderator_editor(('announcements',msg.id,'time_publish'), msg.time_publish) }}
</li>
<li>
bis {{ valueeditor(('announcements',msg.id,'time_expire'), msg.time_expire) }}
bis {{ moderator_editor(('announcements',msg.id,'time_expire'), msg.time_expire) }}
</li>
</ul>
</div>
......@@ -97,9 +97,9 @@
<div class="item {% if loop.first %}active{% endif %}">
{% if ismod() %}
<div class="center-block">
{{ valueeditor(('featured',i.id,'text'), i.text) }}
{{ valueeditor(('featured',i.id,'title'), i.title) }}
{{ valuecheckbox(('featured',i.id,'visible'),i.visible) }}
{{ moderator_editor(('featured',i.id,'text'), i.text) }}
{{ moderator_editor(('featured',i.id,'title'), i.title) }}
{{ moderator_checkbox(('featured',i.id,'visible'),i.visible) }}
</div>
{% else %}
{{i.text|safe}}
......
......@@ -2,9 +2,9 @@
{% from 'macros.html' import video_download_btn %}
{% from 'macros.html' import video_embed_btn %}
{% from 'macros.html' import vtttime %}
{% from 'macros.html' import valueeditor %}
{% from 'macros.html' import valuedeletebtn %}
{% from 'macros.html' import valuecheckbox %}
{% from 'macros.html' import moderator_editor %}
{% from 'macros.html' import moderator_delete %}
{% from 'macros.html' import moderator_checkbox %}
{% set page_border = 0 -%}
{% extends "base.html" %}
......@@ -44,9 +44,9 @@
<tr onclick="videojs('videoplayer').currentTime({{c['time']}})">
<td>{{ loop.index }}</td>
<td>{{ vtttime(c['time']) }}</td>
<td>{{ valueeditor(['chapters',c.id,'text'],c['text']) }}</td>
<td>{{ valuecheckbox(['chapters',c.id,'visible'], c.visible) }}</td>
<td>{{ valuedeletebtn(['chapters',c.id,'deleted']) }}</td>
<td>{{ moderator_editor(['chapters',c.id,'text'],c['text']) }}</td>
<td>{{ moderator_checkbox(['chapters',c.id,'visible'], c.visible) }}</td>
<td>{{ moderator_delete(['chapters',c.id,'deleted']) }}</td>
</tr>
{% endfor %}
</table>
......
......@@ -4,7 +4,8 @@
<div class="row">
<img class="col-xs-4" style="max-height: 100px; width: auto;" src="{{ config.VIDEOPREFIX }}/{{ lecture['titlefile'] }}" alt="Vorschaubild" onerror="this.src='{{url_for('static',filename='no-thumbnail.png')}}'; this.onerror=''; ">
<div class="col-xs-4">
<span><strong>{{ lecture.course.short }}</strong></span><br>
<span><strong>{{ lecture.course.short }}</strong>{% 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'] %}
<div class="small">Gehalten von {{ lecture['speaker'] }} </div>
......@@ -46,7 +47,7 @@
{% for v in videos|sort(attribute='player_prio', reverse=True) %}
<source type="video/mp4" src="{{ config.VIDEOPREFIX }}/{{ v.path }}" label="{{ v.format_description }}"/>
{% endfor %}
<track srclang="en" kind="chapters" src="{{ url_for('chapters',lectureid=lecture.id) }}" />
<track srclang="de" kind="chapters" src="{{ url_for('chapters',lectureid=lecture.id) }}" />
</video>
<script>
$('#videoplayer').addClass("vjs-16-9");
......@@ -66,7 +67,7 @@ $('#videoplayer').css("width");
<span class="col-xs-12 col-md-7">
{% endif %}
<a href="{{url_for('course', handle=course.handle)}}">
{{ course.title }}
{{ course.title }}{% if ismod() %}<i> ({{course.id}})</i>{% endif %}
</a>
</span>
<span class="col-xs-8 col-md-3">
......@@ -80,11 +81,11 @@ $('#videoplayer').css("width");
{% endmacro %}
{% macro video_download_btn(videos) %}
<span class="btn btn-primary dropdown-toggle{% if videos|length is equalto 0 %} disabled{% endif %}" type="button" data-toggle="dropdown">Download <span class="caret"></span></span>
<span class="btn btn-default dropdown-toggle{% if videos|length is equalto 0 %} disabled{% endif %}" type="button" data-toggle="dropdown">Download <span class="caret"></span></span>
<ul class="dropdown-menu">
{% for v in videos|sort(attribute='prio', reverse=True) %}
{% if v.downloadable %}
<li><a href="{{ config.VIDEOPREFIX }}/{{v.path}}">{{ valuecheckbox(['videos',v.id,'visible'], v.visible) }} {{v.format_description}} ({{v.file_size|filesizeformat(true)}})</a></li>
<li><a href="{{ config.VIDEOPREFIX }}/{{v.path}}">{{ moderator_checkbox(['videos',v.id,'visible'], v.visible) }} {{v.format_description}} ({{v.file_size|filesizeformat(true)}}) {{moderator_delete(['videos',v.id,'deleted'])}} </a></li>
{% endif %}
{% endfor %}
</ul>
......@@ -113,27 +114,28 @@ $('#embedcodebtn').popover(
</script>
{% endmacro %}
{% macro lecture_list_item(lecture,videosi,global_acls) %}
{% macro lecture_list_item(lecture,videos,global_acls) %}
<li class="list-group-item" id="lecture-{{lecture.id}}">
<div class="row">
<img class="col-sm-2 col-xs-12"src="{{ config.VIDEOPREFIX }}/{{lecture.titlefile}}" alt="Vorschaubild" onerror="this.src='{{url_for('static',filename='no-thumbnail.png')}}'; this.onerror=''; ">
<span class="col-sm-3 col-xs-12">
<ul class="list-unstyled">
<li>{{ valueeditor(['lectures',lecture.id,'title'], lecture.title) }}</li>
{% if lecture.speaker or ismod() %}<li>Gehalten von {{ valueeditor(['lectures',lecture.id,'speaker'], lecture.speaker) }}</li>{% endif %}
<li>{{ valueeditor(['lectures',lecture.id,'time'], lecture.time) }} </li>
<li>Dauer: {{ valueeditor(['lectures',lecture.id,'duration'], lecture.duration) }} min</li>
<li>{{ moderator_editor(['lectures',lecture.id,'title'], lecture.title) }}</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>
{% if ismod() %}
<li>ID: <a href="{{url_for('course',handle=lecture.course.handle)}}#lecture-{{lecture.id}}">{{lecture.id}}</a></i>
{% endif %}
</ul>
</span>
<span class="col-sm-3 col-xs-12">
<ul class="list-unstyled">
<li>{{ valueeditor(['lectures',lecture.id,'comment'], lecture.comment) }}</li>
<li>{{ moderator_editor(['lectures',lecture.id,'comment'], lecture.comment) }}</li>
{% if ismod() %}
<li>{{ valueeditor(['lectures',lecture.id,'internal'], lecture.internal) }}</li>
<li>Sichtbar: {{ valuecheckbox(['lectures',lecture.id,'visible'], lecture.visible) }}</li>
<li>Hörsaal: {{ valueeditor(['lectures',lecture.id,'place'], lecture.place) }} </li>
<li>{{ moderator_editor(['lectures',lecture.id,'internal'], lecture.internal) }}</li>
<li>Sichtbar: {{ moderator_checkbox(['lectures',lecture.id,'visible'], lecture.visible) }}</li>
<li>Hörsaal: {{ moderator_editor(['lectures',lecture.id,'place'], lecture.place) }} </li>
{% endif %}
</ul>
</span>
......@@ -149,10 +151,10 @@ $('#embedcodebtn').popover(
</a>
</li>
<li>
{{ valuedeletebtn(['lectures',lecture.id,'deleted']) }}
{{ moderator_delete(['lectures',lecture.id,'deleted']) }}
</li>
<li>
{{ editacl('lecture', lecture.id, lecture.auth, global_acls) }}
{{ moderator_acleditor('lecture', lecture.id, lecture.auth, global_acls) }}
</li>
</ul>
</div>
......@@ -160,39 +162,39 @@ $('#embedcodebtn').popover(
</li>
{% endmacro %}
{% macro valueeditor (path,value) %}
{% macro moderator_editor (path,value) %}
{% if ismod() %}
<span class="modeditable" data-path="{{path|join('.')}}" ><a class="modeditablesign btn btn-default" tabindex="0" style="padding: 3px; margin-right: 5px;"><span class="glyphicon glyphicon-pencil"></span></a><span class="modeditablevalue">{{ value|safe }}</span></span>
<span class="moderator_editor" data-path="{{path|join('.')}}" ><a class="moderator_editor_sign btn btn-default" tabindex="0" style="padding: 3px; margin-right: 5px;"><span class="glyphicon glyphicon-pencil"></span></a><span class="moderator_editor_value">{{ value|safe }}</span></span>
{% else %}
{{value|fixnl|safe}}
{% endif %}
{% endmacro %}
{% macro valuecheckbox (path,value) %}
{% macro moderator_checkbox (path,value) %}
{% if ismod() %}
<input type="checkbox" data-path="{{path|join('.')}}" {% if value %} checked {% endif %} onchange="moderatorinterface.change(this)"/>
<input type="checkbox" data-path="{{path|join('.')}}" {% if value %} checked {% endif %} onchange="moderator.editor.changeboxclick(this)"/>
{% endif %}
{% endmacro %}
{% macro valuedeletebtn (path) %}
{% macro moderator_delete (path) %}
{% if ismod() %}
<button class="btn btn-default" style="background-color: red;" data-path="{{path|join('.')}}" onclick="moderatorinterface.delete(this)">
<button class="btn btn-default" style="background-color: red;" data-path="{{path|join('.')}}" onclick="moderator.editor.deletebtnclick(this)">
<span class="glyphicon glyphicon-trash"></span>
</button>
{% endif %}
{% endmacro %}
{% macro editacl(type,id,acl,global_acls) %}
{% macro moderator_acleditor(type,id,acl,global_acls) %}
{% set tmp = global_acls.extend(acl) %}
{% if (not acl) %}
{% if ismod() %}
<button class="btn btn-default modeditacl" data-type="{{ type }}" data-id="{{ id }}">
<button class="btn btn-default modmoderator_acleditor" data-type="{{ type }}" data-id="{{ id }}">
<span class="fa fa-unlock" aria-hidden="true" style="color: green;"></span>
</button>
{% endif %}
{% else %}
{% if ismod() %}
<button class="btn btn-default modeditacl" data-type="{{ type }}" data-id="{{ id }}" onclick="">