def menu_modules(cls): """ Modules Menu """ from s3db.br import br_terminology labels = br_terminology() if current.auth.s3_has_roles(("CASE_MANAGER", "CASE_SUPER", "ORG_ADMIN", )): #case_vars["mine"] = "1" CASES = MM(labels.CASES, c="br", f="person", vars={"closed": "0"}) else: CASES = MM(labels.CASES, c="br", f="case_activity") return [CASES, MM("ToDo", c="project", f="task"), MM("Map", c="gis", f="index"), MM("Working Groups", link=False)( MM("Flights", c="transport", f="flight"), MM("Logistics", c="fin", f="index"), MM("Medical", c="med", f="index"), MM("Security", c="security", f="index"), MM("Organizations", c="org", f="organisation"), ), ]
def menu_modules(cls): """ Custom Modules Menu """ return [MM("Volunteer", c="vol", f="index", ), MM("Donate", c="req", f="index", ), ]
def menu_modules(cls): """ Modules Menu """ auth = current.auth case_vars = {"closed": "0"} if auth.s3_logged_in_human_resource() and \ auth.s3_has_role("CASE_MANAGEMENT"): case_vars["mine"] = "1" labels = current.s3db.br_terminology() return [ MM(labels.CASES, c=("br", "pr"), f="person", vars=case_vars), MM( "Case Management", c="br", f="index", check=lambda this: not this.preceding()[-1].check_permission(), ), MM("ToDo", c="project", f="task"), MM("Shelters", c="cr", f="shelter"), MM("More", link=False)( MM("Organizations", c="org", f="organisation"), MM("Facilities", c="org", f="facility"), MM("Staff", c="hrm", f="staff"), MM("Volunteers", c="vol", f="volunteer"), ), ]
def menu(cls): """ Compose Menu """ # Modules menus main_menu = MM()(cls.menu_modules(), ) # Additional menus current.menu.personal = cls.menu_personal() current.menu.lang = cls.menu_lang() current.menu.about = cls.menu_about() return main_menu
def menu(cls): """ Compose Menu """ main_menu = MM()( # Modules-menu, align-left cls.menu_modules(), # Service menus, align-right # Note: always define right-hand items in reverse order! cls.menu_help(right=True), #cls.menu_lang(right = True), #cls.menu_gis(right = True), cls.menu_auth(right=True), cls.menu_admin(right=True), ) return main_menu
def menu_modules(cls): """ Modules Menu """ return [MM("Volunteers", c=("vol", "hrm"), f="person")( MM("List", c="vol", f="person"), MM("Requests", c="hrm", f="delegation", vars = {"workflow": "p"}, restrict = "COORDINATOR", ), MM("Deployments", c="hrm", f="delegation", ), ), MM("Organizations", c="org", f="organisation"), MM("Volunteer Registration", c="default", f="index", args=["register"], check = lambda i: not current.auth.s3_logged_in(), ), ]
def menu_modules(cls): """ Custom Modules Menu """ auth = current.auth if not auth.is_logged_in(): menu = [ MM("Volunteer Your Time", c="default", f="index", args="volunteer"), MM("Donate Items", c="default", f="index", args="donate"), ] return menu has_role = auth.s3_has_role if has_role("ADMIN"): menu = [ MM("General Information and Advice", c="cms", f="post", m="datalist"), MM("All Documents", c="doc", f="document", m="datalist"), MM("Donors", c="pr", f="person", vars={"donors": 1})( MM("Donations", c="supply", f="person_item"), MM("Edit General Information", c="cms", f="post", vars={"~.name": "Donor"}, m="update"), ), MM("Organisations", c="org", f="organisation")( #MM("Message", c="org", f="organisation", args="message"), ), MM("Volunteers", c="hrm", f="human_resource")( MM("Reserves", c="pr", f="person", vars={"reserves": 1}), MM("Reserve Groups", c="pr", f="group"), ), MM("Events", c="hrm", f="training_event"), MM("Opportunities", c="req", f="need"), MM("Messages", c="project", f="task"), ] elif has_role("ORG_ADMIN"): menu = [ MM("General Information and Advice", c="cms", f="post", m="datalist"), MM("Organisation Documents", c="doc", f="document", m="datalist"), MM("Donors", c="pr", f="person", vars={"donors": 1})(MM("Donations", c="supply", f="person_item"), ), MM("Organisations", c="org", f="organisation")( #MM("Message", c="org", f="organisation", args="message"), ), MM("Volunteers", c="hrm", f="human_resource")( MM("Reserves", c="pr", f="person", vars={"reserves": 1}), MM("Reserve Groups", c="pr", f="group"), ), MM("Events", c="hrm", f="training_event"), MM("Opportunities", c="req", f="need"), MM("Messages", c="project", f="task"), ] elif has_role("AGENCY"): menu = [ MM("General Information and Advice", c="cms", f="post", m="datalist"), MM("Documents", c="doc", f="document", m="datalist"), #MM("Donors", c="pr", f="person", vars={"donors": 1})( MM("Donations", c="supply", f="person_item"), # ), MM("Organisations", c="org", f="organisation")( #MM("Message", c="org", f="organisation", args="message"), ), MM("Events", c="hrm", f="training_event"), MM("Opportunities", c="req", f="need"), MM("Contact Organisation Admins", c="project", f="task", m="create"), ] elif has_role("VOLUNTEER"): menu = [ MM("General Information and Advice", c="cms", f="post", m="datalist"), MM("Organisation Documents", c="doc", f="document", m="datalist"), MM("Events", c="hrm", f="training_event"), MM("Opportunities", c="req", f="need"), MM("Contact Organisation Admins", c="project", f="task", m="create"), ] elif has_role("GROUP_ADMIN"): menu = [ #MM("Volunteer Your Time", c="default", f="index", args="volunteer"), #MM("Donate Items", c="default", f="index", args="donate"), MM("General Information and Advice", c="cms", f="post", m="datalist"), MM("Group", c="pr", f="group", m="update"), ] elif has_role("DONOR"): menu = [ #MM("Volunteer Your Time", c="default", f="index", args="volunteer"), #MM("Donate Items", c="default", f="index", args="donate"), MM("General Information", c="default", f="index", m="donor"), ] else: # Reserve Volunteer menu = [ #MM("Volunteer Your Time", c="default", f="index", args="volunteer"), #MM("Donate Items", c="default", f="index", args="donate"), MM("General Information and Advice", c="cms", f="post", m="datalist"), MM("Events", c="hrm", f="training_event" ), # They can only see ones they're invited to MM("Opportunities", c="req", f="need"), # They can only see ones they're invited to ] return menu
def menu_modules(cls): """ Custom Modules Menu """ if not current.auth.is_logged_in(): menu = [] else: menu = [ MM("Requests", c="req", f="req", m="summary")(), MM("Facilities", c="org", f="facility", m="summary")( MM("Airports", c="transport", f="airport", m="summary"), MM("Facilities", c="org", f="facility", m="summary"), MM("Fire Stations", c="fire", f="station", m="summary"), MM("Hospitals", c="hms", f="hospital", m="summary"), MM("Offices", c="org", f="office", m="summary"), MM("Warehouses", c="inv", f="warehouse", m="summary"), ), MM("Organisations", c="org", f="organisation", m="summary")(), MM("Contacts", c="hrm", f="staff", m="summary")(), MM("Map", c="gis", f="index")(), ] return menu
def menu_modules(cls): """ Modules Menu """ auth = current.auth has_role = auth.s3_has_role is_org_group_admin = lambda i: not has_role("ADMIN") and \ has_role("ORG_GROUP_ADMIN") menu = [ MM( "Organizations", c="org", f="organisation", vars={"mine": 1} if not has_role("ORG_GROUP_ADMIN") else None, restrict=("ORG_GROUP_ADMIN", "ORG_ADMIN"), ), MM( "Test Results", c="disease", f="case_diagnostics", restrict=("VOUCHER_PROVIDER", "DISEASE_TEST_READER"), ), MM( "Projects", c="project", f="project", restrict="ADMIN", ), MM( "Find Test Station", c="org", f="facility", m="summary", ), MM( "Pending Approvals", c="default", f="index", args=["approve"], check=is_org_group_admin, ), MM( "Register Test Station", c="default", f="index", args=["register"], check=lambda i: not current.auth.s3_logged_in(), ), ] # Link to voucher management if auth.s3_logged_in(): f = None if has_role("PROGRAM_MANAGER"): label, f = "Voucher Programs", "voucher_program" elif has_role("VOUCHER_PROVIDER"): label, f = "Voucher Acceptance", "voucher_debit" elif has_role("VOUCHER_ISSUER"): label, f = "Voucher Issuance", "voucher" if f: menu.insert(0, MM(label, c="fin", f=f)) return menu
def menu_modules(cls): """ Custom Modules Menu """ if not current.auth.is_logged_in(): return None shelter_id = current.session.s3.shelter_id if shelter_id: menu = [ MM("My Shelter", c="cr", f="shelter", args=[shelter_id])(MM("All Shelters", c="cr", f="shelter", m="summary"), ), MM("My Staff", c="cr", f="shelter", args=[shelter_id, "human_resource_site"])( MM("Check-In", c="cr", f="shelter", args=[shelter_id, "human_resource_site", "create"]), MM("All Staff", c="hrm", f="human_resource"), ), MM("My Clients", c="cr", f="shelter", args=[shelter_id, "client"])( MM("Check-In", c="cr", f="shelter", args=[shelter_id, "client", "create"]), MM("All Clients", c="pr", f="person", m="summary"), MM("Import", c="cr", f="shelter_registration", m="import"), ), ] else: menu = [ MM("Shelters", c="cr", f="shelter", m="summary")(MM("New Shelter", c="cr", f="shelter", m="create"), ), MM("Staff", c="hrm", f="human_resource")(), MM("Clients", c="pr", f="person", m="summary")(MM("Import", c="cr", f="shelter_registration", m="import"), ), ] return menu
def menu_modules(cls): """ Modules Menu """ auth = current.auth case_vars = {"closed": "0"} if auth.s3_logged_in_human_resource() and \ auth.s3_has_role("CASE_MANAGER"): case_vars["mine"] = "1" labels = current.s3db.br_terminology() return [MM(labels.CASES, c=("br", "pr"), f="person", vars=case_vars), MM("Case Management", c="br", f="index", check = lambda this: not this.preceding()[-1].check_permission(), ), MM("ToDo", c="project", f="task"), MM("More", link=False)( MM("Accommodation", c="cr", f="shelter"), MM("Financial Facilities", c="org", f="facility"), MM("Flights", c="transport", f="flight"), MM("Medical", c="hms", f="hospital"), MM("Organizations", c="org", f="organisation"), MM("Security", c="event", f="incident_report"), MM("Staff", c="hrm", f="staff"), # Just Admins: #MM("Working Groups", c="pr", f="forum"), ), ]
def menu_modules(cls): """ Modules Menu """ auth = current.auth has_role = auth.s3_has_role logged_in = auth.s3_logged_in() #labels = current.s3db.br_terminology() settings = current.deployment_settings org_registration = lambda i: settings.get_custom("org_registration") if has_role("EVENT_MANAGER"): # Organisation managing events menu = [ MM("Current Needs", c="br", f="activities"), MM("Relief Offers", c="br", f="offers", link=False)( MM("Current Relief Offers"), MM("Pending Approvals", vars={"pending": "1"}), MM("Blocked Entries", vars={"blocked": 1}), ), MM("Affected Persons", c="br", f="person"), ] elif has_role("RELIEF_PROVIDER") or has_role("CASE_MANAGER"): # Organisation offering relief services / supplies menu = [ MM("Current Needs", c="br", f="activities"), MM("Our Relief Offers", c="br", f="assistance_offer", restrict="RELIEF_PROVIDER"), MM("Affected Persons", c="br", f="person"), MM("Find Relief Offers", c="br", f="offers"), ] else: # Private Citizen menu = [ MM("Report Need", c="br", f="case_activity"), MM("Find Relief Offers", c="br", f="offers"), MM("Offer Assistance / Supplies", c="br", link=False)( MM("Current Needs", f="activities"), MM("My Relief Offers", f="assistance_offer"), ), ] has_roles = auth.s3_has_roles is_org_user = not has_roles(("ADMIN", "ORG_GROUP_ADMIN")) and \ has_roles(("RELIEF_PROVIDER", "ORG_ADMIN")) return [ menu, MM("Register", c="default", f="index", link=False, check=not logged_in)( MM("Private Citizen", args=["register"]), MM( "Organization", args=["register_org"], check=org_registration, ), ), MM("Organizations", c="org", f="organisation", check=not is_org_user), MM("Organizations", c="org", f="organisation", check=is_org_user)( MM("My Organizations", vars={"mine": "1"}), MM("All Organizations"), ), MM("More", link=False, check=logged_in)( MM("Emergency Shelters", c="cr", f="shelter"), MM("Overview & Statistics", c="default", f="index", args=["overview"]), MM("Events", c="event", f="event", restrict="EVENT_MANAGER"), MM( "Pending Approvals", c="default", f="index", args=["approve_org"], restrict="ORG_GROUP_ADMIN", ), ), ]
def menu_modules(cls): """ Modules Menu """ auth = current.auth has_role = auth.s3_has_role has_roles = auth.s3_has_roles is_org_group_admin = lambda i: has_role("ORG_GROUP_ADMIN", include_admin=False) report_results = lambda i: has_role("VOUCHER_PROVIDER", include_admin=False) and \ len(get_stats_projects()) > 0 managed_requester_orgs = get_managed_requester_orgs() supply_coordinator = lambda i: has_role("SUPPLY_COORDINATOR") supply_distributor = lambda i: has_role("SUPPLY_DISTRIBUTOR", include_admin=False) supply_requester = lambda i: bool(managed_requester_orgs) order_access = lambda i: supply_coordinator(i) or supply_requester(i) supply_access = lambda i: order_access(i) or supply_distributor(i) menu = [ MM("Equipment", c=("req", "inv", "supply"), link=False, check=supply_access)( MM("Orders##delivery", f="req", vars={"type": 1}, check=order_access), MM("Shipment##process", c="inv", f="send", restrict="SUPPLY_COORDINATOR"), MM("Shipments", c="inv", f="send", check=supply_distributor), MM("Deliveries", c="inv", f="recv", check=supply_requester), MM("Items", c="supply", f="item", restrict="SUPPLY_COORDINATOR"), ), MM( "Test Results", c="disease", f="case_diagnostics", restrict="DISEASE_TEST_READER", ), MM("Test Results", c="disease", f="case_diagnostics", check=report_results, link=False)( MM("Report Test Result", m="create", vars={"format": "popup"}, modal=True), MM("List Test Results"), ), MM( "Organizations", c="org", f="organisation", restrict=("ORG_GROUP_ADMIN", "ORG_ADMIN"), vars={"mine": 1} if not has_role("ORG_GROUP_ADMIN") else None, ), MM( "Projects", c="project", f="project", restrict="ADMIN", ), MM("Find Test Station", link=False)( MM( "Test Stations for Everybody", c="org", f="facility", m="summary", vars={"$$code": "TESTS-PUBLIC"}, ), MM( "Test Stations for School and Child Care Staff", c="org", f="facility", m="summary", vars={"$$code": "TESTS-SCHOOLS"}, ), MM( "Unapproved Test Stations", c="org", f="facility", vars={"$$pending": "1"}, restrict="ORG_GROUP_ADMIN", ), ), MM( "Pending Approvals", c="default", f="index", args=["approve"], check=is_org_group_admin, ), MM( "Register Test Station", c="default", f="index", args=["register"], check=lambda i: not current.auth.s3_logged_in(), ), ] # Link to voucher management if auth.s3_logged_in(): f = None if has_roles(("PROGRAM_MANAGER", "PROGRAM_ACCOUNTANT")): label, f = "Voucher Programs", "voucher_program" elif has_roles(("VOUCHER_PROVIDER", "PROVIDER_ACCOUNTANT")): label, f = "Voucher Acceptance", "voucher_debit" elif has_role("VOUCHER_ISSUER"): label, f = "Voucher Issuance", "voucher" if f: menu.insert(0, MM(label, c="fin", f=f)) return menu