Skip to content
Snippets Groups Projects
Commit 7356da6b authored by David Schmitz's avatar David Schmitz
Browse files

rules views: updates for display and fixing security issue with comment

parent d593d50c
No related branches found
Tags
No related merge requests found
settings_local.py settings_local.py
settings_local.py*
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% block extrahead %} {% block extrahead %}
<link href="{{STATIC_URL}}b3theme/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet"> <link href="{{STATIC_URL}}b3theme/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
{% endblock %} {% endblock %}
{% block pagejsbodttom %} {% block pagejsbodttom %}
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.dataTables.js"></script> <script type="text/javascript" src="{{STATIC_URL}}js/jquery.dataTables.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/datatables_bootstrap.js"></script> <script type="text/javascript" src="{{STATIC_URL}}js/datatables_bootstrap.js"></script>
{% endblock %} {% endblock %}
{% block title %}{% trans "My rules" %}{% endblock %} {% block title %}{% trans "My rules" %}{% endblock %}
{% block contentplaceholder %} {% block contentplaceholder %}
{% csrf_token %}
<div class="row">
<div class="col-md-12">
<h1 class="page-header">{% trans "My rules" %} </h1>
</div>
<!-- /.col-lg-12 -->
</div>
{% csrf_token %}
<div class="row">
<div class="col-md-12">
<h1 class="page-header">{% trans "My rules" %} </h1>
</div> <!-- /.col-lg-12 -->
</div>
<div class="row"> <div class="row">
<div class="col-md-10"> <div class="col-md-10">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <i class="fa fa-shield"></i> Firewall Rules <div class="panel-heading"> <i class="fa fa-shield"></i> Firewall Rules
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered" id="routes_table">
<div class="table-responsive"> <thead>
<table class="table table-striped table-bordered" id="routes_table"> <tr>
<thead> <th>Id</th>
<tr> <th style="page-break: break-all;">{% trans "Name" %}</th>
<th>Id</th> <th>{% trans "Match" %}</th>
<th>{% trans "Name" %}</th> <th style="text-align: center;">{% trans "Then" %}</th>
<th>{% trans "Match" %}</th> <th style="text-align: center; ">{% trans "Status" %}</th>
<th style="text-align: center;">{% trans "Then" %}</th> <th style="text-align: center;">{% trans "Applier" %}</th>
<th style="text-align: center; ">{% trans "Status" %}</th> <th style="text-align: center;">{% trans "Expires" %}</th>
<th style="text-align: center;">{% trans "Applier" %}</th> <th style="text-align: center;">{% trans "Response" %}</th>
<th style="text-align: center;">{% trans "Expires" %}</th> <th style="text-align: center;">{% trans "Actions" %}</th>
<th style="text-align: center;">{% trans "Response" %}</th> </tr>
<th style="text-align: center;">{% trans "Actions" %}</th> </thead>
</tr>
</thead> <tbody>
</tbody>
<tbody> </table>
</tbody> </div>
</table> </div>
</div></div> </div>
</div></div>
<div class="col-md-2">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-tags"></i> {% trans "Shortcuts" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<a class="btn btn-sm btn-outline btn-success" id="routebutton" href="{% url add-route %}"><i class="fa fa-plus-circle"></i> {% trans "Add Rule" %}</a>
<a class="btn btn-sm btn-outline btn-info" href="{% url user-profile %}"><i class="fa fa-user"></i> {% trans "My Profile" %}</a>
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
<div class="chat-panel panel panel-info">
<div class="panel-heading">
<i class="fa fa-comment fa-fw"></i> Live status
</div>
<!-- /.panel-heading -->
<div class="panel-body">
{% include "polldash.html" %}
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div> </div>
<div class="col-md-2">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-tags"></i> {% trans "Shortcuts" %}
</div> <!-- /.panel-heading -->
<div class="panel-body">
<a class="btn btn-sm btn-outline btn-success" id="routebutton" href="{% url add-route %}"><i class="fa fa-plus-circle"></i> {% trans "Add Rule" %}</a>
<a class="btn btn-sm btn-outline btn-info" href="{% url user-profile %}"><i class="fa fa-user"></i> {% trans "My Profile" %}</a>
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
<div class="chat-panel panel panel-info">
<div class="panel-heading">
<i class="fa fa-comment fa-fw"></i> Live status
</div> <!-- /.panel-heading -->
<div class="panel-body">
{% include "polldash.html" %}
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
</div>
{% endblock %} {% endblock %}
{% block pagejsbottom %} {% block pagejsbottom %}
...@@ -233,17 +227,35 @@ $(document).ready( function(){ ...@@ -233,17 +227,35 @@ $(document).ready( function(){
}, },
"aoColumns":[ "aoColumns":[
{"mData":"id", "bSearchable": false,"bSortable": false, "bvisible":false}, {"mData":"id", "bSearchable": false,"bSortable": false, "bvisible":false},
{"mData":"details", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, {
"mRender": function (data, type, full) { "mData":"details", "sClass" : "alignCenter","bSearchable": true,"bSortable": true,
if (full.comments !== null) { "mRender": function (data, type, full) {
if (!full.comments.trim()) { if (full.comments !== null) {
return '<small>' + data + '</small>'; if (!full.comments.trim()) {
} return '<small>' + data + '</small>';
return '<a rel="tooltip" href="#" data-toggle="tooltip" data-placement="top" title='+full.comments+'><small>'+data+'</small>' }
} else { var comment_escaped = full.comments;
return 'No comments' comment_escaped = comment_escaped.replace(/&/g, "&amp;");
} comment_escaped = comment_escaped.replace(/</g, "&lt;");
} comment_escaped = comment_escaped.replace(/>/g, "&gt;");
comment_escaped = comment_escaped.replace(/"/g, "&quot;");
comment_escaped = comment_escaped.replace(/'/g, "&apos;");
//alert("test"+comment_escaped)
//alert(data)
//var temp1 = $("<a/>").html(data);
//temp1.attr("href", "#");
//temp1.attr("rel", "tooltip");
//temp1.attr("data-toggle", "tooltip");
//temp1.attr("data-placement", "top");
//temp1.attr("title", comment_escaped);
//alert(temp1.attr("href"))
//temp1.attr("delay", "3000");
return '<a rel="tooltip" data-toggle="tooltip" data-placement="top" title="'+comment_escaped+'"/>'+
'<small>.'+data+'</small>'
} else {
return 'No comments'
}
}
}, },
{"mData":"match", "sClass" : "alignCenter","bSearchable": true,"bSortable": true, {"mData":"match", "sClass" : "alignCenter","bSearchable": true,"bSortable": true,
"mRender": function (data, type, full) { "mRender": function (data, type, full) {
...@@ -388,13 +400,18 @@ var update_size = function() { ...@@ -388,13 +400,18 @@ var update_size = function() {
oTable.fnAdjustColumnSizing(); oTable.fnAdjustColumnSizing();
} }
$("body").tooltip({ selector: '[data-toggle="tooltip"]' }); $("body").tooltip("<pre/>", { selector: '[data-toggle="tooltip"]', show:{delay: 5000} });
}); });
</script> </script>
<style type="text/css"> <style type="text/css">
a {
word-wrap: break-word;
display: block;
width: 200px;
}
.dl-horizontal dt { .dl-horizontal dt {
width: 70px; width: 70px;
} }
.dl-horizontal dd { .dl-horizontal dd {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment