Revision c78c4531

b/static/css/engage.itoggle.css
1
div#itoggle label.ilabel{
2
	display:block;
3
	font-size:12px;
4
	padding-bottom:10px;
5
	cursor:pointer;
6
	}
7

  
8
div#itoggle label.itoggle,
9
div#itoggle label.itoggle span{
10
	display: block;
11
	width: 93px;
12
	height: 27px;
13
/*	margin-bottom: 20px; */
14
	background: url(/static/itoggle.png) left bottom no-repeat;
15
	cursor:pointer;
16
	text-indent:-5000px;
17
	}
18
div#itoggle label.itoggle.iToff{
19
	background-position:right bottom;
20
	}
21
div#itoggle label.itoggle span{
22
	background-position: left top;
23
	margin: 0;
24
	}
25
div#itoggle input.iT_checkbox{
26
	position:absolute;
27
	top:-9999px;
28
	left:-9999px;
29
	}
30

  
31
/*	
32
	If you want the corners to be
33
	transparent, add these two lines
34
	to the main block above. Only
35
	works on webkit and mozilla browsers
36
	For more reliable results, make your
37
	own png using the supplied .psd
38
	
39
	-moz-border-radius:6px;
40
	-webkit-border-radius:6px;
41
*/
b/static/js/easing.js
1
/*
2
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
3
 *
4
 * Uses the built in easing capabilities added In jQuery 1.1
5
 * to offer multiple easing options
6
 *
7
 * TERMS OF USE - jQuery Easing
8
 * 
9
 * Open source under the BSD License. 
10
 * 
11
 * Copyright © 2008 George McGinley Smith
12
 * All rights reserved.
13
 * 
14
 * Redistribution and use in source and binary forms, with or without modification, 
15
 * are permitted provided that the following conditions are met:
16
 * 
17
 * Redistributions of source code must retain the above copyright notice, this list of 
18
 * conditions and the following disclaimer.
19
 * Redistributions in binary form must reproduce the above copyright notice, this list 
20
 * of conditions and the following disclaimer in the documentation and/or other materials 
21
 * provided with the distribution.
22
 * 
23
 * Neither the name of the author nor the names of contributors may be used to endorse 
24
 * or promote products derived from this software without specific prior written permission.
25
 * 
26
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
27
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
32
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
34
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
35
 *
36
*/
37

  
38
// t: current time, b: begInnIng value, c: change In value, d: duration
39
jQuery.easing['jswing'] = jQuery.easing['swing'];
40
console.log('loaded');
41
jQuery.extend( jQuery.easing,
42
{
43
	def: 'easeOutQuad',
44
	swing: function (x, t, b, c, d) {
45
		//alert(jQuery.easing.default);
46
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
47
	},
48
	easeInQuad: function (x, t, b, c, d) {
49
		return c*(t/=d)*t + b;
50
	},
51
	easeOutQuad: function (x, t, b, c, d) {
52
		return -c *(t/=d)*(t-2) + b;
53
	},
54
	easeInOutQuad: function (x, t, b, c, d) {
55
		if ((t/=d/2) < 1) return c/2*t*t + b;
56
		return -c/2 * ((--t)*(t-2) - 1) + b;
57
	},
58
	easeInCubic: function (x, t, b, c, d) {
59
		return c*(t/=d)*t*t + b;
60
	},
61
	easeOutCubic: function (x, t, b, c, d) {
62
		return c*((t=t/d-1)*t*t + 1) + b;
63
	},
64
	easeInOutCubic: function (x, t, b, c, d) {
65
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
66
		return c/2*((t-=2)*t*t + 2) + b;
67
	},
68
	easeInQuart: function (x, t, b, c, d) {
69
		return c*(t/=d)*t*t*t + b;
70
	},
71
	easeOutQuart: function (x, t, b, c, d) {
72
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
73
	},
74
	easeInOutQuart: function (x, t, b, c, d) {
75
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
76
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
77
	},
78
	easeInQuint: function (x, t, b, c, d) {
79
		return c*(t/=d)*t*t*t*t + b;
80
	},
81
	easeOutQuint: function (x, t, b, c, d) {
82
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
83
	},
84
	easeInOutQuint: function (x, t, b, c, d) {
85
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
86
		return c/2*((t-=2)*t*t*t*t + 2) + b;
87
	},
88
	easeInSine: function (x, t, b, c, d) {
89
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
90
	},
91
	easeOutSine: function (x, t, b, c, d) {
92
		return c * Math.sin(t/d * (Math.PI/2)) + b;
93
	},
94
	easeInOutSine: function (x, t, b, c, d) {
95
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
96
	},
97
	easeInExpo: function (x, t, b, c, d) {
98
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
99
	},
100
	easeOutExpo: function (x, t, b, c, d) {
101
		console.log((t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b);
102
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
103
	},
104
	easeInOutExpo: function (x, t, b, c, d) {
105
		if (t==0) return b;
106
		if (t==d) return b+c;
107
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
108
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
109
	},
110
	easeInCirc: function (x, t, b, c, d) {
111
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
112
	},
113
	easeOutCirc: function (x, t, b, c, d) {
114
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
115
	},
116
	easeInOutCirc: function (x, t, b, c, d) {
117
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
118
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
119
	},
120
	easeInElastic: function (x, t, b, c, d) {
121
		var s=1.70158;var p=0;var a=c;
122
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
123
		if (a < Math.abs(c)) { a=c; var s=p/4; }
124
		else var s = p/(2*Math.PI) * Math.asin (c/a);
125
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
126
	},
127
	easeOutElastic: function (x, t, b, c, d) {
128
		var s=1.70158;var p=0;var a=c;
129
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
130
		if (a < Math.abs(c)) { a=c; var s=p/4; }
131
		else var s = p/(2*Math.PI) * Math.asin (c/a);
132
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
133
	},
134
	easeInOutElastic: function (x, t, b, c, d) {
135
		var s=1.70158;var p=0;var a=c;
136
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
137
		if (a < Math.abs(c)) { a=c; var s=p/4; }
138
		else var s = p/(2*Math.PI) * Math.asin (c/a);
139
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
140
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
141
	},
142
	easeInBack: function (x, t, b, c, d, s) {
143
		if (s == undefined) s = 1.70158;
144
		return c*(t/=d)*t*((s+1)*t - s) + b;
145
	},
146
	easeOutBack: function (x, t, b, c, d, s) {
147
		if (s == undefined) s = 1.70158;
148
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
149
	},
150
	easeInOutBack: function (x, t, b, c, d, s) {
151
		if (s == undefined) s = 1.70158; 
152
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
153
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
154
	},
155
	easeInBounce: function (x, t, b, c, d) {
156
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
157
	},
158
	easeOutBounce: function (x, t, b, c, d) {
159
		if ((t/=d) < (1/2.75)) {
160
			return c*(7.5625*t*t) + b;
161
		} else if (t < (2/2.75)) {
162
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
163
		} else if (t < (2.5/2.75)) {
164
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
165
		} else {
166
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
167
		}
168
	},
169
	easeInOutBounce: function (x, t, b, c, d) {
170
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
171
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
172
	}
173
});
174

  
175
/*
176
 *
177
 * TERMS OF USE - EASING EQUATIONS
178
 * 
179
 * Open source under the BSD License. 
180
 * 
181
 * Copyright © 2001 Robert Penner
182
 * All rights reserved.
183
 * 
184
 * Redistribution and use in source and binary forms, with or without modification, 
185
 * are permitted provided that the following conditions are met:
186
 * 
187
 * Redistributions of source code must retain the above copyright notice, this list of 
188
 * conditions and the following disclaimer.
189
 * Redistributions in binary form must reproduce the above copyright notice, this list 
190
 * of conditions and the following disclaimer in the documentation and/or other materials 
191
 * provided with the distribution.
192
 * 
193
 * Neither the name of the author nor the names of contributors may be used to endorse 
194
 * or promote products derived from this software without specific prior written permission.
195
 * 
196
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
197
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
198
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
199
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
200
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
201
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
202
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
203
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
204
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
205
 *
206
 */
b/static/js/engage.itoggle-min.js
1
/*---------------
2
 * jQuery iToggle Plugin by Engage Interactive
3
 * Examples and documentation at: http://labs.engageinteractive.co.uk/itoggle/
4
 * Copyright (c) 2009 Engage Interactive
5
 * Version: 1.0 (10-JUN-2009)
6
 * Dual licensed under the MIT and GPL licenses:
7
 * http://www.opensource.org/licenses/mit-license.php
8
 * http://www.gnu.org/licenses/gpl.html
9
 * Requires: jQuery v1.3 or later
10
---------------*/
11

  
12
(function($){
13
	$.fn.iToggle = function(options) {
14
		
15
		clickEnabled = true;
16
		
17
		var defaults = {
18
			type: 'checkbox',
19
			keepLabel: true,
20
			easing: false,
21
			speed: 200,
22
			onClick: function(){},
23
			onClickOn: function(){},
24
			onClickOff: function(){},
25
			onSlide: function(){},
26
			onSlideOn: function(){},
27
			onSlideOff: function(){}
28
		},
29
		settings = $.extend({}, defaults, options);
30
		
31
		this.each(function(){
32
			var $this = $(this);
33
			if($this.attr('tagName') == 'INPUT'){
34
				var id=$this.attr('id');
35
				label(settings.keepLabel, id);
36
				$this.addClass('iT_checkbox').before('<label class="itoggle" for="'+id+'"><span></span></label>');
37
				if($this.attr('checked')){
38
					$this.prev('label').addClass('iTon');
39
				}else{
40
					$this.prev('label').addClass('iToff');
41
				}
42
			}else{
43
				$this.children('input:'+settings.type).each(function(){
44
					var id = $(this).attr('id');
45
					label(settings.keepLabel, id);
46
					$(this).addClass('iT_checkbox').before('<label class="itoggle" for="'+id+'"><span></span></label>');
47
					if($(this).attr('checked')){
48
						$(this).prev('label').addClass('iTon');
49
					}else{
50
						$(this).prev('label').addClass('iToff');
51
					}
52
					if(settings.type == 'radio'){
53
						$(this).prev('label').addClass('iT_radio');
54
					}
55
				});
56
			}
57
		});
58
		
59
		function label(e, id){
60
			if(e == true){
61
				if(settings.type == 'radio'){
62
					$('label[for='+id+']').addClass('ilabel_radio');
63
				}else{
64
					$('label[for='+id+']').addClass('ilabel');
65
				}
66
			}else{
67
				$('label[for='+id+']').remove();
68
			}
69
		}
70

  
71
		$('label.itoggle').click(function(){
72
			if(clickEnabled == true){
73
				clickEnabled = false;
74
				if($(this).hasClass('iT_radio')){
75
					if($(this).hasClass('iTon')){
76
						clickEnabled = true;
77
					}else{
78
						slide($(this), true);
79
					}
80
				}else{
81
					slide($(this));
82
				}
83
			}
84
			return false;
85
		});
86
		$('label.ilabel').click(function(){
87
			if(clickEnabled == true){
88
				clickEnabled = false;
89
				slide($(this).next('label.itoggle'));
90
			}
91
			return false;
92
		});
93
		
94
		function slide($object, radio){
95
			settings.onClick.call($object); //Generic click callback for click at any state
96
			h=$object.innerHeight();
97
			t=$object.attr('for');
98
			if($object.hasClass('iTon')){
99
				settings.onClickOff.call($object); //Click that turns the toggle to off position
100
				$object.animate({backgroundPosition:'100% -'+h+'px'}, settings.speed, settings.easing, function(){
101
					$object.removeClass('iTon').addClass('iToff');
102
					clickEnabled = true;
103
					settings.onSlide.call(this); //Generic callback after the slide has finnished
104
					settings.onSlideOff.call(this); //Callback after the slide turns the toggle off
105
				});
106
				$('input#'+t).removeAttr('checked');
107
			}else{
108
				settings.onClickOn.call($object);
109
				$object.animate({backgroundPosition:'0% -'+h+'px'}, settings.speed, settings.easing, function(){
110
					$object.removeClass('iToff').addClass('iTon');
111
					clickEnabled = true;
112
					settings.onSlide.call(this); //Generic callback after the slide has finnished
113
					settings.onSlideOn.call(this); //Callback after the slide turns the toggle on
114
				});
115
				$('input#'+t).attr('checked','checked');
116
			}
117
			if(radio == true){
118
				name = $('#'+t).attr('name');
119
				slide($object.siblings('label[for]'));
120
			}
121
		}
122

  
123
	};
124
})(jQuery);
b/templates/user_routes.html
5 5
<script type="text/javascript" src="{% url load-js 'poller' %}"></script>
6 6
{% endif %}
7 7
<script type="text/javascript" src="/static/js/jquery.dataTables.js"></script>
8
<link rel="stylesheet" type="text/css" href="/static/css/engage.itoggle.css"/>
9
<script type="text/javascript" src="/static/js/engage.itoggle-min.js"></script>
8 10
<script type="text/javascript">
9
	$(document).ready( function(){
10
		var noaction = readCookie('noaction');
11
		$( "#hide_noaction" ).button();
12
		if (noaction == 'true'){
13
			$('#hide_noaction').attr('checked','checked');
14
			$("#hide_noaction").button( "option", "label", "Show Expired, AdminInactive, Error" );
15
		}
16
		$("#hid_mid").val('');
17
		$('#dialog').dialog({
18
			height: 220,
19
            width: 300,
20
			modal: true,
21
			autoOpen: false,
22
			buttons: {
23
		'Delete': function() {
24
		route = $('#route_to_delete').text();
25
		route_url_id = '#del_route_'+route;
26
		url = $(route_url_id).attr('href');
27
			$.ajax({
28
			url: url ,
29
			cache: false,
30
			success: function(data) {
31
				$('#dialog').dialog('close');
32
				window.setTimeout('location.reload()', 1000);
33
			  }
34
		});
35
		},
36
		Cancel: function() {
37
			$('#dialog').dialog('close');
38
		},
39
		
40

  
41
	},
42
	close: function() {
43
        update_val = $("#hid_mid").val();
44
		if (update_val == 'UPDATED'){
45
			$("#hid_mid").val('');
46
			window.setTimeout('location.reload()', 500);
47
		}
48
    }
49
		});
50
		$('#console').dialog({
51
			height: 250,
52
            width: 800,
53
			modal: true,
54
			autoOpen: false,
55
			close: function() {
56
		        update_val = $("#hid_mid").val();
57
				if (update_val == 'UPDATED'){
58
					$("#hid_mid").val('');
59
					window.setTimeout('location.reload()', 500);
60
				}
61
		    }
62
		});
63
			
64
		$('#routes_table').dataTable({
65
			"bJQueryUI": true,
66
			"aoColumns": [ 
67
				{"bVisible": false, "bSearchable": false,"bSortable": false },
68
				{"bSearchable": true,"bSortable": true},
69
				{"bSearchable": true,"bSortable": true},
70
				{"bSearchable": true,"bSortable": true},
71
				{"bSearchable": true,"bSortable": true},
72
				{"bSearchable": true,"bSortable": true},
73
				{"bSearchable": true,"bSortable": true},
74
				{"bSearchable": true,"bSortable": true},
75
				{"bVisible": true, "bSearchable": false,"bSortable": false}
76
			],
77
			 "aaSorting": [[0,'desc']],
78
			"oLanguage": {
79
				"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> rules'
80
			},
81
			"iDisplayLength": 25,
82
	});
83
	$.fn.dataTableExt.afnFiltering = new Array();
84
	$.fn.dataTableExt.afnFiltering.push(
85
 	function( oSettings, aData, iDataIndex ) {
86
		// 4 here is the column where my statuses are.
87
 		var status_middle = $(aData[4]);
88
		var status = $(status_middle[0]).text();
89
 		if (( status == "EXPIRED" || status == "ADMININACTIVE" || status == "ERROR") && ($('#hide_noaction').attr('checked'))) {
90
 			return false;
91
 		}
92
		else {
93
			return true;
94
		}
95
 		
96
 	});
97
	var oTable = $('#routes_table').dataTable();
98
	oTable.fnDraw();
99
	$('#hide_noaction').change( function(){
100
			var noaction = $('#hide_noaction').attr('checked');
101
			if (noaction == true){
102
				$("#hide_noaction").button( "option", "label", "Show Expired, AdminInactive, Error" );
103
				}
104
			else{
105
				$("#hide_noaction").button( "option", "label", "Hide Expired, AdminInactive, Error" );
106
			}
107
			createCookie("noaction", noaction, 30);
108
			oTable.fnDraw(); 
109
		});
110
	
111
	$( ".button_place #routebutton" ).button({
112
            icons: {
113
                primary: "ui-icon-circle-plus"
11
$(document).ready(function(){
12
    $("#hid_mid").val('');
13
    $('#dialog').dialog({
14
        height: 220,
15
        width: 300,
16
        modal: true,
17
        autoOpen: false,
18
        buttons: {
19
            'Delete': function(){
20
                route = $('#route_to_delete').text();
21
                route_url_id = '#del_route_' + route;
22
                url = $(route_url_id).attr('href');
23
                $.ajax({
24
                    url: url,
25
                    cache: false,
26
                    success: function(data){
27
                        $('#dialog').dialog('close');
28
                        window.setTimeout('location.reload()', 1000);
29
                    }
30
                });
114 31
            },
115
			});
116
		$( " .edit_button" ).button({
117
            icons: {
118
                primary: "ui-icon-wrench"
32
            Cancel: function(){
33
                $('#dialog').dialog('close');
119 34
            },
120
			});
121
		$( " .del_button" ).button({
122
            icons: {
123
                primary: "ui-icon-circle-close"
124
            },
125
			})
126
			.click(function(){
127
				$('#dialog').dialog('open');
128
				return false;
129
			});
130
		$("#consolebutton").button({
131
            icons: {
132
                primary: "ui-icon-image"
133
            },
134
			})
135
			.click(function(){
136
				$("#consolebutton").stop().stop();
137
				$("#consolebutton").css('color', '#555555');
138
				$('#console').dialog('open');
139
				return false;
140
			});
141
			
142
		$(".expiresclass").tooltip();
143

  
144
		});
35
        
36
        
37
        },
38
        close: function(){
39
            update_val = $("#hid_mid").val();
40
            if (update_val == 'UPDATED') {
41
                $("#hid_mid").val('');
42
                window.setTimeout('location.reload()', 500);
43
            }
44
        }
45
    });
46
    $('#console').dialog({
47
        height: 250,
48
        width: 800,
49
        modal: true,
50
        autoOpen: false,
51
        close: function(){
52
            update_val = $("#hid_mid").val();
53
            if (update_val == 'UPDATED') {
54
                $("#hid_mid").val('');
55
                window.setTimeout('location.reload()', 500);
56
            }
57
        }
58
    });
59
    
60
    var oTable = $('#routes_table').dataTable({
61
        "bJQueryUI": true,
62
        "aoColumns": [{
63
            "bVisible": false,
64
            "bSearchable": false,
65
            "bSortable": false
66
        }, {
67
            "bSearchable": true,
68
            "bSortable": true
69
        }, {
70
            "bSearchable": true,
71
            "bSortable": true
72
        }, {
73
            "bSearchable": true,
74
            "bSortable": true
75
        }, {
76
            "bSearchable": true,
77
            "bSortable": true
78
        }, {
79
            "bSearchable": true,
80
            "bSortable": true
81
        }, {
82
            "bSearchable": true,
83
            "bSortable": true
84
        }, {
85
            "bSearchable": true,
86
            "bSortable": true
87
        }, {
88
            "bVisible": true,
89
            "bSearchable": false,
90
            "bSortable": false
91
        }],
92
        "aaSorting": [[0, 'desc']],
93
        "oLanguage": {
94
            "sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> rules'
95
        },
96
        "iDisplayLength": 25,
97
    });
98
    
99
    oTable.fnDraw();
100
    
101
    $('input[name="status_filter"]').click(function(){
102
    
103
        //slice off the last '|' or it doesn't work
104
        //also be sure to use the third parameter
105
    });
106
    
107
    $(".button_place #routebutton").button({
108
        icons: {
109
            primary: "ui-icon-circle-plus"
110
        },
111
    });
112
    $(".edit_button").button({
113
        icons: {
114
            primary: "ui-icon-wrench"
115
        },
116
    }).css('width','100px');;
117
    $(" .del_button").button({
118
        icons: {
119
            primary: "ui-icon-circle-close"
120
        },
121
    }).click(function(){
122
        $('#dialog').dialog('open');
123
        return false;
124
    }).css('width','100px');
125
    $("#consolebutton").button({
126
        icons: {
127
            primary: "ui-icon-image"
128
        },
129
    }).click(function(){
130
        $("#consolebutton").stop().stop();
131
        $("#consolebutton").css('color', '#555555');
132
        $('#console').dialog('open');
133
        return false;
134
    });
135
    
136
    $(".expiresclass").tooltip();
137
	$(".commentclass").tooltip();
138
    var reg_exp = '';
139
    var checkboxs = document.getElementsByName('status_filter');
140
    for (var i = 0, inp; inp = checkboxs[i]; i++) {
141
        checkCookie = readCookie("cookie_" + inp.value);
142
        if (checkCookie) {
143
            if (checkCookie == 'true') {
144
                $(inp).attr('checked', true);
145
            }
146
            else {
147
                $(inp).attr('checked', false);
148
            }
149
        }
150
        
151
        if (inp.type.toLowerCase() == 'checkbox' && inp.checked == true) {
152
            reg_exp = reg_exp + inp.value + '|';
153
        }
154
        
155
    }
156
	if (reg_exp == '') {
157
            reg_exp = 'X|'
158
        }
159
    oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
160
    
161
    $('input[name="status_filter"]').iToggle({
162
        type: 'checkbox',
163
        onSlide: function(){
164
            var reg_exp = '';
165
            var checkboxs = document.getElementsByName('status_filter');
166
            
167
            for (var i = 0, inp; inp = checkboxs[i]; i++) {
168
                if (inp.type.toLowerCase() == 'checkbox' && inp.checked) {
169
                    reg_exp = reg_exp + inp.value + '|';
170
                }
171
                createCookie("cookie_" + inp.value, inp.checked, 30);
172
            }
173
            //passing an empty string will result in no filter
174
            //thus, it must be set to something that will not exist in the column
175
            if (reg_exp == '') {
176
                reg_exp = 'X|'
177
            }
178
            oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
179
        },
180
    });
181
});
145 182
		
146 183
function delete_route(route){
147 184
	route_name = route;
......
182 219
	<button id="consolebutton">Console</button> <a href="{% url add-route %}" id="routebutton">Add Rule</a>
183 220
</div>
184 221
<br><br>
185
<table cellpadding="0" cellspacing="0" border="0" style="width:220px; clear:both;">
186
	<tbody>
187
		<tr>
188
			<td align="left"><input type="checkbox" id="hide_noaction" name="hide_noaction" value="Hide" /><label for="hide_noaction">Hide Expired, AdminInactive, Error</label></td>
189
		</tr>
190
	</tbody>
191
</table>
192
<br>
222

  
223
<div id='itoggle'>
224
<table cellpadding="0" cellspacing="0" border="0" class="display" style='width:200px;'>
225
				<tbody>
226
					<tr>
227
				        <th>ACTIVE</th><th>SUSPENDED</th><th>EXPIRED</th><th>ADMINDISABLED</th><th>ERROR</th><th>PENDING</th>
228
					</tr>
229
					<tr class="on_off">
230
				        <td>
231
				            <input type="checkbox" class="onoff" name="status_filter" value="ACTIVE" checked id="show_active"/>
232
				        </td>
233
				    
234
				        <td>
235
				            <input type="checkbox" class="onoff" name="status_filter" value="SUSPENDED" checked id="show_inactive"/>
236
				        </td>
237
				   
238
				        <td>
239
				            <input type="checkbox" class="onoff" name="status_filter" value="EXPIRED" id="show_expired"/>
240
				        </td>
241
				    
242
				        <td>
243
				            <input type="checkbox" class="onoff" name="status_filter" value="ADMINDISABLED" id="show_admininactive"/>
244
				        </td>
245
				    
246
				        <td>
247
				            <input type="checkbox" class="onoff" name="status_filter" value="ERROR" id="show_error"/>
248
				        </td>
249
				   
250
				        <td>
251
				            <input type="checkbox" class="onoff" name="status_filter" value="PENDING" checked id="show_pending"/>
252
				        </td>
253
				    </tr>
254
				</tbody>
255
			</table>
256
			</div>
257
	<table class="display" width="100%" id="nodes_table">
193 258
<table class="display" width="100%" id="routes_table">
194 259
<thead>
195 260
<tr>
......
211 276

  
212 277
<tr class="GradeC" >
213 278
	<td>{{ route.pk }}</td>
214
	<td>{{ route.name }}</td>
279
	<td><span {% if route.comments %}
280
	class="commentclass" 
281
		style="border-bottom:1px dotted red;" 
282
        title="{{route.comments}}"
283
		{% endif %}>{{ route.name }}</span></td>
215 284
	<td>{{ route.get_match|safe|escape }}</td>
216 285
	<td style="text-align: center;">{{route.get_then|safe|escape}}</td>
217
	<td style="text-align: center; ">
218
		<span 
219
		{% if route.days_to_expire %}
286
	<td style="text-align: center; ">{% ifequal route.status 'INACTIVE' %}SUSPENDED{% else %}{% ifequal route.status 'ADMININACTIVE' %}ADMINDISABLED{% else %}{{route.status}}{% endifequal %}{% endifequal %}</td>
287
	{% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
288
	<td style="text-align: center;">{{ route.applier }}</td>
289
	<td style="text-align: center;"><span {% if route.days_to_expire %}
220 290
		class="expiresclass" 
221 291
		style="border-bottom:2px dashed red;" 
222 292
        title="Expires {% ifequal route.days_to_expire '0' %}today{% else%}in {{route.days_to_expire}} day{{ route.days_to_expire|pluralize }}{% endifequal %}"
223
		{% endif %}>{{route.status}}</span>
224
	</td>
225
	{% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
226
	<td style="text-align: center;">{{ route.applier }}</td>
227
	<td style="text-align: center;">{{ route.expires }}</td>
293
		{% endif %}>{{ route.expires }}</span></td>
228 294
	<td style="text-align: center;">{{ route.response }}</td>
229 295
	<td style="text-align: center; width:180px;">
230 296
		{% ifequal route.status 'ACTIVE' %}
231 297
		<a href="{% url edit-route route.name %}" class="edit_button" id="edit_button_{{route.pk}}">Edit</a> 
232
		<button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Del</button>
298
		<button class="del_button" id="{{route.name}}" onclick="javascript:delete_route(this.id)">Suspend</button>
233 299
		<a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}"></a>
234 300
		{% else %}
235 301
		{% ifequal route.status 'INACTIVE' %}

Also available in: Unified diff