From 843f2dcc33fc3b556592231b9472316d485aefed Mon Sep 17 00:00:00 2001
From: Andreas <andreasv@fsmpi.rwth-aachen.de>
Date: Wed, 12 Oct 2016 00:33:39 +0200
Subject: [PATCH] made ui for permissions look better

---
 server.py             |   3 ++-
 static/l2p-logo.gif   | Bin 0 -> 271 bytes
 static/rwth.png       | Bin 0 -> 630 bytes
 templates/macros.html |  40 +++++++++++++++++++++++++---------------
 4 files changed, 27 insertions(+), 16 deletions(-)
 create mode 100644 static/l2p-logo.gif
 create mode 100644 static/rwth.png

diff --git a/server.py b/server.py
index 15d6679..e1613b1 100644
--- a/server.py
+++ b/server.py
@@ -119,7 +119,7 @@ def permdescr(perms):
 		elif perm['type'] == 'password':
 			password = True
 		elif perm['type'] == 'l2p':
-			l2p_courses.append(perm['param'])
+			l2p_courses.append(perm['param1'])
 		elif perm['type'] == 'rwth':
 			rwth_intern = True
 	if public or not perms:
@@ -287,6 +287,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['perm'] = []
+		lecture['perm'] += course['perm']
 		lecture['course'] = course
 		for perm in perms:
 			if perm['lecture_id'] == lecture['id']:
diff --git a/static/l2p-logo.gif b/static/l2p-logo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..a864af5ee9d30aa4b23cd62b061bddfe287e007a
GIT binary patch
literal 271
zcmZ?wbhEHb6lD-)IKsfdkas+3*`2zrkLtHQZr<^@b?1}5eb1&Helg?7i@C>Nt~mR8
z->nb(Z+$#;=i`yPpH4meeC65Kn=ijTc>Ck!r(bWs{QmIm_vasfzW@6B=kLG2|3KjX
z|Njg~K=CIFBLjmpgAPaxWG4e_&jYnSWwykWRb9eH3YT}K@fqG}nS4@t>YW48O-h$-
zxDKW~T<94o(z>EVD>R}aV(OBEZ{5r$=7l>6F`RpGK&`=z|J2*fvt;Z0&wQ+uNf3X?
z$i~jjBhAyqmRFE2sx8`Cp3$S#mtHGfKS^^+O&7yVmD$r~^!C?HTrzd;eC36!R?Jc6
RX4)*SExwtFTS<|@8URtrgqi>V

literal 0
HcmV?d00001

diff --git a/static/rwth.png b/static/rwth.png
new file mode 100644
index 0000000000000000000000000000000000000000..5c9168c5968474dad9bd119f24d980383eeeb736
GIT binary patch
literal 630
zcmeAS@N?(olHy`uVBq!ia0y~yU@!t<4mJh`208nVjSLJ7Y)RhkE)4%caKYZ?lNlHo
zI14-?iy0WWg+Z8+Vb&Z81_lQ95>H=O_6J<tVhTc*+n20jU|?eQba4#HxcBy&b%v;;
z$gz*{LW|u*Sl9MEU|y4xtE0lG+MA%rZN?bcF~Q3xeW6Cg3W2~QGc+1S54wr59`thY
zQ8g=z>iD4)C=w*mBe-~D!Q#_T?#-6|bRp^AhJt4`-_M*e@89jMBGl=kG|>Z0T~Ih_
zclCn$M;7r7ywAI3OcEE{%$<-D`{L+#r|3@RPha+_WFPhJIa|DL@24*^9-HLm==7TJ
z<B?8#nNa^x=IAa5X&3cb8_h2KQoUJblH~gFOnazfjNE(g$1+yCI<$>_)FQnNPMAbr
z+!W%zdeX$;qbg+&A{Vso-p*G2ak1C^aKpe;wuh>=B&D~`+UAsf^g~T=&#BATEBYQc
zn)NMre5bZ-)tCF7zDvKES6XTLyMI`C=)L`^%M+dE^K3agDQCM%_VH;|Jrh!RKb3IF
zHhvQLt@Xysz4xfq4u|E>1=_kSORgrT2r*B};kmo?&jy>livIT>y9R7tE>h38Mfv}$
zK9hy)tDFCH2GwX@IQ8G-I#cdKy+5-b_3=IowRMwv^3p<%{paEOMK*hT)`zmyw6k|_
zc+vc6OYFRD3-|A{{xsXzu{!)?+>B>AQ+J7d(QTUeENIW3I_1i$?Gbm4n3w*j>b+&{
z{kPNTHuuLbJ+VKnZ*JcazIfZ~dZVK3V;em;B`+;AuM1nbH};oU7d$Q|dZ-wg*D<=S
X$<Lc4=KPd_fq}u()z4*}Q$iB}_LLMv

literal 0
HcmV?d00001

diff --git a/templates/macros.html b/templates/macros.html
index 8f9381c..fc6285d 100644
--- a/templates/macros.html
+++ b/templates/macros.html
@@ -186,24 +186,34 @@ $('#embedcodebtn').popover(
 
 {% macro moderator_acleditor(type,id,acl,global_acls) %}
 	{% set tmp = global_acls.extend(acl) %}
-	{% if (not acl) %}
-		{% if ismod() %}
+	{% set permdescription = acl|permdescr %}
+	{% set permlogos = '' %}
+
+	{% if permdescription[0] == 'public' %}
+		{% set permlogos = '<span class="fa fa-globe" aria-hidden="true"></span>' %}
+	{% endif %}
+	{% if permdescription[0] == 'password' %}
+		{% set permlogos = '<span class="fa fa-lock" aria-hidden="true"></span>' %}
+	{% endif %}
+	{% if permdescription[0] == 'l2p' %}
+		{% set permlogos %}
+		<span class="fa" aria-hidden="true" style="width: 12px; height: 14px; background-size: cover;  background-image: url('/static/l2p-logo.gif');"></span>
+		{% endset %}
+	{% endif %}
+	{% if permdescription[0] == 'rwth' %}
+		{% set permlogos %}
+		<span class="fa" aria-hidden="true" style="width: 25px; height: 20px; background-size: cover;  background-image: url('/static/rwth.png');"></span>
+		{% endset %}
+	{% endif %}
+
+	{% if ismod() %}
 		<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>
+			{{ permlogos|safe }}	
 		</button>
-		{% endif %}
 	{% else %}
-			{% if ismod() %}
-			<button class="btn btn-default modmoderator_acleditor" data-type="{{ type }}" data-id="{{ id }}" onclick="">
-			{% else %}
-			<a>
-			{% endif %}
-				<span class="fa fa-lock" aria-hidden="true" style="color: red;"></span>
-			{% if ismod() %}
-			</button>
-			{% else %}
-			</a>
-			{% endif %}
+		<a>
+			{{ permlogos|safe }}	
+		</a>
 	{% endif %}
 	
 {% endmacro %}
-- 
GitLab