X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Fbase.html;h=fd1869ee9239d8c51702f5230de6941b584e228c;hb=refs%2Fheads%2Ff4f-review;hp=cc60f7f166d267f15517d6cd47627e84aab66d89;hpb=6f3b594f6003a388a3a746e9aac32107d2567fb6;p=myslice.git
diff --git a/portal/templates/base.html b/portal/templates/base.html
index cc60f7f1..fd1869ee 100644
--- a/portal/templates/base.html
+++ b/portal/templates/base.html
@@ -1,9 +1,19 @@
{% load portal_filters %}
{# This is required by insert_above #}{% insert_handler %}
-
+
+
{{theme}} portal - {{ section }}
-
+
+
+{% if theme == "fed4fire" %}
+
+{% elif theme == "smartfire" %}
+
+{% else %}
+
+{% endif %}
+
{# This is where insert_str will end up #}{% media_container prelude %}
{% include 'messages-transient-header.html' %}
@@ -11,13 +21,19 @@
-
+
+
+
+
+
+
{{ header_prelude }}
{% block head %} {% endblock head %}
{# let's add these ones no matter what #}
+{#NOTE: DO NOT ADD JQUERY-UI JS & CSS HERE. IT BREAKS THE RESOURCE BROWSING PAGE -- DETAILS WITH JORDAN AUGE#}
{% insert_str prelude "js/jquery.min.js" %}
{% insert_str prelude "js/angular/angular.min.js" %}
{% insert_str prelude "js/jquery.html5storage.min.js" %}
@@ -48,53 +64,79 @@ 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/myslice: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" %}
+ p = myslice.projects();
+ if(p != null){
+ drawProjects(p);
+ drawProjectsTree(p,slices);
+ }
+ {% 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($( "", { html: items.join( "" ) }));
$("ul#dropdown-slice-list").append(items.join( "" ));
}
+
+ {% if theme == "fed4fire" %}
+ function drawProjects(projects){
+ var items = [];
+
+ $.each( projects, function(i, 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 = [];
+ $.each( projects, function(i, p) {
+ $.each( slices, function(y, s) {
+ console.log(escapeRegExp(p));
+ if (s.match('^' + escapeRegExp(p))) {
+ items_sl.push( "" + s.replace(p + '.','') + " " );
+ }
+ });
+ el = "" + p + " ";
+ if (items_sl.length > 0) {
+ el += "" + items_sl.join( "" ) + " ";
+ }
+ el += " ";
+ items.push(el);
+ items_sl = [];
+ });
+ $("div#home-project-tree").html($( "", { html: items.join( "" ) }));
+ }
{% endif %}
+{% endif %}
jQuery('[title!=""]').qtip();
});
+
+{% widget '_widget-message.html' %}
+
{% block container %}
{% block topmenu %}
{% widget "_widget-topmenu.html" %}