From: Ciro Scognamiglio Date: Tue, 1 Jul 2014 09:30:36 +0000 (+0200) Subject: Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab X-Git-Tag: myslice-1.1~60^2~19 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=9d4a0883ee7e5bc5cf5b990c400ddf573ef9937c;hp=044f1e70a0aa79bf7195c95061f2d92e312d4765;p=myslice.git Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab --- diff --git a/portal/homeview.py b/portal/homeview.py index 1097570c..80e93478 100644 --- a/portal/homeview.py +++ b/portal/homeview.py @@ -5,6 +5,7 @@ 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 +import json from unfold.loginrequired import FreeAccessView @@ -60,6 +61,29 @@ class HomeView (FreeAccessView, ThemeView): if request.user.is_authenticated(): env['person'] = self.request.user env['username'] = self.request.user + + ## check user is pi or not + platform_query = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled') + account_query = Query().get('local:account').select('user_id','platform_id','auth_type','config') + platform_details = execute_query(self.request, platform_query) + account_details = execute_query(self.request, account_query) + for platform_detail in platform_details: + for account_detail in account_details: + if platform_detail['platform_id'] == account_detail['platform_id']: + if 'config' in account_detail and account_detail['config'] is not '': + account_config = json.loads(account_detail['config']) + if 'myslice' in platform_detail['platform']: + acc_auth_cred = account_config.get('delegated_authority_credentials','N/A') + # assigning values + if acc_auth_cred == {}: + pi = "is_not_pi" + else: + pi = "is_pi" + + print "testing" + print pi + + env['pi'] = pi else: env['person'] = None return render_to_response(self.template,env, context_instance=RequestContext(request)) diff --git a/portal/registrationview.py b/portal/registrationview.py index 13b6961a..46c64b1c 100644 --- a/portal/registrationview.py +++ b/portal/registrationview.py @@ -50,6 +50,7 @@ class RegistrationView (FreeAccessView, ThemeView): page.add_css_files ( [ "https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" ] ) if method == 'POST': + reg_form = {} # The form has been submitted # get the domain url @@ -152,6 +153,12 @@ class RegistrationView (FreeAccessView, ThemeView): else: user_request = {} + ## this is coming from onelab website onelab.eu + reg_form = { + 'first_name': wsgi_request.GET.get('first_name', ''), + 'last_name': wsgi_request.GET.get('last_name', ''), + 'email': wsgi_request.GET.get('email', ''), + } template_env = { 'topmenu_items': topmenu_items_live('Register', page), @@ -160,5 +167,6 @@ class RegistrationView (FreeAccessView, ThemeView): 'theme': self.theme } template_env.update(user_request) + template_env.update(reg_form) template_env.update(page.prelude_env ()) return render(wsgi_request, self.template,template_env) diff --git a/portal/templates/base.html b/portal/templates/base.html index de620437..5989508a 100644 --- a/portal/templates/base.html +++ b/portal/templates/base.html @@ -8,6 +8,7 @@ {% include 'messages-transient-header.html' %} + @@ -31,6 +32,8 @@ {% insert_str prelude "css/topmenu.css" %} {% insert_str prelude "js/logout.js" %} + + diff --git a/portal/templates/onelab/onelab_home-view.html b/portal/templates/onelab/onelab_home-view.html index 11fa2ee3..87f3b14e 100644 --- a/portal/templates/onelab/onelab_home-view.html +++ b/portal/templates/onelab/onelab_home-view.html @@ -18,10 +18,16 @@
+
+

+ Your slices

+
Loading Slices
+ {%if 'is_pi' in pi %}

MANAGEMENT

@@ -31,6 +37,7 @@
+ {%endif%}

SUPPORT @@ -57,7 +64,7 @@ {% if person.last_name %} {{person.first_name}} {{person.last_name}}
{% endif %} - Email: {{person.email}} + Username: {{person.email}}

diff --git a/portal/templates/onelab/onelab_widget-topmenu.html b/portal/templates/onelab/onelab_widget-topmenu.html index e81121b7..5a6a19b7 100644 --- a/portal/templates/onelab/onelab_widget-topmenu.html +++ b/portal/templates/onelab/onelab_widget-topmenu.html @@ -19,8 +19,10 @@ + {%if 'is_pi' in pi %} + {%endif%}
  • SUPPORT
  • diff --git a/portal/templates/registration_view.html b/portal/templates/registration_view.html index 3cdbecf3..654f79d6 100644 --- a/portal/templates/registration_view.html +++ b/portal/templates/registration_view.html @@ -487,6 +487,18 @@ jQuery(document).ready(function(){ {value:"",label:"No authority found !!!"} {% endif %} ]; + // sorting the list + availableTags.sort(function(a,b){ + var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase(); + if (nameA < nameB) { + return -1; + } + if (nameA > nameB) { + return 1; + } + return 0; + }); + // auto-complete the form jQuery( "#authority_hrn" ).autocomplete({ source: availableTags, minLength: 0,