import os.path
+
DEBUG = True
TEMPLATE_DEBUG = DEBUG
import traceback
traceback.print_exc()
+# themes
+from myslice.configengine import ConfigEngine
+configEngine = ConfigEngine()
+if configEngine.myslice.theme :
+ theme = configEngine.myslice.theme
+
# find out HTTPROOT, which is different from ROOT
# when deployed from a package
# this code is run by collectstatic too, so we cannot
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
+ os.path.join(HTTPROOT,"portal/templates", theme),
+ os.path.join(HTTPROOT,"portal/templates"),
os.path.join(HTTPROOT,"templates"),
)
from ui.topmenu import topmenu_items, the_user
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
class AboutView (FreeAccessView, ThemeView):
template_name = 'about.html'
from django.contrib import messages
from django.contrib.auth.decorators import login_required
-from theme import ThemeView
+from myslice.theme import ThemeView
#
import json, os, re, itertools
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
-from theme import ThemeView
+from myslice.theme import ThemeView
theme = ThemeView()
from portal.forms import ContactForm
-from theme import ThemeView
+from myslice.theme import ThemeView
# splitting the 2 functions done here
# GET is for displaying the empty form
from ui.topmenu import topmenu_items_live, the_user
-from theme import ThemeView
+from myslice.theme import ThemeView
#This view requires login
class DashboardView (LoginRequiredAutoLogoutView, ThemeView):
from portal.forms import PassResetForm
from portal.actions import manifold_update_user
-from theme import ThemeView
+from myslice.theme import ThemeView
# 4 views for password reset:
# - password_reset sends the mail
from ui.topmenu import topmenu_items, the_user
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
class DocumentationView (FreeAccessView, ThemeView):
template_name = 'documentationview.html'
from ui.topmenu import topmenu_items, the_user
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
class HomeView (FreeAccessView, ThemeView):
template_name = 'home-view.html'
from ui.topmenu import topmenu_items, the_user
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
import json
class InstitutionView (FreeAccessView, ThemeView):
from portal.models import PendingUser,PendingAuthority
from portal.actions import authority_get_pi_emails, manifold_add_user,manifold_add_account
-from theme import ThemeView
+from myslice.theme import ThemeView
# since we inherit from FreeAccessView we cannot redefine 'dispatch'
# so let's override 'get' and 'post' instead
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import messages
from django.contrib.auth.decorators import login_required
-from theme import ThemeView
+from myslice.theme import ThemeView
#
import json, os, re, itertools
from ui.topmenu import topmenu_items_live, the_user
from plugins.querytable import QueryTable
-from theme import ThemeView
+from myslice.theme import ThemeView
# View for platforms
class PlatformsView(FreeAccessView, ThemeView):
from plugins.querytable import QueryTable
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
# View for 1 platform and its details
class PlatformView(FreeAccessView, ThemeView):
from portal.models import PendingUser
from portal.actions import create_pending_user
-from theme import ThemeView
+from myslice.theme import ThemeView
# since we inherit from FreeAccessView we cannot redefine 'dispatch'
# so let's override 'get' and 'post' instead
from plugins.slicestat import SliceStat
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
# View for 1 platform and its details
class ResourceView(FreeAccessView, ThemeView):
from unfold.loginrequired import LoginRequiredAutoLogoutView
from ui.topmenu import topmenu_items_live, the_user
-from theme import ThemeView
+from myslice.theme import ThemeView
import json, time
from plugins.queryupdater import QueryUpdater
from plugins.testbeds import TestbedsPlugin
-from theme import ThemeView
+from myslice.theme import ThemeView
class SliceResourceView (LoginRequiredView, ThemeView):
template_name = "slice-resource-view.html"
from ui.topmenu import topmenu_items, the_user
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
class ExperimentView (FreeAccessView, ThemeView):
template_name = 'slice-tab-experiment.html'
from manifold.core.query import Query, AnalyzedQuery
from manifoldapi.manifoldapi import execute_query
-from theme import ThemeView
+from myslice.theme import ThemeView
class SliceInfoView (LoginRequiredView, ThemeView):
template_name = "slice-tab-info.html"
from unfold.loginrequired import LoginRequiredView
-from theme import ThemeView
+from myslice.theme import ThemeView
class SliceTabTestbeds (LoginRequiredView, ThemeView):
template_name = "slice-tab-testbeds.html"
from manifold.core.query import Query, AnalyzedQuery
from manifoldapi.manifoldapi import execute_query
-from theme import ThemeView
+from myslice.theme import ThemeView
class SliceUserView (LoginRequiredView, ThemeView):
template_name = "slice-tab-users-view.html"
from manifold.core.query import Query, AnalyzedQuery
from manifoldapi.manifoldapi import execute_query
-from theme import ThemeView
+from myslice.theme import ThemeView
class SliceView (LoginRequiredView, ThemeView):
template_name = "slice-view.html"
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
tmp_default_slice='ple.upmc.myslicedemo'
--- /dev/null
+html { height: 100% }
+
+body {
+ background-color:white;
+ color:black;
+ margin:0;
+ padding:0;
+ height: 100%;
+}
+a, a:active, a:focus {
+ outline: 0;
+}
+
+h1 {
+ border-bottom:1px solid #DDDDDD;
+ padding:0 0 0 0;
+ margin:0 0 0 0;
+ font-size:18pt;
+}
+h1 img {
+ vertical-align:middle;
+ margin-bottom:6px;
+}
+h2 {
+ font-size:14pt;
+ color:#333333;
+}
+h3 {
+ font-size:13pt;
+ color:#201E62;
+}
+
+div.wrapper {
+ width:980px;
+ margin:0 auto;
+ position:relative;
+}
+div.container {
+ width:980px;
+ margin:25px auto;
+}
+div.wide {
+ margin:25px auto;
+ padding:0 25px;
+}
+
+span.label {
+ font-size:11pt;
+ color:gray;
+ font-weight:normal;
+ padding:0;
+}
+/***** Notifications *****/
+.warning {
+ border: 1px solid red;
+ margin: 20px 60px;
+ padding: 10px 20px;
+ color: red;
+ background-color: #f2dbdb;
+ text-align: center;
+}
+/* HEADER */
+div#header {
+ height:100px;
+ background-color:white;
+}
+
+div#secondary {
+
+}
+
+div#secondary ul {
+ position:absolute;
+ top:20px;
+ right:0;
+}
+
+div#secondary li {
+ font-size:10pt;
+ float:left;
+ list-style:none;
+ margin-right:30px;
+}
+div#secondary li a {
+ color:black;
+}
+div#secondary li a:hover {
+ color:#270A5A;
+ text-decoration:none;
+}
+div#secondary li:last-child {
+ margin-right:0;
+}
+
+div#navigation {
+ background-color:black;
+ width:100%;
+ height:40px;
+}
+div#navigation div.wrapper {
+ text-align:center;
+}
+div#navigation ul {
+ margin:0;
+ padding:0;
+ display: inline-block;
+ list-style-type: none;
+ white-space: nowrap;
+}
+
+div#navigation li {
+ color:white;
+ font-family:helvetica, sans-serif;
+ font-size:10pt ;
+ font-weight:normal;
+ line-height:0.8em;
+ letter-spacing:0.6pt;
+ list-style:none;
+ float:left;
+ padding:0;
+ margin:15px 50px 0 0;
+}
+div#navigation li a {
+ color:white;
+}
+div#navigation li a:hover {
+ text-decoration:none;
+ color:#B8B2FF;
+}
+div#navigation li:last-child {
+ margin-right:0;
+}
+
+div#navigation li.active {
+ padding:5px;
+ padding-top: 15px;
+ min-height: 40px;
+ margin-top: 0px;
+ background-color:gray;
+ color:#FF0000;
+}
+div#navigation li.slices {
+ position:relative;
+ cursor:pointer;
+}
+div#navigation .dropdown-menu {
+ color:white;
+ padding:0 15px 15px 15px;
+ margin-top:5px;
+ margin-left:-16px;
+ background-color:black;
+}
+div#navigation .dropdown-menu a {
+ color:white;
+}
+
+div#menu-slice-list{
+ display:none;
+ position:absolute;
+ background-color:black;
+ padding:15px;
+ left:-15px;
+ z-index:10;
+}
+
+div#navigation .dropdown-menu li:first-child {
+ border-bottom:1px solid white;
+ padding-bottom:5px;
+
+}
+/* HOME DASHBOARD */
+div#home-dashboard {
+ color:black;
+ margin:0 auto 25px auto;
+}
+div#home-dashboard table {
+ margin:25px;
+ width:100%;
+}
+div#home-dashboard table td {
+ text-align:center;
+ padding:15px 0;
+ width:33%;
+}
+div#home-dashboard table tr:first-child td {
+ font-size:12pt;
+ font-weight:bold;
+ color:#270A5A;
+}
+div#home-dashboard table tr:last-child td {
+ vertical-align:top;
+ padding:25px 0;
+}
+div#home-dashboard table tr:last-child td.logged-in {
+ border-right:1px solid #DDDDDD;
+ padding:25px;
+}
+div#home-dashboard table tr:last-child td.support {
+ border-left:1px solid #DDDDDD;
+ padding:25px;
+}
+div#home-dashboard table tr:last-child td:first-child {
+}
+div#home-dashboard table tr:last-child td:last-child {
+ border-right:0;
+}
+div#home-dashboard table tr:last-child td.logged-in div {
+ text-align:left;
+ padding:25px 0;
+}
+div#home-dashboard table tr:last-child td.support div {
+ text-align:left;
+ padding:25px 0;
+}
+div#home-dashboard div.login-widget {
+ padding:20px;
+}
+div#home-dashboard table td.support {
+}
+div#home-dashboard table td.support a {
+}
+div#home-dashboard table td.support a:hover {
+ text-decoration:none;
+}
+
+div#home-dashboard div#manager {
+ display:none;
+}
+
+div#home-dashboard div#home-slice-list {
+ margin:25px 0;
+ padding:0 25px;
+ text-align:left;
+}
+div#home-dashboard div#home-slice-list ul {
+ list-style: none;
+ padding:0;
+ margin:0;
+}
+div#home-dashboard div#home-slice-list li {
+
+}
+
+.login-submit {
+ vertical-align:middle;
+ padding:0;
+}
+.lost-password {
+ font-size:10pt;
+ color:#CCCCCC;
+ text-align:right;
+ padding:0px;
+}
+.lost-password a {
+}
+.login-signup {
+ border-top:1px solid #CCCCCC;
+ text-align:center;
+ margin-top:15px;
+ padding:5px 0 0 0;
+}
+/**/
+
+/**/
+/* WELL */
+div.well {
+}
+/**/
+/* BUTTON */
+.btn.btn-default {
+ font-weight: bold;
+}
+
+.btn.btn-default:hover {
+ font-weight: bold;
+}
+/**/
+/* TABLE */
+table.table {
+ margin:0;
+}
+table.table thead {
+ padding:0;
+}
+table.table tbody {
+ padding:0;
+}
+table.table tr {
+ padding:0;
+}
+table.table td {
+ padding:0;
+}
+/* INSTITUTION */
+div#institution {
+ color:black;
+}
+.form-hint {
+ font-size:11pt;
+ font-style:italic;
+ color:gray;
+}
+
+
+.form-hint {
+ font-size:11pt;
+ font-style:italic;
+ color:gray;
+}
+
+
+
+/* TICKET REQUEST */
+div#ticket-request {
+ color:black;
+}
+.form-hint {
+ font-size:11pt;
+ font-style:italic;
+ color:gray;
+}
+div#ticket-request p {
+ margin:20px 0;
+}
+
+ul.nav-tabs {}
+ul.nav-tabs ul {}
+ul.nav-tabs li {}
+
+ul.nav-section li a {
+ border-bottom:0;
+}
+ul.nav-section li:first-child {
+ padding:0;
+}
+ul.nav-section li:first-child a {
+ font-weight:bold;
+ padding:6px 15px 4px 15px;
+}
+ul.nav-section li:first-child.active a {
+ padding:6px 15px 3px 15px;
+}
+ul.nav-section li:first-child img {
+ margin:0 4px 1px 0;
+ padding:0;
+}
+
+ul.nav-resources {
+ margin:15px 0;
+}
+ul.nav-resources a {
+ padding: 4px 10px 5px 10px;
+}
+
+
+/* SLICE VIEW */
+
+
+div#slice-view {
+ margin:0;
+}
+div.list-group-item {
+ border:0;
+ background-color:white;
+ font-weight:bold;
+ padding-left:0;
+}
+a.list-group-item {
+ border:0;
+ background-color:white;
+ padding:3px 0 3px 10px;
+ border-left:2pt white solid;
+}
+a.list-group-item.active, a.list-group-item.active:hover {
+ font-weight: bold;
+ color:black;
+ background-color:transparent;
+ border-left:2pt blue solid;
+}
+a.list-group-item.active:hover {
+ background-color:#dddddd;
+}
+a.list-group-item:hover {
+ border-left:2pt blue solid;
+}
+a.list-group-item p.list-group-item-text {
+ font-size:9pt;
+ font-style:italic;
+ font-weight: normal;
+ color: black !important;
+}
+
+div#slice-info {
+ margin-top:25px;
+}
+div#slice-info table {
+ width:100%;
+ margin:0 auto;
+}
+div#slice-info table td:first-child {
+ text-align:right;
+ font-weight:bold;
+ padding-right:15px;
+}
+div#slice-info td {
+ padding:5px;
+}
+
+/* SLICE VIEW sections */
+.slice-sections, .slice-pending {
+ margin:0;
+ padding:0;
+}
+.slice-sections ul, .slice-pending ul {
+ margin:0;
+ padding:0;
+}
+.slice-pending ul {
+ width:400px;
+ margin:0 auto 15px auto;
+}
+.slice-sections li {
+ text-align:left;
+ margin:0;
+ padding:0;
+}
+.slice-pending li {
+ padding-right:15px;
+}
+.slice-sections li a, .slice-pending li a {
+ font-size:14px;
+ color:black;
+ padding:0;
+}
+.slice-sections li.active a, .slice-pending li.active a {
+ color:#201E62;
+ background-color:#EFEFEF;
+ text-decoration:underline;
+ padding:0;
+}
+.slice-sections ul.nav-pills li a:hover, .slice-pending ul.nav-pills li a:hover {
+ text-decoration:underline;
+ background-color:#EFEFEF;
+ color:black;
+}
+.slice-sections ul.nav-pills li.active, .slice-pending ul.nav-pills li.active {
+
+}
+.slice-sections li:first-child, .slice-sections li:first-child a {
+ color:#201E62;
+ font-weight:bold;
+}
+.slice-experiment {
+ text-align:right;
+ padding:0;
+}
+.slice-experiment button {
+ margin:3px 0 0 0;
+ background-color:#CC4125;
+ color:white;
+}
+
+.slice-pending {
+}
+.slice-pending button {
+ font-size:9pt;
+ margin:-2px 0 0 0;
+ padding:3px 5px;
+}
+.slice-pending button.apply {
+}
+.slice-pending button.clear {
+}
+tr.active, tr.active td {
+ background-color:#FFFFCC !important;
+}
+div.dataTables_filter label{
+ float:left;
+ width:400px;
+}
this.elements = [];
}
-list.prototype.save = function() {
- for (var prop in this) {
- if (typeof this[prop] != 'function') {
- console.log("prop: " + prop);
- } else {
- console.log("func: " + prop);
- }
- }
- //localStorage.setItem(name, JSON.stringify(value));
-};
-
-list.prototype.load = function(name) {
- this.pending = JSON.parse(localStorage.getItem(name));
- if (!this.pending) {
- this.pending = [];
- }
-};
-
list.prototype.add = function(element) {
if (!this.has(element)) {
this.elements.push(element);
};
};
-function users() {
+function leases() {
this.pending = {
toremove: new list(),
toadd: new list(),
};
};
-function leases() {
+function users() {
this.pending = {
toremove: new list(),
toadd: new list(),
this.users = new users();
this.leases = new leases();
-};
-slice.prototype.pending = function() {
-
-};
-slice.prototype.reserve = function() {
-
-};
-slice.prototype.unreserve = function() {
-
};
+
/*
* User
*/
-function user(u) {
- this.u = u;
- this.testbeds = {};
- this.slices = {};
+function user(user) {
+ this.user = user;
+ this.testbeds = new list();
+ this.slices = new list();
- for (i = 0; i < this.u.slices.length; i++) {
- this.slices[this.u.slices[i]] = new slice(this.u.slices[i]);
+ for (i = 0; i < this.user.slices.length; i++) {
+ this.slices[this.user.slices[i]] = new slice(this.user.slices[i]);
}
};
user.prototype.list = function() {
for (s in this.slices) {
- for (o in s) {
+ for (o in s) {
if (typeof o != 'function') {
console.log(o);
} else {
*/
var myslice = {
user: {},
-
+
+ user: function() {
+ if ($.isEmptyObject(this.user)) {
+ //this.login(function() { return this.user; });
+ } else {
+ return this.user;
+ }
+ },
+
+ login: function(fn) {
+ $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ myslice.user = new user(data[0]);
+ });
+ },
+
getSlices: function(name) {
},
$(document).ready(function() {
+ //console.log(myslice.user().slices);
+
// $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function(data) {
// myslice.user = new user(data[0]);
// console.log(myslice.user.slices);
from ui.topmenu import topmenu_items, the_user
from myslice.configengine import ConfigEngine
-from theme import ThemeView
+from myslice.theme import ThemeView
class SupportView (FreeAccessView, ThemeView):
template_name = 'supportview.html'
+{% load portal_filters %}
{# This is required by insert_above #}{% insert_handler %}<!DOCTYPE html>
<html lang="en"><head>
<title>OneLab - {{ section }}</title>
<script type="text/javascript"> {# raw js code - use {% insert prelude_js %} ... {% endinsert %} #} {% container prelude_js %}</script>
<script src="{{ STATIC_URL }}js/jquery.dataTables.min.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.datatables.js"></script>
+<script src="{{ STATIC_URL }}js/stash.min.js"></script>
<script src="{{ STATIC_URL }}js/myslice.js"></script>
<script src="{{ STATIC_URL }}js/myslice-ui.js"></script>
<style type="text/css">{# In case we need to add raw css code #}{% container prelude_css %}</style>
<body>
{% block container %}
{% block topmenu %}
- {% include theme|add:"__widget-topmenu.html" %}
+ {% widget "_widget-topmenu.html" %}
{% endblock topmenu %}
{% include 'messages-transient.html' %}
{% block base_content %}
--- /dev/null
+
+<div id="header">
+ <div class="wrapper">
+ <div class="logo">
+ <a href="/"><img src="{{ STATIC_URL }}img/fantaastic-s.png" alt="FanTaaStic" /></a>
+ </div>
+
+ <div id="secondary">
+ <ul>
+ <li>News</li>
+ <li><a href="/portal/about">About</a></li>
+ <li><a target="_blank" href="http://www.onelab.eu">Public Website</a></li>
+ <li><a target="_blank" href="http://intranet.onelab.eu">Intranet</a></li>
+ </ul>
+ </div>
+ </div>
+
+ {% if username %}
+ <div id="navigation">
+ <div class="wrapper">
+ <ul>
+ <li id="nav-account"><a href="/portal/account/">{{ username }}</a></li>
+ <li>|</li>
+ <li id="nav-institution" class=""><a href="/portal/institution">INSTITUTION</a></li>
+ <li class="slices">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ SLICES <span class="caret"></span>
+ </a>
+
+ <div class="dropdown-menu" style="z-index:99;">
+ <ul>
+ <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>
+ <li id="nav-request"><a href="/portal/validate">REQUESTS</a></li>
+ <li id="nav-support"><a href="/portal/support/">SUPPORT</a></li>
+ <li>|</li>
+ <li id="nav-logout" style="margin-top: 10px;"><a id="logout" style="cursor:pointer;" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> LOGOUT</a></li>
+ </ul>
+ </div>
+ </div>
+ {% else %}
+ <div id="navigation">
+ <div class="wrapper"></div>
+ </div>
+ {% endif %}
+</div>
+<script>
+ $(document).ready(function() {
+ $('li.slices').mouseenter(function() {
+ $('div#menu-slice-list').fadeIn(100);
+ });
+ $('div#menu-slice-list').mouseleave(function(e) {
+ if (!$('li.slices').is(":hover")) {
+ $(this).fadeOut(100);
+ }
+ });
+ // var slices = localStorage.getItem('slices');
+ // if (slices.length == 0) {
+ // $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ // var items = [];
+ // localStorage.setItem('slices', data[0].slice);
+ // });
+ // }
+ // $.each(slices, function( key, val ) {
+ // items.push( "<li><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
+ // });
+ // $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+ });
+</script>
{% extends "layout.html" %}
+{% load portal_filters %}
{% block content %}
-<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/registration.css" />
-<div id="home-dashboard">
+<div class="row" id="home-dashboard">
<ul class="nav nav-tabs">
- <li class="active"><a href="#">USER</a></li>
- <li><a href="#">MANAGER</a></li>
+ <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 id="user">
+ <div class="home-panel" id="user">
<table>
<tr>
<td>ACCOUNT</td>
<td>SUPPORT</td>
</tr>
<tr>
- <td><a href="/portal/account"><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></a></td>
- <td><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></td>
+ <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>
- <td>
- {% include '_widget-login-user.html' %}
+ {% 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>
+ {% widget '_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">
- <div><a href="/portal/contact">Contact</a></div>
- <div><a href="">Documentation</a></div>
+ <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 id="manager">
+ <div class="home-panel" id="manager">
<table>
<tr>
<td>INSTITUTION</td>
<td>SLICES</td>
- <td>SUPPORT</td>
+ <td>REQUESTS</td>
</tr>
<tr>
<td><a href="/portal/institution"><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></a></td>
- <td><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></td>
- <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.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>
- <td>
- {% include '_widget-login-manager.html' %}
+ {% 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>
+ {% widget '_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">
- <div><a href="/portal/contact">Contact</a></div>
- <div><a href="">Documentation</a></div>
+ {% 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 = [];
+ $.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( "" ) }));
+
+ });
+ {% endif %}
+ });
+</script>
{% endblock %}
--- /dev/null
+
+<div id="header">
+ <div class="wrapper">
+ <div class="logo">
+ <a href="/"><img src="{{ STATIC_URL }}img/onelab-portal.png" alt="OneLab - Future Internet Testbeds" /></a>
+ </div>
+
+ <div id="secondary">
+ <ul>
+ <li>News</li>
+ <li><a href="/portal/about">About</a></li>
+ <li><a target="_blank" href="http://www.onelab.eu">Public Website</a></li>
+ <li><a target="_blank" href="http://intranet.onelab.eu">Intranet</a></li>
+ </ul>
+ </div>
+ </div>
+
+ {% if username %}
+ <div id="navigation">
+ <div class="wrapper">
+ <ul>
+ <li id="nav-account"><a href="/portal/account/">{{ username }}</a></li>
+ <li>|</li>
+ <li id="nav-institution" class=""><a href="/portal/institution">INSTITUTION</a></li>
+ <li class="slices">
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
+ SLICES <span class="caret"></span>
+ </a>
+
+ <div class="dropdown-menu" style="z-index:99;">
+ <ul>
+ <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>
+ <li id="nav-request"><a href="/portal/validate">REQUESTS</a></li>
+ <li id="nav-support"><a href="/portal/support/">SUPPORT</a></li>
+ <li>|</li>
+ <li id="nav-logout" style="margin-top: 10px;"><a id="logout" style="cursor:pointer;" data-username="{{ username }}"><span class="glyphicon glyphicon-off"></span> LOGOUT</a></li>
+ </ul>
+ </div>
+ </div>
+ {% else %}
+ <div id="navigation">
+ <div class="wrapper"></div>
+ </div>
+ {% endif %}
+</div>
+<script>
+ $(document).ready(function() {
+ $('li.slices').mouseenter(function() {
+ $('div#menu-slice-list').fadeIn(100);
+ });
+ $('div#menu-slice-list').mouseleave(function(e) {
+ if (!$('li.slices').is(":hover")) {
+ $(this).fadeOut(100);
+ }
+ });
+ // var slices = localStorage.getItem('slices');
+ // if (slices.length == 0) {
+ // $.post("/rest/user/",{'filters':{'user_hrn':'$user_hrn'}}, function( data ) {
+ // var items = [];
+ // localStorage.setItem('slices', data[0].slice);
+ // });
+ // }
+ // $.each(slices, function( key, val ) {
+ // items.push( "<li><a href=\"/slice/"+val.slice_hrn+"\">" + val.slice_hrn + "</a></li>" );
+ // });
+ // $("div#home-slice-list").html($( "<ul/>", { html: items.join( "" ) }));
+ });
+</script>
{% extends "layout_wide.html" %}
+{% load portal_filters %}
{% block head %}
<!-- <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC1RUj824JAiHRVqgc2CSIg4CpKHhh84Lw&sensor=false"></script> -->
</div>
<div class="col-md-10" style="height:100%;">
<div class="row">
- {% include theme|add:"_widget-slice-sections.html" %}
+ {% widget '_widget-slice-sections.html' %}
</div>
<!-- <div class="row slice-pending">
<ul class="nav nav-pills">
slice_row += "<tr><td>users:</td><td>"+user_length+"</td></tr>";
slice_row += "<tr><td>resources:</td><td>"+nodes_length+"</td></tr>";
slice_row += "<tr><td>created:</td><td>"+val.created+"</td></tr>";
- slice_row += "<tr><td>last update:</td><td>"+val.last_updated+"</td></tr>";
+ slice_row += "<tr><td>last update:</td><td>"+val.slice_last_updated+"</td></tr>";
slice_row += "<tr><td>expires:</td><td>"+val.slice_expires+"</td></tr>";
table_slices.push(slice_row);
});
{% extends "layout_wide.html" %}
+{% load portal_filters %}
{% block head %}
<div class="container">
<div class="row">
<div class="col-md-12">
- {% include theme|add:"_widget-slice-sections.html" %}
+ {% widget "_widget-slice-sections.html" %}
</div>
</div>
</div>
--- /dev/null
+from django import template
+from django.template.loader_tags import do_include
+from myslice.settings import theme
+
+register = template.Library()
+
+class IncludeNode(template.Node):
+
+ def __init__(self, template_name):
+ if theme :
+ self.theme_template_name = "%s%s" % (theme, template_name)
+ self.template_name = template_name
+
+ def render(self, context):
+ try:
+ # Loading the template and rendering it
+ included_template = template.loader.get_template(self.theme_template_name).render(context)
+ except template.TemplateDoesNotExist:
+ # template theme does not exists, try the generic one
+ try:
+ # Loading the template and rendering it
+ included_template = template.loader.get_template(self.template_name).render(context)
+ except template.TemplateDoesNotExist:
+ included_template = ''
+
+ return included_template
+
+@register.tag
+def widget(parser, token):
+ """Usage: {% widget "widget.html" %}
+
+ This will fail silently if the template doesn't exist. If it does, it will
+ be rendered with the current context."""
+ try:
+ tag_name, template_name = token.split_contents()
+ except ValueError:
+ raise template.TemplateSyntaxError, \
+ "%r tag requires a single argument" % token.contents.split()[0]
+
+ return IncludeNode(template_name[1:-1])
\ No newline at end of file
from manifoldapi.manifoldapi import execute_admin_query
from unfold.loginrequired import LoginRequiredAutoLogoutView
-from theme import ThemeView
+from myslice.theme import ThemeView
import json
class UsersView (LoginRequiredAutoLogoutView, ThemeView):
from manifoldapi.manifoldapi import execute_query
from manifold.core.query import Query
from unfold.page import Page
-from theme import ThemeView
+from myslice.theme import ThemeView
class ValidatePendingView(FreeAccessView, ThemeView):
template_name = "validate_pending.html"