Commit 8eaf2c59 authored by Andreas Valder's avatar Andreas Valder
Browse files

finished renaming acl/auth to perm/permission closes #67

parent 0fefb18f
......@@ -95,19 +95,19 @@ var moderator = {
}
}
},
acleditor: {
acls: [],
setacls: function(value) {
permissioneditor: {
permissions: [],
setpermissions: function(value) {
var idlist = [];
for (i in value) {
if (idlist.indexOf(value[i]['id']) == -1) {
idlist[idlist.length] = value[i]['id'];
moderator.acleditor.acls[moderator.acleditor.acls.length] = value[i];
moderator.permissioneditor.permissions[moderator.permissioneditor.permissions.length] = value[i];
}
}
},
init: function () {
$('.modmoderator_acleditor').popover(
$('.modmoderator_permissioneditor').popover(
{
title: "Zugriffsrechte",
html: true,
......@@ -119,15 +119,15 @@ var moderator = {
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="moderator.acleditor.selectacl(this)" size="6" class="col-xs-12 acllist">';
html += '<select onchange="moderator.permissioneditor.selectpermission(this)" size="6" class="col-xs-12 permissionlist">';
var idlist = [];
for (i in moderator.acleditor.acls) {
if ((moderator.acleditor.acls[i][type+'_id'] == id)) {
for (i in moderator.permissioneditor.permissions) {
if ((moderator.permissioneditor.permissions[i][type+'_id'] == id)) {
var perm = {};
perm.type = moderator.acleditor.acls[i]['type'];
perm.param1 = moderator.acleditor.acls[i]['param1'];
perm.param2 = moderator.acleditor.acls[i]['param2'];
perm.id = moderator.acleditor.acls[i]['id'];
perm.type = moderator.permissioneditor.permissions[i]['type'];
perm.param1 = moderator.permissioneditor.permissions[i]['param1'];
perm.param2 = moderator.permissioneditor.permissions[i]['param2'];
perm.id = moderator.permissioneditor.permissions[i]['id'];
idlist[idlist.length] = perm.id;
permstring = '';
......@@ -149,7 +149,7 @@ var moderator = {
}
}
html += '</select>';
html += '<select class="col-xs-12 authtype" onchange="moderator.acleditor.acltypechange(this)">';
html += '<select class="col-xs-12 authtype" onchange="moderator.permissioneditor.typechange(this)">';
html += '<option value="public">Öffentlich</option>';
html += '<option selected value="password">Password</option>';
html += '<option value="rwth">RWTH intern</option>';
......@@ -158,20 +158,20 @@ var moderator = {
html += '<input class="col-xs-12 passwordinput authuser" type="text" placeholder="Benutzername">';
html += '<input class="col-xs-12 passwordinput authpassword" type="text" placeholder="Passwort">';
html += '<input class="col-xs-12 authl2p" type="text" placeholder="Lernraum" style="display: none;">';
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 += '<button class="col-xs-6" onclick="moderator.permissioneditor.addbtnclick(this)">Add</button>';
//html += '<button class="col-xs-4" onclick="moderator.permissionedior.updatebtnclick(this)">Update</button>';
html += '<button class="col-xs-6" onclick="moderator.permissioneditor.delbtnclick(this)">Delete</button>';
html += '</div>';
return html;
}
}
);
},
selectacl: function (element) {
selectpermission: function (element) {
},
delbtnclick: function (element) {
moderator.api.set("perm."+$(".acllist option:selected", element.parentElement).data('auth_id')+".deleted",1,true);
moderator.api.set("perm."+$(".permissionlist option:selected", element.parentElement).data('auth_id')+".deleted",1,true);
},
addbtnclick: function (element) {
var perm = {};
......@@ -196,9 +196,9 @@ var moderator = {
"text": perm.type+' '+( perm.type == "password" ? ' ("'+perm.param1+'":"'+perm.param2+'")' : '' ) ,
"data-auth": JSON.stringify(perm)
});
$(".acllist",element.parentElement).append(option);
$(".permissionlist",element.parentElement).append(option);
},
acltypechange: function (element) {
typechange: function (element) {
switch ($(element).val()) {
case 'password':
$(".passwordinput",element.parentElement).show();
......@@ -218,7 +218,7 @@ var moderator = {
init: function () {
moderator.api.init();
moderator.editor.init();
moderator.acleditor.init();
moderator.permissioneditor.init();
}
};
......
{% set page_border = page_border|default(1) %}
{% set global_acls = [] %}
{% set global_permissions = [] %}
{% 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 moderator_editor, moderator_checkbox, moderator_delete %}
......@@ -145,7 +145,7 @@
{% if ismod() %}
<script>
$( function () {
moderator.acleditor.setacls({{global_acls|tojson|safe}});
moderator.permissioneditor.setpermissions({{global_permissions|tojson|safe}});
});
</script>
{% endif %}
......
......@@ -3,7 +3,7 @@
{% from 'macros.html' import moderator_delete %}
{% from 'macros.html' import moderator_checkbox %}
{% from 'macros.html' import preview %}
{% from 'macros.html' import moderator_acleditor %}
{% from 'macros.html' import moderator_permissioneditor %}
{% extends "base.html" %}
{% block content %}
......@@ -12,7 +12,7 @@
<h1 class="panel-title">{{ moderator_editor(['courses',course.id,'title'], course.title)}} {% if ismod() %}<i>(<a href={{ url_for('course', id=course.id) }}>{{course.id}}</a>)</i>{% endif %}
<ul class="pull-right list-inline">
<li>{{ moderator_delete(['courses',course.id,'deleted']) }}</li>
<li>{{ moderator_acleditor('course',course.id,course.perm, global_acls) }}</li>
<li>{{ moderator_permissioneditor('course',course.id,course.perm, global_permissions) }}</li>
</ul>
</h1>
</div>
......@@ -54,7 +54,7 @@
</div>
<ul class="list-group lectureslist">
{% for l in lectures %}
{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list,global_acls)}}
{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list,global_permissions)}}
{% endfor %}
</ul>
</div>
......
......@@ -114,7 +114,7 @@ $('#embedcodebtn').popover(
</script>
{% endmacro %}
{% macro lecture_list_item(lecture,videos,global_acls) %}
{% macro lecture_list_item(lecture,videos,global_permissions) %}
<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=''; ">
......@@ -154,7 +154,7 @@ $('#embedcodebtn').popover(
{{ moderator_delete(['lectures',lecture.id,'deleted']) }}
</li>
<li>
{{ moderator_acleditor('lecture', lecture.id, lecture.perm, global_acls) }}
{{ moderator_permissioneditor('lecture', lecture.id, lecture.perm, global_permissions) }}
</li>
</ul>
</div>
......@@ -184,9 +184,9 @@ $('#embedcodebtn').popover(
{% endif %}
{% endmacro %}
{% macro moderator_acleditor(type,id,acl,global_acls) %}
{% set tmp = global_acls.extend(acl) %}
{% set permdescription = acl|permdescr %}
{% macro moderator_permissioneditor(type,id,perm,global_permissions) %}
{% set tmp = global_permissions.extend(perm) %}
{% set permdescription = perm|permdescr %}
{% set permlogos = '' %}
{% if permdescription[0] == 'public' %}
......@@ -207,7 +207,7 @@ $('#embedcodebtn').popover(
{% endif %}
{% if ismod() %}
<button class="btn btn-default modmoderator_acleditor" data-type="{{ type }}" data-id="{{ id }}">
<button class="btn btn-default modmoderator_permissioneditor" data-type="{{ type }}" data-id="{{ id }}">
{{ permlogos|safe }}
</button>
{% else %}
......
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