#NEWLINE# def __call__( self ) : #NEWLINE# #INDENT# output = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if current . deployment_settings . has_module ( 'cms' ) : #NEWLINE# #INDENT# system_roles = current . auth . get_system_roles ( ) #NEWLINE# ADMIN = ( system_roles . ADMIN in current . session . s3 . roles ) #NEWLINE# s3db = current . s3db #NEWLINE# table = _class . cms_post #NEWLINE# ltable = s3db . cms_post_module #NEWLINE# module = 'default' #NEWLINE# resource = 'index' #NEWLINE# query = ( ( ( ( ltable . module == module ) & ( ( ltable . resource == None ) | ( ltable . resource == resource ) ) ) & ( ltable . post_id == table . id ) ) & ( table . deleted != True ) ) #NEWLINE# item = current . db ( query ) . select ( table . body , table . id , limitby = ( 0 , 1 ) ) . first ( ) #NEWLINE# if item : #NEWLINE# #INDENT# if ADMIN : #NEWLINE# #INDENT# item = DIV ( XML ( item . body ) , BR ( ) , A ( current . T ( 'Edit' ) , _href = URL ( c = 'cms' , f = 'post' , args = [ item . id , 'update' ] ) , _class = 'action-btn' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# item = DIV ( XML ( item . body ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ADMIN : #NEWLINE# #INDENT# if ( current . response . s3 . crud . formstyle == 'bootstrap' ) : #NEWLINE# #INDENT# _class = 'btn' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _class = 'action-btn' #NEWLINE# #UNINDENT# item = A ( current . T ( 'Edit' ) , _href = URL ( c = 'cms' , f = 'post' , args = 'create' , vars = { #NEWLINE# #INDENT# 'module' : module , #NEWLINE# 'resource' : resource , #NEWLINE# #UNINDENT# } ) , _class = ( '%s cms-edit' % _class ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# item = '' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# item = '' #NEWLINE# #UNINDENT# output [ 'item' ] = item #NEWLINE# self . _view ( THEME , 'index.html' ) #NEWLINE# return output