1 {% extends "base.html" %}
6 {% trans "Edit Rule" %} {{form.data.name}}
8 {% trans "Create new Rule" %}
12 {% block breadcrumbs %}
13 <li class="active"><span class="divider">/</span>
15 {% trans "Edit rule" %} {{form.data.name}}
17 {% trans "Create rule" %}
23 $(document).ready( function(){
26 $('#setFromAll').click(function(){
27 $("#id_source").val('0.0.0.0/0');
32 /*$('#id_then').attr("multiple", "");*/
33 $( "#id_expires" ).datepicker({ dateFormat: 'yy-mm-dd' , maxDate: '+10d', minDate: '+1d', changeMonth: false, changeYear: false }).datepicker( $.datepicker.regional[ "el" ] );
35 $('#then_diag').dialog({
41 '{% trans "Add" %}': function() {
42 console.log($("#add_rl_form").serialize());
44 url:"{% url add-rate-limit %}",
45 data:$("#add_rl_form").serialize(),
48 success:function(data){
52 $('#id_then').append($("<option></option>").attr("value",value).text(text));
53 $('#then_diag').dialog('close');
56 $('#then_diag').html(data);
61 '{% trans "Cancel" %}': function() {
62 $('#then_diag').dialog('close');
67 $('#port_diag').dialog({
73 '{% trans "Add" %}': function() {
75 url:"{% url add-port %}",
76 data:$("#add_port_form").serialize(),
79 success:function(data){
84 console.log(text, value);
85 if (typeof value === 'undefined' && typeof text === 'undefined'){
86 $('#port_diag').html(data);
89 $('#id_port').append($("<option></option>").attr("value",value).text(text));
90 $('#id_destinationport').append($("<option></option>").attr("value",value).text(text));
91 $('#id_sourceport').append($("<option></option>").attr("value",value).text(text));
92 $('#port_diag').dialog('close');
96 $('#port_diag').html(data);
101 '{% trans "Cancel" %}': function() {
102 $('#port_diag').dialog('close');
108 $("#new_then_actions").button({
110 primary: "ui-icon-plusthick"
115 url: "{% url add-rate-limit %}",
117 success: function(data){
118 $("#then_diag").html(data);
121 $('#then_diag').dialog('open');
126 $(".new_port").button()
129 url: "{% url add-port %}",
131 success: function(data){
132 $("#port_diag").html(data);
135 $('#port_diag').dialog('open');
143 <style type="text/css">
147 #rule_form_container input:not([type="submit"]), #rule_form_container select {
148 background: none repeat scroll 0 0 #FFFFFF;
149 border: 1px solid #DDDDDD;
150 -moz-border-radius: 3px; border-radius:3px; -webkit-border-radius: 3px;
152 font-family: "Century Gothic",Helvetica,sans-serif;
154 outline: medium none;
160 #rule_form_container{
161 -moz-border-radius: 10px 10px 10px 10px; border-radius:10px; -webkit-border-radius: 10px;
162 -moz-box-shadow: 0 0 3px #AAAAAA; box-shadow: 0 0 3px #AAAAAA; -webkit-box-shadow: 0 0 3px #AAAAAA;
163 background-color: #F9F9F9;
164 border: 2px solid #FFFFFF;
168 #rule_form_container div label {
171 font-family: "Century Gothic",Helvetica,sans-serif;
177 text-shadow: 1px 1px 1px #FFFFFF;
180 #rule_form_container p.submit {
181 background: none repeat scroll 0 0 transparent;
187 <div id="rule_form_wrapper" class="container">
188 {% if edit %}<h4>{% trans "Edit rule" %}: {{form.data.name}}</h4>
189 {% else %}<h4>{% trans "Apply for a new rule" %}</h4>
193 <form method="POST" class="form-horizontal">
197 {% if form.non_field_errors %}
199 {{ form.non_field_errors|unescape}}
202 <fieldset {% if edit %} style="display:none;" {% endif %}>
204 {% trans "Rule Basic Info" %}
206 <div class="control-group {% if form.name.errors %} error {% endif %}">
207 <label class="control-label" for="id_name"><b>{% trans "Name" %}</b></label>
208 <div class="controls">
210 {% if form.name.errors %}
211 <span class="help-inline">
212 {{ form.name.errors|join:", " }}
215 <span class="help-block">A unique identifier will be added as a name_suffix</span>
219 {% if user.is_superuser %}
222 {% trans "Admin Options" %}
224 <div class="control-group">
225 <label class="control-label" for="id_applier"><b>{% trans "Applier" %}</b></label>
226 <div class="controls">{{ form.applier }}</div>
227 {% if form.applier.errors %}
229 <p class="error" style="clear:both;">
230 {{ form.applier.errors|join:", " }}
236 <input type="hidden" id="id_applier" name="applier" value="{{applier}}"/>
240 {% trans "Rule Match Conditions" %}
242 <div class="control-group {% if form.source.errors %} error {% endif %}">
243 <label class="control-label" for="id_source"><b>{% trans "Source Address" %}</b></label>
244 <div class="controls">{{ form.source }} <img src="/fodstatic/threat_source.png" style="height: 30px;"/> <a class="btn btn-small btn-info" id="setFromAll" href="#">Any</a>
245 {% if form.source.errors %}
246 <span class="help-inline">
247 {{ form.source.errors|join:", " }}
250 <span class="help-block"> {{ form.source.help_text }}</span>
255 <div class="control-group {% if form.destination.errors %} error {% endif %}">
256 <label class="control-label" for="id_destination"><b>{% trans "Destination Address" %}</b></label>
257 <div class="controls">
258 {{ form.destination }} <img src="/fodstatic/secure_destination.png" style="height: 30px;"/>
259 {% if form.destination.errors %}
260 <span class="help-inline">
261 {{ form.destination.errors|join:", " }}
264 <span class="help-block">{{ form.destination.help_text }}</span>
268 <div class="control-group {% if form.protocol.errors %} error {% endif %}">
269 <label class="control-label" for="id_protocol">{% trans "Protocol" %}</label>
270 <div class="controls">{{ form.protocol }}
271 {% if form.protocol.errors %}
272 <span class="help-inline">
273 {{ form.protocol.errors|join:", " }}
279 <div class="control-group {% if form.fragmenttype.errors %} error {% endif %}">
280 <label class="control-label" for="id_fragmenttype">{% trans "Fragment Type" %}</label>
281 <div class="controls">{{ form.fragmenttype }}
282 {% if form.fragmenttype.errors %}
283 <span class="help-inline">
284 {{ form.fragmenttype.errors|join:", " }}
292 class="control-group {% if form.port.errors %} error {% endif %}">
293 <label class="control-label" for="id_port">{% trans "Ports" %}</label>
294 <div class="controls">
295 <div id="portsaccordion" class="accordion">
296 <div class="accordion-group">
297 <div class="accordion-heading">
298 <a class="accordion-toggle" data-toggle="collapse"
299 data-parent="#accordion2" href="#collapseOne"> {% trans "Advanced Settings (Ports)" %}</a>
301 <div id="collapseOne" class="accordion-body collapse">
302 <div class="accordion-inner">
303 <label>{% trans "Select source/destination port(s), or select common port(s) for both source/destination" %}</label>
304 <div class="control-group {% if form.sourceport.errors %} error {% endif %}">
305 <label class="control-label" for="id_sourceport">{% trans "Source Port" %}</label>
306 <div class="controls">
307 {{ form.sourceport }}
309 <span class="help-inline">
310 <button class="new_port btn btn-small"><i class="icon-plus"></i>{% trans "Port" %}</button>
311 {% if form.sourceport.errors %}
312 {{ form.sourceport.errors|join:", " }}
316 <span class="help-block">{{ form.sourceport.help_text }}</span>
319 <div class="control-group {% if form.destinationport.errors %} error {% endif %}">
320 <label class="control-label" for="id_destinationport">{% trans "Destination Port" %}</label>
321 <div class="controls">
322 {{ form.destinationport }}
324 <span class="help-inline">
325 <button class="new_port btn btn-small"><i class="icon-plus"></i>{% trans "Port" %}</button>
326 {% if form.destinationport.errors %}
327 {{ form.destinationport.errors|join:", " }}
331 <span class="help-block">{{ form.destinationport.help_text }}</span>
334 <div class="control-group {% if form.port.errors %} error {% endif %}">
335 <label class="control-label" for="id_port">{% trans "Port" %}</label>
336 <div class="controls">
339 <span class="help-inline">
340 <button class="new_port btn btn-small"><i class="icon-plus"></i>{% trans "Port" %}</button>
341 {% if form.port.errors %}
342 {{ form.port.errors|join:", " }}
346 <span class="help-block">{{ form.port.help_text }}</span>
360 {% trans "Rule Actions" %}
362 <div class="control-group {% if form.then.errors %} error {% endif %}">
363 <label class="control-label" for="id_then"><b>{% trans "Then" %}</b></label>
364 <div class="controls">{{ form.then }}
365 {% if form.then.errors %}
366 <span class="help-inline">
367 {{ form.then.errors|join:", " }}
371 {% comment %}
372 <button id="new_then_actions">
381 {% trans "Expiration" %}
383 <div class="control-group {% if form.expires.errors %} error {% endif %}">
384 <label class="control-label" for="id_expires">{% trans "Expires" %}</label>
385 <div class="controls">{{ form.expires }}
386 {% if form.expires.errors %}
387 <span class="help-inline">
388 {{ form.expires.errors|join:", " }}
397 {% trans "Use/Comments" %}
399 <div class="control-group {% if form.comments.errors %} error {% endif %}">
400 <label class="control-label" for="id_comments">{% trans "Comments" %}</label>
401 <div class="controls">
402 <span class="help-block">{% blocktrans %}Give a short description of the intended use of this rule, that justifies the parameter selection above. Feel free to include any additional comments.{% endblocktrans %}</span>
405 {% if form.comments.errors %}
406 <span class="help-inline">
407 {{ form.comments.errors|join:", " }}
414 <div class="control-group">
415 <div class="controls">
416 <button type="submit" id="applybutton" value="{% trans 'Apply' %}" class="btn btn-large btn-primary"/>Apply</button>
423 <div id="then_diag" title="Add new rate-limit value">
425 <div id="port_diag" title="{% trans "Add new port" %}">