Statistics
| Branch: | Tag: | Revision:

root / djnro / templates / edumanage / instrealmmons.html @ d3ea44a4

History | View | Annotate | Download (8.8 kB)

1
{% extends "edumanage/welcome.html"%}
2
{% load i18n %}
3
                        {% block crumbs %}
4
                                    <li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
5
                                    <li class="active">{% trans "Monitored Realms" %}</li>
6
                                    {% endblock %}
7
{% load i18n %}
8
{% block extrahead %}
9
<script type="text/javascript" src="/static/js/jquery.dataTables.min.js"></script>
10
<script type="text/javascript" src="/static/js/datatables_bootstrap.js"></script>
11

    
12
<script type="text/javascript">
13
$(document).ready(function(){
14
{% if realms %}
15
var oTable = $('#table').dataTable({
16
        "sPaginationType": "bootstrap",
17
        "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
18
        "aoColumns": [{
19
        "bSearchable": true,
20
        "bSortable": true
21
    }, {
22
        "bSearchable": true,
23
        "bSortable": true
24
    },
25
    {
26
        "bVisible": true,
27
        "bSearchable": false,
28
        "bSortable": false
29
    },
30
    {
31
        "bSearchable": true,
32
        "bSortable": true
33
    }
34
   ],
35
    "aaSorting": [[0, 'desc']],
36
    "iDisplayLength": 25,
37
    "oSearch": {"bSmart": false, "bRegex":true},
38
    "oLanguage": {
39
            "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "realms" %}',
40
        "sProcessing":   "Processing...",
41
        "sZeroRecords": '{% trans "No records to display" %}',
42
        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
43
        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
44
        "sInfoFiltered": "(filtered from _MAX_ total entries)",
45
        "sInfoPostFix":  "",
46
        "sSearch":       '{% trans "Search:" %}',
47
        "sUrl":          "",
48
        "oPaginate": {
49
            "sFirst":    '{% trans "First" %}',
50
            "sPrevious": '{% trans "Previous" %}',
51
            "sNext":     '{% trans "Next" %}',
52
            "sLast":     '{% trans "Last" %}'
53
        }
54
    }
55
});
56

57
oTable.fnDraw();
58

59
$('[id^=del_instrealmmon_]').click(function(){
60
        instrealmmon_pk = (this.id).replace("del_instrealmmon_", '');
61
        name = this.getAttribute("data-realmname");
62
        $("#mymodalbody").html("{% trans 'You are about to delete monitored realm (and its parameters if any)' %}: <b>"+name+"</b><br>{% trans 'Press Delete to proceed or Cancel to cancel deletion' %}");
63
        $("#myModalLabel").html("{% trans 'Delete Monitored Realm' %} "+name);
64
        $('#myModal').modal('show');
65
        $("#modalfooter1").show();
66
        return false;
67
});
68

69
$("#delrealmSubmit").click(function(){
70
    $.ajax({
71
        url:"{% url del-instrealmmon %}/?instrealmmon_pk="+instrealmmon_pk,
72
        type: "GET",
73
        success: function(data){
74
            if (data.error){
75
                $("#modalfooter1").hide();
76
                $("#mymodalbody").html("<font style='color:#B94A48'>"+data.error+"</font>");
77
            }
78
            if (data.success){
79
                $(".modal-footer").hide();
80
                $("#mymodalbody").html("monitored realm "+name+" successfully deleted");
81
                window.setTimeout('location.reload()', 1000);
82
                
83
            }
84
            }
85
        });
86
});
87

88

89
$('[id^=del_monlocauthpar_]').click(function(){
90
    monlocauthpar_pk = (this.id).replace("del_monlocauthpar_", '');
91
    name = this.getAttribute("data-realmname");
92
    $("#mymodalbody2").html("{% trans 'You are about to delete monitored realm parameters for ' %}: <b>"+name+"</b><br>{% trans 'Press Delete to proceed or Cancel to cancel deletion' %}");
93
    $("#myModalLabel2").html("{% trans 'Delete Monitored Realm Parameters' %} "+name);
94
    $('#myModal2').modal('show');
95
    $("#modalfooter1").show();
96
    return false;
97
});
98

99
$("#delmonlocauthparSubmit").click(function(){
100
        $.ajax({
101
                url:"{% url del-monlocauthpar %}/?monlocauthpar_pk="+monlocauthpar_pk,
102
                type: "GET",
103
                success: function(data){
104
                        if (data.error){
105
                                $("#modalfooter2").hide();
106
                                $("#mymodalbody2").html("<font style='color:#B94A48'>"+data.error+"</font>");
107
                        }
108
                        if (data.success){
109
                                $("#modalfooter2").hide();
110
                                $("#mymodalbody2").html("monitored realm parameters "+name+" successfully deleted");
111
                                window.setTimeout('location.reload()', 1000);
112
                                
113
                        }
114
                        }
115
                });
116
});
117
{% endif %}
118
});
119
</script>
120

    
121
{% endblock %}
122

    
123
        {% block navbar %}
