Added views for about, institution and corresponding templates
authorLoic Baron <loic.baron@lip6.fr>
Fri, 21 Feb 2014 14:54:05 +0000 (15:54 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Fri, 21 Feb 2014 14:54:05 +0000 (15:54 +0100)
14 files changed:
portal/about.py [new file with mode: 0644]
portal/institution.py [new file with mode: 0644]
portal/templates/about.html [new file with mode: 0644]
portal/templates/fed4fire/fed4fire__widget-login.html [new file with mode: 0644]
portal/templates/fed4fire/fed4fire__widget-topmenu.html [new file with mode: 0644]
portal/templates/fed4fire/fed4fire_home-view.html [new file with mode: 0644]
portal/templates/home-view.html
portal/templates/institution.html [new file with mode: 0644]
portal/templates/onelab/onelab__widget-login-manager.html [new file with mode: 0644]
portal/templates/onelab/onelab__widget-login-user.html [new file with mode: 0644]
portal/templates/onelab/onelab__widget-topmenu.html [new file with mode: 0644]
portal/templates/onelab/onelab_home-view.html [new file with mode: 0644]
portal/urls.py
ui/static/img/icon_authority_color.png [new file with mode: 0644]

diff --git a/portal/about.py b/portal/about.py
new file mode 100644 (file)
index 0000000..ade6f6a
--- /dev/null
@@ -0,0 +1,51 @@
+# this somehow is not used anymore - should it not be ?
+from django.core.context_processors import csrf
+from django.http import HttpResponseRedirect
+from django.contrib.auth import authenticate, login, logout
+from django.template import RequestContext
+from django.shortcuts import render_to_response
+from django.shortcuts import render
+
+from unfold.loginrequired import FreeAccessView
+
+from manifold.manifoldresult import ManifoldResult
+from ui.topmenu import topmenu_items, the_user
+from myslice.configengine import ConfigEngine
+
+from theme import ThemeView
+
+class AboutView (FreeAccessView, ThemeView):
+    template_name = 'about.html'
+        
+    # expose this so we can mention the backend URL on the welcome page
+    def default_env (self):
+        return { 
+                 'MANIFOLD_URL':ConfigEngine().manifold_url(),
+                 }
+
+    def post (self,request):
+        env = self.default_env()
+        env['theme'] = self.theme
+        return render_to_response(self.template, env, context_instance=RequestContext(request))
+
+    def get (self, request, state=None):
+        env = self.default_env()
+
+        if request.user.is_authenticated(): 
+            env['person'] = self.request.user
+        else: 
+            env['person'] = None
+    
+        env['theme'] = self.theme
+    
+
+        env['username']=the_user(request)
+        env['topmenu_items'] = topmenu_items(None, request)
+        if state: env['state'] = state
+        elif not env['username']: env['state'] = None
+        # use one or two columns for the layout - not logged in users will see the login prompt
+        env['layout_1_or_2']="layout-unfold2.html" if not env['username'] else "layout-unfold1.html"
+        
+        
+        return render_to_response(self.template, env, context_instance=RequestContext(request))
+
diff --git a/portal/institution.py b/portal/institution.py
new file mode 100644 (file)
index 0000000..31d2d59
--- /dev/null
@@ -0,0 +1,51 @@
+# this somehow is not used anymore - should it not be ?
+from django.core.context_processors import csrf
+from django.http import HttpResponseRedirect
+from django.contrib.auth import authenticate, login, logout
+from django.template import RequestContext
+from django.shortcuts import render_to_response
+from django.shortcuts import render
+
+from unfold.loginrequired import FreeAccessView
+
+from manifold.manifoldresult import ManifoldResult
+from ui.topmenu import topmenu_items, the_user
+from myslice.configengine import ConfigEngine
+
+from theme import ThemeView
+
+class InstitutionView (FreeAccessView, ThemeView):
+    template_name = 'institution.html'
+        
+    # expose this so we can mention the backend URL on the welcome page
+    def default_env (self):
+        return { 
+                 'MANIFOLD_URL':ConfigEngine().manifold_url(),
+                 }
+
+    def post (self,request):
+        env = self.default_env()
+        env['theme'] = self.theme
+        return render_to_response(self.template, env, context_instance=RequestContext(request))
+
+    def get (self, request, state=None):
+        env = self.default_env()
+
+        if request.user.is_authenticated(): 
+            env['person'] = self.request.user
+        else: 
+            env['person'] = None
+    
+        env['theme'] = self.theme
+    
+
+        env['username']=the_user(request)
+        env['topmenu_items'] = topmenu_items(None, request)
+        if state: env['state'] = state
+        elif not env['username']: env['state'] = None
+        # use one or two columns for the layout - not logged in users will see the login prompt
+        env['layout_1_or_2']="layout-unfold2.html" if not env['username'] else "layout-unfold1.html"
+        
+        
+        return render_to_response(self.template, env, context_instance=RequestContext(request))
+
diff --git a/portal/templates/about.html b/portal/templates/about.html
new file mode 100644 (file)
index 0000000..375946c
--- /dev/null
@@ -0,0 +1,10 @@
+{% extends "layout-unfold1.html" %}
+
+{% block unfold_main %}
+<div class="wrapper" id="ticket-request">
+</div>
+
+<h1>This portal is powered by MySlice</h1>
+<a href ="http://myslice.info">More info</a>
+
+{% endblock %}
diff --git a/portal/templates/fed4fire/fed4fire__widget-login.html b/portal/templates/fed4fire/fed4fire__widget-login.html
new file mode 100644 (file)
index 0000000..db7245c
--- /dev/null
@@ -0,0 +1,26 @@
+<div class="well">
+       {% if state %}
+       <span class="help-block">{{ state }}</span>
+       {% endif %}
+       <form action="/login/" method="post" role="form">
+         {% csrf_token %}
+         {% if next %}
+         <input type="hidden" name="next" value="{{ next }}" />
+         {% endif %}
+       <div class="form-group">
+       <label for="username">Email address / Username</label>
+       <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+       </div>
+       <div class="form-group">
+       <label for="password">Password</label>
+       <input type="password" class="form-control" name="password" placeholder="Password">
+       </div>
+       <div class="login-submit">
+               <input class="btn btn-default" type="submit" value="Sign In" />
+               <span class="lost-password">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="/portal/pass_reset/">Can't access your account?</a></span>
+       </div>
+       <div class="login-signup">
+               <a href="/portal/register">Try</a> or <a href="/portal/register">Sign Up</a>
+       </div>
+       </form>
+</div>
diff --git a/portal/templates/fed4fire/fed4fire__widget-topmenu.html b/portal/templates/fed4fire/fed4fire__widget-topmenu.html
new file mode 100644 (file)
index 0000000..4b2ae0e
--- /dev/null
@@ -0,0 +1,38 @@
+{% insert_str prelude "js/bootstrap.js" %}
+{% insert_str prelude "css/bootstrap.css" %}
+{% insert_str prelude "css/topmenu.css" %}
+{% insert_str prelude "js/logout.js" %}
+<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
+  <div class="navbar-header">
+    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-myslice-collapse">
+      <span class="sr-only">Toggle navigation</span>
+      <span class="icon-bar"></span>
+      <span class="icon-bar"></span>
+      <span class="icon-bar"></span>
+    </button>
+    <a class="navbar-brand" href="/"><img src="{{ STATIC_URL }}img/f4f-logo.png" height="30" alt="Fed4Fire logo" /></a>
+     <a href="/" alt="Home" class="logoTxt">Fed4Fire Portal</a>
+  </div>
+  <div class="collapse navbar-collapse navbar-myslice-collapse topmenu">
+    <ul class="nav navbar-nav">
+       {% for d in topmenu_items %} 
+       {% if d.dropdown %}
+       {% if d.is_active %} <li class='active'> {% else %} <li class='other'> {% endif %}
+         <a class="dropdown-toggle" data-toggle="dropdown" href="{{ d.href }}">{{ d.label }}<b class="caret"></b></a>
+         <ul class="dropdown-menu">
+           {% for dd in d.contents %}
+           <li class='{% if dd.is_active %}active{% else %}other{% endif %}{% if dd.disabled %} disabled{%endif%}'
+           {% if dd.domid %} id='{{dd.domid}}'{% endif %}>
+           <a href="{{ dd.href }}"> {{ dd.label }} </a> </li>
+           {% endfor %}
+         </ul>
+        </li>
+        {% else %} 
+       <li class='{% if d.is_active %}active{% else %}other{% endif %}{% if d.disabled %} disabled{%endif%}'
+       {% if d.domid %} id='{{d.domid}}'{% endif %}>
+       <a href="{{ d.href }}"> {{ d.label }} </a> </li>
+    {% endif %}
+    {% endfor %}
+</div>
+
+
diff --git a/portal/templates/fed4fire/fed4fire_home-view.html b/portal/templates/fed4fire/fed4fire_home-view.html
new file mode 100644 (file)
index 0000000..bc018a4
--- /dev/null
@@ -0,0 +1,19 @@
+{# fine for either layout-unfold1.html (logged in) or layout-unfold2.html (needs a login prompt) #}
+{% extends layout_1_or_2 %}
+{% block unfold_margin %}
+{% include 'fed4fire/_widget-login.html' %}
+{% endblock unfold_margin %}
+
+{% block unfold_main %}
+<div class='well-lg f4f-title'>
+  <h2 style="font-weight: bold;">Welcome to Fed4Fire portal !</h2>
+  <h4>New to Fed4fire? Please <a href="/portal/register">register</a> or learn more about <a href="http://fed4fire.eu/" target="_blank">the project</a>.</h3>
+</div>
+<div class='well'>
+<p>
+A federation of experimentation facilities will significantly accelerate Future Internet research. Fed4FIRE will deliver open and easily accessible facilities to the FIRE experimentation communities, which focus on fixed and wireless infrastructures, services and applications, and combinations thereof. 
+</p>
+<p>This UI server is connected to the manifold backend running at <code>{{ MANIFOLD_URL }}</code>.</p>
+</div>
+{% endblock unfold_main %}
index 99d6464..4a44ce1 100644 (file)
@@ -15,9 +15,9 @@
                                <td>SUPPORT</td>
                        </tr>
                        <tr>
-                               <td><img src="{{ STATIC_URL }}img/icon_user_color.png" alt="" /></td>
+                               <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><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></td>
+                               <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
                        </tr>
                        <tr>
                                <td>
@@ -41,9 +41,9 @@
                                <td>SUPPORT</td>
                        </tr>
                        <tr>
-                               <td><img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /></td>
+                               <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><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></td>
+                               <td><a href="/portal/support"><img src="{{ STATIC_URL }}img/icon_support.png" alt="" /></a></td>
                        </tr>
                        <tr>
                                <td>
diff --git a/portal/templates/institution.html b/portal/templates/institution.html
new file mode 100644 (file)
index 0000000..1851ae5
--- /dev/null
@@ -0,0 +1,31 @@
+{% extends "layout-unfold1.html" %}
+
+{% block unfold_main %}
+<div class="wrapper" id="ticket-request">
+    <h1>Affiliation to an Institution</h1>
+    <br>
+    <div style="float:left; width:30%;">
+        <img src="{{ STATIC_URL }}img/icon_authority_color.png" alt="" /><br>
+        <br>
+        <img src="{{ STATIC_URL }}img/onelab-logo.png" alt="" /><br>
+        <b>Membership:</b> Governor
+    </div>
+    <div style="float:right; width:70%;">
+        <img src="http://www.upmc.fr/skins/UPMC/templates/index/resources/img/upmc-logotype.gif" alt="" /><br>
+        <br>
+        <b>authority:</b> onelab.upmc<br>
+        <br>
+        <b>Université Pierre et Marie Curie</b><br>
+        <br>
+        <b>Address:</b> 4 Place Jussieu, 75005 Paris<br>
+        <br>
+        <b>Country:</b> France<br>
+        <br>
+        <br>
+        <h2>Contacts</h2>
+        <b>Legal:</b> Président Jean Chambaz<br>
+        <br>
+        <b>Scientific:</b> Dr Timur Friedman
+    </div>
+</div>
+{% endblock %}
diff --git a/portal/templates/onelab/onelab__widget-login-manager.html b/portal/templates/onelab/onelab__widget-login-manager.html
new file mode 100644 (file)
index 0000000..7c5f170
--- /dev/null
@@ -0,0 +1,26 @@
+<div class="well">
+       {% if state %}
+       <span class="help-block">{{ state }}</span>
+       {% endif %}
+       <form action="/login/" method="post" role="form">
+         {% csrf_token %}
+         {% if next %}
+         <input type="hidden" name="next" value="{{ next }}" />
+         {% endif %}
+       <div class="form-group">
+       <label for="username">Email address / Username</label>
+       <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+       </div>
+       <div class="form-group">
+       <label for="password">Password</label>
+       <input type="password" class="form-control" name="password" placeholder="Password">
+       </div>
+       <div class="login-submit">
+               <input class="btn btn-default" type="submit" value="Sign In" />
+               <span class="lost-password">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="/portal/pass_reset/">Can't access your account?</a></span>
+       </div>
+       <div class="login-signup">
+               <a href="/portal/register">Try</a>, <a href="/portal/register">Sign Up</a> or <a href="/portal/join">Join</a>
+       </div>
+       </form>
+</div>
diff --git a/portal/templates/onelab/onelab__widget-login-user.html b/portal/templates/onelab/onelab__widget-login-user.html
new file mode 100644 (file)
index 0000000..9e24887
--- /dev/null
@@ -0,0 +1,26 @@
+<div class="well login-widget">
+       {% if state %}
+       <span class="help-block">{{ state }}</span>
+       {% endif %}
+       <form action="/login/" method="post" role="form">
+         {% csrf_token %}
+         {% if next %}
+         <input type="hidden" name="next" value="{{ next }}" />
+         {% endif %}
+       <div class="form-group">
+       <label for="username">Email address / Username</label>
+       <input type="email" class="form-control" name="username" placeholder="Enter Email / username">
+       </div>
+       <div class="form-group">
+       <label for="password">Password</label>
+       <input type="password" class="form-control" name="password" placeholder="Password">
+       </div>
+       <div class="login-submit">
+               <input class="btn btn-default" type="submit" value="Sign In" />
+               <span class="lost-password">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="/portal/pass_reset/">Can't access your account?</a></span>
+       </div>
+       <div class="login-signup">
+               <a href="/portal/register">Try</a> or <a href="/portal/register">Sign Up</a>
+       </div>
+       </form>
+</div>
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..da638c5
--- /dev/null
@@ -0,0 +1,40 @@
+{% insert_str prelude "js/bootstrap.js" %}
+{% insert_str prelude "css/bootstrap.css" %}
+{% insert_str prelude "css/topmenu.css" %}
+{% insert_str prelude "js/logout.js" %}
+<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>Intranet</li>
+                       </ul>
+               </div>
+       </div>
+       
+       {% if username %}
+       <div id="navigation">
+               <div class="wrapper">
+               <ul>
+                       <li>SLICES</li>
+                       <li>REQUESTS</li>
+                       <li><a href="/portal/institution">INSTITUTION</a></li>
+                       <li><a href="/portal/contact">SUPPORT</a></li>
+                       <li>|</li>
+                       <li><a href="/portal/account">{{ username }}</a></li>
+                       <li><a id="logout" style="cursor:pointer;" data-username="{{ username }}">LOGOUT</a></li>
+               </ul>
+               </div>
+       </div>
+       {% else %}
+       <div id="navigation">
+               <div class="wrapper"></div>
+       </div>
+       {% endif %}
+</div>
diff --git a/portal/templates/onelab/onelab_home-view.html b/portal/templates/onelab/onelab_home-view.html
new file mode 100644 (file)
index 0000000..120680c
--- /dev/null
@@ -0,0 +1,102 @@
+{% extends "layout-unfold1.html" %}
+
+{% block unfold_main %}
+<div class="wrapper" 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='mailto:{{person.email}}'>{{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 a Slice</button>
+                               {% 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="">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><img src="{{ STATIC_URL }}img/icon_slices.png" alt="" /></td>
+                               <td><img src="{{ STATIC_URL }}img/icon_testbed_color.png" alt="" /></td>
+                       </tr>
+                       <tr>
+                               {% if person %}
+                               <td class="logged-in">
+                                       {% if person.last_name %}
+                                       <div><span id='username'>{{person.first_name}} {{person.last_name}}</span></div> {% endif %}
+                               <div><b>Email: </b><a href='mailto:{{person.email}}'>{{person.email}}</a></div>
+                               {% else %}
+                               <td>
+                                       {% include 'onelab__widget-login-manager.html' %}
+                               {% endif %}
+                               </td>
+                               <td>
+                                       
+                               </td>
+                               <td class="support">
+                                       <div><a href=""></a></div>
+                                       <div><a href=""></a></div>
+                               </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#ticketbtn').click(function() {
+                       window.location="/portal/contact/";
+               })
+               ;$('button#slicerequestbtn').click(function() {
+                       window.location="/portal/slice_request/";
+               });
+       });
+</script>
+{% endblock unfold_main %}
index c7b7de5..5e4634e 100644 (file)
@@ -24,6 +24,7 @@ from django.views.generic.base   import TemplateView
 from django.conf.urls           import patterns, include, url
 
 from portal.about               import AboutView
+from portal.institution         import InstitutionView
 from portal.usersview           import UsersView
 from portal.manageuserview      import UserView, user_process    
 from portal.platformsview       import PlatformsView
@@ -62,6 +63,7 @@ urlpatterns = patterns('',
     url(r'^dashboard/?$', DashboardView.as_view(), name='dashboard'),
     #url(r'^my_account/?$', MyAccountView.as_view(), name='my_account'),
     url(r'^account/?$', AccountView.as_view(), name='account'),
+    url(r'^institution/?$', InstitutionView.as_view(), name='institution'),
     url(r'^about/?$', AboutView.as_view(), name='about'),
     url(r'^users/?$', UsersView.as_view(), name='user_list'),
     url(r'^user/(?P<email>[\w\s.@\-]+)/?$', UserView.as_view(), name='user'),
diff --git a/ui/static/img/icon_authority_color.png b/ui/static/img/icon_authority_color.png
new file mode 100644 (file)
index 0000000..27d2343
Binary files /dev/null and b/ui/static/img/icon_authority_color.png differ