Statistics
| Branch: | Tag: | Revision:

root / djnro / templates / edumanage / realms.html @ 1d70dbce

History | View | Annotate | Download (5.1 kB)

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

    
5
{% block crumbs %}
6
<li><a href="{% url manage %}">{% trans "Home" %}</a><span class="divider">/</span></li>
7
<li class="active">{% trans "Realms" %}</li>
8
{% endblock %}
9

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

52
oTable.fnDraw();
53

54
$('[id^=del_realm_]').click(function(){
55
        realm_id = (this.id).replace("del_realm_", '');
56
        name = this.getAttribute("data-realmname");
57
        $("#mymodalbody").html("You are about to delete realm: <b>"+name+"</b><br>Press Delete to proceed or Cancel to cancel deletion");
58
        $("#myModalLabel").html("Delete Realm "+name);
59
        $('#myModal').modal('show');
60
        $(".modal-footer").show();
61
        $("#realm_name_del").html(name)
62
        return false;
63
});
64

65
$("#delrealmSubmit").click(function(){
66
        $.ajax({
67
                url:"{% url del-realm %}/?realm_pk="+realm_id,
68
                type: "GET",
69
                success: function(data){
70
                        if (data.error){
71
                                $(".modal-footer").hide();
72
                                $("#mymodalbody").html("<font style='color:#B94A48'>"+data.error+"</font>");
73
                        }
74
                        if (data.success){
75
                                $(".modal-footer").hide();
76
                                $("#mymodalbody").html("Realm "+name+" successfully deleted");
77
                                window.setTimeout('location.reload()', 1000);
78

79
                        }
80
                        }
81
                });
82
});
83

84
{% endif %}
85
});
86
</script>
87
{% endblock %}
88

    
89
        {% block navbar %}
90

    
91
                    {% endblock %}
92

    
93
                    {% block homeactive %}{% endblock %}
94
                    {% block realmsactive %}class="active"{% endblock %}
95
                {% block management_content %}
96

    
97

    
98
                      <h4>Realms</h4>
99
                      <hr>
100
                      {% if messages %}
101
                        <table class="table table-condensed">
102

    
103
                                            {% for message in messages %}
104
                                            <tr {% if  %} class="{{ message.tags }}"{% endif %}><td>{{ message }}<td></tr>
105
                                            {% endfor %}
106
                                        </table>
107
                                  {% endif %}
108
                      <div>{% if institution.ertype == 1 or institution.ertype == 3 %}<a href="{% url edit-realms %}" class="btn btn-primary">{% trans "Add new realm" %}</a>{% endif %}</div>
109
                      <div class="span10"></div>
110
                      {% if institution.ertype == 1 or institution.ertype == 3 %}
111
                              {% if realms %}
112
                              <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
113
                                                <thead>
114
                                                <tr>
115
                                                        <th>Realm</th>
116
                                                        <th>Server(s)</th>
117
                                                        <th style="text-align: center;">{% trans "Action" %}</th>
118
                                                </tr>
119
                                                </thead>
120

    
121
                                                <tbody>
122
                                {% for realm in realms %}
123
                                      <tr class="GradeC">
124
                                        <td>{{realm.realm}}</td>
125
                                        <td>{{realm.get_servers}}</td>
126
                                        <td style="text-align: center;"><a href="{% url edit-realms realm.pk %}" class="btn btn-small">{% trans "edit" %}</a> <a href="#" id="del_realm_{{realm.pk}}" data-realmname="{{realm.realm}}" class="btn btn-small btn-warning">{% trans "delete" %}</a></td>
127
                                </tr>
128
                                      {% endfor %}
129
                                      </tbody>
130
                              </table>
131
                              {% endif %}
132
                      {% endif %}
133
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
134
<div class="modal-header">
135
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
136
<h3 id="myModalLabel">{% trans "Delete Realm" %}</h3>
137
</div>
138
<div class="modal-body" id="mymodalbody">
139

    
140
</div>
141
<div class="modal-footer">
142
<button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
143
<a class="btn btn-warning" id="delrealmSubmit" href="#">{% trans "Delete" %}</a>
144
</div>
145
</div>
146
            {% endblock %}
147