#NEWLINE# @ staticmethod #NEWLINE# def layout( item ) : #NEWLINE# #INDENT# ' Layout Method (Item Renderer) ' #NEWLINE# if ( ( not item . authorized ) and ( not item . opts . always_display ) ) : #NEWLINE# #INDENT# item . enabled = False #NEWLINE# item . visible = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( item . enabled is None ) or item . enabled ) : #NEWLINE# #INDENT# item . enabled = True #NEWLINE# item . visible = True #NEWLINE# #UNINDENT# #UNINDENT# if ( item . enabled and item . visible ) : #NEWLINE# #INDENT# items = item . render_components ( ) #NEWLINE# if ( item . parent is not None ) : #NEWLINE# #INDENT# if item . attr . _class : #NEWLINE# #INDENT# classes = item . attr . _class . split ( ' ' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# classes = [ ] #NEWLINE# #UNINDENT# if ( item . parent . parent is None ) : #NEWLINE# #INDENT# toplevel = True #NEWLINE# if item . opts . right : #NEWLINE# #INDENT# classes . append ( 'menu-right' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# toplevel = False #NEWLINE# #UNINDENT# if item . components : #NEWLINE# #INDENT# classes . append ( 'has-dropdown not-click' ) #NEWLINE# _class = ' ' . join ( classes ) #NEWLINE# if item . get_first ( enabled = True ) : #NEWLINE# #INDENT# _href = item . url ( ) #NEWLINE# return LI ( A ( item . label , _href = _href , _id = item . attr . _id ) , UL ( items , _class = 'dropdown' ) , _class = _class ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if toplevel : #NEWLINE# #INDENT# item_url = item . url ( ) #NEWLINE# if ( item_url == URL ( c = 'default' , f = 'index' ) ) : #NEWLINE# #INDENT# classes . append ( 'menu-home' ) #NEWLINE# #UNINDENT# if item . selected : #NEWLINE# #INDENT# classes . append ( 'active' ) #NEWLINE# #UNINDENT# _class = ' ' . join ( classes ) #NEWLINE# return LI ( A ( item . label , _href = item_url , _id = item . attr . _id , _target = item . attr . _target ) , _class = _class ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( item . label , dict ) : #NEWLINE# #INDENT# if ( 'id' in item . label ) : #NEWLINE# #INDENT# return S3MainMenuDefaultLayout . checkbox_item ( item ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'name' in item . label ) : #NEWLINE# #INDENT# label = item . label [ 'name' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# label = item . label #NEWLINE# #UNINDENT# link = A ( label , _href = item . url ( ) , _id = item . attr . _id , _target = item . attr . _target ) #NEWLINE# _class = ' ' . join ( classes ) #NEWLINE# return LI ( link , _class = _class ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if item . opts . title_area : #NEWLINE# #INDENT# title_area = item . opts . title_area #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# title_area = A ( ' ' , _href = URL ( c = 'default' , f = 'index' ) , _class = 'S3menulogo' ) #NEWLINE# #UNINDENT# right = [ ] #NEWLINE# left = [ ] #NEWLINE# for item in items : #NEWLINE# #INDENT# if ( 'menu-right' in item [ '_class' ] ) : #NEWLINE# #INDENT# item . remove_class ( 'menu-right' ) #NEWLINE# right . append ( item ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# left . append ( item ) #NEWLINE# #UNINDENT# #UNINDENT# right . reverse ( ) #NEWLINE# if current . response . s3 . rtl : #NEWLINE# #INDENT# ( right , left ) = ( left , right ) #NEWLINE# #UNINDENT# return NAV ( UL ( LI ( title_area , _class = 'name' ) , LI ( A ( SPAN ( current . T ( 'Menu' ) ) ) , _class = 'toggle-topbar menu-icon' ) , _class = 'title-area' ) , SECTION ( UL ( right , _class = 'right' ) , UL ( left , _class = 'left' ) , _class = 'top-bar-section' ) , _class = 'top-bar' , data = { #NEWLINE# #INDENT# 'topbar' : ' ' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return None