1 {% extends "layout-unfold1.html" %}
3 {% block unfold_main %}
4 <div class="wrapper" id="institution">
5 <ul class="nav nav-tabs">
6 <li class="active"><a class="home-tab" data-panel="institution" href="#">INSTITUTION</a></li>
7 <li><a class="home-tab" data-panel="users" href="#">USERS</a></li>
8 <li><a class="home-tab" data-panel="slices" href="#">SLICES</a></li>
10 <div class="home-panel" id="institution">
11 <h1><img src="{{ STATIC_URL }}img/icon_authority_color_small.png" alt="" /> Affiliation to an Institution</h1>
13 <div id="authority-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Authority" /></div>
14 <div id="authority-tab-loaded" style="display:none;">
15 <div id="onelab_membership" style="float:left; width:30%;">
16 <img src="{{ STATIC_URL }}img/onelab-logo.png" alt="" /><br>
17 <div id="onelab-data"></div>
19 <div id="authority-data" style="float:right; width:70%;">
23 <div class="home-panel" id="users" style="display:none;">
25 <h1>Users: {{user_details.parent_authority}}</button></h1>
26 <div id="user-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
27 <div id="user-tab-loaded" style="display:none;">
39 <button id="deleteusers" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Users</button>
42 <div class="home-panel" id="slices" style="display:none;">
44 <h1>Slices: {{user_details.parent_authority}} <button id="createslice" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create a Slice</button></h1>
45 <div id="slice-tab-loading"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
46 <div id="slice-tab-loaded" style="display:none;">
47 <table id="slice-tab">
59 <button id="renewslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> Renew Slices</button>
60 <button id="deleteslices" type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span> Delete Slices</button>
66 $(document).ready(function() {
67 $('a.home-tab').click(function() {
68 $('ul.nav-tabs li').removeClass('active');
69 $(this).parent().addClass('active');
70 $('div.home-panel').hide();
71 $('div#'+$(this).data('panel')).show();
73 $('button#createslice').click(function() {
74 window.location="/portal/slice_request/";
76 ;$('button#slicerequestbtn').click(function() {
78 window.location="/portal/slice_request/";
82 {% if user_details.parent_authority %}
83 $.post("/rest/authority/",{'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
84 var authority_data = [];
86 /* 'city','enabled','legal','longitude','onelab_membership','address','parent_authority','slice','user','country',
87 'tech','abbreviated_name','url','postcode','description','scientific','authority_hrn','latitude','name' */
88 $.each( data, function( key, val ) {
89 authority_row = "<img src='{{ STATIC_URL }}img/institutions/{{user_details.parent_authority}}.gif' alt='' /><br>";
90 authority_row += "<br>";
91 authority_row += "<b>authority:</b> "+val.authority_hrn+"<br>";
92 authority_row += "<br>";
93 authority_row += "<b>"+val.name+"</b><br>";
94 authority_row += "<br>";
95 authority_row += "<b>Address:</b> "+val.address+"<br>";
96 authority_row += "<b>City:</b> "+val.postcode+" "+val.city+"<br>";
97 authority_row += "<br>";
98 authority_row += "<b>Country:</b> "+val.country+"<br>";
99 authority_row += "<br>";
100 authority_row += "<br>";
101 authority_row += "<h2>Contacts</h2>";
102 authority_row += "<b>Legal:</b> ";
105 TODO: find a way to express JSON correctly given the constrains: CSV / JSON
107 legal = jQuery.parseJSON(val.legal);
108 if($.isArray(legal)){
109 $.each(legal, function(k,v){
110 authority_row += k+" "+v+"<br>";
114 authority_row += val.legal+"<br>";
116 authority_row += "<br>";
117 authority_row += "<b>Scientific:</b> ";
119 scientific = jQuery.parseJSON(val.scientific);
120 if($.isArray(scientific)){
121 $.each(scientific, function(v){
122 authority_row += v+", ";
126 authority_row += val.scientific+"<br>";
128 onelab_membership = "<b>Membership:</b> "+val.onelab_membership;
129 onelab_data.push(onelab_membership);
130 authority_data.push(authority_row);
132 $("div#authority-data").html(authority_data.join( "" ));
133 $("div#onelab-data").html(onelab_data.join( "" ));
134 $("div#authority-tab-loaded").css("display","block");
135 $("div#authority-tab-loading").css("display","none");
138 $.post("/rest/slice/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
139 var list_slices = [];
140 var table_slices = [];
141 /* "slice_hrn", "slice_description", "slice_type", "parent_authority", "created", "nodes", "slice_url", "slice_last_updated", "user", "slice_urn", "slice_expires" */
142 $.each( data, function( key, val ) {
143 list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
144 if(val.nodes=="undefined" || val.nodes==null){
147 nodes_length=val.nodes.length;
150 if(val.user=="undefined" || val.user==null){
153 user_length=val.user.length;
156 if(val.slice_url=="undefined" || val.slice_url==null){
159 slice_url="<a href='"+val.slice_url+"' target='_blank'>"+val.slice_url+"</a>";
163 slice_row += "<td><input type='checkbox'></td>";
164 slice_row += "<td><a href=\"/portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></td>";
165 slice_row += "<td>"+user_length+"</td>";
166 slice_row += "<td>"+slice_url+"</td>";
167 slice_row += "<td>"+nodes_length+"</td>";
168 slice_row += "<td>"+val.slice_expires+"</td>";
169 slice_row += "</tr>";
170 table_slices.push(slice_row);
174 /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
175 $("table#slice-tab tr:last").after(table_slices.join( "" ));
176 $("div#slice-tab-loaded").css("display","block");
177 $("div#slice-tab-loading").css("display","none");
180 $.post("/rest/user/",{'filters':{'parent_authority':'{{user_details.parent_authority}}'}}, function( data ) {
182 var table_users = [];
184 "enabled", "keys", "parent_authority", "user_first_name", "user_last_name", "user_phone", "user_hrn", "slice", "user_email"
186 $.each( data, function( key, val ) {
187 list_users.push( "<li><a href=\"portal/user/"+val.user_email+"\">" + val.user_email + "</a></li>" );
189 user_row += "<td><input type='checkbox'></td>";
190 user_row += "<td>"+val.user_email+"</td>";
191 user_row += "<td>"+val.user_hrn+"</td>";
192 user_row += "<td>"+val.user_first_name+"</td>";
193 user_row += "<td>"+val.user_last_name+"</td>";
194 user_row += "<td>"+val.enabled+"</td>";
196 table_users.push(user_row);
199 $("table#user-tab tr:last").after(table_users.join( "" ));
200 $("div#user-tab-loaded").css("display","block");
201 $("div#user-tab-loading").css("display","none");
207 {% endblock unfold_main %}