simple.html.j2
2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Ldap</title>
<style type="text/css">
ul {
list-style-type: none;
}
ul.attributes {
border: 1px solid black;
font-weight: normal;
display: none;
padding: 5px;
margin: 0;
}
ul.childs {
display: none;
}
button {
cursor: pointer;
background-color: rgba(0,0,0,0);
border: none;
color: black;
padding: 2px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
span.linked {
font-weight: bold;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Ldap</h1>
<script language="Javascript">
function toggle(e, cls) {
attr = e.parentElement.getElementsByClassName(cls)[0];
if(attr.style.display == 'block')
attr.style.display = 'none';
else
attr.style.display = 'block';
}
</script>
<ul class="tree">
{% set depth=0 -%}
{% for d in ldaptree.hirarchy -%}
{% if depth>=d[0] and depth!=0 -%}
<ul class="childs" {% if depth < 3 -%}style="display: block;"{% endif -%}>
</ul>
</li>
{% endif -%}
{% if depth < d[0] -%}
{% set depth=d[0] -%}
<ul class="childs" {% if depth < 3 -%}style="display: block;"{% endif -%}>
{% endif -%}
{% if depth > d[0] -%}
{% for i in range(depth-d[0]) -%}
</ul>
</li>
{% endfor -%}
{% set depth=d[0] -%}
{% endif -%}
<li>
<span {% if ldaptree.childs(d[2]) -%}class="linked"{% endif -%}
onclick="toggle(this, 'childs')">dn: {{ d[2]|e }}</span>
<button onclick="toggle(this, 'attributes')">[Attributes]</button>
<ul class="attributes">
{% for k in ldaptree.node(d[2]).keys() -%}
{% if ldaptree.node(d[2]) is string -%}
<li>{{ k }}: {{ ldaptree.node(d[2])[k]|e }}</li>
{% else -%}
{% for v in ldaptree.node(d[2])[k] -%}
<li>{{ k }}: {{ v|e }}</li>
{% endfor -%}
{% endif -%}
{% endfor -%}
</ul>
{% endfor -%}
</ul>
</body>
</html>
<!-- vim: set et ts=2 sw=2: -->