Statistics
| Branch: | Tag: | Revision:

root / templates / edumanage / services.html @ 138dad8b

History | View | Annotate | Download (6.3 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 "Services" %}</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
<script type="text/javascript">
12
$(document).ready(function(){
13
         {% if services %}
14
var oTable = $('#table').dataTable({
15
        "sPaginationType": "bootstrap",
16
        "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
17
        "aoColumns": [{
18
        "bSearchable": true,
19
        "bSortable": true
20
    }, {
21
        "bSearchable": true,
22
        "bSortable": true
23
    }, {
24
        "bSearchable": true,
25
        "bSortable": true
26
    }, {
27
        "bSearchable": true,
28
        "bSortable": true
29
    }, {
30
        "bSearchable": true,
31
        "bSortable": true
32
    }, {
33
        "bVisible": true,
34
        "bSearchable": false,
35
        "bSortable": false
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 "services" %}',
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" %}'
55
        }
56
    }
57
});
58

59
oTable.fnDraw();
60
$('[id^=del_service_]').click(function(){
61
        server_id = (this.id).replace("del_service_", '');
62
        name = this.getAttribute("data-servicename");
63
        $("#mymodalbody").html("{% trans 'You are about to delete service' %}: <b>"+name+"</b><br>{% trans 'Press Delete to proceed or Cancel to cancel deletion' %}");
64
        $("#myModalLabel").html("{% trans 'Delete Service' %} "+name);
65
        $('#myModal').modal('show');
66
        $(".modal-footer").show();
67
        $("#service_name_del").html(name)        
68
        return false;
69
});
70

71
$("#delserviceSubmit").click(function(){
72
        $.ajax({
73
                url:"{% url del-service %}/?service_pk="+server_id,
74
                type: "GET",
75
                success: function(data){
76
                        if (data.error){
77
                                $(".modal-footer").hide();
78
                                $("#mymodalbody").html("<font style='color:#B94A48'>"+data.error+"</font>");
79
                        }
80
                        if (data.success){
81
                                $(".modal-footer").hide();
82
                                $("#mymodalbody").html("{% trans 'Service' %} "+name+" {% trans 'successfully deleted' %}");
83
                                window.setTimeout('location.reload()', 1000);
84
                                
85
                        }
86
                        }
87
                });
88
});
89
{% endif %}
90
});
91
</script>
92
{% endblock %}
93
                        {% block homeactive %}{% endblock %}
94
                    {% block servicesactive %}class="active"{% endblock %}
95
            {% block subcontent %}
96
              <h4>{% trans "Services" %}</h4>
97
              <hr>
98
              {% if messages %}
99
                        <table class="table table-condensed">
100
                                        
101
                                            {% for message in messages %}
102
                                            <tr {% if  %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
103
                                            {% endfor %}
104
                                        </table>
105
                          {% endif %}
106
              <div>{% if institution.ertype == 2 or institution.ertype == 3 %}<a href="{% url edit-services %}" class="btn btn-primary">{% trans "Add new service" %}</a>{% endif %}</div>
107
                      <div class="span10"></div>
108
              {% load tolocale %}
109
              {% if institution.ertype == 2 or institution.ertype == 3 %}
110
              {% if services %}
111
               <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
112
                       <thead>
113
                                        <tr>
114
                                        <th>{% trans "Name" %}</th>
115
                                        <th>{% trans "Address" %}</th>
116
                                        <th>{% trans "SSID" %}</th>
117
                                        <th>{% trans "Encryption Level" %}</th>
118
                                        <th>{% trans "AP no" %}</th>
119
                                        <th>{% trans "Actions" %}</th>
120
                                        </tr>
121
                                        </thead>
122
                                        <tbody>
123
                        {% for service in services %}
124
                              <tr class="GradeC">
125
                                <td><a href="{% url services service.pk %}">{% tolocale service LANGUAGE_CODE %}</a></td>
126
                                <td>{{service.address_street}}<br>{{service.address_city}}</td>
127
                                <td>{{service.SSID}}</td>
128
                                <td>{% for enc in service.enc_level %}{{enc}}{% if not forloop.last%},{% endif %}{% endfor %}</td>
129
                                <td>{{service.AP_no}}</td>
130
                                <td style="text-align: center;"><a href="{% url edit-services service.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_service_{{service.pk}}" data-servicename="{% tolocale service LANGUAGE_CODE%}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
131
                        </tr>
132
                              {% endfor %}
133
                              </tbody>
134
                      </table>
135
                      {% endif %}
136
              {% endif %}
137
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
138
<div class="modal-header">
139
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
140
<h3 id="myModalLabel">Delete Service</h3>
141
</div>
142
<div class="modal-body" id="mymodalbody">
143

    
144
</div>
145
<div class="modal-footer">
146
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
147
<a class="btn btn-warning" id="delserviceSubmit" href="#">{% trans "Delete" %}</a>
148
</div>
149
</div>
150

    
151
<div class="modal hide fade" id="servDets" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
152
<div class="modal-header">
153
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
154
<h3 id="myModalLabelservdets">{% trans "Service Details" %}</h3>
155
</div>
156
<div class="modal-body" id="servDetsbody">
157

    
158
</div>
159
<div class="modal-footer">
160
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Close" %}</button>
161
</div>
162
</div>
163
                {% endblock %}