+$(document).ready(function() {
+ {% if person %}
+ {% if user_details.parent_authority %}
+
+ $.post("/rest/myslice: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" */
+ $.each( data, function( key, val ) {
+ list_slices.push( "<li><a href=\"portal/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
+ if(val.nodes=="undefined" || val.nodes==null){
+ nodes_length=0;
+ }else{
+ nodes_length=val.nodes.length;
+ }
+ //console.log(val);
+ if(val.users=="undefined" || val.users==null){
+ users_length=0;
+ }else{
+ users_length=val.users.length;
+ }
+
+ if(val.url=="undefined" || val.url==null){
+ slice_url="";
+ }else{
+ slice_url="<a href='"+val.url+"' target='_blank'>"+val.url+"</a>";
+ }
+
+ slice_row = "<tr id='"+val.slice_hrn+"'>";
+ slice_row += "<td><input type='checkbox' class='slice' id='"+val.slice_hrn+"'></td>";
+ slice_row += "<td><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></td>";
+ slice_row += "<td>"+users_length+"</td>";
+ slice_row += "<td>"+slice_url+"</td>";
+ //slice_row += "<td>"+nodes_length+"</td>";
+ slice_row += "<td>"+val.slice_date_created+"</td>";
+ slice_row += "</tr>";
+ table_slices.push(slice_row);
+
+ });
+
+ /* $("div#slice-list").html($( "<ul/>", { html: list_slices.join( "" ) })); */
+ $("table#slice-tab tr:last").after(table_slices.join( "" ));
+ $("div#slice-tab-loaded").css("display","block");
+ $("div#slice-tab-loading").css("display","none");
+ });
+
+ {% if project %}
+ // XXX LOIC CACHE PB IF PREFIXED !
+ $.post("/rest/authority/",{'fields':['pi_users'],'filters':{'authority_hrn':'{{user_details.parent_authority}}'}}, function( data ) {
+
+ var table_users = [];
+ $.each( data[0].pi_users, function( key, val ) {
+ console.log(val);
+ user_row = "<tr id='"+val+"'>";
+ user_row += "<td><input type='checkbox' class='user' id='"+val+"'></td>";
+ user_row += "<td></td>";
+ user_row += "<td>"+val+"</td>";
+ user_row += "</tr>";
+ table_users.push(user_row);
+ });
+ $("table#user-tab tr:last").after(table_users.join( "" ));
+ $("div#user-tab-loaded").css("display","block");
+ $("div#user-tab-loading").css("display","none");
+