except User.DoesNotExist:
# Create a user in Django's local database
user = User.objects.create_user(username, username, 'passworddoesntmatter')
- user.first_name = "DUMMY_FIRST_NAME" #person['first_name']
- user.last_name = "DUMMY LAST NAME" # person['last_name']
user.email = person['email']
+
+ if 'firstname' in person:
+ user.first_name = person['firstname']
+ if 'lastname' in person:
+ user.last_name = person['lastname']
+
return user
# Required for your backend to work properly - unchanged in most scenarios
//create empty LatLngBounds object in order to automatically center the map on the displayed objects
this.bounds = new google.maps.LatLngBounds();
var center = new google.maps.LatLng(this.options.latitude, this.options.longitude);
+
+ console.log("GoogleMap zoom = "+this.options.zoom);
var myOptions = {
zoom: this.options.zoom,
center: center,
});
$(".dataTables_filter").append("<div style='display:inline-block;height:27px;width:27px;padding-left:6px;padding-top:4px;'><span class='glyphicon glyphicon-search'></span></div>");
$(".dataTables_filter input").css("width","100%");
- $(".columns_selector").append("columns");
- $(".columns_selector").css("float","right");
- $(".columns_selector").css("width","inherit");
}, // initialize_table
/**
# center on Paris
latitude = 49.,
longitude = 9,
- zoom = 4,
+ zoom = 8,
)
# --------------------------------------------------------------------------
</a>
<div class="dropdown-menu" style="z-index:99;">
- <ul>
+ <ul id="dropdown-slice-list">
<li><a href="/portal/slice_request/">Request Slice</a></li>
- <li><a href="/slice/ple.upmc.agent3/">ple.upmc.agent3</a></li>
- <li><a href="/slice/ple.upmc.agent/">ple.upmc.agent</a></li>
- <li><a href="/slice/ple.upmc.myslicedemo/">ple.upmc.myslicedemo</a></li>
- <li><a href="/slice/ple.upmc.slicestat/">ple.upmc.slicestat</a></li>
- <li><a href="/slice/ple.upmc.agent2/">ple.upmc.agent2</a></li>
</ul>
</div>
</li>
{% load portal_filters %}
{# This is required by insert_above #}{% insert_handler %}<!DOCTYPE html>
<html lang="en"><head>
-<title>OneLab Portal - {{ section }}</title>
+<title>{{theme}} portal - {{ section }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/static/img/favicon.ico">
{# This is where insert_str will end up #}{% media_container prelude %}
{% insert_str prelude "css/topmenu.css" %}
{% insert_str prelude "js/logout.js" %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/{{ theme }}.css">
+
+<script type="text/javascript">
+/*
+XXX TODO: session
+This list of slices should go into SESSION !
+*/
+$(document).ready(function() {
+
+ user = myslice.user();
+ if(user.length>0){
+ $.each( user.slices, function(i, val) {
+ items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
+ });
+ $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+ $("ul#dropdown-slice-list").append(items.join( "" ));
+ }
+ {% if person %}
+ $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ var items = [];
+ if(data.length > 0){
+ $.each( data[0].slices, function(i, val) {
+ items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
+ });
+
+ $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+ $("ul#dropdown-slice-list").append(items.join( "" ));
+ }else{
+ $("div#home-slice-list").html("no slice");
+ }
+ });
+ {% endif %}
+});
+</script>
</head>
<body>
{% block container %}
+++ /dev/null
-{% extends "layout.html" %}
-
-{% block content %}
-<div class="row" id="home-dashboard">
- <ul class="nav nav-tabs">
- <li class="active"><a class="home-tab" data-panel="user" href="#">USER</a></li>
- <li><a class="home-tab" data-panel="manager" href="#">MANAGER</a></li>
- </ul>
- <div class="home-panel" id="user">
- <table>
- <tr>
- <td>ACCOUNT</td>
- <td>SLICES</td>
- <td>SUPPORT</td>
- </tr>
- <tr>
- <td><a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a></td>
- <td><a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
- <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
- </tr>
- <tr>
- {% if person %}
- <td class="logged-in">
- <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
- <div>
- {% if person.last_name %}
- {{person.first_name}} {{person.last_name}}<br />
- {% endif %}
- <span class="label">Email:</span> <a href='/portal/account/'>{{person.email}}</a>
- </div>
- {% else %}
- <td>
- {% include '_widget-login-user.html' %}
- {% endif %}
- </td>
- <td>
- {% if person %}
- <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request Slice</button>
- <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
- {% else %}
- {% endif %}
- </td>
- <td class="support">
- <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
- <div>
- <a href="/portal/contact">Contact</a> <br />
- <a href="/portal/support/documentation">Documentation</a>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <div class="home-panel" id="manager">
- <table>
- <tr>
- <td>INSTITUTION</td>
- <td>SLICES</td>
- <td>REQUESTS</td>
- </tr>
- <tr>
- <td><a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a></td>
- <td><a href="/portal/institution#slices"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
- <td><a href="/portal/validate"><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></a></td>
- </tr>
- <tr>
- {% if person %}
- <td class="logged-in">
- <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
- {% else %}
- <td>
- {% include '_widget-login-manager.html' %}
- {% endif %}
- </td>
- <td>
- {% if person %}
- <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Slice</button>
- {% endif %}
- </td>
- <td class="support">
- {% if person %}
- <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
- {% endif %}
- </td>
- </tr>
- </table>
- </div>
-</div>
-<script>
- $(document).ready(function() {
- $('a.home-tab').click(function() {
- $('ul.nav-tabs li').removeClass('active');
- $(this).parent().addClass('active');
- $('div.home-panel').hide();
- $('div#'+$(this).data('panel')).show();
- });
- $('button#validaterequestbtn').click(function() {
- window.location="/portal/validate/";
- });
- $('button#ticketbtn').click(function() {
- window.location="/portal/contact/";
- });
- $('button#slicerequestbtn').click(function() {
- window.location="/portal/slice_request/";
- });
-
- {% if person %}
- $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
- var items = [];
- if(data.length > 0){
- $.each( data[0].slices, function(i, val) {
- items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
- });
- $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
- }else{
- $("div#home-slice-list").html("no slice");
- }
- });
- {% endif %}
- });
-</script>
-{% endblock %}
</a>
<div class="dropdown-menu" style="z-index:99;">
- <ul>
+ <ul id="dropdown-slice-list">
<li><a href="/portal/slice_request/">Request Slice</a></li>
<!--
<li><a href="/slice/ple.upmc.agent3/">ple.upmc.agent3</a></li>
</table>
</div>
</div>
-<script>
+<script type="text/javascript">
$(document).ready(function() {
+ {% if person %}
+ myslice.login();
+ {% endif %}
+
$('a.home-tab').click(function() {
$('ul.nav-tabs li').removeClass('active');
$(this).parent().addClass('active');
$('button#slicerequestbtn').click(function() {
window.location="/portal/slice_request/";
});
-
- {% if person %}
- $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
- var items = [];
- if(data.length > 0){
- $.each( data[0].slices, function(i, val) {
- items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
- });
-
- $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
- }else{
- $("div#home-slice-list").html("no slice");
- }
- });
- {% endif %}
- });
+/*-------
+List of slices has been moved in
+portal/templates/base.html
+This should go into session
+--------*/
+});
</script>
{% endblock %}
+++ /dev/null
-{% extends "layout.html" %}
-
-{% block content %}
-<div class="row" id="home-dashboard">
- <ul class="nav nav-tabs">
- <li class="active"><a class="home-tab" data-panel="user" href="#">USER</a></li>
- <li><a class="home-tab" data-panel="manager" href="#">MANAGER</a></li>
- </ul>
- <div class="home-panel" id="user">
- <table>
- <tr>
- <td>ACCOUNT</td>
- <td>SLICES</td>
- <td>SUPPORT</td>
- </tr>
- <tr>
- <td><a href="/portal/account/"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a></td>
- <td><a href="#"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
- <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
- </tr>
- <tr>
- {% if person %}
- <td class="logged-in">
- <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
- <div>
- {% if person.last_name %}
- {{person.first_name}} {{person.last_name}}<br />
- {% endif %}
- <span class="label">Email:</span> <a href='/portal/account/'>{{person.email}}</a>
- </div>
- {% else %}
- <td>
- {% include 'onelab__widget-login-user.html' %}
- {% endif %}
- </td>
- <td>
- {% if person %}
- <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Request Slice</button>
- <div id="home-slice-list"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading Slices" /></div>
- {% else %}
- {% endif %}
- </td>
- <td class="support">
- <button id="ticketbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Ticket</button>
- <div>
- <a href="/portal/contact">Contact</a> <br />
- <a href="/portal/support/documentation">Documentation</a>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <div class="home-panel" id="manager">
- <table>
- <tr>
- <td>INSTITUTION</td>
- <td>SLICES</td>
- <td>REQUESTS</td>
- </tr>
- <tr>
- <td><a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a></td>
- <td><a href="/portal/institution#slices"><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></a></td>
- <td><a href="/portal/validate"><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></a></td>
- </tr>
- <tr>
- {% if person %}
- <td class="logged-in">
- <button id="logoutbtn" type="button" class="btn btn-default" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> Logout</button>
- {% else %}
- <td>
- {% include 'onelab__widget-login-manager.html' %}
- {% endif %}
- </td>
- <td>
- {% if person %}
- <button id="slicerequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span> Create Slice</button>
- {% endif %}
- </td>
- <td class="support">
- {% if person %}
- <button id="validaterequestbtn" type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span> Validate Requests</button>
- {% endif %}
- </td>
- </tr>
- </table>
- </div>
-</div>
-<script>
- $(document).ready(function() {
- $('a.home-tab').click(function() {
- $('ul.nav-tabs li').removeClass('active');
- $(this).parent().addClass('active');
- $('div.home-panel').hide();
- $('div#'+$(this).data('panel')).show();
- });
- $('button#validaterequestbtn').click(function() {
- window.location="/portal/validate/";
- });
- $('button#ticketbtn').click(function() {
- window.location="/portal/contact/";
- });
- $('button#slicerequestbtn').click(function() {
- window.location="/portal/slice_request/";
- });
-
- {% if person %}
- $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
- var items = [];
- if(data.length > 0){
- $.each( data[0].slices, function(i, val) {
- items.push( "<li><a href=\"/slice/"+val+"\">" + val + "</a></li>" );
- });
- $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
- }else{
- $("div#home-slice-list").html("no slice");
- }
- });
- {% endif %}
- });
-</script>
-{% endblock %}
</a>
<div class="dropdown-menu" style="z-index:99;">
- <ul>
+ <ul id="dropdown-slice-list">
<li><a href="/portal/slice_request/">Request Slice</a></li>
- <li><a href="/slice/ple.upmc.agent3/">ple.upmc.agent3</a></li>
- <li><a href="/slice/ple.upmc.agent/">ple.upmc.agent</a></li>
- <li><a href="/slice/ple.upmc.myslicedemo/">ple.upmc.myslicedemo</a></li>
- <li><a href="/slice/ple.upmc.slicestat/">ple.upmc.slicestat</a></li>
- <li><a href="/slice/ple.upmc.agent2/">ple.upmc.agent2</a></li>
</ul>
</div>
</li>