Statistics
| Branch: | Tag: | Revision:

root / templates / edumanage / services.html @ 2398cbad

History | View | Annotate | Download (5.7 kB)

1
{% extends "edumanage/welcome.html"%}
2
                        {% block crumbs %}
3
                                    <li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
4
                                    <li class="active">Services</li>
5
                                    {% endblock %}
6
{% load i18n %}
7
{% block extrahead %}
8
<script type="text/javascript" src="/static/js/jquery.dataTables.min.js"></script>
9
<script type="text/javascript" src="/static/js/datatables_bootstrap.js"></script>
10
<script type="text/javascript">
11
$(document).ready(function(){
12
         {% if services %}
13
var oTable = $('#table').dataTable({
14
        "sPaginationType": "bootstrap",
15
        "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
16
        "aoColumns": [{
17
        "bSearchable": true,
18
        "bSortable": true
19
    }, {
20
        "bSearchable": true,
21
        "bSortable": true
22
    }, {
23
        "bSearchable": true,
24
        "bSortable": true
25
    }, {
26
        "bSearchable": true,
27
        "bSortable": true
28
    }, {
29
        "bSearchable": true,
30
        "bSortable": true
31
    }, {
32
        "bSearchable": true,
33
        "bSortable": true
34
    }, {
35
        "bSearchable": true,
36
        "bSortable": true
37
    }, {
38
        "bSearchable": true,
39
        "bSortable": true
40
    }, {
41
        "bSearchable": true,
42
        "bSortable": true
43
    },{
44
        "bSearchable": true,
45
        "bSortable": true
46
    },{
47
        "bVisible": true,
48
        "bSearchable": false,
49
        "bSortable": false
50
    }],
51
    "aaSorting": [[0, 'desc']],
52
    "iDisplayLength": 25,
53
    "oSearch": {"bSmart": false, "bRegex":true},
54
    "oLanguage": {
55
            "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "services" %}',
56
        "sProcessing":   "Processing...",
57
        "sZeroRecords": '{% trans "No records to display" %}',
58
        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
59
        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
60
        "sInfoFiltered": "(filtered from _MAX_ total entries)",
61
        "sInfoPostFix":  "",
62
        "sSearch":       '{% trans "Search:" %}',
63
        "sUrl":          "",
64
        "oPaginate": {
65
            "sFirst":    '{% trans "First" %}',
66
            "sPrevious": '{% trans "Previous" %}',
67
            "sNext":     '{% trans "Next" %}',
68
            "sLast":     '{% trans "Last" %}'
69
        }
70
    }
71
});
72

73
oTable.fnDraw();
74
$('[id^=del_service_]').click(function(){
75
        server_id = (this.id).replace("del_service_", '');
76
        name = this.getAttribute("data-servicename");
77
        $("#mymodalbody").html("You are about to delete service: <b>"+name+"</b><br>Press Delete to proceed or Cancel to cancel deletion");
78
        $("#myModalLabel").html("Delete Service "+name);
79
        $('#myModal').modal('show');
80
        $(".modal-footer").show();
81
        $("#service_name_del").html(name)        
82
        return false;
83
});
84

85
$("#delserviceSubmit").click(function(){
86
        $.ajax({
87
                url:"{% url del-service %}/?service_pk="+server_id,
88
                type: "GET",
89
                success: function(data){
90
                        if (data.error){
91
                                $(".modal-footer").hide();
92
                                $("#mymodalbody").html("<font style='color:#B94A48'>"+data.error+"</font>");
93
                        }
94
                        if (data.success){
95
                                $(".modal-footer").hide();
96
                                $("#mymodalbody").html("Service "+name+" successfully deleted");
97
                                window.setTimeout('location.reload()', 1000);
98
                                
99
                        }
100
                        }
101
                });
102
});
103
{% endif %}
104
});
105
</script>
106
{% endblock %}
107
                        {% block homeactive %}{% endblock %}
108
                    {% block servicesactive %}class="active"{% endblock %}
109
            {% block subcontent %}
110
              <h4>Services</h4>
111
              <hr>
112
              <div><a href="{% url edit-services %}" class="btn btn-primary">Add new service</a></div>
113
                      <div class="span10"></div>
114
              {% load tolocale %}
115
              {% if services %}
116
               <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
117
                       <thead>
118
                                        <tr>
119
                                        <th>Name</th>
120
                                        <th>Address</th>
121
                                        <th>SSID</th>
122
                                        <th>enc_level</th>
123
                                        <th>port_restrict</th>
124
                                        <th>transp_proxy</th>
125
                                        <th>NAT</th>
126
                                        <th>IPv6</th>
127
                                        <th>AP no</th>
128
                                        <th>wired</th>
129
                                        <th>Actions</th>
130
                                        </tr>
131
                                        </thead>
132
                                        <tbody>
133
                        {% for service in services %}
134
                              <tr class="GradeC">
135
                                <td>{% tolocale service LANGUAGE_CODE%}</td>
136
                                <td>{{service.address_street}}<br>{{service.address_city}}</td>
137
                                <td>{{service.SSID}}</td>
138
                                <td>{{service.enc_level}}</td>
139
                                <td>{{service.port_restrict}}</td>
140
                                <td>{{service.transp_proxy}}</td>
141
                                <td>{{service.NAT}}</td>
142
                                <td>{{service.IPv6}}</td>
143
                                <td>{{service.AP_no}}</td>
144
                                <td>{{service.wired}}</td>                       
145
                                <td style="text-align: center;"><a href="{% url edit-services service.pk %}" class="btn btn-small">edit</a> <a href="#" id="del_service_{{service.pk}}" data-servicename="{% tolocale service LANGUAGE_CODE%}" class="btn btn-small btn-warning">delete</a></td>
146
                        </tr>
147
                              {% endfor %}
148
                              </tbody>
149
                      </table>
150
              {% else %}
151
              <div>No services defined yet (<a href="{% url edit-services %}">edit</a>)</div>
152
              {% endif %}
153
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
154
<div class="modal-header">
155
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
156
<h3 id="myModalLabel">Delete Service</h3>
157
</div>
158
<div class="modal-body" id="mymodalbody">
159

    
160
</div>
161
<div class="modal-footer">
162
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
163
<a class="btn btn-warning" id="delserviceSubmit" href="#">Delete</a>
164
</div>
165
</div>
166
                {% endblock %}