blob: 37d0d5fe46acb432749a712032f3d51ed55bc506 (
plain) (
blame)
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
90
91
92
93
94
|
<h2>
{{#roleid}}
{{lang_editRoleHeading}}
{{/roleid}}
{{^roleid}}
{{#builtin}}
{{lang_copyRoleHeading}}
{{/builtin}}
{{^builtin}}
{{lang_addRoleHeading}}
{{/builtin}}
{{/roleid}}
</h2>
<form method="post" action="?do=permissionmanager">
<input type="hidden" name="action" value="saveRole">
<input type="hidden" name="token" value="{{token}}">
<input type="hidden" name="roleid" value="{{roleid}}">
<div class="input-group">
<span class="input-group-addon slx-ga">
<label for="rolename">{{lang_name}}</label>
</span>
<input id="rolename" name="rolename" value="{{rolename}}" type="text" class="form-control" required>
</div>
<div class="input-group">
<span class="input-group-addon slx-ga">
<label for="roledescription">{{lang_description}}</label>
</span>
<input id="roledescription" name="roledescription" value="{{roledescription}}" type="text" class="form-control">
</div>
<br>
<div class="pull-right">
<a href="?do=permissionmanager&show={{cancelShow}}" class="btn btn-default">{{lang_cancel}}</a>
<button type="submit" class="btn btn-primary" {{perms.roles.edit.disabled}}>
<span class="glyphicon glyphicon-floppy-disk"></span>
{{lang_save}}
</button>
</div>
<ul class="nav nav-tabs text-center" role="tablist">
<li role="presentation" class="active"><a href="#permissions" role="tab" data-toggle="tab">{{lang_permissions}}</a></li>
<li role="presentation"><a href="#locations" role="tab" data-toggle="tab">{{lang_locations}}</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="permissions">
{{{permissionHTML}}}
<div class="panel panel-default">
<div class="panel-body">
<span class="glyphicon glyphicon-home text-muted"></span> 
{{lang_locationAwareDesc}}
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="locations">
{{{locationHTML}}}
</div>
</div>
</form>
<script type="application/javascript">
document.addEventListener("DOMContentLoaded", function () {
$(".tree-container input[type=checkbox]").change(function () {
// (Un)Mark all sub-elements when changing a checkbox in the panel body
var $this = $(this);
var checked = $this.prop("checked");
$this.closest('li').find("input[type=checkbox]").prop("checked", checked);
if (!checked) {
var parent = $(this).parent().parent();
while (!parent.hasClass("tree-panel")) {
parent = parent.parent().parent();
if (parent.hasClass("tree-container")) parent = parent.parent().parent();
parent.find("input[type=checkbox]:first").prop("checked", false);
}
}
});
$("input.master-checkbox").change(function () {
// (Un)Mark everything within the panel when the master checkbox on top is clicked
var $this = $(this);
var checked = $this.prop("checked");
$this.closest('.tree-panel').find("input[type=checkbox]").prop("checked", checked);
});
$('[data-toggle="tooltip"]').tooltip({
container: 'body',
trigger : 'hover'
});
});
</script>
|