<s> from gluon import * <EOL> from s3 import S3CustomController <EOL> THEME = "<STR_LIT>" <EOL> class index ( S3CustomController ) : <EOL> """<STR_LIT>""" <EOL> def __call__ ( self ) : <EOL> output = { } <EOL> if current . deployment_settings . has_module ( "<STR_LIT>" ) : <EOL> system_roles = current . auth . get_system_roles ( ) <EOL> ADMIN = system_roles . ADMIN in current . session . s3 . roles <EOL> s3db = current . s3db <EOL> table = s3db . cms_post <EOL> ltable = s3db . cms_post_module <EOL> module = "<STR_LIT:default>" <EOL> resource = "<STR_LIT:index>" <EOL> query = ( ltable . module == module ) & ( ( ltable . resource == None ) | ( ltable . resource == resource ) ) & ( ltable . post_id == table . id ) & ( table . deleted != True ) <EOL> item = current . db ( query ) . select ( table . body , <EOL> table . id , <EOL> limitby = ( <NUM_LIT:0> , <NUM_LIT:1> ) ) . first ( ) <EOL> if item : <EOL> if ADMIN : <EOL> item = DIV ( XML ( item . body ) , <EOL> BR ( ) , <EOL> A ( current . T ( "<STR_LIT>" ) , <EOL> _href = URL ( c = "<STR_LIT>" , f = "<STR_LIT>" , <EOL> args = [ item . id , "<STR_LIT>" ] ) , <EOL> _class = "<STR_LIT>" ) ) <EOL> else : <EOL> item = DIV ( XML ( item . body ) ) <EOL> elif ADMIN : <EOL> if current . response . s3 . crud . formstyle == "<STR_LIT>" : <EOL> _class = "<STR_LIT>" <EOL> else : <EOL> _class = "<STR_LIT>" <EOL> item = A ( current . T ( "<STR_LIT>" ) , <EOL> _href = URL ( c = "<STR_LIT>" , f = "<STR_LIT>" , args = "<STR_LIT>" , <EOL> vars = { "<STR_LIT>" : module , <EOL> "<STR_LIT>" : resource <EOL> } ) , <EOL> _class = "<STR_LIT>" % _class ) <EOL> else : <EOL> item = "<STR_LIT>" <EOL> else : <EOL> item = "<STR_LIT>" <EOL> output [ "<STR_LIT>" ] = item <EOL> self . _view ( THEME , "<STR_LIT>" ) <EOL> return output </s>
