user_local_query = Query().get('local:user').select('config').filter_by('email','==',str(self.request.user))
user_local_details = execute_query(self.request, user_local_query)
user_authority = json.loads(user_local_details[0]['config']).get('authority')
-
- authority_query = Query().get('authority').select('description', 'authority_hrn', 'legal', 'address', 'abbreviated_name',
+ # XXX Should be done using Metadata
+ # select column.name from local:object where table=='authority'
+ authority_query = Query().get('authority').select('authority_hrn', 'name', 'address', 'enabled','description',
'scientific', 'city', 'name', 'url', 'country', 'enabled', 'longitude',
'tech', 'latitude', 'pi_users', 'parent_authority', 'onelab_membership',
'postcode').filter_by('authority_hrn','==',user_authority)
if authority_details :
authority_contacts = {}
- authority_contacts['scientific'] = [ x.strip()[1:-1] for x in authority_details[0]['scientific'][1:-1].split(',') ]
- authority_contacts['technical'] = [ x.strip()[1:-1] for x in authority_details[0]['tech'][1:-1].split(',') ]
-
- authority_contacts['legal'] = [ x.strip().replace('"','') for x in authority_details[0]['legal'][1:-1].split(',') ]
authority = authority_details[0]
+ if 'scientific' in authority and authority['scientific'] is not None:
+ authority_contacts['scientific'] = [ x.strip()[1:-1] for x in authority['scientific'][1:-1].split(',') ]
+ if 'technical' in authority and authority['technical'] is not None:
+ authority_contacts['technical'] = [ x.strip()[1:-1] for x in authority['tech'][1:-1].split(',') ]
+ if 'legal' in authority and authority['legal'] is not None:
+ authority_contacts['legal'] = [ x.strip().replace('"','') for x in authority['legal'][1:-1].split(',') ]
else :
authority_contacts = None
authority = None
<th>+/-</th>
<th>Email</th>
<th>User hrn</th>
+ <!--
<th>First name</th>
<th>Last name</th>
<th>Enabled</th>
+ -->
</tr>
</table>
<th>Users</th>
<th>Url</th>
<!-- <th>nodes</th> -->
- <th>Expiration</th>
+ <th>Creation</th>
</tr>
</table>
</div>
{% if person %}
{% if user_details.parent_authority %}
- $.post("/rest/slice/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
+ $.post("/rest/slice/",{'fields':['slice_hrn','users','url','slice_date_created'],'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
var list_slices = [];
var table_slices = [];
/* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "users", "slice_urn", "slice_expires" */
users_length=val.users.length;
}
- if(val.slice_url=="undefined" || val.slice_url==null){
+ if(val.url=="undefined" || val.url==null){
slice_url="";
}else{
- slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
+ slice_url="<a href='"+val.url+"' target='_blank'>"+val.url+"</a>";
}
slice_row = "<tr id='"+val.slice_hrn+"'>";
slice_row += "<td>"+users_length+"</td>";
slice_row += "<td>"+slice_url+"</td>";
//slice_row += "<td>"+nodes_length+"</td>";
- slice_row += "<td>"+val.slice_expires+"</td>";
+ slice_row += "<td>"+val.slice_date_created+"</td>";
slice_row += "</tr>";
table_slices.push(slice_row);
});
- $.post("/rest/user/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
+ $.post("/rest/user/",{'fields':['user_hrn','user_email'],'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
var list_users = [];
var table_users = [];
/* Available fields
user_row += "<td><input type='checkbox' class='user' id='"+val.user_hrn+"'></td>";
user_row += "<td>"+val.user_email+"</td>";
user_row += "<td>"+val.user_hrn+"</td>";
+ /*
user_row += "<td>"+val.user_first_name+"</td>";
user_row += "<td>"+val.user_last_name+"</td>";
user_row += "<td>"+val.user_enabled+"</td>";
+ */
user_row += "</tr>";
table_users.push(user_row);
});
<img src="{{ STATIC_URL|add:'img/institutions/'|add:authority.authority_hrn|add:'.gif'|file_exists }}" alt="{{authority.name}}">
</div>
<br />
+ {% if authority.name and authority.url %}
<h3><a href="{{authority.url}}">{{authority.name}}</a></h3>
+ {% elif authority.name %}
+ <h3>{{authority.name}}</h3>
+ {% endif %}
<p>
+ {% if authority.address %}
{{authority.address}} <br />
- {{authority.postcode}} {{authority.city}} <br />
+ {% endif %}
+ {% if authority.postcode %}
+ {{authority.postcode}}
+ {% endif %}
+ {% if authority.address %}
+ {{authority.city}} <br />
+ {% endif %}
+ {% if authority.address %}
{{authority.country}}
+ {% endif %}
</p>
<br />
+
+ {% if authority.address %}
<h4>Onelab membership</h4>
<p>
{{ authority.onelab_membership }}
</p>
+ {% endif %}
</div>
<div class="col-md-6">
+ {% if authority.legal %}
<h4>Legal Contact:</h4>
<p>
{% for c in authority_contacts.legal %}
{% endfor %}
</p>
<br />
+ {% endif %}
+ {% if authority.scientific %}
<h4>Scientific Contact:</h4>
<p>
{% for c in authority_contacts.scientific %}
{% endfor %}
</p>
<br />
+ {% endif %}
+ {% if authority.technical %}
<h4>Technical Contact:</h4>
<p>
{% for c in authority_contacts.technical %}
{{ c }} <br />
{% endfor %}
</p>
+ {% endif %}
</div>
<script>$(document).ready(function() {
{% if authority.name %}