changed template paths in settings (takes into account the theme)
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 27 Mar 2014 10:51:08 +0000 (11:51 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 27 Mar 2014 10:51:08 +0000 (11:51 +0100)
44 files changed:
myslice/settings.py
myslice/theme.py [moved from portal/theme.py with 100% similarity]
portal/about.py
portal/accountview.py
portal/actions.py
portal/contactview.py
portal/dashboardview.py
portal/django_passresetview.py
portal/documentationview.py
portal/homeview.py
portal/institution.py
portal/joinview.py
portal/manageuserview.py
portal/platformsview.py
portal/platformview.py
portal/registrationview.py
portal/resourceview.py
portal/slicerequestview.py
portal/sliceresourceview.py
portal/slicetabexperiment.py
portal/slicetabinfo.py
portal/slicetabtestbeds.py
portal/slicetabusers.py
portal/sliceview.py
portal/sliceviewold.py
portal/static/css/fantaastic.css [new file with mode: 0644]
portal/static/img/fantaastic-s.png [new file with mode: 0644]
portal/static/img/ict_logo-s.png [new file with mode: 0644]
portal/static/js/myslice.js
portal/supportview.py
portal/templates/_widget-topmenu.html [moved from portal/templates/onelab/onelab__widget-topmenu.html with 100% similarity]
portal/templates/base.html [moved from ui/templates/base.html with 93% similarity]
portal/templates/fantaastic/fantaastic_widget-topmenu.html [new file with mode: 0644]
portal/templates/fed4fire/fed4fire_widget-topmenu.html [moved from portal/templates/fed4fire/fed4fire__widget-topmenu.html with 100% similarity]
portal/templates/home-view.html
portal/templates/institution-tab-info.html [new file with mode: 0644]
portal/templates/onelab/onelab_widget-topmenu.html [new file with mode: 0644]
portal/templates/slice-resource-view.html
portal/templates/slice-tab-info.html
portal/templates/slice-view.html
portal/templatetags/__init__.py [new file with mode: 0644]
portal/templatetags/portal_filters.py [new file with mode: 0644]
portal/usersview.py
portal/validationview.py

index 21c2897..ccf94dd 100644 (file)
@@ -2,6 +2,7 @@
 
 import os.path
 
+
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
@@ -19,6 +20,12 @@ except:
     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
@@ -186,6 +193,8 @@ TEMPLATE_DIRS = (
     # 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"),
 )
 
similarity index 100%
rename from portal/theme.py
rename to myslice/theme.py
index 49a890b..5080601 100644 (file)
@@ -12,7 +12,7 @@ from manifoldapi.manifoldresult import ManifoldResult
 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'
index 9b0c466..8243e39 100644 (file)
@@ -11,7 +11,7 @@ from django.http                        import HttpResponse, HttpResponseRedirec
 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
index 399cae6..c612b09 100644 (file)
@@ -8,7 +8,7 @@ from django.contrib.auth.models import User
 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()
 
index 13450df..b89aa75 100644 (file)
@@ -7,7 +7,7 @@ from ui.topmenu                 import topmenu_items, the_user
 
 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
index 2b0ab82..06f02f8 100644 (file)
@@ -11,7 +11,7 @@ from unfold.loginrequired        import LoginRequiredAutoLogoutView
 
 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):
index 7d7f52e..a0018b0 100644 (file)
@@ -87,7 +87,7 @@ from portal.actions             import manifold_update_user
 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
index 6a75a62..ccd42fa 100644 (file)
@@ -12,7 +12,7 @@ from manifoldapi.manifoldresult import ManifoldResult
 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'
index 14487c9..7c47d99 100644 (file)
@@ -12,7 +12,7 @@ from manifoldapi.manifoldresult import ManifoldResult
 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'
index 6c55517..4ee9016 100644 (file)
@@ -13,7 +13,7 @@ from manifoldapi.manifoldresult     import ManifoldResult
 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):
index abe73f3..a2b8b7d 100644 (file)
@@ -19,7 +19,7 @@ from manifold.core.query        import Query
 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
index 369d6e9..7687d34 100644 (file)
@@ -10,7 +10,7 @@ from ui.topmenu                         import topmenu_items_live, the_user
 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
 
index eef773a..c31cd17 100644 (file)
@@ -5,7 +5,7 @@ from unfold.loginrequired       import FreeAccessView
 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):
index d70c99b..b0fc3ec 100644 (file)
@@ -15,7 +15,7 @@ from ui.topmenu                  import topmenu_items_live, the_user
 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):
index 9f5f39f..396d357 100644 (file)
@@ -17,7 +17,7 @@ from manifold.core.query        import Query
 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
index a407725..d670645 100644 (file)
@@ -10,7 +10,7 @@ from plugins.lists.simplelist   import SimpleList
 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):
index dfa4658..fc093d1 100644 (file)
@@ -10,7 +10,7 @@ from portal.forms               import SliceRequestForm
 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
 
index afd9531..bdffa3f 100644 (file)
@@ -18,7 +18,7 @@ from plugins.googlemap               import GoogleMap
 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"
index cd1d6ad..cca8afb 100644 (file)
@@ -12,7 +12,7 @@ from manifoldapi.manifoldresult import ManifoldResult
 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'
index 7e7b78e..fc7fa29 100644 (file)
@@ -14,7 +14,7 @@ from unfold.page                     import Page
 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"
