X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Fbase.html;h=ceebc5d75f7d903ef31351bb9ee95a0feefd2aac;hb=5199a0430bc1d916307395058c6ffe5cc24a6a91;hp=aed282c1847adaf61fd325cdcd725a7b725a90a7;hpb=3e1430f1419315212e9a8622926fb710756cbbc9;p=unfold.git
diff --git a/portal/templates/base.html b/portal/templates/base.html
index aed282c1..ceebc5d7 100644
--- a/portal/templates/base.html
+++ b/portal/templates/base.html
@@ -21,7 +21,7 @@
-
+
@@ -54,6 +54,7 @@
{% insert_str prelude "css/slider.css" %}
{% insert_str prelude "css/topmenu.css" %}
{% insert_str prelude "js/logout.js" %}
+
@@ -66,7 +67,7 @@ This list of slices should go into SESSION !
$(document).ready(function() {
{% if username %}
myslice.login(function(){
- user = myslice.user();
+ user = myslice.get_user();
var slices = [];
if($.isEmptyObject(user)){
@@ -76,36 +77,81 @@ $(document).ready(function() {
slices.push("no slice");
}else{
slices = user.slices;
+ {% if theme != "fed4fire" or "onelab" in theme %}
drawSlices(slices);
+ {% endif %}
}
- {% if theme == "fed4fire" %}
- p = myslice.projects();
+ {% if theme == "fed4fire" or "onelab" in theme%}
+ p = myslice.get_projects();
if(p != null){
- drawProjects(p);
+ //drawProjects(p);
+ drawProjectsTree(p,slices);
}
{% endif %}
});
function drawSlices(slices){
var items = [];
-
+ console.log(slices);
$.each( slices, function(i, val) {
- items.push( "
" + val + "" );
+ items.push( "" + val + "" );
});
$("div#home-slice-list").html($( "", { html: items.join( "" ) }));
$("ul#dropdown-slice-list").append(items.join( "" ));
}
- {% if theme == "fed4fire" %}
+ {% if theme == "fed4fire" or "onelab" in theme%}
function drawProjects(projects){
var items = [];
$.each( projects, function(i, val) {
- items.push( "" + val + "" );
+ items.push( "" + val + "" );
});
$("div#home-project-list").html($( "", { html: items.join( "" ) }));
$("ul#dropdown-project-list").append(items.join( "" ));
}
+ function drawProjectsTree(projects,slices) {
+ var items = [];
+ var items_sl = [];
+ var slices_no_project = [];
+ $.each( projects, function(i, p) {
+ $.each( slices, function(y, s) {
+ if (s.match('^' + escapeRegExp(p))) {
+ slicename = s.replace(p + '.','')
+ items_sl.push( " " + slicename + "" );
+ }else if(s.split('.').length < 4){
+ slices_no_project.push( " " + s + "" );
+ }
+ });
+ el = "" + p + "";
+ if (items_sl.length > 0) {
+ el += "" + items_sl.join( "" ) + "
";
+ }
+ el += "";
+ items.push(el);
+ items_sl = [];
+ });
+ if (projects.length == 0){
+ $.each( slices, function(y, s) {
+ slices_no_project.push( " " + s + "" );
+ });
+ }
+ if (slices_no_project.length > 0) {
+ elm = 'other slices ';
+ elm += "" + slices_no_project.join( "" ) + "
";
+ elm += "";
+ items.push(elm);
+ }
+
+ $("div#home-project-tree").html($( "", { html: items.join( "" ) }));
+ if (projects.length > 0) {
+ $('.dashboard-create-slice').show();
+ }
+ }
+
+ window.setTimeout(function() {
+ $('.projects-loading').hide();
+ },20000);
{% endif %}
{% endif %}
jQuery('[title!=""]').qtip();