124
                        
125
                    {% endblock %}
126
                    
127
                    {% block homeactive %}{% endblock %}
128
                    {% block instrealmmon %}class="active"{% endblock %}
129
            {% block subcontent %}
130

    
131
                      <h4>{% trans "Monitored Realms" %}</h4>
132
                      <hr>
133
                      {% if messages %}
134
                    <table class="table table-condensed">
135
                    
136
                        {% for message in messages %}
137
                        <tr {% if  %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
138
                        {% endfor %}
139
                    </table>
140
                  {% endif %}
141
                      <div><a href="{% url edit-instrealmmon %}" class="btn btn-primary">{% trans "Add monitored realm" %}</a></div>
142
                      <div class="span10"></div>
143
                      {% if realms %}
144
                      <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
145
                                        <thead>
146
                                        <tr>
147
                                                <th>{% trans "Realm" %}</th>
148
                                                <th>{% trans "Type" %}</th>
149
                                                
150
                                        
151
                                                <th style="text-align: center;">{% trans "Action" %}</th>
152
                                                <th>
153
                                        {% trans "Parameters" %}
154
                                        </th>
155
                                        </tr>
156
                                        </thead>
157
                                        
158
                                        <tbody>
159
                        {% for realm in realms %}
160
                              <tr class="GradeC">
161
                                <td>{{realm.realm}}</td>
162
                                <td style="width: 120px;">
163
                                {{realm.get_mon_type_display}}
164
                                </td>
165
                                <td style="text-align: center;">
166
                                        
167
                                        <a href="{% url edit-instrealmmon realm.pk %}" class="btn btn-small">{% trans "edit" %}</a> 
168
                                        <a href="#" id="del_instrealmmon_{{realm.pk}}" data-realmname="{{realm.realm}}" class="btn btn-small btn-warning">{% trans "delete" %}</a>
169
                                </td>
170
                                        <td style="text-align: center;">
171
                                        {% if realm.monlocalauthnparam %}
172
                                        <div class="well paramwell">
173
<div class="row">
174
<div class="span6">
175
                            
176
                                <dl class="dl-horizontal" style=" text-align: left;">
177
                                <dt>Method</dt>
178
                                <dd>{{realm.monlocalauthnparam.get_eap_method_display}}</dd>
179
                                <dt>Phase 2</dt>
180
                                <dd>{{realm.monlocalauthnparam.get_phase2_display}}</dd>
181
                                <dt>Username</dt>
182
                                <dd>{{realm.monlocalauthnparam.username}}</dd>
183
                                </dl>
184
                                </div>
185
<div class="span6">
186
                            <a href="{% url edit-monlocauthpar realm.pk realm.monlocalauthnparam.pk %}" class="btn btn-mini">{% trans "edit" %}</a>
187
                            <a href="#" id="del_monlocauthpar_{{realm.monlocalauthnparam.pk}}" data-realmname="{{realm.realm}}" class="btn btn-small btn-warning">{% trans "delete" %}</a>
188
                            
189
</div>
190
</div>
191
                                            
192
                                        {% else %}
193
                                        {% if not realm.monlocalauthnparam %}<a href="{% url edit-monlocauthpar realm.pk %}" class="btn btn-mini btn-primary">{% trans "add" %}</a>{% endif %}
194
                                        {% endif %}
195
                                        </td>
196
                                
197
                                
198
                        </tr>
199
                        
200
                              {% endfor %}
201
                              </tbody>
202
                      </table>
203
                      {% endif %}
204
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
205
<div class="modal-header">
206
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
207
<h3 id="myModalLabel">{% trans "Delete monitored realm" %}</h3>
208
</div>
209
<div class="modal-body" id="mymodalbody">
210

    
211
</div>
212
<div class="modal-footer" id="modalfooter1">
213
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
214
<a class="btn btn-warning" id="delrealmSubmit" href="#">{% trans "Delete" %}</a>
215
</div>
216
</div>
217

    
218
<div class="modal hide fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
219
<div class="modal-header">
220
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
221
<h3 id="myModalLabel2">{% trans "Delete monitored realm" %}</h3>
222
</div>
223
<div class="modal-body" id="mymodalbody2">
224

    
225
</div>
226
<div class="modal-footer" id="modalfooter2">
227
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
228
<a class="btn btn-warning" id="delmonlocauthparSubmit" href="#">{% trans "Delete" %}</a>
229
</div>
230
</div>
231
            {% endblock %}
232