index a93f678..abd6ce6 100644 (file)
@@ -3,7 +3,7 @@ from django.shortcuts                import render_to_response
 
 from unfold.loginrequired           import LoginRequiredView
 
-from theme import ThemeView
+from myslice.theme import ThemeView
 
 class SliceTabTestbeds (LoginRequiredView, ThemeView):
     template_name = "slice-tab-testbeds.html"
index e1a1742..861b0cb 100644 (file)
@@ -14,7 +14,7 @@ from unfold.page                     import Page
 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"
index 008222c..10cab7c 100644 (file)
@@ -14,7 +14,7 @@ from unfold.page                     import Page
 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"
index e799153..7cf80f9 100644 (file)
@@ -31,7 +31,7 @@ from plugins.slicestat               import SliceStat
 
 from myslice.configengine            import ConfigEngine
 
-from theme import ThemeView
+from myslice.theme import ThemeView
 
 tmp_default_slice='ple.upmc.myslicedemo'
 
diff --git a/portal/static/css/fantaastic.css b/portal/static/css/fantaastic.css
new file mode 100644 (file)
index 0000000..07a77eb
--- /dev/null
@@ -0,0 +1,480 @@
+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;
+}
diff --git a/portal/static/img/fantaastic-s.png b/portal/static/img/fantaastic-s.png
new file mode 100644 (file)
index 0000000..ea33949
Binary files /dev/null and b/portal/static/img/fantaastic-s.png differ
diff --git a/portal/static/img/ict_logo-s.png b/portal/static/img/ict_logo-s.png
new file mode 100644 (file)
index 0000000..78183ee
Binary files /dev/null and b/portal/static/img/ict_logo-s.png differ
index 7038e53..c7c32d2 100644 (file)
@@ -6,24 +6,6 @@ function list() {
        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);
@@ -60,14 +42,14 @@ function resources() {
        };
 };
 
-function users() {
+function leases() {
        this.pending = {
                toremove: new list(),
                toadd: new list(),
        };
 };
 
-function leases() {
+function users() {
        this.pending = {
                toremove: new list(),
                toadd: new list(),
@@ -83,27 +65,19 @@ function slice(name) {
        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]);
        }
 };
 
@@ -113,7 +87,7 @@ user.prototype.slice = function(name) {
 
 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 {
@@ -128,7 +102,21 @@ user.prototype.list = function() {
  */
 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) {
        
     },
@@ -197,6 +185,8 @@ var myslice = {
 
 
 $(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);
index bbb5b49..f42bbd8 100644 (file)
@@ -12,7 +12,7 @@ from manifoldapi.manifoldresult import ManifoldResult
 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'
similarity index 93%
rename from ui/templates/base.html
rename to portal/templates/base.html
index 8513951..6dc48e7 100644 (file)
@@ -1,3 +1,4 @@
+{% load portal_filters %}
 {# This is required by insert_above #}{% insert_handler %}<!DOCTYPE html>
 <html lang="en"><head>
 <title>OneLab - {{ section }}</title>
@@ -8,6 +9,7 @@
 <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>
@@ -33,7 +35,7 @@
 <body>
 {% block container %}
        {% block topmenu %}
-       {% include theme|add:"__widget-topmenu.html" %}
+       {% widget "_widget-topmenu.html" %}
        {% endblock topmenu %}
        {% include 'messages-transient.html' %}
        {% block base_content %}
diff --git a/portal/templates/fantaastic/fantaastic_widget-topmenu.html b/portal/templates/fantaastic/fantaastic_widget-topmenu.html
new file mode 100644 (file)
index 0000000..de37b04
--- /dev/null
@@ -0,0 +1,76 @@
+
+<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>
index c88902d..453ed2f 100644 (file)
@@ -1,13 +1,13 @@
 {% 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 %}
diff --git a/portal/templates/institution-tab-info.html b/portal/templates/institution-tab-info.html
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/portal/templates/onelab/onelab_widget-topmenu.html b/portal/templates/onelab/onelab_widget-topmenu.html
new file mode 100644 (file)
index 0000000..4ed429a
--- /dev/null
@@ -0,0 +1,76 @@
+
+<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>
index 1c00cb8..69f8bc1 100644 (file)
@@ -1,4 +1,5 @@
 {% 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> -->
@@ -24,7 +25,7 @@
        </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">
index 747f3a1..bd10ac3 100644 (file)
@@ -34,7 +34,7 @@
                 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);
             });
index cf9ee7d..d9ca050 100644 (file)
@@ -1,4 +1,5 @@
 {% extends "layout_wide.html" %}
+{% load portal_filters %}
 
 {% block head %}
 
@@ -9,7 +10,7 @@
 <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>
diff --git a/portal/templatetags/__init__.py b/portal/templatetags/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/portal/templatetags/portal_filters.py b/portal/templatetags/portal_filters.py
new file mode 100644 (file)
index 0000000..9bd0175
--- /dev/null
@@ -0,0 +1,40 @@
+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
index e8b7b68..5b4e2ee 100644 (file)
@@ -10,7 +10,7 @@ from unfold.page                import Page
 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):
index e0f4ab1..9ecd962 100644 (file)
@@ -44,7 +44,7 @@ from portal.actions             import get_requests
 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"