Statistics
| Branch: | Tag: | Revision:

root / djnro / templates / edumanage / instrealmmons.html @ 4772922a

History | View | Annotate | Download (8.7 kB)

1
{% extends "edumanage/welcome.html"%}
2
{% load i18n %}
3
{% load staticfiles %}
4

    
5
{% block homeactive %}{% endblock %}
6
{% block instrealmmon %}class="active"{% endblock %}
7
{% block management_content %}
8

    
9
      <h4>{% trans "Monitored Realms" %}</h4>
10
      <hr>
11
      {% if messages %}
12
        <table class="table table-condensed">
13

    
14
            {% for message in messages %}
15
            <tr {% if  %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
16
            {% endfor %}
17
        </table>
18
      {% endif %}
19

    
20
      <div class="span10"></div>
21
      {% if realms %}
22
      <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
23
                <thead>
24
                <tr>
25
                        <th>{% trans "Realm" %}</th>
26
                        <th>{% trans "Type" %}</th>
27

    
28

    
29
                        <th style="text-align: center;">{% trans "Action" %}</th>
30
                        <th>
31
                        {% trans "Parameters" %}
32
                        </th>
33
                </tr>
34
                </thead>
35

    
36
                <tbody>
37
        {% for realm in realms %}
38
              <tr class="GradeC">
39
                <td>{{realm.realm}}</td>
40
                <td style="width: 120px;">
41
                {{realm.get_mon_type_display}}
42
                </td>
43
                <td style="text-align: center;">
44

    
45
                        <a href="{% url edit-instrealmmon realm.pk %}" class="btn btn-small">{% trans "edit" %}</a>
46
                        <a href="#" id="del_instrealmmon_{{realm.pk}}" data-realmname="{{realm.realm}}" class="btn btn-small btn-warning">{% trans "delete" %}</a>
47
                </td>
48
                        <td style="text-align: center;">
49
                        {% if realm.monlocalauthnparam %}
50
                        <div class="well paramwell">
51
<div class="row">
52
<div class="span6">
53

    
54
                    <dl class="dl-horizontal" style=" text-align: left;">
55
                    <dt>Method</dt>
56
                    <dd>{{realm.monlocalauthnparam.get_eap_method_display}}</dd>
57
                    <dt>Phase 2</dt>
58
                    <dd>{{realm.monlocalauthnparam.get_phase2_display}}</dd>
59
                    <dt>Username</dt>
60
                    <dd>{{realm.monlocalauthnparam.username}}</dd>
61
                    </dl>
62
                    </div>
63
<div class="span6">
64
                <a href="{% url edit-monlocauthpar realm.pk realm.monlocalauthnparam.pk %}" class="btn btn-mini">{% trans "edit" %}</a>
65
                <a href="#" id="del_monlocauthpar_{{realm.monlocalauthnparam.pk}}" data-realmname="{{realm.realm}}" class="btn btn-small btn-warning">{% trans "delete" %}</a>
66

    
67
</div>
68
</div>
69

    
70
                        {% else %}
71
                        {% if not realm.monlocalauthnparam %}<a href="{% url edit-monlocauthpar realm.pk %}" class="btn btn-mini btn-primary">{% trans "add" %}</a>{% endif %}
72
                        {% endif %}
73
                        </td>
74

    
75

    
76
        </tr>
77

    
78
              {% endfor %}
79
              </tbody>
80
      </table>
81
      {% endif %}
82
      <div><a href="{% url edit-instrealmmon %}" class="btn btn-primary">{% trans "Add monitored realm" %}</a></div>
83

    
84
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
85
    <div class="modal-dialog">
86
        <div class="modal-content">
87
            <div class="modal-header">
88
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
89
                <h3 id="myModalLabel">{% trans "Delete monitored realm" %}</h3>
90
            </div>
91
            <div class="modal-body" id="mymodalbody">
92
            </div>
93
            <div class="modal-footer" id="modalfooter1">
94
                <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
95
                <a class="btn btn-warning" id="delrealmSubmit" href="#">{% trans "Delete" %}</a>
96
            </div>
97
        </div>
98
    </div>
99
</div>
100

    
101
<div class="modal" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
102
      <div class="modal-dialog">
103
        <div class="modal-content">
104
            <div class="modal-header">
105
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
106
                <h3 id="myModalLabel2">{% trans "Delete monitored realm" %}</h3>
107
            </div>
108
            <div class="modal-body" id="mymodalbody2">
109
            </div>
110
            <div class="modal-footer" id="modalfooter2">
111
                <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
112
                <a class="btn btn-warning" id="delmonlocauthparSubmit" href="#">{% trans "Delete" %}</a>
113
            </div>
114
        </div>
115
    </div>
116
</div>
117
{% endblock %}
118

    
119
{% block extrajs %}
120
<script type="text/javascript" src="//cdn.datatables.net/1.10.7/js/jquery.dataTables.min.js"></script>
121
<script type="text/javascript" src="//cdn.datatables.net/plug-ins/505bef35b56/integration/bootstrap/1/dataTables.bootstrap.js"></script>
122
<script type="text/javascript">
123
$(document).ready(function(){
124
{% if realms %}
125
var oTable = $('#table')
126
    .on( 'init.dt', function () {
127
            $('.pagination ul').addClass('pagination');
128
        })
129
    .dataTable({
130
        "sPaginationType": "bootstrap",
131
        "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
132
        "aoColumns": [{
133
            "bSearchable": true,
134
            "bSortable": true
135
        }, {
136
            "bSearchable": true,
137
            "bSortable": true
138
        },
139
        {
140
            "bVisible": true,
141
            "bSearchable": false,
142
            "bSortable": false
143
        },
144
        {
145
            "bSearchable": true,
146
            "bSortable": true
147
        }
148
       ],
149
        "aaSorting": [[0, 'desc']],
150
        "iDisplayLength": 25,
151
        "oSearch": {"bSmart": false, "bRegex":true},
152
        "oLanguage": {
153
            "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "realms" %}',
154
            "sProcessing":   "Processing...",
155
            "sZeroRecords": '{% trans "No records to display" %}',
156
            "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
157
            "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
158
            "sInfoFiltered": "(filtered from _MAX_ total entries)",
159
            "sInfoPostFix":  "",
160
            "sSearch":       '{% trans "Search:" %}',
161
            "sUrl":          "",
162
            "oPaginate": {
163
                "sFirst":    '{% trans "First" %}',
164
                "sPrevious": '{% trans "Previous" %}',
165
                "sNext":     '{% trans "Next" %}',
166
                "sLast":     '{% trans "Last" %}'
167
            }
168
        }
169
    });
170

171
oTable.fnDraw();
172

173
$('[id^=del_instrealmmon_]').click(function(){
174
    instrealmmon_pk = (this.id).replace("del_instrealmmon_", '');
175
    name = this.getAttribute("data-realmname");
176
    $("#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' %}");
177
    $("#myModalLabel").html("{% trans 'Delete Monitored Realm' %} "+name);
178
    $('#myModal').modal('show');
179
    $("#modalfooter1").show();
180
    return false;
181
});
182

183
$("#delrealmSubmit").click(function(){
184
    $.ajax({
185
        url:"{% url del-instrealmmon %}/?instrealmmon_pk="+instrealmmon_pk,
186
        type: "GET",
187
        success: function(data){
188
            if (data.error){
189
                $("#modalfooter1").hide();
190
                $("#mymodalbody").html("<font style='color:#B94A48'>"+data.error+"</font>");
191
            }
192
            if (data.success){
193
                $(".modal-footer").hide();
194
                $("#mymodalbody").html("monitored realm "+name+" successfully deleted");
195
                window.setTimeout('location.reload()', 1000);
196

197
            }
198
            }
199
        });
200
    });
201

202

203
$('[id^=del_monlocauthpar_]').click(function(){
204
    monlocauthpar_pk = (this.id).replace("del_monlocauthpar_", '');
205
    name = this.getAttribute("data-realmname");
206
    $("#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' %}");
207
    $("#myModalLabel2").html("{% trans 'Delete Monitored Realm Parameters' %} "+name);
208
    $('#myModal2').modal('show');
209
    $("#modalfooter1").show();
210
    return false;
211
});
212

213
$("#delmonlocauthparSubmit").click(function(){
214
    $.ajax({
215
        url:"{% url del-monlocauthpar %}/?monlocauthpar_pk="+monlocauthpar_pk,
216
        type: "GET",
217
        success: function(data){
218
            if (data.error){
219
                $("#modalfooter2").hide();
220
                $("#mymodalbody2").html("<font style='color:#B94A48'>"+data.error+"</font>");
221
            }
222
            if (data.success){
223
                $("#modalfooter2").hide();
224
                $("#mymodalbody2").html("monitored realm parameters "+name+" successfully deleted");
225
                window.setTimeout('location.reload()', 1000);
226

227
            }
228
            }
229
        });
230
});
231
{% endif %}
232
});
233
</script>
234

    
235
{% endblock %}