Revision 4772922a djnro/templates/edumanage/instrealmmons.html

b/djnro/templates/edumanage/instrealmmons.html
2 2
{% load i18n %}
3 3
{% load staticfiles %}
4 4

  
5
{% block crumbs %}
6
    <li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
7
    <li class="active">{% trans "Monitored Realms" %}</li>
8
{% endblock %}
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 message.tags %} 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>
9 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>
10 100

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

  
59 171
oTable.fnDraw();
60 172

  
61 173
$('[id^=del_instrealmmon_]').click(function(){
62
	instrealmmon_pk = (this.id).replace("del_instrealmmon_", '');
63
	name = this.getAttribute("data-realmname");
64
	$("#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' %}");
65
	$("#myModalLabel").html("{% trans 'Delete Monitored Realm' %} "+name);
66
	$('#myModal').modal('show');
67
	$("#modalfooter1").show();
68
	return false;
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;
69 181
});
70 182

  
71 183
$("#delrealmSubmit").click(function(){
......
85 197
            }
86 198
            }
87 199
        });
88
});
200
    });
89 201

  
90 202

  
91 203
$('[id^=del_monlocauthpar_]').click(function(){
......
99 211
});
100 212

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

  
115
			}
116
			}
117
		});
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
        });
118 230
});
119 231
{% endif %}
120 232
});
121 233
</script>
122 234

  
123 235
{% endblock %}
124

  
125
	{% block navbar %}
126

  
127
    		{% endblock %}
128

  
129
    		{% block homeactive %}{% endblock %}
130
    		{% block instrealmmon %}class="active"{% endblock %}
131
            {% block management_content %}
132

  
133
	              <h4>{% trans "Monitored Realms" %}</h4>
134
	              <hr>
135
	              {% if messages %}
136
                    <table class="table table-condensed">
137

  
138
                        {% for message in messages %}
139
                        <tr {% if message.tags %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
140
                        {% endfor %}
141
                    </table>
142
                  {% endif %}
143
	              <div><a href="{% url edit-instrealmmon %}" class="btn btn-primary">{% trans "Add monitored realm" %}</a></div>
144
	              <div class="span10"></div>
145
	              {% if realms %}
146
	              <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
147
					<thead>
148
					<tr>
149
						<th>{% trans "Realm" %}</th>
150
						<th>{% trans "Type" %}</th>
151

  
152

  
153
						<th style="text-align: center;">{% trans "Action" %}</th>
154
						<th>
155
	                		{% trans "Parameters" %}
156
	                		</th>
157
					</tr>
158
					</thead>
159

  
160
					<tbody>
161
	                {% for realm in realms %}
162
	              	<tr class="GradeC">
163
	                	<td>{{realm.realm}}</td>
164
	                	<td style="width: 120px;">
165
	                	{{realm.get_mon_type_display}}
166
	                	</td>
167
	                	<td style="text-align: center;">
168

  
169
	                		<a href="{% url edit-instrealmmon realm.pk %}" class="btn btn-small">{% trans "edit" %}</a>
170
	                		<a href="#" id="del_instrealmmon_{{realm.pk}}" data-realmname="{{realm.realm}}" class="btn btn-small btn-warning">{% trans "delete" %}</a>
171
	                	</td>
172
	                		<td style="text-align: center;">
173
	                		{% if realm.monlocalauthnparam %}
174
	                		<div class="well paramwell">
175
<div class="row">
176
<div class="span6">
177

  
178
                                <dl class="dl-horizontal" style=" text-align: left;">
179
                                <dt>Method</dt>
180
                                <dd>{{realm.monlocalauthnparam.get_eap_method_display}}</dd>
181
                                <dt>Phase 2</dt>
182
                                <dd>{{realm.monlocalauthnparam.get_phase2_display}}</dd>
183
                                <dt>Username</dt>
184
                                <dd>{{realm.monlocalauthnparam.username}}</dd>
185
                                </dl>
186
                                </div>
187
<div class="span6">
188
                            <a href="{% url edit-monlocauthpar realm.pk realm.monlocalauthnparam.pk %}" class="btn btn-mini">{% trans "edit" %}</a>
189
                            <a href="#" id="del_monlocauthpar_{{realm.monlocalauthnparam.pk}}" data-realmname="{{realm.realm}}" class="btn btn-small btn-warning">{% trans "delete" %}</a>
190

  
191
</div>
192
</div>
193

  
194
	                		{% else %}
195
	                		{% if not realm.monlocalauthnparam %}<a href="{% url edit-monlocauthpar realm.pk %}" class="btn btn-mini btn-primary">{% trans "add" %}</a>{% endif %}
196
	                		{% endif %}
197
	                		</td>
198

  
199

  
200
	                </tr>
201

  
202
	              	{% endfor %}
203
	              	</tbody>
204
	              </table>
205
	              {% endif %}
206
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
207
<div class="modal-header">
208
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
209
<h3 id="myModalLabel">{% trans "Delete monitored realm" %}</h3>
210
</div>
211
<div class="modal-body" id="mymodalbody">
212

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

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

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

  

Also available in: Unified diff