Fixed serious bug with csrf token cookie
[flowspy] / templates / user_routes.html
index 3ae9347..c7a4dc3 100644 (file)
 $(document).ready(function(){
     $("#hid_mid").val('');
     $('#dialog').dialog({
-        height: 220,
-        width: 300,
+        height: 250,
+        width: 340,
         modal: true,
         autoOpen: false,
         buttons: {
-            'Delete': function(){
+            'Suspend': function(){
                 route = $('#route_to_delete').text();
                 route_url_id = '#del_route_' + route;
                 url = $(route_url_id).attr('href');
@@ -48,6 +48,7 @@ $(document).ready(function(){
         width: 800,
         modal: true,
         autoOpen: false,
+               overlay: { opacity: 0.5, background: 'black'},
         close: function(){
             update_val = $("#hid_mid").val();
             if (update_val == 'UPDATED') {
@@ -56,7 +57,8 @@ $(document).ready(function(){
             }
         }
     });
-    
+    $('#console').parent().css('opacity', 0.9);
+       $('#console').parent().css('filter', 'alpha(opacity=90)');
     var oTable = $('#routes_table').dataTable({
         "bJQueryUI": true,
         "aoColumns": [{
@@ -133,6 +135,7 @@ $(document).ready(function(){
         return false;
     });
     
+       $(".statustootipclass").tooltip();
     $(".expiresclass").tooltip();
        $(".commentclass").tooltip();
     var reg_exp = '';
@@ -154,7 +157,7 @@ $(document).ready(function(){
         
     }
        if (reg_exp == '') {
-            reg_exp = 'X|'
+            reg_exp = 'XXX|'
         }
     oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
     
@@ -212,6 +215,7 @@ function delete_route(route){
 {% endblock %}
 {% block title %}{% trans "My rules" %}{% endblock %}
 {% block content %}
+{% csrf_token %}
 <div style="float:left">
        <h3 style="margin-top: 0px;">{% trans "My rules" %}</h3>
 </div>
@@ -224,7 +228,7 @@ function delete_route(route){
 <table cellpadding="0" cellspacing="0" border="0" class="display" style='width:200px;'>
                                <tbody>
                                        <tr>
-                                       <th>ACTIVE</th><th>SUSPENDED</th><th>EXPIRED</th><th>ADMINDISABLED</th><th>ERROR</th><th>PENDING</th>
+                                       <th>ACTIVE</th><th>SUSPENDED</th><th>ERROR</th><th>PENDING</th>
                                        </tr>
                                        <tr class="on_off">
                                        <td>
@@ -232,23 +236,14 @@ function delete_route(route){
                                        </td>
                                    
                                        <td>
-                                           <input type="checkbox" class="onoff" name="status_filter" value="SUSPENDED" checked id="show_inactive"/>
-                                       </td>
-                                  
-                                       <td>
-                                           <input type="checkbox" class="onoff" name="status_filter" value="EXPIRED" id="show_expired"/>
-                                       </td>
-                                   
-                                       <td>
-                                           <input type="checkbox" class="onoff" name="status_filter" value="ADMINDISABLED" id="show_admininactive"/>
-                                       </td>
-                                   
+                                           <input type="checkbox" class="onoff" name="status_filter" value="SUSPENDED" id="show_inactive"/>
+                                       </td>                               
                                        <td>
                                            <input type="checkbox" class="onoff" name="status_filter" value="ERROR" id="show_error"/>
                                        </td>
                                   
                                        <td>
-                                           <input type="checkbox" class="onoff" name="status_filter" value="PENDING" checked id="show_pending"/>
+                                           <input type="checkbox" class="onoff" name="status_filter" value="PENDING" id="show_pending"/>
                                        </td>
                                    </tr>
                                </tbody>
@@ -283,22 +278,26 @@ function delete_route(route){
                {% endif %}>{{ route.name }}</span></td>
        <td>{{ route.get_match|safe|escape }}</td>
        <td style="text-align: center;">{{route.get_then|safe|escape}}</td>
-       <td style="text-align: center; ">{% ifequal route.status 'INACTIVE' %}SUSPENDED{% else %}{% ifequal route.status 'ADMININACTIVE' %}ADMINDISABLED{% else %}{{route.status}}{% endifequal %}{% endifequal %}</td>
+       <td style="text-align: center; "><span 
+               {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}
+           class="statustootipclass" 
+               style="border-bottom:1px dotted red;" 
+               title = "{% ifequal route.status 'INACTIVE' %}Suspended by user{% else %}{% ifequal route.status 'ADMININACTIVE' %}Suspended by administrator{% else %}{% ifequal route.status 'EXPIRED' %}Suspended due to expiration{% else %}{% ifequal route.status 'OUTOFSYNC' %}Syncronization error. Configuration in device deffers from rule{% endifequal %}{% endifequal %}{% endifequal %}{% endifequal %}"{% endif %}>{% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' %}SUSPENDED{% else %}{% if route.status == 'OUTOFSYNC' %}ERROR{% else %}{{route.status}}{% endif %}{% endif %}</span></td>
        {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
        <td style="text-align: center;">{{ route.applier }}</td>
-       <td style="text-align: center;"><span {% if route.days_to_expire %}
+       <td style="text-align: center;"><span {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}{% else %}{% if route.days_to_expire %}
                class="expiresclass" 
                style="border-bottom:2px dashed red;" 
         title="Expires {% ifequal route.days_to_expire '0' %}today{% else%}in {{route.days_to_expire}} day{{ route.days_to_expire|pluralize }}{% endifequal %}"
-               {% endif %}>{{ route.expires }}</span></td>
-       <td style="text-align: center;">{{ route.response }}</td>
+               {% endif %}{% endif %}>{{ route.expires }}</span></td>
+       <td style="text-align: center;">{% if route.status == 'EXPIRED' %}Rule expired{% else %}{% if route.status == 'ADMININACTIVE' %}Suspended by administrator{% else %}{% if route.status == 'INACTIVE' %}Suspended by user{% else %}{{ route.response }}{% endif %}{% endif %}{% endif %}</td>
        <td style="text-align: center; width:180px;">
                {% ifequal route.status 'ACTIVE' %}
                <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Edit</a> 
                <button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Suspend</button>
                <a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}"></a>
                {% else %}
-               {% ifequal route.status 'INACTIVE' %}
+               {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' %}
                <a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Reactivate</a>
                {% else %}
                {% ifequal route.status 'OUTOFSYNC' %}
@@ -306,7 +305,7 @@ function delete_route(route){
                {% else %}
                -
                {% endifequal %}
-               {% endifequal %}
+               {% endif %}
                {% endifequal %}
                </td>
 </tr>
@@ -315,9 +314,9 @@ function delete_route(route){
 </tbody>
 </table>
 
-<div id="dialog" title="Delete Route">
-               <p>You are about to delete rule <strong><span id="route_to_delete"></span></strong></p>
-               <p>Deleting the rule will automatically remove the configuration from the network and mark this route as inactive.</p>
+<div id="dialog" title="Suspend Rule">
+               <p>You are about to suspend rule <strong><span id="route_to_delete"></span></strong></p>
+               <p>Suspending the rule will automatically remove the configuration from the network and mark this rule as inactive.</p>
                <p>Are you sure you want to proceed?</p>
 </div>
 <div id="console" title="Console">