X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=myslice%2Fviewutils.py;h=b9309e1b123fddd2d44b1935690eab719b841171;hb=c15eb339cc9b7955f77b7cbb6e3466e0ce49b7e4;hp=98f16fd72b60935dc62f131571f1f05e9acd6d69;hpb=9b89a32f1ae0a1e0618a9cc11138a766a4ba870b;p=myslice.git diff --git a/myslice/viewutils.py b/myslice/viewutils.py index 98f16fd7..b9309e1b 100644 --- a/myslice/viewutils.py +++ b/myslice/viewutils.py @@ -1,24 +1,39 @@ # a set of utilities to help make the global layout consistent across views -from copy import deepcopy - +# this standard_topmenu_items = [ - { 'label':'Tab', 'href': '/tab/'}, - { 'label':'Scroll', 'href': '/scroll/'}, - { 'label':'Slice', 'href': '/slice/'}, - { 'label':'Plugin', 'href': '/plugin/'}, - { 'label':'Dashboard', 'href': '/dashboard/'}, +# { 'label':'Tab', 'href': '/tab/'}, +# { 'label':'Scroll', 'href': '/scroll/'}, +# { 'label':'One Plugin', 'href': '/plugin/'}, +# Thierry : using this goes to some test slice that not every one is in +# besides, the topmenu needs to be shrunk down horizontally +# otherwise the topmenu takes more vertical space than avail. and the layout is broken +# { 'label':'Slice', 'href': '/slice/'}, + #{'label':'My Account', 'href': '/portal/account/'} ] #login_out_items = { False: { 'label':'Login', 'href':'/login/'}, # True: { 'label':'Logout', 'href':'/logout/'}} def topmenu_items (current,request=None): - result=deepcopy(standard_topmenu_items) + has_user=request.user.is_authenticated() + result=[] + if has_user: + result.append({'label':'Platforms', 'href': '/portal/platforms/'}) + result.append({ 'label':'Dashboard', 'href': '/portal/dashboard/'}) + # This should probably go in dashboard at some point + result.append({ 'label':'Request a slice', 'href': '/portal/slice_request/'}) + result.append({'label':'My Account', 'href': '/portal/account/'}) + else: + result.append({'label':'Home', 'href': '/login'}) + # looks like this is accessible to non-logged users + result.append({'label':'Platforms', 'href': '/portal/platforms/'}) + result.append({ 'label':'Register', 'href': '/portal/register/'}) + result.append({'label':'Contact Support', 'href': '/portal/contact/'}) for d in result: - if d['label'].lower().find(current)>=0: d['active']=True + #if d['label'].lower()find(current)>=0: d['is_active']=True + if d['label'] == current: d['is_active']=True if not request: return result - has_user=request.user.is_authenticated() # result.append (login_out_items [ has_user] ) return result @@ -59,6 +74,8 @@ hard_wired_list.append("just like a standard plugin can be set as visible or not hard_wired_list.append("") hard_wired_list.append("OTOH and IMHO, there should be two separate and explicit subclasses of SimpleList for slices or testbeds") -quickfilter_criterias = [{'key': 'Slice', 'values': ['slice1','slice2']}, \ - {'key': 'Type', 'values': ['type1','type2']}, \ - {'key': 'Network', 'values': ['net1','net2']}] +quickfilter_criterias = [ + {'key': 'Slice', 'values': ['slice1','slice2']}, + {'key': 'Type', 'values': ['type1','type2']}, + {'key': 'Network', 'values': ['net1','net2']}, + ]