Commit 101d86ee authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos
Browse files

Aligned branch internationalization with latest changes in master

parents be9ee8b3 cc0c4fcf
......@@ -256,11 +256,29 @@ div.roundbox, #portsacc, #id_comments{
</p>
</div>
</fieldset>
{% if user.is_superuser %}
<fieldset>
<legend>
{% trans "Admin Options" %}
</legend>
<div class="roundbox">
{{ form.applier.label_tag }}{{ form.applier }}
<br>
{% if form.applier.errors %}
<br>
<p class="error" style="clear:both;">
{{ form.applier.errors|join:", " }}
</p>
{% endif %}
</div>
</fieldset>
{% else %}
<input type="hidden" id="id_applier" name="applier" value="{{applier}}"/>
{% endif %}
<fieldset>
<legend>
{% trans "Rule Match Conditions" %}
</legend>
<input type="hidden" id="id_applier" name="applier" value="{{applier}}"/>
<div class="roundbox">
{{ form.source.label_tag }}{{ form.source }}<img src="/static/threat_source.png"/> {% if form.source.errors %}
<br>
......
......@@ -29,13 +29,14 @@
<div id="main">
<div id="header">
<a class="grnetlogo" href="{% url group-routes %}">
<img class="logoimg" src="/static/grnet_logo.png">
<img class="logoimg" src="/static/logo.png">
</a>
<div id="title">
<a href="{% url group-routes %}">Firewall on Demand</a>
</div>
<div class="loginform">
<div id="formcontent">
{% block menublock %}
{% if user.is_authenticated %}
<span class="topmenuuser">{% trans "Welcome" %} <strong>{{user}}</strong></span>
{% endif %}
......@@ -59,6 +60,7 @@
{% else %}
<span class="topmenuaction"><a href="{% url login %}">{% trans "Shibboleth Login" %}</a></span>
{% endif %}
{% endblock %}
</div>
</div>
......@@ -80,13 +82,9 @@
{% endblock %}
</div>
<div id="footer">
{% if user.is_authenticated %}
{% trans "If you have any questions or need help, contact GRNET Helpdesk at <a href='mailto:helpdesk@grnet.gr'>helpdesk@grnet.gr</a> or 800-11-47638." %}<br />
{% endif %}
<a href="http://www.grnet.gr">{% trans "GRNET" %} NOC</a> | <a href="{% url getinfo %}">{% trans "Info" %}</a> | <a href="{% url gettos %}">{% trans "Service Terms" %}</a>
</div>
{% block footerblock %}
{% include "footer.html" %}
{% endblock %}
</div>
</body>
</html>
{% extends "base.html" %}
{% load i18n %}
<html>
<head>
<title>{% if error %}{% if inactive %}{% trans "Activation Pending" %}{% else %}{% trans "Error" %}{% endif %}{% endif %}</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/static/css/base.css">
<link rel="stylesheet" type="text/css" href="/static/css/smoothness/jquery-ui-1.8.13.custom.css">
<script type="text/javascript" src="/static/js/jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.tooltip.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".relogin").tooltip({ position: "bottom center", opacity: 0.7});
});
</script>
<style type="text/css">
{% block title %}{% if error %}{% if inactive %}{% trans "Activation Pending" %}{% else %}{% trans "Error" %}{% endif %}{% endif %}{% endblock %}
{% block extrahead %}
<script type="text/javascript">
$(document).ready(function(){
$(".relogin").tooltip({ position: "bottom center", opacity: 0.7});
});
</script>
<style type="text/css">
.tooltip {
display: none;
background: transparent url(/static/black_arrow_updown.png);
font-size: 12px;
height: 70px;
width: 160px;
padding: 25px;
padding-top: 30px;
color: #fff;
}
.tooltip {
display: none;
background: transparent url(/static/black_arrow_updown.png);
font-size: 12px;
height: 70px;
width: 160px;
padding: 25px;
padding-top: 30px;
color: #fff;
}
</style>
<script type="text/javascript">
......@@ -37,87 +31,46 @@ $(document).ready(function(){
}
</script>
</head>
{% endblock %}
<body>
<div id="main">
<div id="header">
<a class="grnetlogo" href="{% url group-routes %}">
<img class="logoimg" src="/static/grnet_logo.png">
</a>
<div id="title">
<a href="{% url group-routes %}">Firewall on Demand</a>
</div>
<div class="loginform">
<div id="formcontent">
{% if user.is_authenticated %}
<span class="topmenuuser">{% trans "Welcome" %} <strong>{{user}}</strong></span>
{% endif %}
<span {% if user.is_authenticated %}class="topmenuaction"{% else %}class="topmenuuser"{% endif %} >
<form action="{% url django.views.i18n.set_language %}" method="post" style="display:inline;" id="langform">
{% csrf_token %}
<input name="next" type="hidden" value="{{ next }}" />
<input id="langsel" name="language" type="hidden" value="" />
{% for lang in LANGUAGES %}<a class="select_lang" href="#" onclick="setlang('{{ lang.0 }}'); return false;" title="{{lang.1}}">{% ifnotequal LANGUAGE_CODE lang.0 %}<font style="font-weight:normal;">{% endifnotequal %}{% trans lang.1 %}{% ifnotequal LANGUAGE_CODE lang.0 %}</font>{% endifnotequal %}</a>{% if not forloop.last %} -{% endif %}
{% endfor %}
</form>
</span>
{% if user.is_authenticated %}
<span class="topmenuaction"><a href="{% url user-profile %}">{% trans "My profile" %}</a></span>
{% if user.is_superuser %}
<span class="topmenuaction"><a href="{% url admin:index %}">{% trans "Admin" %}</a></span>
{% endif %}
<span class="topmenuaction"><a href="{% url logout %}">{% trans "Logout" %}</a></span>
{% else %}
<span class="topmenuaction relogin" title='{% trans "After clicking Retry Login, it is strongly suggested to close your browser and visit the page again" %}'><a href="{% url logout %}">{% trans "Retry Login" %}</a></span>
{% endif %}
</div>
</div>
</div>
<div id="content">
{% block brcrmb_container %}
<div class="info_content_title">{% if user.is_authenticated %}<a href="{% url group-routes %}">{% trans "My routes" %}</a>{% endif %}
{% block breadcrumbs %}{% endblock %}
</div>
{% endblock %}
{% block content %}
{% if error %}{% if inactive %}<h2>{% trans "Activation Pending" %}</h2>{% else %}<h2>{% trans "Error" %}</h2>{% endif %}{% endif %}
<div>
{% if missing_attributes %}
<p>{% trans "One or more required shibboleth attributes were not released towards this service" %}</p>
{% endif %}
<p {% if not inactive %}style="color: red;"{% endif %}>{% autoescape off %}{{error}}{% endautoescape %}</p>
{% if missing_attributes %}
<p>
{% trans "Required shibboleth attributes" %}:<br>
<ul>
<li>HTTP_EPPN</li>
<li>HTTP_SHIB_HOMEORGANIZATION</li>
<li>HTTP_SHIB_INETORGPERSON_MAIL</li>
<li>An appropriate HTTP_SHIB_EP_ENTITLEMENT</li>
</ul>
{% trans "Optional" %}:
<ul>
<li>HTTP_SHIB_INETORGPERSON_GIVENNAME</li>
<li>HTTP_SHIB_PERSON_SURNAME</li>
</ul>
</p>
{% endif %}
</div>
{% endblock %}
{% block menublock %}
{% if user.is_authenticated %}
<span class="topmenuuser">{% trans "Welcome" %} <strong>{{user}}</strong></span>
{% endif %}
{% if user.is_authenticated %}
<span class="topmenuaction"><a href="{% url user-profile %}">{% trans "My profile" %}</a></span>
{% if user.is_superuser %}
<span class="topmenuaction"><a href="{% url admin:index %}">{% trans "Admin" %}</a></span>
{% endif %}
<span class="topmenuaction"><a href="{% url logout %}">{% trans "Logout" %}</a></span>
{% else %}
<span class="topmenuaction relogin" title="After clicking Retry Login, it is strongly suggested to close your browser and visit the page again"><a href="{% url logout %}">{% trans "Retry Login" %}</a></span>
{% endif %}
{% endblock %}
</div>
<div id="footer">
{% if user.is_authenticated %}
{% trans "If you have any questions or need help, contact GRNET Helpdesk at <a href='mailto:helpdesk@grnet.gr'>helpdesk@grnet.gr</a> or 800-11-47638." %}<br />
{% endif %}
<a href="http://www.grnet.gr">{% trans "GRNET" %} NOC</a> | <a href="/about/info/">{% trans "Info" %}</a> | <a href="/about/terms-of-service">{% trans "Service Terms" %}</a>
</div>
{% block content %}
{% if error %}{% if inactive %}<h2>{% trans "Activation Pending" %}</h2>{% else %}<h2>{% trans "Error" %}</h2>{% endif %}{% endif %}
<div>
{% if missing_attributes %}
<p>{% trans "One or more required shibboleth attributes were not released towards this service" %}</p>
{% endif %}
<p {% if not inactive %}style="color: red;"{% endif %}>{% autoescape off %}{{error}}{% endautoescape %}</p>
{% if missing_attributes %}
<p>
{% trans "Required shibboleth attributes" %}:<br>
<ul>
<li>HTTP_EPPN</li>
<li>HTTP_SHIB_HOMEORGANIZATION</li>
<li>HTTP_SHIB_INETORGPERSON_MAIL</li>
<li>An appropriate HTTP_SHIB_EP_ENTITLEMENT</li>
</ul>
{% trans "Optional" %}:
<ul>
<li>HTTP_SHIB_INETORGPERSON_GIVENNAME</li>
<li>HTTP_SHIB_PERSON_SURNAME</li>
</ul>
</p>
{% endif %}
</div>
</body>
</html>
{% endblock %}
{% load i18n %}
<div id="footer">
{% if user.is_authenticated %}
{% trans "If you have any questions or need help, contact GRNET Helpdesk at <a href='mailto:helpdesk@grnet.gr'>helpdesk@grnet.gr</a> or 800-11-47638." %}<br />
{% endif %}
<a href="http://www.grnet.gr">{% trans "GRNET" %} NOC</a> | <a href="{% url getinfo %}">{% trans "Info" %}</a> | <a href="{% url gettos %}">{% trans "Service Terms" %}</a>
<p style="text-align: center;"><img width="46" height="40" border="0" class="image image-img_assist_custom-46x40 " src="http://noc.grnet.gr/sites/default/files/images/image_PSSYGK.img_assist_custom-46x40.png" alt="Flag ΨΣ" title="Flag ΨΣ"> <img width="49" height="40" border="0" class="image image-img_assist_custom-49x40 " src="http://noc.grnet.gr/sites/default/files/images/image_EEflag.img_assist_custom-49x40.png" alt="EU flag" title="EU flag"> <img width="90" height="40" border="0" class="image image-img_assist_custom-90x40 " src="http://noc.grnet.gr/sites/default/files/images/image_YPDBMTH.img_assist_custom-90x40.png" alt="Flag ΥΠΔΒΜΘ" title="Flag ΥΠΔΒΜΘ"><img width="67" height="40" border="0" class="image image-img_assist_custom-67x40 " src="http://noc.grnet.gr/sites/default/files/images/image_ESPA.img_assist_custom-67x40.png" alt="ESPA" title="ESPA"></p>
</div>
......@@ -2,6 +2,7 @@
{% load i18n %}
{% block title %}{% trans "My profile" %}{% endblock %}
{% block breadcrumbs %}:: {% trans "My profile" %}{% endblock %}
{% block content %}
<h3>{% trans "My profile" %}</h3>
......@@ -10,16 +11,25 @@
<strong>{% trans "First name" %}:</strong> {{user.first_name}} <br>
<strong>{% trans "Last name" %}:</strong> {{user.last_name}} <br>
<strong>{% trans "Email" %}:</strong> {{user.email}}<br>
<strong>{% trans "Organization" %}:</strong> {{peer}} <br>
<strong>{% trans "Admin Networks" %}:</strong> <br>
{% for network in peer.networks.all %}
{{network}}<br>
{% empty %}
<span style="color:red">{% blocktrans %}Ooops! Seems you have no networks associated with your peer. Contact Helpdesk to resolve this issue.{% endblocktrans %}</span>
<br>
<strong>{% trans "My Networks" %}:</strong><br>
<table class="display">
<tr>
<th class="ui-state-default">{% trans "Organization" %}</th><th class="ui-state-default">{% trans "Networks" %}</th>
</tr>
{% for peer in peers %}
<tr class="gradeC {% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}">
<td>{{peer}} </td>
<td>
{% for network in peer.networks.all %}
{{network}}<br>
{% empty %}
<span style="color:red">{% blocktrans %}Ooops! Seems you have no networks associated with your peer. Contact Helpdesk to resolve this issue.{% endblocktrans %}</span>
{% endfor %}
</td></tr>
{% endfor %}
</table>
</div>
{% endblock %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans "Review application" %} #{{ application.pk }}{% endblock %}
{% block content %}
<style type="text/css">
.comments {
font-style: italic;
max-width: 40em;
}
.notice {
text-align: center;
font-style: italic;
}
#review {
max-width: 50em;
margin-left: auto;
margin-right: auto;
}
</style>
<script>
function set_network(net){
$("#id_network").val(net);
}
</script>
<div align="center" id="review">
<h2>{% trans "Review application" %} #{{ application.pk }} {% trans "by" %} {{ application.applicant }}</h2>
<p>{% trans "Submitted" %} {{ application.filed|date }}</p>
{% if application.is_pending %}
<form method="POST" id="appform">
{% csrf_token %}
<fieldset>
<legend>{% trans "Instance information" %}</legend>
<table>
<tr><th>{{ appform.hostname.label_tag }}</th><td>{{ appform.hostname }}<span class="error">{{ appform.hostname.errors|join:", " }}</span></td></tr>
<tr><th>{{ appform.memory.label_tag }}</th><td>{{ appform.memory }}<span class="error">{{ appform.memory.errors|join:", " }}</span></td></tr>
<tr><th>{{ appform.vcpus.label_tag }}</th><td>{{ appform.vcpus }}<span class="error">{{ appform.vcpus.errors|join:", " }}</span></td></tr>
<tr><th>{{ appform.disk_size.label_tag }}</th><td>{{ appform.disk_size }}<span class="error">{{ appform.disk_size.errors|join:", " }}</span></td></tr>
<tr><th>{{ appform.organization.label_tag }}</th><td>{{ appform.organization }}<span class="error">{{ appform.organization.errors|join:", " }}</span></td></tr>
<tr><th>{{ appform.hosts_mail_server.label_tag }}</th><td>{{ appform.hosts_mail_server }}<span class="error">{{ appform.hosts_mail_server.errors|join:", " }}</span></td></tr>
<tr><th>{{ appform.operating_system.label_tag }}</th><td>{{ appform.operating_system }}<span class="error">{{ appform.operating_system.errors|join:", " }}</span></td></tr>
</table>
</fieldset>
{% if application.admin_contact_name %}
<fieldset>
<legend>{% trans "Administrative contact" %}</legend>
<table>
<tr><th>{% trans "Name" %}</th><td>{{ application.admin_contact_name }}</td></tr>
<tr><th>{% trans "Email" %}</th><td>{{ application.admin_contact_email }}</td></tr>
<tr><th>{% trans "Phone" %}</th><td>{{ application.admin_contact_phone }}</td></tr>
</table>
</fieldset>
{% endif %}
<fieldset>
<legend>{% trans "Comments" %}</legend>
<div class="comments">
{{ application.comments }}
</div>
</fieldset>
<fieldset>
<legend>{% trans "Placement" %}</legend>
{% if application.network %}
<div class="notice">
{% trans "The user has requested explicit network placement on" %} {{ application.network }} ({{ application.network.cluster.description }})
</div>
{% endif %}
<p>{% trans "Choose either a network, or a cluster from the quick list to use the cluster's default network." %}</p>
<p>{% trans "Network" %}: {{ appform.network }}</p>
{% if appform.network.errors %}
<p class="error">{{ appform.network.errors|join:", " }}</p>
{% endif %}
<p>{% for cl in fast_clusters %}<a href="#" onclick="set_network('{{ cl.get_default_network.pk }}');">{{ cl.description }} ({{ cl.slug }})</a> {% if not forloop.last %}| {% endif %}{% endfor %}</p>
</fieldset>
<fieldset>
<legend>{% trans "Decision" %}</legend>
<p>{% trans "Comments to the user" %}:</p>
{% if appform.admin_comments.errors %}
<p><span class="error">{{ appform.admin_comments.errors }}</span></p>
{% endif %}
<p>{{ appform.admin_comments }}</p>
<p><input type="submit" value="Accept" name="accept"/> <input type="submit" value="Reject" name="reject" /></p>
</legend>
</form>
{% else %}
<fieldset>
<legend>{% trans "Instance information" %}</legend>
<table>
<tr><th>{{ appform.hostname.label_tag }}</th><td>{{ application.hostname }}</td></tr>
<tr><th>{{ appform.memory.label_tag }}</th><td>{{ application.memory }}</td></tr>
<tr><th>{{ appform.vcpus.label_tag }}</th><td>{{ application.vcpus }}</td></tr>
<tr><th>{{ appform.disk_size.label_tag }}</th><td>{{ application.disk_size }}</td></tr>
<tr><th>{{ appform.organization.label_tag }}</th><td>{{ application.organization }}</td></tr>
<tr><th>{{ appform.hosts_mail_server.label_tag }}</th><td>{{ application.hosts_mail_server }}</td></tr>
<tr><th>{{ appform.operating_system.label_tag }}</th><td>{{ application.operating_system }}</td></tr>
</table>
</fieldset>
{% if application.admin_contact_name %}
<fieldset>
<legend>{% trans "Administrative contact" %}</legend>
<table>
<tr><th>{% trans "Name" %}</th><td>{{ application.admin_contact_name }}</td></tr>
<tr><th>{% trans "Email" %}</th><td>{{ application.admin_contact_email }}</td></tr>
<tr><th>{% trans "Phone" %}</th><td>{{ application.admin_contact_phone }}</td></tr>
</table>
</fieldset>
{% endif %}
<fieldset>
<legend>{% trans "Comments" %}</legend>
<div class="comments">
{{ application.comments }}
</div>
</fieldset>
<fieldset>
<legend>{% trans "Placement" %}</legend>
<p>{% trans "The instance has been placed on" %} {{ application.network }} ({{ application.cluster.description }})</p>
</fieldset>
{% endif %}
</div>
{% endblock %}
{% load tofqdn %}{% ifequal action 'expires' %}Rule {{route.name}} expires {% ifequal expiration_days 0 %}today{% else%}in {{expiration_days}} day{{ expiration_days|pluralize }}{% endifequal %}{% else %}A new rule {{action}} job has spawned
Peer: {{route.applier.get_profile.peer.peer_name}}
User {{route.applier.username}} requested the {{action}} of the following rule from address {{address}} {% if address|tofqdn %}({{address|tofqdn}}){% endif %}:
Rule name: {{route.name}}{% endifequal %}
Match Statements:
* Source Address: {{route.source}}
* Destination Address: {{route.destination}}
* Protocol: {% if route.protocol.all %}{% for protocol in route.protocol.all %}{{ protocol }}{% if not forloop.last %}, {% endif %}{% endfor %}{% else %}any{% endif %}
* Ports: {% if route.sourceport.all or route.destinationport.all %}Defined by source/destination ports{% else %}{% if route.port.all %}{% for port in route.port.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}{% else %}any{% endif %}{% endif %}
* Source Ports: {% if route.port.all %}same as ports{% else %}{% if route.sourceport.all %}{% for port in route.sourceport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}{% else %}any{% endif %}{% endif %}
* Destination Ports: {% if route.port.all %}same as ports{% else %}{% if route.destinationport.all %}{% for port in route.destinationport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}{% else %}any{% endif %}{% endif %}
Then Actions:
* Action:{% for then in route.then.all %}{{ then }}{% if not forloop.last %}, {% endif %}{% endfor %}
Comments: {% if route.comments %}{{route.comments}}{% else %}-{% endif %}
Expires: {% ifequal action 'removal' %}Now, removal requested{%else%}{{route.expires}}{% endifequal %}
Rule url: {{url}}
{% load tofqdn %}
A new rule creation job has spawned
Peer: {{route.applier.get_profile.peer.peer_name}}
User {{route.applier.username}} requested the application of the following rule from address {{address}} {% if address|tofqdn %}({{address|tofqdn}}){% endif %}:
Match
* Dst Addr:{{route.destination}}
* Src Addr: {{route.source}}
* Protocol:{% for protocol in route.protocol.all %}{{ protocol }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Ports:{% for port in route.ports.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Source Ports:{% for port in route.sourceport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Destination Ports:{% for port in route.destinationport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
*Then:{% for then in route.then.all %}{{ then }}{% if not forloop.last %}, {% endif %}{% endfor %}
{% load tofqdn %}
A new rule removal job has spawned
Peer: {{route.applier.get_profile.peer.peer_name}}
User {{route.applier.username}} requested the removal of the following rule from address {{address}} {% if address|tofqdn %}({{address|tofqdn}}){% endif %}:
Match
* Dst Addr:{{route.destination}}
* Src Addr: {{route.source}}
* Protocol:{% for protocol in route.protocol.all %}{{ protocol }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Ports:{% for port in route.ports.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Source Ports:{% for port in route.sourceport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Destination Ports:{% for port in route.destinationport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
*Then:{% for then in route.then.all %}{{ then }}{% if not forloop.last %}, {% endif %}{% endfor %}
{% load tofqdn %}
A new rule edit job has spawned
Peer: {{route.applier.get_profile.peer.peer_name}}
User {{route.applier.username}} requested the application of the following rule from address {{address}} {% if address|tofqdn %}({{address|tofqdn}}){% endif %}:
Match
* Dst Addr:{{route.destination}}
* Src Addr: {{route.source}}
* Protocol:{% for protocol in route.protocol.all %}{{ protocol }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Ports:{% for port in route.ports.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Source Ports:{% for port in route.sourceport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Destination Ports:{% for port in route.destinationport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
*Then:{% for then in route.then.all %}{{ then }}{% if not forloop.last %}, {% endif %}{% endfor %}
Rule {{route.name}} expires {% ifequal expiration_days 0 %}today{% else%}in {{expiration_days}} day{{ expiration_days|pluralize }}{% endifequal %}
Match
* Dst Addr:{{route.destination}}
* Src Addr: {{route.source}}
* Protocol:{% for protocol in route.protocol.all %}{{ protocol }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Ports:{% for port in route.ports.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Source Ports:{% for port in route.sourceport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
* Destination Ports:{% for port in route.destinationport.all %}{{ port }}{% if not forloop.last %}, {% endif %}{% endfor %}
*Then:{% for then in route.then.all %}{{ then }}{% if not forloop.last %}, {% endif %}{% endfor %}
Visit {{url}} to edit the rule.
<div id="sshkeys_placeholder">
<script>
$(document).ajaxSend(function(event, xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
function sameOrigin(url) {
// url could be relative or scheme relative or absolute
var host = document.location.host; // host + port
var protocol = document.location.protocol;
var sr_origin = '//' + host;
var origin = protocol + sr_origin;
// Allow absolute or scheme relative URLs to same origin
return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
(url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + '/') ||
// or any other URL that isn't scheme relative or absolute i.e relative.
!(/^(\/\/|http:|https:).*/.test(url));
}
function safeMethod(method) {
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
}
});
$(function() {
$('.remove_btn').button({
icons: {
primary: "ui-icon-circle-close"
},
text: false
})
$('#add_ssh_key_btn').button();
$('#add_ssh_key_btn').click(function() {
str = $('#sshkeyform').serialize();
$.ajax({
type: "POST",
url: "{% url user-keys %}",
data: str,
success: function(response){
// var $response=$(response);
// var resdata = $response.filter("#sshkeys_placeholder").html();
$("#sshkeys_placeholder").html(response);
}
});
return false;
});
$('a[id^="remove_key_"]').click(function() {
var $this = $(this);
var id = $this.attr("id");
var key_id = id.replace("remove_key_", "")
$.ajax({
type: "GET",
url: "{% url delete-key %}"+key_id,
success: function(response){
// var $response=$(response);
// var resdata = $response.filter("#sshkeys_placeholder").html();
$("#sshkeys_placeholder").html(response);
}
});
return false;
});
});
</script>
<style type="text/css">
.fingerprint {
font-family: monospace;
}
</style>
{% load i18n %}
<p>{% trans "Upload your SSH public keys and have them automatically installed on all newly-created instances. Keys must be in OpenSSH format, either RSA, or DSA, with or without a trailing comment." %}</p>
{% if keys %}
<table>
<tr><th>{% trans "Fingerprint" %}</th><th>{% trans "Comment" %}</th></tr>
{% for key in keys %}
<tr><td class="fingerprint">{{ key.fingerprint }}</td><td>{{ key.comment|default:"&mdash;" }}</td><td><a class="remove_btn" id="remove_key_{{key.id}}" href="#">{% trans "Delete" %}</a></tr>
{% endfor %}
</table>
{% endif %}
<h2>{% trans "Add new key" %}</h2>
{% if msg %}
<div class="error">{{msg}}</div>
{% endif %}
<form method="POST" id="sshkeyform">
{% csrf_token %}
{% if form.ssh_pubkey.errors %}
<div class="error">{{ form.ssh_pubkey.errors }}</div>
{% endif %}