Commit 026d4c20 authored by Andreas Valder's avatar Andreas Valder
Browse files

fixed acl editor...

parent 6f757c67
......@@ -70,7 +70,6 @@ def mod_required(func):
return decorator
app.jinja_env.globals['navbar'] = []
app.jinja_env.globals['acls'] = []
# iconlib can be 'bootstrap'
# ( see: http://getbootstrap.com/components/#glyphicons )
# or 'fa'
......
......@@ -163,11 +163,9 @@ var moderatorinterface = {
setacls: function(value) {
var idlist = [];
for (i in value) {
for (j in value[i]) {
if (idlist.indexOf(value[i][j]['auth_id']) == -1) {
idlist[idlist.length] = value[i][j]['auth_id'];
moderatorinterface.acls[moderatorinterface.acls.length] = value[i][j];
}
if (idlist.indexOf(value[i]['auth_id']) == -1) {
idlist[idlist.length] = value[i]['auth_id'];
moderatorinterface.acls[moderatorinterface.acls.length] = value[i];
}
}
}
......
{% set page_border = page_border|default(1) %}
{% 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 %}
......@@ -141,7 +142,7 @@
</body>
{% if ismod() %}
<script>
moderatorinterface.setacls({{acls|tojson|safe}})
moderatorinterface.setacls({{global_acls|tojson|safe}})
</script>
{% endif %}
</html>
......@@ -12,7 +12,7 @@
<h1 class="panel-title">{{ valueeditor(['courses',course.id,'title'], course.title)}}
<ul class="pull-right list-inline">
<li>{{ valuedeletebtn(['courses',course.id,'deleted']) }}</li>
<li>{{ editacl('course',course.id,course.auth) }}</li>
<li>{{ editacl('course',course.id,course.auth, global_acls) }}</li>
</ul>
</h1>
</div>
......@@ -49,7 +49,7 @@
</div>
<ul class="list-group lectureslist">
{% for l in lectures %}
{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list) }}
{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list,global_acls)}}
{% endfor %}
</ul>
</div>
......
......@@ -113,7 +113,7 @@ $('#embedcodebtn').popover(
</script>
{% endmacro %}
{% macro lecture_list_item(lecture,videos) %}
{% macro lecture_list_item(lecture,videosi,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=''; ">
......@@ -152,7 +152,7 @@ $('#embedcodebtn').popover(
{{ valuedeletebtn(['lectures',lecture.id,'deleted']) }}
</li>
<li>
{{ editacl('lecture', lecture.id, lecture.auth) }}
{{ editacl('lecture', lecture.id, lecture.auth, global_acls) }}
</li>
</ul>
</div>
......@@ -182,8 +182,8 @@ $('#embedcodebtn').popover(
{% endif %}
{% endmacro %}
{% macro editacl(type,id,acl) %}
{{ acls.append(acl) }}
{% macro editacl(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 }}">
......
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