Statistics
| Branch: | Tag: | Revision:

root / templates / edumanage / realms.html @ 25028c1d

History | View | Annotate | Download (5.1 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 "Realms" %}</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 realms %}
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
        "bVisible": true,
25
        "bSearchable": false,
26
        "bSortable": false
27
    }],
28
    "aaSorting": [[0, 'desc']],
29
    "iDisplayLength": 25,
30
    "oSearch": {"bSmart": false, "bRegex":true},
31
    "oLanguage": {
32
            "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "realms" %}',
33
        "sProcessing":   "Processing...",
34
        "sZeroRecords": '{% trans "No records to display" %}',
35
        "sInfo":         "Showing _START_ to _END_ of _TOTAL_ entries",
36
        "sInfoEmpty":    "{% trans "Showing 0 to 0 of 0 entries" %}",
37
        "sInfoFiltered": "(filtered from _MAX_ total entries)",
38
        "sInfoPostFix":  "",
39
        "sSearch":       '{% trans "Search:" %}',
40
        "sUrl":          "",
41
        "oPaginate": {
42
            "sFirst":    '{% trans "First" %}',
43
            "sPrevious": '{% trans "Previous" %}',
44
            "sNext":     '{% trans "Next" %}',
45
            "sLast":     '{% trans "Last" %}'
46
        }
47
    }
48
});
49

50
oTable.fnDraw();
51

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

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

82
{% endif %}
83
});
84
</script>
85
{% endblock %}
86

    
87
        {% block navbar %}
88
                        
89
                    {% endblock %}
90
                    
91
                    {% block homeactive %}{% endblock %}
92
                    {% block realmsactive %}class="active"{% endblock %}
93
            {% block subcontent %}
94

    
95
                            
96
                      <h4>Realms</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 instdets.ertype == 1 or instdets.ertype == 3 %}<a href="{% url edit-realms %}" class="btn btn-primary">{% trans "Add new realm" %}</a>{% endif %}</div>
107
                      <div class="span10"></div>
108
                      {% if instdets.ertype == 1 or instdets.ertype == 3 %}
109
                              {% if realms %}
110
                              <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
111
                                                <thead>
112
                                                <tr>
113
                                                        <th>Realm</th>
114
                                                        <th>Server(s)</th>
115
                                                        <th style="text-align: center;">{% trans "Action" %}</th>
116
                                                </tr>
117
                                                </thead>
118
                                                
119
                                                <tbody>
120
                                {% for realm in realms %}
121
                                      <tr class="GradeC">
122
                                        <td>{{realm.realm}}</td>
123
                                        <td>{{realm.get_servers}}</td>
124
                                        <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>
125
                                </tr>
126
                                      {% endfor %}
127
                                      </tbody>
128
                              </table>
129
                              {% endif %}
130
                      {% endif %}
131
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
132
<div class="modal-header">
133
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
134
<h3 id="myModalLabel">{% trans "Delete Realm" %}</h3>
135
</div>
136
<div class="modal-body" id="mymodalbody">
137

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