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
95
96
97
98
99
100
101
102
103
104
105
|
<div class="panel panel-default">
<div class="panel-heading">rules.conf
<input class="settings-bs-switch" id="rules_expert_Switch" type="checkbox" name="rules_expert_Switch"
data-on-text="Expert" data-off-text="Casual" data-size="small">
</div>
<div class="panel-body" id="casualRules">
<div class="list-group">
<!-- TEST_AREA -->
<div>
Work in progress ...
</div>
<!-- /TEST_AREA -->
</div>
</div>
<div class="panel-body" id="expertRules" style="display: none;">
<div class="list-group">
<div class="form-group">
<textarea class="form-control" rows="10" name="rules" id="rules">{{rules}}</textarea>
</div>
<div class="pull-right">
<a class="btn btn-default" title="{{lang_howToRuleLang}}"
href="https://usbguard.github.io/documentation/rule-language.html"
style="margin-right: -1px;" target="_blank">
<span class="glyphicon glyphicon-question-sign"></span>
</a>
<a class="btn btn-success" onclick="loadAddGenericRuleModal();"
style="margin-right: 3px; float: none;">
<span class="glyphicon glyphicon-plus"></span>
<span>{{lang_genericRule}}</span>
</a>
<a class="btn btn-success" style="float: right;" onclick="loadAddDeviceModal();">
<span style="margin-right: 5px;" class="glyphicon glyphicon-plus"></span>
<span>{{lang_devices}}</span>
</a>
</div>
</div></div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" id="myModalHeader"></div>
<div class="modal-body" id="myModalBody"></div>
<div class="modal-footer">
<a class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</a>
<button id="myModalAddButton" class="btn btn-success" type="button">
<span style="margin-right: 5px;" class="glyphicon glyphicon-plus"></span>
<span id="myModalAddButtonText"></span>
</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
$('a.btn[title]').tooltip({placement: "auto", html: true});
var s = $('#rules_expert_Switch');
var mode = "casual";
s.bootstrapSwitch();
s.parent().parent().addClass('pull-right');
s.parent().parent().css("margin", "-5px");
s.on('switchChange.bootstrapSwitch', function(event, state) {
if (state) {
// Expert mode.
$('#casualRules').hide();
$('#expertRules').show();
mode = "expert";
} else {
// Casual mode.
$('#expertRules').hide();
$('#casualRules').show();
mode = "casual";
}
});
});
function loadAddDeviceModal() {
$('#myModalHeader').text("{{lang_device-list}}").css("font-weight", "Bold");
$('#myModalAddButton').attr("form", "addDevicesForm");
$('#myModal .modal-dialog').css('width', '60%');
$('#myModal .modal-dialog').css('min-width', '60%');
$('#myModal').modal('show');
$('#myModalBody').load("?do=usblockoff&action=deviceList");
}
function loadAddGenericRuleModal() {
$('#myModalHeader').text("{{lang_add-generic-rule}}").css("font-weight", "Bold");
$('#myModalAddButton').attr("form", "addGenericRuleForm");
$('#myModal .modal-dialog').css('width', '60%');
$('#myModal .modal-dialog').css('min-width', '60%');
$('#myModal').modal('show');
$('#myModalBody').load("?do=usblockoff&action=genericRuleBuilder");
}
</script>
|