<s> """<STR_LIT>""" <EOL> module = request . controller <EOL> resourcename = request . function <EOL> if not settings . has_module ( module ) : <EOL> raise HTTP ( <NUM_LIT> , body = "<STR_LIT>" % module ) <EOL> def index ( ) : <EOL> """<STR_LIT>""" <EOL> return s3db . cms_index ( module , alt_function = "<STR_LIT>" ) <EOL> def index_alt ( ) : <EOL> """<STR_LIT>""" <EOL> s3_redirect_default ( URL ( f = "<STR_LIT>" ) ) <EOL> def shelter_type ( ) : <EOL> """<STR_LIT>""" <EOL> output = s3_rest_controller ( ) <EOL> return output <EOL> def shelter_service ( ) : <EOL> """<STR_LIT>""" <EOL> output = s3_rest_controller ( ) <EOL> return output <EOL> def shelter_unit ( ) : <EOL> """<STR_LIT>""" <EOL> def prep ( r ) : <EOL> if r . representation == "<STR_LIT>" : <EOL> record_id = r . id <EOL> table = s3db . cr_shelter_unit <EOL> row = db ( table . id == record_id ) . select ( table . shelter_id , <EOL> limitby = ( <NUM_LIT:0> , <NUM_LIT:1> ) <EOL> ) . first ( ) <EOL> shelter_id = row . shelter_id <EOL> s3db . configure ( "<STR_LIT>" , <EOL> popup_url = URL ( c = "<STR_LIT>" , f = "<STR_LIT>" , <EOL> args = [ shelter_id , "<STR_LIT>" , <EOL> record_id ] ) , <EOL> ) <EOL> return True <EOL> elif r . representation in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) or r . method == "<STR_LIT>" : <EOL> return True <EOL> return False <EOL> s3 . prep = prep <EOL> return s3_rest_controller ( ) <EOL> def shelter_registration ( ) : <EOL> """<STR_LIT>""" <EOL> s3 . crud_strings . cr_shelter_registration = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) <EOL> ) <EOL> output = s3_rest_controller ( ) <EOL> return output <EOL> def shelter ( ) : <EOL> """<STR_LIT>""" <EOL> tablename = "<STR_LIT>" <EOL> table = s3db . cr_shelter <EOL> s3base . s3_set_default_filter ( "<STR_LIT>" , [ <NUM_LIT:2> , None ] , tablename = tablename ) <EOL> def prep ( r ) : <EOL> s3db . gis_location_filter ( r ) <EOL> method = r . method <EOL> if method == "<STR_LIT>" : <EOL> table . population_day . readable = False <EOL> table . population_night . readable = False <EOL> elif method == "<STR_LIT>" : <EOL> table . organisation_id . default = None <EOL> elif method == "<STR_LIT>" : <EOL> shelter_id = r . id <EOL> name = r . record . name <EOL> profile_header = settings . get_ui_profile_header ( r ) <EOL> map_widget = dict ( label = T ( "<STR_LIT>" ) , <EOL> type = "<STR_LIT>" , <EOL> icon = "<STR_LIT>" , <EOL> colspan = <NUM_LIT:2> , <EOL> height = <NUM_LIT> , <EOL> ) <EOL> ftable = s3db . gis_layer_feature <EOL> query = ( ftable . controller == "<STR_LIT>" ) & ( ftable . function == "<STR_LIT>" ) <EOL> layer = db ( query ) . select ( ftable . layer_id , <EOL> limitby = ( <NUM_LIT:0> , <NUM_LIT:1> ) <EOL> ) . first ( ) <EOL> try : <EOL> layer = dict ( active = True , <EOL> layer_id = layer . layer_id , <EOL> filter = "<STR_LIT>" % shelter_id , <EOL> name = T ( "<STR_LIT>" ) , <EOL> id = "<STR_LIT>" % ( tablename , shelter_id ) , <EOL> ) <EOL> except : <EOL> layer = None <EOL> profile_widgets = [ map_widget , <EOL> ] <EOL> s3db . configure ( tablename , <EOL> profile_header = profile_header , <EOL> profile_layers = ( layer , ) , <EOL> profile_title = "<STR_LIT>" % ( s3_unicode ( s3 . crud_strings [ "<STR_LIT>" ] . title_display ) , <EOL> name ) , <EOL> profile_widgets = profile_widgets , <EOL> ) <EOL> if r . interactive : <EOL> if r . id : <EOL> table . obsolete . readable = table . obsolete . writable = True <EOL> if r . component : <EOL> if r . component . name == "<STR_LIT>" or r . component . name == "<STR_LIT>" or r . component . name == "<STR_LIT>" : <EOL> s3db . inv_prep ( r ) <EOL> elif r . component . name == "<STR_LIT>" : <EOL> s3db . org_site_staff_config ( r ) <EOL> elif r . component . name == "<STR_LIT>" : <EOL> db . assess_rat . location_id . writable = False <EOL> db . assess_rat . location_id . default = r . record . location_id <EOL> db . assess_rat . location_id . comment = "<STR_LIT>" <EOL> staff_id = auth . s3_logged_in_human_resource ( ) <EOL> if staff_id : <EOL> db . assess_rat . staff_id . default = staff_id . id <EOL> elif r . component . name == "<STR_LIT>" : <EOL> if settings . get_cr_shelter_housing_unit_management ( ) : <EOL> field = s3db . cr_shelter_registration . shelter_unit_id <EOL> dbset = db ( s3db . cr_shelter_unit . shelter_id == r . id ) <EOL> field . requires = IS_EMPTY_OR ( IS_ONE_OF ( dbset , "<STR_LIT>" , <EOL> field . represent , <EOL> sort = True , <EOL> ) ) <EOL> s3 . crud_strings . cr_shelter_registration = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) <EOL> ) <EOL> elif r . component . name == "<STR_LIT>" : <EOL> s3 . crud_strings . cr_shelter_allocation = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) <EOL> ) <EOL> elif r . component . name == "<STR_LIT>" : <EOL> if r . method != "<STR_LIT>" and r . method != "<STR_LIT>" : <EOL> s3db . req_create_form_mods ( ) <EOL> return True <EOL> s3 . prep = prep <EOL> return s3_rest_controller ( rheader = s3db . cr_shelter_rheader ) <EOL> def incoming ( ) : <EOL> """<STR_LIT>""" <EOL> return s3db . inv_incoming ( ) <EOL> def req_match ( ) : <EOL> """<STR_LIT>""" <EOL> return s3db . req_match ( ) </s>
