File size: 3,695 Bytes
7c89ed7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!--
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
Copyright (c) 2014 Mozilla Corporation

contains two ways to display the same dshield data
non-modal: for http(s)://servername/ipdshield/1.2.3.4
modal: for  Session.set('ipdshieldipaddress','1,2.3.4') then
            $('#modaldshieldwindow').modal()
-->

<template name="ipdshield">
<body>


<div class="container">
    <div class="well">
        dshield: {{dshield.status}} {{dshield.error}}
    </div>
    <div class="row"><a class="showmodal" href=#>click me for modal</a></div>
    <div class="row center">
        <ul class="unstyled">
        {{#each objKeyValue dshield.data}}

            {{#if isAnObject value}}
                <li><ul class="unstyled">{{key}}
                {{#with value}}
                    {{#each objKeyValue this}}
                        <li>{{key}}:
                        {{value}}</li>
                    {{/each}}
                {{/with}}
                </ul></li>
            {{else}}
                <li>
                    {{key}}:
                    {{value}}
                </li>
            {{/if}}
        {{/each}}
        </ul>
    </div>
    <div class="row center">
        <span>raw json:</span>
        <span class="unstyled">
                {{dshield.content}}
        </span>
    </div>
    {{>dshieldmodal}}
</div>
</body>
</template>

<template name="dshieldmodal">
    <div class="modal fade" id="modaldshieldwindow">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                   <button type="button" class="close" data-dismiss="modal">&times;</button>
                   <h4>DShield Results</h4>
                </div>
                <div class="modal-body">
                    <div class="row center">
                        <div class="well">
                            dshield: {{dshield.status}} {{dshield.error}}
                        </div>
                    </div>
                    <div class="row  center">
                        <ul class="list-unstyled">
                        {{#each objKeyValue dshield.data}}

                            {{#if isAnObject value}}
                                <li><ul class="list-unstyled">{{key}}
                                {{#with value}}
                                    {{#each objKeyValue this}}
                                        <li>{{key}}:
                                        {{value}}</li>
                                    {{/each}}
                                {{/with}}
                                </ul></li>
                            {{else}}
                                <li>
                                    {{key}}:
                                    {{value}}
                                </li>
                            {{/if}}
                        {{/each}}
                        </ul>
                    </div>
                    <div class="col-xs-1"><button class="btn btn-xs" data-toggle="collapse" data-target="#rawdshieldjson">raw json</button></div>
                    <div class="col-xs-7 col-xs-offset-1">
                        <div id='rawdshieldjson' class="collapse">
                            <pre>{{dshield.content}}</pre>
                        </div>
                    </div>
              </div>
              <div class="modal-footer">
                <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
              </div>
            </div>
        </div>
    </div>
</template>