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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Mail::DMARC::HTTP</title>
<link rel="stylesheet" type="text/css" media="screen" href="https://code.jquery.com/ui/1.10.3/themes/cupertino/jquery-ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/dmarc/css/ui.jqgrid.css" />
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="/dmarc/js/i18n/grid.locale-en.js"></script>
<script type="text/javascript" src="/dmarc/js/jquery.jqGrid.min.js"></script>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
font-size: 80%;
}
span.cellWithoutBackground {
display: block;
background-image: none;
margin-right:-2px;
margin-left:-2px;
height: 14px;
padding:4px;
}
</style>
<script type="text/javascript">
// Set the options globally
jQuery.extend(jQuery.jgrid.defaults, {
altRows:true,
datatype: "json",
height:'60%',
jsonReader : {
root: 'rows',
page: 'cur_page',
total: 'total_pages',
records:'total_rows',
repeatitems:false,
subgrid: {
root: 'rows',
page: 'cur_page',
total: 'total_pages',
records:'total_rows',
repeatitems:false,
},
},
pager: '#gridpager',
});
jQuery(document).ready(function(){
jQuery("#grid").jqGrid({
url:'/dmarc/json/report',
mtype: 'POST',
colNames:['Id','Sender/From','Org Name','Begin','End','UUID' ],
colModel :[
{name:'rid', index:'rid', width:30, align:'center', sortable: true },
{name:'from_domain', index:'from_domain', width:150, align:'right', sortable: true},
{name:'author', index:'author', width:170, align:'center' },
{name:'begin', index:'begin', width:100, sorttype:'date'},
{name:'end', index:'end', width:100, sorttype:'date'},
{name:'uuid', index:'uuid', width:250, align:'left'},
],
rowNum: 100,
rowList: [50,100,500],
sortname: 'rid',
viewrecords: true,
editurl:"/dmarc/json/record/edit",
sortorder: 'desc',
caption:"DMARC Reports",
subGrid: true,
subGridRowExpanded: (subgrid_id, row_id) => {
// subgrid_id is a id of the div tag created within a table
// the row_id is the id of the row
// If we want to pass additional parameters to the url we can use
// the method getRowData(row_id) - which returns associative array in type name-value
var subgrid_table_id;
subgrid_table_id = subgrid_id+"_t";
var row_data = jQuery('#grid').getRowData(row_id);
jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"/dmarc/json/row?rid="+ row_data.rid,
datatype: "json",
colNames: ['Header From','IP','#','Disposition','SPF','DKIM','Envelope To','Envelope From'],
colModel: [
{name:"header_from",index:"header_from",width:140,align:"right",key:true},
{name:"source_ip",index:"source_ip",width:200,align:"center",key:true},
{name:"count",index:"count",width:20,align:"center"},
{name:"disposition",index:"disposition",width:70,align:"center",formatter:dmarcFormatter},
{name:"spf",index:"spf",width:40,align:"center",formatter:dmarcFormatter},
{name:"dkim",index:"dkim",width:40,align:"center",formatter:dmarcFormatter},
{name:"envelope_to",index:"envelope_to",width:140,align:"right",sortable:false},
{name:"envelope_from",index:"envelope_from",width:100,align:"right"},
],
height: '100%',
rowNum:20,
sortname: 'num',
pager: false,
sortorder: "asc"
});
},
filterToolbar: {
autosearch:true
},
})
.navGrid('#gridpager',{add:false,del:false,edit:false,search:true});
});
function dmarcFormatter (cellValue, Options, rowObject) {
let color;
if ( cellValue == 'fail' ) color = '#FFCCCC';
if ( cellValue == 'pass' ) color = '#CCFFCC'; // CCFFCC green
if ( cellValue == 'reject' ) color = '#FFCCCC'; // FFCCCC red
if ( cellValue == 'quarantine' ) color = '#FFFFCC'; // FFFFCC yellow
if ( cellValue == 'none' ) color = '#CCFFCC';
return '<span class="cellWithoutBackground" style="background-color: '+color+';">' + cellValue +'</span>';
};
jQuery("#mybutton").click(function() {
jQuery("#grid").setColumns({'Begin':'begin','End':'end'});
return false;
});
</script>
</head>
<body>
<p><a href="https://search.cpan.org/dist/Mail-DMARC/">Mail::DMARC::HTTP</a>.</p>
<div id="mybutton"></div>
<div id="jqgrid">
<table id="grid"></table>
<div id="gridpager"></div>
</div>
</body>
</html>
|