root / templates / apply_set.html @ 1b996627
History | View | Annotate | Download (6 kB)
1 |
{% extends "base.html" %} |
---|---|
2 |
{% load i18n %} |
3 |
|
4 |
{% block title %} |
5 |
{% if edit %} |
6 |
{% trans "Edit Rule" %} {{form.data.name}} |
7 |
{% else %} |
8 |
{% trans "Create new Rule" %} |
9 |
{% endif %} |
10 |
{% endblock %} |
11 |
|
12 |
{% block breadcrumbs %}:: |
13 |
{% if edit %} |
14 |
{% trans "Edit rule" %} {{form.data.name}} |
15 |
{% else %} |
16 |
{% trans "Create set of rules" %} |
17 |
{% endif %} |
18 |
{% endblock %} |
19 |
{% block extrahead %} |
20 |
<script>
|
21 |
$(document).ready( function(){
|
22 |
|
23 |
$("#id_sourceport").css('width', '100px').attr('size', '5');
|
24 |
$("#id_port").css('width', '100px').attr('size', '5');
|
25 |
$("#id_destinationport").css('width', '100px').attr('size', '5');
|
26 |
$('#id_then').attr("multiple", "");
|
27 |
$( "#id_expires" ).datepicker({ dateFormat: 'yy-mm-dd' , maxDate: '+10d', minDate: '+1d', changeMonth: false, changeYear: false }).datepicker( $.datepicker.regional[ "el" ] );
|
28 |
{% comment %}
|
29 |
$('#then_diag').dialog({
|
30 |
height: 220,
|
31 |
width: 340,
|
32 |
modal: true,
|
33 |
autoOpen: false,
|
34 |
buttons: {
|
35 |
'Add': function() {
|
36 |
console.log($("#add_rl_form").serialize());
|
37 |
$.ajax({
|
38 |
url:"{% url add-rate-limit %}",
|
39 |
data:$("#add_rl_form").serialize(),
|
40 |
type: "POST",
|
41 |
cache: false,
|
42 |
success:function(data){
|
43 |
try {
|
44 |
value = data.pk;
|
45 |
text = data.value;
|
46 |
$('#id_then').append($("<option></option>").attr("value",value).text(text));
|
47 |
$('#then_diag').dialog('close');
|
48 |
}
|
49 |
catch (exception) {
|
50 |
$('#then_diag').html(data);
|
51 |
}
|
52 |
}
|
53 |
});
|
54 |
},
|
55 |
Cancel: function() {
|
56 |
$('#then_diag').dialog('close');
|
57 |
}
|
58 |
}
|
59 |
});
|
60 |
{% endcomment %}
|
61 |
$('#port_diag').dialog({
|
62 |
height: 220,
|
63 |
width: 340,
|
64 |
modal: true,
|
65 |
autoOpen: false,
|
66 |
buttons: {
|
67 |
'Add': function() {
|
68 |
$.ajax({
|
69 |
url:"{% url add-port %}",
|
70 |
data:$("#add_port_form").serialize(),
|
71 |
type: "POST",
|
72 |
cache: false,
|
73 |
success:function(data){
|
74 |
try {
|
75 |
value = data.value;
|
76 |
text = data.text;
|
77 |
$('#id_port').append($("<option></option>").attr("value",value).text(text));
|
78 |
$('#id_destinationport').append($("<option></option>").attr("value",value).text(text));
|
79 |
$('#id_sourceport').append($("<option></option>").attr("value",value).text(text));
|
80 |
$('#port_diag').dialog('close');
|
81 |
}
|
82 |
catch (exception) {
|
83 |
$('#port_diag').html(data);
|
84 |
}
|
85 |
}
|
86 |
});
|
87 |
},
|
88 |
Cancel: function() {
|
89 |
$('#port_diag').dialog('close');
|
90 |
}
|
91 |
}
|
92 |
});
|
93 |
|
94 |
{% comment %}
|
95 |
$("#new_then_actions").button({
|
96 |
icons: {
|
97 |
primary: "ui-icon-plusthick"
|
98 |
},
|
99 |
})
|
100 |
.click(function(){
|
101 |
$.ajax({
|
102 |
url: "{% url add-rate-limit %}",
|
103 |
cache: false,
|
104 |
success: function(data){
|
105 |
$("#then_diag").html(data);
|
106 |
}
|
107 |
});
|
108 |
$('#then_diag').dialog('open');
|
109 |
return false;
|
110 |
});
|
111 |
|
112 |
{% endcomment %}
|
113 |
$(".new_port").button({
|
114 |
icons: {
|
115 |
primary: "ui-icon-plusthick"
|
116 |
},
|
117 |
})
|
118 |
.click(function(){
|
119 |
$.ajax({
|
120 |
url: "{% url add-port %}",
|
121 |
cache: false,
|
122 |
success: function(data){
|
123 |
$("#port_diag").html(data);
|
124 |
}
|
125 |
});
|
126 |
$('#port_diag').dialog('open');
|
127 |
return false;
|
128 |
});
|
129 |
|
130 |
$("#portsacc").accordion({
|
131 |
collapsible: true,
|
132 |
active: false,
|
133 |
|
134 |
});
|
135 |
|
136 |
$("#applybutton").button();
|
137 |
|
138 |
});
|
139 |
|
140 |
</script>
|
141 |
|
142 |
|
143 |
<style type="text/css"> |
144 |
th { |
145 |
text-align: right; |
146 |
padding-right: 0.5em; |
147 |
vertical-align: top; |
148 |
} |
149 |
|
150 |
.accord_wrapper{ |
151 |
height: 452px !important; |
152 |
} |
153 |
|
154 |
.help { |
155 |
font-style: italic; |
156 |
|
157 |
} |
158 |
div.roundbox, #portsacc, #id_comments{ |
159 |
-moz-border-radius: 5px; border-radius:5px; -webkit-border-radius: 5px; |
160 |
-moz-box-shadow: 0 0 3px #AAAAAA; box-shadow: 0 0 3px #AAAAAA; -webkit-box-shadow: 0 0 3px #AAAAAA; |
161 |
background-color: #F4F4F4; |
162 |
border: 1px solid #FFFFFF; |
163 |
clear: both; |
164 |
float: left; |
165 |
margin: 5px 0 5px 100px; |
166 |
padding: 10px; |
167 |
width: 620px; |
168 |
} |
169 |
#rule_form_wrapper{ |
170 |
margin: 15px auto; |
171 |
position: relative; |
172 |
text-align: center; |
173 |
width: 800px; |
174 |
} |
175 |
|
176 |
#rule_form_container input:not([type="submit"]), #rule_form_container select { |
177 |
background: none repeat scroll 0 0 #FFFFFF; |
178 |
border: 1px solid #DDDDDD; |
179 |
-moz-border-radius: 3px; border-radius:3px; -webkit-border-radius: 3px; |
180 |
float: left; |
181 |
font-family: "Century Gothic",Helvetica,sans-serif; |
182 |
font-size: 13px; |
183 |
outline: medium none; |
184 |
padding: 5px; |
185 |
width: 180px; |
186 |
} |
187 |
|
188 |
#id_comments { |
189 |
background: none repeat scroll 0 0 #FFFFFF; |
190 |
border: 1px solid #DDDDDD; |
191 |
border-radius: 3px 3px 3px 3px; |
192 |
float: left; |
193 |
font-family: "Century Gothic",Helvetica,sans-serif; |
194 |
font-size: 13px; |
195 |
outline: medium none; |
196 |
padding: 5px; |
197 |
width: 622px; |
198 |
} |
199 |
|
200 |
#rule_form_container{ |
201 |
-moz-border-radius: 10px 10px 10px 10px; border-radius:10px; -webkit-border-radius: 10px; |
202 |
-moz-box-shadow: 0 0 3px #AAAAAA; box-shadow: 0 0 3px #AAAAAA; -webkit-box-shadow: 0 0 3px #AAAAAA; |
203 |
background-color: #F9F9F9; |
204 |
border: 2px solid #FFFFFF; |
205 |
overflow: hidden; |
206 |
width: 800px; |
207 |
} |
208 |
#rule_form_container div label { |
209 |
color: #666666; |
210 |
float: left; |
211 |
font-family: "Century Gothic",Helvetica,sans-serif; |
212 |
font-size: 15px; |
213 |
font-weight: bold; |
214 |
line-height: 26px; |
215 |
margin-right: 15px; |
216 |
text-align: right; |
217 |
text-shadow: 1px 1px 1px #FFFFFF; |
218 |
width: 180px; |
219 |
} |
220 |
#rule_form_container p.submit { |
221 |
background: none repeat scroll 0 0 transparent; |
222 |
border: medium none; |
223 |
box-shadow: none; |
224 |
} |
225 |
input { |
226 |
width:100px; |
227 |
} |
228 |
|
229 |
|
230 |
</style>
|
231 |
{% endblock %} |
232 |
{% block content %} |
233 |
<div align="center" id="rule_form_wrapper"> |
234 |
{% load unescape %} |
235 |
<form method="POST"> |
236 |
{{ formset.non_form_errors.as_ul }} |
237 |
{% csrf_token %} |
238 |
<table id="formset" class="form"> |
239 |
<thead><tr> |
240 |
<th>Name</th><th>Source</th><th>Destination</th><th>Then</th><th>Note</th> |
241 |
</tr></thead> |
242 |
{% for form in formset.forms %} |
243 |
{{form.errors}} |
244 |
<tr>
|
245 |
<td>{{ form.name }}</td> |
246 |
<td>{{ form.source }}</td> |
247 |
<td>{{ form.destination }}</td> |
248 |
<td>{{ form.then }}</td> |
249 |
<td>{{ form.comments }}</td> |
250 |
</tr>
|
251 |
{% endfor %} |
252 |
</table>
|
253 |
|
254 |
<input type="submit" id="applybutton" value="{% trans "Apply" %}" /> |
255 |
</form>
|
256 |
</div>
|
257 |
<div id="then_diag" title="Add new rate-limit value"> |
258 |
</div>
|
259 |
<div id="port_diag" title="Add new port"> |
260 |
</div>
|
261 |
|
262 |
{% endblock %} |