summaryrefslogtreecommitdiffstats
path: root/modules-available/usblockoff/templates/usb-rules-config.html
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/usblockoff/templates/usb-rules-config.html')
-rw-r--r--modules-available/usblockoff/templates/usb-rules-config.html122
1 files changed, 122 insertions, 0 deletions
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..eb6bea59
--- /dev/null
+++ b/modules-available/usblockoff/templates/usb-rules-config.html
@@ -0,0 +1,122 @@
+<div class="panel panel-default">
+ <div class="panel-heading">
+ {{lang_rules}}
+
+ <div class="pull-right">
+ <span style="color: red;font-weight: bold;opacity: 0.75;">
+ <span class="glyphicon glyphicon-alert" style="margin-right: 5px;"></span>
+ {{lang_firstMatchingRuleCounts}}
+ </span>
+ </div>
+ <div class="clearfix"></div>
+
+ </div>
+
+ <div class="panel-body" id="casualRules">
+ <div class="list-group">
+
+ <input type="hidden" name="rules" value="" id="rules">
+ <table id="rulesTable" class="table table-condensed table-hover fixedTableLayout">
+ <thead>
+ <tr>
+ <th style="width: 10%" data-sort="string"><span class="glyphicon glyphicon-th-list"></span></th>
+ <th style="width: 20%" class="tableWrapBreakWord" width="120">{{lang_action}}</th>
+ <th style="width: 50%" class="tableWrapBreakWord">{{lang_attributes}}</th>
+ <th style="width: 10%" class="tableWrapBreakWord">{{lang_edit}}</th>
+ <th style="width: 10%" class="tableWrapBreakWord">{{lang_delete}}</th>
+ </tr>
+ </thead>
+ <tbody id="tableBody" style="overflow: auto;">
+
+
+ {{#rules}}
+ <tr id="{{id}}">
+ <td class="drag-handler" style="cursor: pointer;text-align: center; vertical-align: middle;">
+ <span class="glyphicon glyphicon-th-list"></span>
+ </td>
+ <td class="tableWrapBreakWord" style="vertical-align: middle; text-align: center;">{{target}}</td>
+ <td class="tableWrapBreakWord">
+ {{#attributes}}
+ {{prop}}: {{value}}<br>
+ {{/attributes}}
+ {{#hasoverload}}
+ <a class="label label-default overload" style="background-color: #337ab7;" title="{{attributes_overload}}">+{{num_overload}}</a>
+ {{/hasoverload}}
+ </td>
+ <td class="tableWrapBreakWord">
+ <a class="btn btn-xs btn-info" href="?do=usblockoff&show=edit-rule&ruleid={{id}}&configid={{configid}}">
+ <span class="glyphicon glyphicon-edit"></span>
+ </a>
+ </td>
+ <td class="tableWrapBreakWord">
+ <a class="btn btn-xs btn-danger" href="?do=usblockoff&action=deleteRule&id={{id}}&configid={{configid}}">
+ <span class="glyphicon glyphicon-trash"></span>
+ </a>
+ </td>
+ </tr>
+ {{/rules}}
+
+ </tbody>
+ </table>
+ <div class="pull-right">
+ <a class="btn btn-success {{#newConfig}}disabled{{/newConfig}}"
+ {{^newConfig}}href="?do=usblockoff&show=add-generic-rule&configid={{configid}}"{{/newConfig}}
+ {{#newConfig}}title="{{lang_disabledButtons_helptext}}" style="pointer-events: auto;"{{/newConfig}}>
+ <span class="glyphicon glyphicon-plus"></span>
+ <span>{{lang_genericRule}}</span>
+ </a>
+ <a class="btn btn-success {{#newConfig}}disabled{{/newConfig}}"
+ {{^newConfig}}href="?do=usblockoff&show=add-devices&configid={{configid}}"{{/newConfig}}
+ {{#newConfig}}title="{{lang_disabledButtons_helptext}}" style="pointer-events: auto;"{{/newConfig}}>
+ <span class="glyphicon glyphicon-plus"></span>
+ <span>{{lang_devices}}</span>
+ </a>
+ </div>
+ </div>
+
+ </div>
+</div>
+<script type="text/javascript">
+ var rules = [];
+ var oldIndex = -1;
+ document.addEventListener("DOMContentLoaded", function(event) {
+ $('a.btn[title]').tooltip({placement: "auto", html: true});
+
+ $("#tableBody tr").each(function() {
+ rules.push(Number(this.id));
+ });
+ $('#rules').val(JSON.stringify(rules));
+
+ $('#tableBody').sortable({
+ opacity: 0.8,
+ handle: '.drag-handler',
+ start: function(evt, ui) {
+ oldIndex = ui.item.index();
+ ui.placeholder.css("visibility", "visible");
+ ui.placeholder.css("opacity", "0.152");
+ ui.placeholder.css("background-color", "LawnGreen");
+ },
+ stop: function(evt, ui) {
+ updateTable(ui.item.index());
+ }
+ });
+
+ $('a.overload').tooltip({placement: "auto", html: true});
+ });
+
+
+ // Called after a drag & drop event is finished.
+ function updateTable(new_index) {
+ var old_i = -1;
+ if (oldIndex === -1) {
+ return;
+ } else {
+ old_i = oldIndex;
+ oldIndex = -1;
+ }
+ var rule = rules[old_i];
+ rules.splice(old_i, 1);
+ rules.splice(new_index, 0, rule);
+ $('#rules').val(JSON.stringify(rules));
+ }
+</script> \ No newline at end of file