Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jannik Hellenkamp
website
Commits
b04b9298
Commit
b04b9298
authored
Oct 04, 2016
by
Andreas Valder
Browse files
overworked moderator backend, added id ankers
parent
3c079b08
Changes
8
Hide whitespace changes
Inline
Side-by-side
server.py
View file @
b04b9298
...
...
@@ -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
)
...
...
static/moderator.js
View file @
b04b9298
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
(
'
mode
ditable
value
'
)[
0
].
innerHTML
+
'
</textarea>
'
+
'
<textarea class="form-control editor
_
value" rows="3" data-path="
'
+
$
(
this
.
parentElement
).
data
(
'
path
'
)
+
'
">
'
+
this
.
parentElement
.
getElementsByClassName
(
'
mode
rator_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="moderator
interface.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="moderator
interface
.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
moderator
interface
.
acls
)
{
if
((
moderator
interface
.
acls
[
i
][
type
+
'
_id
'
]
==
id
))
{
for
(
i
in
moderator
.
acleditor
.
acls
)
{
if
((
moderator
.
acleditor
.
acls
[
i
][
type
+
'
_id
'
]
==
id
))
{
var
auth
=
{};
auth
.
type
=
moderator
interface
.
acls
[
i
][
'
auth_type
'
];
auth
.
user
=
moderator
interface
.
acls
[
i
][
'
auth_user
'
];
auth
.
password
=
moderator
interface
.
acls
[
i
][
'
auth_passwd
'
];
auth
.
id
=
moderator
interface
.
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="moderator
interface
.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="moderator
interface.addacl
(this)">Add</button>
'
;
//html += '<button class="col-xs-4" onclick="moderator
interface.delacl
(this)">Update</button>';
html
+=
'
<button class="col-xs-6" onclick="moderator
interface.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
(
moderator
interface
.
init
()
);
$
(
document
).
ready
(
function
()
{
moderator
.
init
()
;
}
);
templates/base.html
View file @
b04b9298
...
...
@@ -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, value
delete
btn
%}
{% 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>
templates/course.html
View file @
b04b9298
{% from 'macros.html' import lecture_list_item %}
{% from 'macros.html' import
value
editor %}
{% from 'macros.html' import
value
delete
btn
%}
{% from 'macros.html' import
value
checkbox %}
{% 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"
>
{{
value
editor(['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>
{{
value
delete
btn
(['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>
{{
value
editor(['courses',course.id,'semester'], course.semester) }}
</td></tr>
<tr><td>
Veranstalter:
</td><td>
{{
value
editor(['courses',course.id,'organizer'], course.organizer) }}
</td></tr>
<tr><td>
Bemerkungen:
</td><td>
{{
value
editor(['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>
{{
value
checkbox(['courses',course.id,'visible'], course.visible) }}
</td></tr>
<tr><td>
Gelistet:
</td><td>
{{
value
checkbox(['courses',course.id,'listed'], course.listed) }}
</td></tr>
<tr><td>
Downloadable:
</td><td>
{{
value
checkbox(['courses',course.id,'downloadable'], course.downloadable) }}
</td></tr>
<tr><td>
Short:
</td><td>
{{
value
editor(['courses',course.id,'short'], course.short) }}
</td></tr>
<tr><td>
Handle:
</td><td>
{{
value
editor(['courses',course.id,'handle'], course.handle) }}
</td></tr>
<tr><td>
Thema:
</td><td>
{{
value
editor(['courses',course.id,'subject'], course.subject) }}
</td></tr>
<tr><td>
Zuständig:
</td><td>
{{
value
editor(['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>
...
...
templates/import_campus.html
View file @
b04b9298
{% from 'macros.html' import
value
delete
btn
%}
{% 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') %}
{{
value
delete
btn
(['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>
...
...
templates/index.html
View file @
b04b9298
...
...
@@ -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"
>
{{
value
delete
btn
(('announcements',msg.id,'deleted')) }}
</div>
<div>
{{
value
editor(('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 {{
value
editor(('announcements',msg.id,'time_publish'), msg.time_publish) }}
Aktiv von {{
moderator_
editor(('announcements',msg.id,'time_publish'), msg.time_publish) }}
</li>
<li>
bis {{
value
editor(('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"
>
{{
value
editor(('featured',i.id,'text'), i.text) }}
{{
value
editor(('featured',i.id,'title'), i.title) }}
{{
value
checkbox(('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}}
...
...
templates/lecture.html
View file @
b04b9298
...
...
@@ -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
value
editor %}
{% from 'macros.html' import
value
delete
btn
%}
{% from 'macros.html' import
value
checkbox %}
{% 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>
{{
value
editor(['chapters',c.id,'text'],c['text']) }}
</td>
<td>
{{
value
checkbox(['chapters',c.id,'visible'], c.visible) }}
</td>
<td>
{{
value
delete
btn
(['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>
...
...
templates/macros.html
View file @
b04b9298
...
...
@@ -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=
"e
n
"
kind=
"chapters"
src=
"{{ url_for('chapters',lectureid=lecture.id) }}"
/>
<track
srclang=
"
d
e"
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}}"
>
{{
value
checkbox(['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,videos
i
,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>
{{
value
editor(['lectures',lecture.id,'title'], lecture.title) }}
</li>
{% if lecture.speaker or ismod() %}
<li>
Gehalten von {{
value
editor(['lectures',lecture.id,'speaker'], lecture.speaker) }}
</li>
{% endif %}
<li>
{{
value
editor(['lectures',lecture.id,'time'], lecture.time) }}
</li>
<li>
Dauer: {{
value
editor(['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>
{{
value
editor(['lectures',lecture.id,'comment'], lecture.comment) }}
</li>
<li>
{{
moderator_
editor(['lectures',lecture.id,'comment'], lecture.comment) }}
</li>
{% if ismod() %}
<li>
{{
value
editor(['lectures',lecture.id,'internal'], lecture.internal) }}
</li>
<li>
Sichtbar: {{
value
checkbox(['lectures',lecture.id,'visible'], lecture.visible) }}
</li>
<li>
Hörsaal: {{
value
editor(['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>
{{
value
delete
btn
(['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
value
editor (path,value) %}
{% macro
moderator_
editor (path,value) %}
{% if ismod() %}
<span
class=
"mode
ditable
"
data-path=
"{{path|join('.')}}"
><a
class=
"mode
ditable
sign btn btn-default"
tabindex=
"0"
style=
"padding: 3px; margin-right: 5px;"
><span
class=
"glyphicon glyphicon-pencil"
></span></a><span
class=
"mode
ditable
value"
>
{{ value|safe }}
</span></span>
<span
class=
"mode
rator_editor
"
data-path=
"{{path|join('.')}}"
><a
class=
"mode
rator_editor_
sign btn btn-default"
tabindex=
"0"
style=
"padding: 3px; margin-right: 5px;"
><span
class=
"glyphicon glyphicon-pencil"
></span></a><span
class=
"mode
rator_editor_
value"
>
{{ value|safe }}
</span></span>
{% else %}
{{value|fixnl|safe}}
{% endif %}
{% endmacro %}
{% macro
value
checkbox (path,value) %}
{% macro
moderator_
checkbox (path,value) %}
{% if ismod() %}
<input
type=
"checkbox"
data-path=
"{{path|join('.')}}"
{%
if
value
%}
checked
{%
endif
%}
onchange=
"moderator
interface.change
(this)"
/>
<input
type=
"checkbox"
data-path=
"{{path|join('.')}}"
{%
if
value
%}
checked
{%
endif
%}
onchange=
"moderator
.editor.changeboxclick
(this)"
/>
{% endif %}
{% endmacro %}
{% macro
value
delete
btn
(path) %}
{% macro
moderator_
delete (path) %}
{% if ismod() %}
<button
class=
"btn btn-default"
style=
"background-color: red;"
data-path=
"{{path|join('.')}}"
onclick=
"moderator
interface.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 mod
editacl
"
data-type=
"{{ type }}"
data-id=
"{{ id }}"
>
<button
class=
"btn btn-default mod
moderator_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 mod
editacl
"
data-type=
"{{ type }}"
data-id=
"{{ id }}"
onclick=
""
>
<button
class=
"btn btn-default mod
moderator_acleditor
"
data-type=
"{{ type }}"
data-id=
"{{ id }}"
onclick=
""
>