#NEWLINE# def __call__( self ) : #NEWLINE# #INDENT# output = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# db = current . db #NEWLINE# s3db = current . s3db #NEWLINE# atable = s3db . project_activity #NEWLINE# query = ( atable . deleted == False ) #NEWLINE# output [ 'total_activities' ] = db ( query ) . count ( ) #NEWLINE# ogtable = s3db . org_group #NEWLINE# ltable = s3db . project_activity_group #NEWLINE# query &= ( ( atable . id == ltable . activity_id ) & ( ogtable . id == ltable . group_id ) ) #NEWLINE# rows = db ( query ) . select ( atable . id , atable . name , atable . date , ogtable . name , limitby = ( 0 , 3 ) , orderby = ( ~ atable . date ) ) #NEWLINE# latest_activities = [ ] #NEWLINE# current . deployment_settings . L10n . date_format = '%d %b %y' #NEWLINE# drepresent = atable . date . represent #NEWLINE# for row in rows : #NEWLINE# #INDENT# date = row [ 'project_activity.date' ] #NEWLINE# if date : #NEWLINE# #INDENT# nice_date = drepresent ( date ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# nice_date = '' #NEWLINE# #UNINDENT# latest_activities . append ( Storage ( id = row [ 'project_activity.id' ] , name = drepresent [ 'project_activity.name' ] , date = nice_date , date_iso = ( date or '' ) , org_group = row [ 'org_group.name' ] ) ) #NEWLINE# #UNINDENT# output [ 'latest_activities' ] = latest_activities #NEWLINE# auth = current . auth #NEWLINE# table = s3db . gis_config #NEWLINE# if ( auth . is_logged_in ( ) and auth . user . org_group_id ) : #NEWLINE# #INDENT# ogtable = s3db . org_group #NEWLINE# og = db ( ( ogtable . id == auth . user . org_group_id ) ) . select ( ogtable . pe_id , limitby = ( 0 , 1 ) ) . first ( ) #NEWLINE# query = ( table . pe_id == og . pe_id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# query = ( table . uuid == 'SITE_DEFAULT' ) #NEWLINE# #UNINDENT# config = db ( query ) . select ( table . id , limitby = ( 0 , 1 ) ) . first ( ) #NEWLINE# try : #NEWLINE# #INDENT# output [ 'config_id' ] = config . id #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# output [ 'config_id' ] = None #NEWLINE# #UNINDENT# self . _view ( THEME , 'index.html' ) #NEWLINE# return output