Commit c2b3014a authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Added xml generation plus user management

parent 04df82f7
......@@ -7,6 +7,10 @@ from django.contrib.contenttypes import generic
class NameInline(generic.GenericTabularInline):
model = Name_i18n
class UrlInline(generic.GenericTabularInline):
model = URL_i18n
class InstitutionAdmin(admin.ModelAdmin):
inlines = [
......@@ -18,6 +22,10 @@ class ServiceLocAdmin(admin.ModelAdmin):
NameInline,
]
class RealmInLine(admin.ModelAdmin):
inlines = [
UrlInline,
]
admin.site.register(Name_i18n)
......@@ -32,5 +40,5 @@ admin.site.register(MonLocalEAPOLData)
admin.site.register(ServiceLoc, ServiceLocAdmin)
admin.site.register(Institution, InstitutionAdmin)
admin.site.register(InstitutionDetails)
admin.site.register(Realm)
admin.site.register(Realm, RealmInLine)
admin.site.register(RealmData)
\ No newline at end of file
......@@ -19,6 +19,11 @@ class InstServerForm(forms.ModelForm):
class Meta:
model = InstServer
class ContactForm(forms.ModelForm):
class Meta:
model = Contact
class InstRealmForm(forms.ModelForm):
class Meta:
......
This diff is collapsed.
{% extends "edumanage/welcome.html"%}
{% block crumbs %}
<li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
<li class="active">Contacts</li>
{% endblock %}
{% load i18n %}
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/js/datatables_bootstrap.js"></script>
<script type="text/javascript">
$(document).ready(function(){
{% if contacts %}
var oTable = $('#table').dataTable({
"sPaginationType": "bootstrap",
"sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"aoColumns": [{
"bSearchable": true,
"bSortable": true
}, {
"bSearchable": true,
"bSortable": true
}, {
"bSearchable": true,
"bSortable": true
}, {
"bVisible": true,
"bSearchable": false,
"bSortable": false
}],
"aaSorting": [[0, 'desc']],
"iDisplayLength": 25,
"oSearch": {"bSmart": false, "bRegex":true},
"oLanguage": {
"sLengthMenu": '{% trans "Display" %} <select><option value="25">25</option><option value="50">50</option><option value="-1">{% trans "All" %}</option></select> {% trans "contacts" %}',
"sProcessing": "Processing...",
"sZeroRecords": '{% trans "No records to display" %}',
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "{% trans "Showing 0 to 0 of 0 entries" %}",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sSearch": '{% trans "Search:" %}',
"sUrl": "",
"oPaginate": {
"sFirst": '{% trans "First" %}',
"sPrevious": '{% trans "Previous" %}',
"sNext": '{% trans "Next" %}',
"sLast": '{% trans "Last" %}'
}
}
});
oTable.fnDraw();
$('[id^=del_contact_]').click(function(){
contact_id = (this.id).replace("del_contact_", '');
name = this.getAttribute("data-contactname");
$("#mymodalbody").html("You are about to delete contact: <b>"+name+"</b><br>Press Delete to proceed or Cancel to cancel deletion");
$("#myModalLabel").html("Delete contact "+name);
$('#myModal').modal('show');
$(".modal-footer").show();
$("#contact_name_del").html(name)
return false;
});
$("#delcontactSubmit").click(function(){
$.ajax({
url:"{% url del-contact %}/?contact_pk="+contact_id,
type: "GET",
success: function(data){
if (data.error){
$(".modal-footer").hide();
$("#mymodalbody").html("<font style='color:#B94A48'>"+data.error+"</font>");
}
if (data.success){
$(".modal-footer").hide();
$("#mymodalbody").html("contact "+name+" successfully deleted");
window.setTimeout('location.reload()', 1000);
}
}
});
});
{% endif %}
});
</script>
{% endblock %}
{% block navbar %}
{% endblock %}
{% block homeactive %}{% endblock %}
{% block contactsactive %}class="active"{% endblock %}
{% block subcontent %}
<h4>contacts</h4>
<hr>
<div><a href="{% url edit-contacts %}" class="btn btn-primary">Add new contact</a></div>
<div class="span10"></div>
{% if contacts %}
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" width="100%" id="table">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th style="text-align: center;">Action</th>
</tr>
</thead>
<tbody>
{% for contact in contacts %}
<tr class="GradeC">
<td>{{contact.firstname}} {{contact.lastname}}</td>
<td>{{contact.email}}</td>
<td>{{contact.phone}}</td>
<td style="text-align: center;"><a href="{% url edit-contacts contact.pk %}" class="btn btn-small">edit</a> <a href="#" id="del_contact_{{contact.pk}}" data-contactname="{{contact.firstname}} {{contact.lastname}}" class="btn btn-small btn-warning">delete</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div>No contacts defined yet (<a href="{% url edit-contacts %}">add</a>)</div>
{% endif %}
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Delete contact</h3>
</div>
<div class="modal-body" id="mymodalbody">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<a class="btn btn-warning" id="delcontactSubmit" href="#">Delete</a>
</div>
</div>
{% endblock %}
{% extends "edumanage/welcome.html"%}
{% block crumbs %}
<li><a href="{% url manage %}">Home</a><span class="divider">/</span></li>
<li><a href="{% url realms %}">Realms</a><span class="divider">/</span></li>
<li class="active">Add-Edit</li>
{% endblock %}
{% block extrahead %}
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
{% endblock %}
{% block homeactive %}{% endblock %}
{% block contactsactive %}class="active"{% endblock %}
{% block subcontent %} <h4>Contacts Add/Edit</h4>
<hr>
<form method="POST" class="form-horizontal">
{% csrf_token %}
{% if form.non_field_errors %}
<p class="error">
{{ form.non_field_errors}}
</p>
{% endif %}
<div style="display: none">
{{form.instid}}
</div>
<div class="control-group {% if form.firstname.errors %} error {% endif %}">
<label class="control-label" for="id_firstname"><b>First name</b></label>
<div class="controls">
{{ form.firstname }}
{% if form.firstname.errors %} <span class="help-inline"> {{ form.firstname.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.firstname.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.lastname.errors %} error {% endif %}">
<label class="control-label" for="id_lastname"><b>Last name</b></label>
<div class="controls">
{{ form.lastname }}
{% if form.lastname.errors %} <span class="help-inline"> {{ form.lastname.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.lastname.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.email.errors %} error {% endif %}">
<label class="control-label" for="id_email"><b>Email</b></label>
<div class="controls">
{{ form.email }}
{% if form.email.errors %} <span class="help-inline"> {{ form.email.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.email.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.phone.errors %} error {% endif %}">
<label class="control-label" for="id_phone"><b>Phone</b></label>
<div class="controls">
{{ form.phone }}
{% if form.phone.errors %} <span class="help-inline"> {{ form.phone.errors|join:", " }} </span>
{% endif %} <span class="help-block"> {{ form.phone.help_text }}</span>
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="submit" id="applybutton" value="Apply" class="btn btn-large btn-primary"/>
Apply</button>
</div>
</div>
</form>
{% endblock %}
......@@ -195,6 +195,9 @@ $.get("{% url get-service-points %}", function(data){
<li {% block realmsactive %}{% endblock %}>
<a href="{% url realms %}">Realms ({{realms_num}})</a>
</li>
<li {% block contactsactive %}{% endblock %}>
<a href="{% url contacts %}">Contacts ({{contacts_num}})</a>
</li>
</ul>
</div><!--/.well -->
</div><!--/span-->
......
{% autoescape off %}{{xml}}{% endautoescape %}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="eduroam_institution_type">
<xs:restriction base="xs:int">
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>IdP</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="2">
<xs:annotation>
<xs:documentation>SP</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="3">
<xs:annotation>
<xs:documentation>SPIdP</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:element name="institutions">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="institution">
<xs:complexType>
<xs:sequence>
<xs:element name="country" type="xs:string"/>
<xs:element name="type" type="eduroam_institution_type"/>
<xs:element name="inst_realm" type="xs:string" maxOccurs="unbounded" minOccurs="0"/>
<xs:element name="org_name" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="street" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="contact" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
<xs:element name="phone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="info_URL" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="policy_URL" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="ts" type="xs:dateTime">
<xs:annotation>
<xs:documentation> Format: 2008-02-29T12:00:00 </xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="location" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="longitude" type="xs:string"/>
<xs:element name="latitude" type="xs:string"/>
<xs:element name="loc_name" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="street" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="contact" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
<xs:element name="phone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="SSID" type="xs:string"/>
<xs:element name="enc_level" type="xs:string"/>
<xs:element name="port_restrict" type="xs:boolean" default="0"/>
<xs:element name="transp_proxy" type="xs:boolean" default="0" minOccurs="0"/>
<xs:element name="IPv6" type="xs:boolean" default="0" minOccurs="0"/>
<xs:element name="NAT" type="xs:boolean" default="0" minOccurs="0"/>
<xs:element name="AP_no" type="xs:int" minOccurs="0"/>
<xs:element name="wired" type="xs:boolean" default="0" minOccurs="0"/>
<xs:element name="info_URL" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
{% autoescape off %}{{xml}}{% endautoescape %}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="eduroam_realm_stype">
<xs:restriction base="xs:int">
<xs:enumeration value="0">
<xs:annotation>
<xs:documentation>FLRS</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="1">
<xs:annotation>
<xs:documentation>(E)TLRS</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:element name="realms">
<xs:complexType>
<xs:sequence>
<xs:element name="realm">
<xs:complexType>
<xs:sequence>
<xs:element name="country" type="xs:string"/>
<xs:element name="stype" type="eduroam_realm_stype"/>
<xs:element name="org_name" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element name="street" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="contact" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
<xs:element name="phone" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="info_URL" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="policy_URL" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attribute name="lang" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="ts" type="xs:dateTime">
<xs:annotation>
<xs:documentation> Format: 2008-02-29T12:00:00 </xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment