summaryrefslogtreecommitdiffstats
path: root/modules-available/usblockoff/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/usblockoff/templates')
-rw-r--r--modules-available/usblockoff/templates/server-prop-bool.html16
-rw-r--r--modules-available/usblockoff/templates/server-prop-dropdown.html19
-rw-r--r--modules-available/usblockoff/templates/server-prop-generic.html16
-rw-r--r--modules-available/usblockoff/templates/usb-add-generic-rule.html195
-rw-r--r--modules-available/usblockoff/templates/usb-configuration-table.html70
-rw-r--r--modules-available/usblockoff/templates/usb-daemon-config.html26
-rw-r--r--modules-available/usblockoff/templates/usb-device-list.html169
-rw-r--r--modules-available/usblockoff/templates/usb-edit-config.html68
-rw-r--r--modules-available/usblockoff/templates/usb-rules-config.html105
9 files changed, 684 insertions, 0 deletions
diff --git a/modules-available/usblockoff/templates/server-prop-bool.html b/modules-available/usblockoff/templates/server-prop-bool.html
new file mode 100644
index 00000000..de7c990a
--- /dev/null
+++ b/modules-available/usblockoff/templates/server-prop-bool.html
@@ -0,0 +1,16 @@
+<div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label for="prop-{{property}}">{{title}}</label></div>
+ <div class="col-md-7">
+ <input class="settings-bs-switch" id="prop-{{property}}" type="checkbox" name="prop-{{property}}" value="1"
+ {{#currentvalue}}checked{{/currentvalue}}>
+ </div>
+ <div class="col-md-2">
+ {{#helptext}}
+ <a class="btn btn-default" title="{{helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ {{/helptext}}
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules-available/usblockoff/templates/server-prop-dropdown.html b/modules-available/usblockoff/templates/server-prop-dropdown.html
new file mode 100644
index 00000000..337c40aa
--- /dev/null
+++ b/modules-available/usblockoff/templates/server-prop-dropdown.html
@@ -0,0 +1,19 @@
+<div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label for="prop-{{property}}">{{title}}</label></div>
+ <div class="col-md-7">
+ <select class="form-control" id="prop-{{property}}" name="prop-{{property}}">
+ {{#select_list}}
+ <option {{#active}}selected{{/active}}>{{option}}</option>
+ {{/select_list}}
+ </select>
+ </div>
+ <div class="col-md-2">
+ {{#helptext}}
+ <a class="btn btn-default" title="{{helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ {{/helptext}}
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules-available/usblockoff/templates/server-prop-generic.html b/modules-available/usblockoff/templates/server-prop-generic.html
new file mode 100644
index 00000000..3c06585e
--- /dev/null
+++ b/modules-available/usblockoff/templates/server-prop-generic.html
@@ -0,0 +1,16 @@
+<div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label for="prop-{{property}}">{{title}}</label></div>
+ <div class="col-md-7">
+ <input class="form-control" id="prop-{{property}}" type="{{inputtype}}" name="prop-{{property}}"
+ value="{{currentvalue}}">
+ </div>
+ <div class="col-md-2">
+ {{#helptext}}
+ <a class="btn btn-default" title="{{helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ {{/helptext}}
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules-available/usblockoff/templates/usb-add-generic-rule.html b/modules-available/usblockoff/templates/usb-add-generic-rule.html
new file mode 100644
index 00000000..07729db4
--- /dev/null
+++ b/modules-available/usblockoff/templates/usb-add-generic-rule.html
@@ -0,0 +1,195 @@
+<div>
+ <form method="post" action="?do=usblockoff" id="addGenericRuleForm">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="addGenericRule">
+
+ <div class="panel panel-default">
+ <div class="panel-heading">{{lang_generalOptions}}</div>
+ <div class="panel-body">
+ <div class="list-group">
+
+ {{#settings}}
+ {{{settingHtml}}}
+ {{/settings}}
+
+ </div>
+ </div>
+ </div>
+
+ <div class="panel panel-default">
+ <div class="panel-heading">{{lang_modeOptions}}
+ <input class="settings-bs-switch" id="expert_Switch" type="checkbox" name="expert_Switch"
+ data-on-text="Expert" data-off-text="Casual" data-size="small">
+ </div>
+ <div class="panel-body">
+ <div class="list-group">
+
+ <div id="casualMode">
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label>{{lang_deviceClasses}}</label></div>
+ <div class="col-md-7">
+ <select class="form-control" id="casual_selected">
+ <option value="08:*:*" selected>{{lang_mass-storage}}</option>
+ <option value="03:*:*">{{lang_hid}}</option>
+ <option value="09:*:*">{{lang_hub}}</option>
+ <option value="07:*:*">{{lang_printer}}</option>
+ <option value="01:*:*">{{lang_audio}}</option>
+ <option value="*:*:*">{{lang_all-devices}}</option>
+ </select>
+ </div>
+ <div class="col-md-2">
+ <a class="btn btn-default" title="{{lang_classes-helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label>{{lang_contains}}</label></div>
+ <div class="col-md-7">
+ <input class="settings-bs-switch" id="contains" type="checkbox" value="1" checked
+ data-size="small">
+ </div>
+ <div class="col-md-2">
+ <a class="btn btn-default" title="{{lang_contains-helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ </div>
+
+ <div id="expertMode" style="display: none;">
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label>{{lang_operator}}</label></div>
+ <div class="col-md-7">
+ <select class="form-control" id="expert_selected">
+ <option value="all-of">{{lang_all-of}}</option>
+ <option value="one-of">{{lang_one-of}}</option>
+ <option value="none-of">{{lang_none-of}}</option>
+ <option value="equals" selected>{{lang_equals}}</option>
+ <option value="equals-ordered">{{lang_equals-ordered}}</option>
+ </select>
+ </div>
+ <div class="col-md-2">
+ <a class="btn btn-default" title="{{lang_operator-helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label>{{lang_deviceClass}}</label></div>
+ <div class="col-md-7">
+ <input class="form-control" type="input" id="input_deviceClass"
+ value="">
+ </div>
+ <div class="col-md-2">
+ <a class="btn btn-default" title="{{lang_deviceClass-helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label>{{lang_deviceSubClass}}</label></div>
+ <div class="col-md-7">
+ <input class="form-control" type="input" id="input_deviceSubClass"
+ value="">
+ </div>
+ <div class="col-md-2">
+ <a class="btn btn-default" title="{{lang_deviceSubClass-helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-md-3"><label>{{lang_deviceProtocol}}</label></div>
+ <div class="col-md-7">
+ <input class="form-control" type="input" id="input_deviceProtocol"
+ value="">
+ </div>
+ <div class="col-md-2">
+ <a class="btn btn-default" title="{{lang_deviceProtocol-helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ </div>
+
+ </div>
+ </div>
+ </div>
+
+ </form>
+</div>
+
+<script type="text/javascript">
+ $('a.btn[title]').tooltip({placement: "auto", html: true});
+
+ var contains = true;
+ var c = $('#contains');
+ c.bootstrapSwitch();
+ c.on('switchChange.bootstrapSwitch', function(event, state) {
+ contains = state;
+ });
+
+ var s = $('#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.
+ $('#casualMode').hide();
+ $('#expertMode').show();
+ mode = "expert";
+ } else {
+ // Casual mode.
+ $('#expertMode').hide();
+ $('#casualMode').show();
+ mode = "casual";
+ }
+ });
+
+ // Add handler to the modal Button.
+ $('#myModalAddButton').unbind().click(addRule);
+ $('#myModalAddButtonText').text('{{lang_addRule}}');
+
+ function addRule() {
+ if ($('#rules').val() != "") {
+ $('#rules').val($('#rules').val() + "\r\n");
+ }
+ if (mode == "casual") {
+ if (contains) {
+ $('#rules').val($('#rules').val() + $('#prop-action').val() + ' with-interface one-of' + ' { ' +
+ $('#casual_selected option:selected').val() + ' }');
+ } else {
+ $('#rules').val($('#rules').val() + $('#prop-action').val() + ' with-interface ' + $('#casual_selected option:selected').val());
+ }
+ } else {
+ $('#rules').val($('#rules').val() + $('#prop-action').val() + ' with-interface ' + $('#expert_selected option:selected').val()
+ + ' { ' + $("#input_deviceClass").val() + ":" + $("#input_deviceSubClass").val() + ":"
+ + $('#input_deviceProtocol').val() + ' }');
+ }
+ $('#myModal').modal('hide');
+ }
+</script> \ No newline at end of file
diff --git a/modules-available/usblockoff/templates/usb-configuration-table.html b/modules-available/usblockoff/templates/usb-configuration-table.html
new file mode 100644
index 00000000..eb3a8839
--- /dev/null
+++ b/modules-available/usblockoff/templates/usb-configuration-table.html
@@ -0,0 +1,70 @@
+<div class="container-fluid">
+ <div class="row">
+ <div class="col-md-12">
+ <div class="page-header">
+ <h1>{{lang_usb-lock-off}}</h1>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12">
+ <table id="configurationTable" class="table table-condensed table-hover stupidtable">
+ <thead>
+ <tr>
+ <th data-sort="string">{{lang_serverName}}</th>
+ <th>{{lang_ruleInfoTODO}}</th>
+ <th>{{lang_edit}}</th>
+ <th>{{lang_delete}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#config_list}}
+ <tr>
+ <td data-sort-value="{{config_name}}">{{config_name}}</td>
+ <td>TODO: Show Rule information here</td>
+ <td>
+ <a class="btn btn-xs btn-info" href="?do=usblockoff&amp;show=edit-config&amp;configid={{config_id}}">
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
+ </td>
+ <td>
+ <a class="btn btn-xs btn-danger" onclick="deleteConfig(event, {{config_id}});">
+ <span class="glyphicon glyphicon-trash"></span>
+ </a>
+ </td>
+ </tr>
+ {{/config_list}}
+ </tbody>
+ </table>
+ <div class="buttonbar text-right">
+ <a class="btn btn-success" href="?do=usblockoff&amp;show=edit-config&amp;configid=new-default">
+ <span class="glyphicon glyphicon-plus"></span>
+ {{lang_configuration}}
+ </a>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+ function deleteConfig(event, id) {
+ event.preventDefault();
+
+ BootstrapDialog.confirm({
+ title: '{{lang_delete}}',
+ message: '{{lang_deleteConfigMessage}}',
+ type: BootstrapDialog.TYPE_DANGER, // <-- Default value is BootstrapDialog.TYPE_PRIMARY
+ closable: false, // <-- Default value is false
+ draggable: false, // <-- Default value is false
+ btnCancelLabel: '{{lang_cancel}}', // <-- Default value is 'Cancel',
+ btnOKLabel: '<span class="glyphicon glyphicon-trash"></span> {{lang_delete}}', // <-- Default value is 'OK',
+ btnOKClass: 'btn-danger', // <-- If you didn't specify it, dialog type will be used,
+ callback: function (result) {
+ if (result) {
+ url = "?do=usblockoff&action=deleteConfig&id=" + id;
+ window.location = url;
+ }
+ }
+ });
+ }
+</script> \ No newline at end of file
diff --git a/modules-available/usblockoff/templates/usb-daemon-config.html b/modules-available/usblockoff/templates/usb-daemon-config.html
new file mode 100644
index 00000000..be8c903c
--- /dev/null
+++ b/modules-available/usblockoff/templates/usb-daemon-config.html
@@ -0,0 +1,26 @@
+<div class="panel panel-default">
+ <div class="panel-heading">usbugard-daemon.conf</div>
+ <div class="panel-body">
+ <div class="list-group">
+
+ {{#list}}
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label>{{name}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input class="form-control" name="{{name}}" id="{{name}}" value="{{value}}">
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default" title="{{helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+ {{/list}}
+
+ </div>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules-available/usblockoff/templates/usb-device-list.html b/modules-available/usblockoff/templates/usb-device-list.html
new file mode 100644
index 00000000..a7c9afed
--- /dev/null
+++ b/modules-available/usblockoff/templates/usb-device-list.html
@@ -0,0 +1,169 @@
+<div>
+ <form method="post" action="?do=usblockoff" id="addDevicesForm">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="addDevices">
+
+ <div class="input-group" id="search">
+ <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
+ <input type="text" id="myInput" class="form-control" onkeyup="search()" placeholder="Search for .."
+ style="font-size: 16px;"/>
+ <span class="input-group-addon" style="width:0px; padding-left:0px; padding-right:0px; border:none;"></span>
+ <select class="form-control" id="searchFor" style="font-size: 16px;" onchange="search()">
+ <option value="0" select>Name</option>
+ <option value="1">Date / Time</option>
+ <option value="2">User Information</option>
+ <option value="3">USB Information</option>
+ <option value="4">Rules Information</option>
+ </select>
+ </div>
+
+ <div style="max-height: 800px; overflow-x: auto;">
+ <table class="table table-hover" id="myTable">
+ <thead>
+ <tr>
+ <th width="1" style="text-align: center;">Name</th>
+ <th width="1" style="text-align: center;">Time</th>
+ <th width="1">User Info</th>
+ <th width="1">USB Info</th>
+ <th width="1">Rule Info</th>
+ </tr>
+ </thead>
+ {{#list}}
+ <input type="hidden" id="{{uid}}-prop-name" value="{{name}}">
+ <input type="hidden" id="{{uid}}-prop-id" value="{{id}}">
+ <input type="hidden" id="{{uid}}-prop-serial" value="{{serial}}">
+ <input type="hidden" id="{{uid}}-prop-via-port" value="{{via-port}}">
+ <input type="hidden" id="{{uid}}-prop-hash" value="{{hash}}">
+ <input type="hidden" id="{{uid}}-prop-parent-hash" value="{{parent-hash}}">
+ <input type="hidden" id="{{uid}}-prop-with-interface" value="{{with-interface}}">
+
+ <tbody onclick="clickRow(this, {{uid}});" id="{{uid}}">
+ <tr>
+ <td nowrap align="center" style="vertical-align: middle;"><label>{{name}}</label></td>
+ <td nowrap align="center" style="vertical-align: middle;">{{time}}<br>{{date}}</td>
+ <td nowrap><font size="0">User: {{user}}<br>Location: {{location}}<br>Client: {{clientip}}</font></td>
+ <td nowrap><font size="0">id: {{id}}<br>Serial: {{serial}}<br>via-port: {{via-port}}</font></td>
+ <td nowrap><font size="0">hash: {{hash}}<br>parent-hash: {{parent-hash}}<br>with-interface:
+ {{with-interface}}</font></td>
+ </tr>
+ </tbody>
+ {{/list}}
+ </table>
+ </div>
+
+ <div class="panel panel-default">
+ <div class="panel-heading">{{lang_ruleOptions}}</div>
+ <div class="panel-body">
+ <div class="list-group">
+ <div id="settingsDIV">
+ {{#settings}}
+ {{{settingHtml}}}
+ {{/settings}}
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </form>
+</div>
+
+<script type="text/javascript">
+ $('a.btn[title]').tooltip();
+ $('.settings-bs-switch').bootstrapSwitch({size: 'small'});
+ countSelected();
+
+ // Add handler to the modal Button.
+ $('#myModalAddButton').unbind().click(addDevices);
+
+ function clickRow(tbody, uid) {
+ $(tbody).toggleClass('selected');
+ countSelected();
+ }
+
+ function countSelected() {
+ var numSelected = $('.selected').length;
+ if (numSelected == 0) {
+ $('#myModalAddButton').prop('disabled', true);
+ } else {
+ $('#myModalAddButton').prop('disabled', false);
+ }
+ if (numSelected == 1) {
+ $('#myModalAddButtonText').text(' ' + numSelected + ' {{lang_device}}');
+ } else {
+ $('#myModalAddButtonText').text(' ' + numSelected + ' {{lang_devices}}');
+ }
+ }
+
+ function search() {
+ var searchForIndex = $('#searchFor').val();
+ // Declare variables
+ var input, filter, table, tr, td, i;
+ input = document.getElementById("myInput");
+ filter = input.value.toUpperCase();
+ table = document.getElementById("myTable");
+ tr = table.getElementsByTagName("tr");
+
+ // Loop through all table rows, and hide those who don't match the search query
+ for (i = 0; i < tr.length; i++) {
+ td = tr[i].getElementsByTagName("td")[searchForIndex];
+ if (td) {
+ if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
+ tr[i].style.display = "";
+ } else {
+ tr[i].style.display = "none";
+ }
+ }
+ }
+ }
+
+ function addDevices() {
+ $('.selected').each(function () {
+ var rule = $('#prop-action').val();
+ var selected = $(this);
+ $('#settingsDIV .settings-bs-switch').each(function () {
+ if ($(this).is(":checked")) {
+ var settingname = $(this).attr('name').substring(5);
+ var info = $('#' + $(selected).attr('id') + '-' + $(this).attr('name'));
+
+ if (settingname == 'id' || settingname == 'with-interface') {
+ rule += ' ' + settingname + ' ' + info.val();
+ } else {
+ rule += ' ' + settingname + ' "' + info.val() + '"';
+ }
+ }
+ });
+ if ($('#rules').val() != "") {
+ $('#rules').val($('#rules').val() + "\r\n");
+ }
+ $('#rules').val($('#rules').val() + rule);
+ });
+ $('#myModal').modal('toggle');
+ }
+
+</script>
+
+<style type='text/css'>
+ .selected {
+ background-color: #F5F5F5;
+ }
+
+ #myTable {
+ border-collapse: collapse; /* Collapse borders */
+ width: 100%; /* Full-width */
+ border: 1px solid #ddd; /* Add a grey border */
+ }
+
+ #myTable th, #myTable td {
+ padding: 12px; /* Add padding */
+ }
+
+ #myTable tr {
+ /* Add a bottom border to all table rows */
+ border-bottom: 1px solid #ddd;
+ }
+
+ #myTable tr.header, #myTable tr:hover {
+ /* Add a grey background color to the table header and on hover */
+ background-color: #f1f1f1;
+ }
+</style>
diff --git a/modules-available/usblockoff/templates/usb-edit-config.html b/modules-available/usblockoff/templates/usb-edit-config.html
new file mode 100644
index 00000000..fc7aabfb
--- /dev/null
+++ b/modules-available/usblockoff/templates/usb-edit-config.html
@@ -0,0 +1,68 @@
+<form method="post" action="?do=usblockoff" id="configForm">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" id="formAction" value="updateConfig">
+ <input type="hidden" name="id" value="{{configid}}" id="configID">
+
+ <div class="panel panel-default">
+ <div class="panel-heading">{{lang_general}}</div>
+ <div class="panel-body">
+ <div class="list-group">
+
+ <div class="list-group-item">
+ <div class="row">
+ <div class="col-sm-3">
+ <label>{{lang_configName}}</label>
+ </div>
+ <div class="col-sm-7">
+ <input required class="form-control" name="configName" id="configName" value="{{configName}}">
+ </div>
+ <div class="col-sm-2">
+ <a class="btn btn-default" title="{{lang_configName_helptext}}">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+
+ <ul class="nav nav-tabs">
+ <li class="active"><a data-toggle="tab" href="#rulesConfigMenu">{{lang_rulesConfig}}</a></li>
+ <li><a data-toggle="tab" href="#deamonConfigMenu">{{lang_daemonConfig}}</a></li>
+ <li><a data-toggle="tab" href="#assignMenu">{{lang_assignMenu}}</a></li>
+ </ul>
+
+ <div class="tab-content">
+ <div id="rulesConfigMenu" class="tab-pane fade in active">
+ <div id="rulesConfigDIV">
+ {{{rulesConfigHtml}}}
+ </div>
+ </div>
+ <div id="deamonConfigMenu" class="tab-pane fade">
+ <div id="daemonConfigDIV">
+ {{{daemonConfigHtml}}
+ </div>
+ </div>
+ <div id="assignMenu" class="tab-pane fade">
+ <h3>Work in progress ...</h3>
+ <p>Todo: Implement this.</p>
+ <p>Or not.</p>
+ <p>¯\_(ツ)_/¯</p>
+ </div>
+ </div>
+
+ <div class="pull-right">
+ <!-- TODO: Reset Button should't call loadConfig instead do not reset the select input... but how? -->
+ <button class="btn btn-warning" type="reset" onclick="loadConfig($('#select_config'));">
+ <!-- TODO: Add discardChanges to the main-> globalVariables -->
+ <span class="glyphicon glyphicon-refresh"></span> {{lang_discardChanges}}
+ </button>
+ <a href="?do=usblockoff" class="btn btn-default">Cancel</a>
+ <button type="submit" id="configFormButton" class="btn btn-primary">
+ <span class="glyphicon glyphicon-floppy-disk"></span> {{lang_save}}
+ </button>
+ </div>
+
+</form>
diff --git a/modules-available/usblockoff/templates/usb-rules-config.html b/modules-available/usblockoff/templates/usb-rules-config.html
new file mode 100644
index 00000000..3827dc03
--- /dev/null
+++ b/modules-available/usblockoff/templates/usb-rules-config.html
@@ -0,0 +1,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> \ No newline at end of file