X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=myslice%2Fviewutils.py;h=c469d5ccc4cdfa233d2576788bd8a261be1b5626;hb=0dbb6aa8f18054cb2fce0809a982de65c7d13fc8;hp=98f16fd72b60935dc62f131571f1f05e9acd6d69;hpb=9b89a32f1ae0a1e0618a9cc11138a766a4ba870b;p=myslice.git diff --git a/myslice/viewutils.py b/myslice/viewutils.py index 98f16fd7..c469d5cc 100644 --- a/myslice/viewutils.py +++ b/myslice/viewutils.py @@ -3,22 +3,33 @@ from copy import deepcopy 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/'}, + { 'label':'Dashboard', 'href': '/portal/dashboard/'}, + { '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() + if has_user: + result=deepcopy(standard_topmenu_items) + result.append({'label':'My Account', 'href': '/portal/account/'}) + result.append({ 'label':'Request a slice', 'href': '/portal/slice_request/'}) + result.append({'label':'Contact Support', 'href': '/portal/contact/'}) + else: + result = [] + result.append({'label':'Home', 'href': '/login'}) + result.append({ 'label':'Register', 'href': '/portal/user/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 +70,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']}, + ]