X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=myslice%2Fviewutils.py;h=b62e1a477929f3cc1be94d455d3aede4e6f35431;hb=129b1502b5188c74f48e82da6c20c3b63350936c;hp=ecdd81f4464637db80cdcbdd5d8186a040b72883;hpb=a222cef0a10a5517349f05cea0e382b35e3a14a6;p=myslice.git diff --git a/myslice/viewutils.py b/myslice/viewutils.py index ecdd81f4..b62e1a47 100644 --- a/myslice/viewutils.py +++ b/myslice/viewutils.py @@ -2,21 +2,34 @@ from copy import deepcopy -standard_topmenu_items = [ { 'label':'Plugin', 'href': '/plugin/'}, - { 'label':'Slice', 'href': '/slice/'}, - { 'label':'Scroll', 'href': '/scroll/'}, - { 'label':'Tab', 'href': '/tab/'}, - ] +standard_topmenu_items = [ +# { '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/'}) + else: + result = [] + result.append({'label':'Home', 'href': '/login'}) + result.append({ 'label':'Register', 'href': '/portal/register/'}) + result.append({'label':'Platforms', 'href': '/portal/platforms/'}) + 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 @@ -57,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']}, + ]