#NEWLINE# @ property #NEWLINE# def sidebar_items( self ) : #NEWLINE# #INDENT# from corehq.apps.domain.views import FeatureFlagsView , FeaturePreviewsView , TransferDomainView #NEWLINE# items = [ ] #NEWLINE# user_is_admin = self . couch_user . is_domain_admin ( self . domain ) #NEWLINE# project_info = [ ] #NEWLINE# if user_is_admin : #NEWLINE# #INDENT# from corehq.apps.domain.views import EditBasicProjectInfoView , EditPrivacySecurityView #NEWLINE# project_info . extend ( [ { #NEWLINE# #INDENT# 'title' : _ ( EditBasicProjectInfoView . page_title ) , #NEWLINE# 'url' : reverse ( EditBasicProjectInfoView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'title' : _ ( EditPrivacySecurityView . page_title ) , #NEWLINE# 'url' : reverse ( EditPrivacySecurityView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# #UNINDENT# from corehq.apps.domain.views import EditMyProjectSettingsView #NEWLINE# project_info . append ( { #NEWLINE# #INDENT# 'title' : _ ( EditMyProjectSettingsView . page_title ) , #NEWLINE# 'url' : reverse ( EditMyProjectSettingsView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# if toggles . DHIS2_DOMAIN . enabled ( self . domain ) : #NEWLINE# #INDENT# from corehq.apps.domain.views import EditDhis2SettingsView #NEWLINE# project_info . append ( { #NEWLINE# #INDENT# 'title' : _ ( EditDhis2SettingsView . page_title ) , #NEWLINE# 'url' : reverse ( EditDhis2SettingsView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# items . append ( ( _ ( 'Project Information' ) , project_info ) ) #NEWLINE# if user_is_admin : #NEWLINE# #INDENT# administration = [ { #NEWLINE# #INDENT# 'title' : _ ( 'CommCare Exchange' ) , #NEWLINE# 'url' : reverse ( 'domain_snapshot_settings' , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'title' : _ ( 'Multimedia Sharing' ) , #NEWLINE# 'url' : reverse ( 'domain_manage_multimedia' , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ] #NEWLINE# if toggles . SYNC_SEARCH_CASE_CLAIM . enabled ( self . domain ) : #NEWLINE# #INDENT# administration . append ( { #NEWLINE# #INDENT# 'title' : _ ( 'Case Search' ) , #NEWLINE# 'url' : reverse ( 'case_search_config' , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# def forward_name( repeater_type = None , **context ) : #NEWLINE# #INDENT# if ( repeater_type == 'FormRepeater' ) : #NEWLINE# #INDENT# return _ ( 'Forward Forms' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( repeater_type == 'ShortFormRepeater' ) : #NEWLINE# #INDENT# return _ ( 'Forward Form Stubs' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( repeater_type == 'CaseRepeater' ) : #NEWLINE# #INDENT# return _ ( 'Forward Cases' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# administration . extend ( [ { #NEWLINE# #INDENT# 'title' : _ ( 'Data Forwarding' ) , #NEWLINE# 'url' : reverse ( 'domain_forwarding' , args = [ self . domain ] ) , #NEWLINE# 'subpages' : [ { #NEWLINE# #INDENT# 'title' : forward_name , #NEWLINE# 'urlname' : 'add_repeater' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'title' : forward_name , #NEWLINE# 'urlname' : 'add_form_repeater' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'title' : _ ( 'Data Forwarding Records' ) , #NEWLINE# 'url' : reverse ( 'domain_report_dispatcher' , args = [ self . domain , 'repeat_record_report' ] ) , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# administration . append ( { #NEWLINE# #INDENT# 'title' : _ ( FeaturePreviewsView . page_title ) , #NEWLINE# 'url' : reverse ( FeaturePreviewsView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# if toggles . TRANSFER_DOMAIN . enabled ( self . domain ) : #NEWLINE# #INDENT# administration . append ( { #NEWLINE# #INDENT# 'title' : _ ( TransferDomainView . page_title ) , #NEWLINE# 'url' : reverse ( TransferDomainView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# items . append ( ( _ ( 'Project Administration' ) , administration ) ) #NEWLINE# #UNINDENT# from corehq.apps.users.models import WebUser #NEWLINE# if isinstance ( self . couch_user , WebUser ) : #NEWLINE# #INDENT# if ( user_is_admin or self . couch_user . is_superuser ) : #NEWLINE# #INDENT# from corehq.apps.domain.views import DomainSubscriptionView , EditExistingBillingAccountView , DomainBillingStatementsView , ConfirmSubscriptionRenewalView , InternalSubscriptionManagementView #NEWLINE# billing_account = BillingAccount . get_account_by_domain ( self . domain ) #NEWLINE# subscription = [ { #NEWLINE# #INDENT# 'title' : DomainSubscriptionView . page_title , #NEWLINE# 'url' : reverse ( DomainSubscriptionView . urlname , args = [ self . domain ] ) , #NEWLINE# 'subpages' : [ { #NEWLINE# #INDENT# 'title' : ConfirmSubscriptionRenewalView . page_title , #NEWLINE# 'urlname' : ConfirmSubscriptionRenewalView . urlname , #NEWLINE# 'url' : reverse ( ConfirmSubscriptionRenewalView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ] #NEWLINE# if ( billing_account is not None ) : #NEWLINE# #INDENT# subscription . append ( { #NEWLINE# #INDENT# 'title' : EditExistingBillingAccountView . page_title , #NEWLINE# 'url' : reverse ( EditExistingBillingAccountView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( ( billing_account is not None ) and Invoice . exists_for_domain ( self . domain ) ) : #NEWLINE# #INDENT# subscription . append ( { #NEWLINE# #INDENT# 'title' : DomainBillingStatementsView . page_title , #NEWLINE# 'url' : reverse ( DomainBillingStatementsView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if self . couch_user . is_superuser : #NEWLINE# #INDENT# subscription . append ( { #NEWLINE# #INDENT# 'title' : _ ( 'Internal Subscription Management (Dimagi Only)' ) , #NEWLINE# 'url' : reverse ( InternalSubscriptionManagementView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# items . append ( ( _ ( 'Subscription' ) , subscription ) ) #NEWLINE# #UNINDENT# #UNINDENT# if any ( ( toggles . PRIME_RESTORE . enabled ( item ) for item in [ self . couch_user . username , self . domain ] ) ) : #NEWLINE# #INDENT# from corehq.apps.ota.views import PrimeRestoreCacheView #NEWLINE# project_tools = [ { #NEWLINE# #INDENT# 'title' : _ ( PrimeRestoreCacheView . page_title ) , #NEWLINE# 'url' : reverse ( PrimeRestoreCacheView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ] #NEWLINE# items . append ( ( _ ( 'Project Tools' ) , project_tools ) ) #NEWLINE# #UNINDENT# if self . couch_user . is_superuser : #NEWLINE# #INDENT# from corehq.apps.domain.views import EditInternalDomainInfoView , EditInternalCalculationsView #NEWLINE# internal_admin = [ { #NEWLINE# #INDENT# 'title' : _ ( EditInternalDomainInfoView . page_title ) , #NEWLINE# 'url' : reverse ( EditInternalDomainInfoView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'title' : _ ( EditInternalCalculationsView . page_title ) , #NEWLINE# 'url' : reverse ( EditInternalCalculationsView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'title' : _ ( FeatureFlagsView . page_title ) , #NEWLINE# 'url' : reverse ( FeatureFlagsView . urlname , args = [ self . domain ] ) , #NEWLINE# #UNINDENT# } ] #NEWLINE# items . append ( ( _ ( 'Internal Data (Dimagi Only)' ) , internal_admin ) ) #NEWLINE# #UNINDENT# return items