X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Fbase.html;h=4e2c5064d2bdc4946bc2189d67f4e63870c52f7a;hb=a228a3f58b5be134ebd4085294da28618c55268e;hp=9bc52dd1264ed28f021eb0382d64c1df2e3ccc2a;hpb=7464fb5c0d4d4857963b52b944b27df41e4ec1f6;p=myslice.git diff --git a/portal/templates/base.html b/portal/templates/base.html index 9bc52dd1..4e2c5064 100644 --- a/portal/templates/base.html +++ b/portal/templates/base.html @@ -48,53 +48,58 @@ XXX TODO: session This list of slices should go into SESSION ! */ $(document).ready(function() { - {% if username %} - myslice.login(); +{% if username %} + myslice.login(function(){ + user = myslice.user(); - user = myslice.user(); - - var slices = []; - if($.isEmptyObject(user)){ - $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) { - if(data.length > 0){ - drawSlices(data[0].slices); - }else{ - $("div#home-slice-list").html( - "
You do not yet have a slice
"); - $("ul#dropdown-slice-list").append("
  • no slice
  • "); - slices.push("no slice"); - } - }); - }else{ - slices = user.slices; - drawSlices(slices); - } + var slices = []; + if($.isEmptyObject(user)){ + $("div#home-slice-list").html( + "
    You do not yet have a slice
    "); + $("ul#dropdown-slice-list").append("
  • no slice
  • "); + slices.push("no slice"); + }else{ + slices = user.slices; + drawSlices(slices); + } + {% if theme == "fed4fire" %} + myslice.loadProjects(function(){ + p = myslice.projects(); + drawProjects(p); + }); + {% endif %} + }); - /* - Launch queries to get the resources and leases in Manifold Cache - */ - function drawSlices(slices){ var items = []; $.each( slices, function(i, val) { items.push( "
  • " + val + "
  • " ); - /* - // Launch a Query for each slice to get resources and leases in Manifold Cache - // Now only done in Homeview to speed up the other pages - $.post("/rest/slice/", { 'filters': { 'slice_hrn' : val } }, function(data) { - }); - */ }); $("div#home-slice-list").html($( "