<s> from django . core . urlresolvers import reverse <EOL> from django . utils . safestring import mark_safe <EOL> from django . utils . translation import ugettext_noop , ugettext_lazy as _ , ugettext <EOL> from corehq . apps . accounting . models import SoftwarePlanEdition as Edition , SoftwareProductType as Product , FeatureType <EOL> DESC_BY_EDITION = { <EOL> Edition . COMMUNITY : { <EOL> '<STR_LIT:name>' : _ ( "<STR_LIT>" ) , <EOL> '<STR_LIT:description>' : _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> } , <EOL> Edition . STANDARD : { <EOL> '<STR_LIT:name>' : _ ( "<STR_LIT>" ) , <EOL> '<STR_LIT:description>' : _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> } , <EOL> Edition . PRO : { <EOL> '<STR_LIT:name>' : _ ( "<STR_LIT>" ) , <EOL> '<STR_LIT:description>' : _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> } , <EOL> Edition . ADVANCED : { <EOL> '<STR_LIT:name>' : _ ( "<STR_LIT>" ) , <EOL> '<STR_LIT:description>' : _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> } , <EOL> Edition . ENTERPRISE : { <EOL> '<STR_LIT:name>' : _ ( "<STR_LIT>" ) , <EOL> '<STR_LIT:description>' : _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> } <EOL> } <EOL> FEATURE_TYPE_TO_NAME = { <EOL> FeatureType . SMS : _ ( "<STR_LIT>" ) , <EOL> FeatureType . USER : _ ( "<STR_LIT>" ) , <EOL> } <EOL> def ensure_product ( product ) : <EOL> if product not in [ s [ <NUM_LIT:0> ] for s in Product . CHOICES ] : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> def get_feature_name ( feature_type , product ) : <EOL> ensure_product ( product ) <EOL> if feature_type not in [ f [ <NUM_LIT:0> ] for f in FeatureType . CHOICES ] : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> return { <EOL> FeatureType . USER : { <EOL> Product . COMMCARE : _ ( "<STR_LIT>" ) , <EOL> Product . COMMCONNECT : _ ( "<STR_LIT>" ) , <EOL> Product . COMMTRACK : _ ( "<STR_LIT>" ) , <EOL> } [ product ] , <EOL> FeatureType . SMS : _ ( "<STR_LIT>" ) , <EOL> } [ feature_type ] <EOL> def get_feature_recurring_interval ( feature_type ) : <EOL> if feature_type == FeatureType . SMS : <EOL> return _ ( "<STR_LIT>" ) <EOL> else : <EOL> return None <EOL> class PricingTableCategories ( object ) : <EOL> CORE = '<STR_LIT>' <EOL> MOBILE = '<STR_LIT>' <EOL> WEB = '<STR_LIT>' <EOL> ANALYTICS = '<STR_LIT>' <EOL> SMS = '<STR_LIT>' <EOL> USER_MANAGEMENT_AND_SECURITY = '<STR_LIT>' <EOL> SUPPORT = '<STR_LIT>' <EOL> @ classmethod <EOL> def get_wiki_url ( cls , category ) : <EOL> return { <EOL> cls . MOBILE : _ ( "<STR_LIT>" ) , <EOL> cls . WEB : _ ( "<STR_LIT>" ) , <EOL> cls . ANALYTICS : _ ( "<STR_LIT>" ) , <EOL> cls . SMS : _ ( "<STR_LIT>" ) , <EOL> cls . USER_MANAGEMENT_AND_SECURITY : _ ( "<STR_LIT>" ) , <EOL> cls . SUPPORT : _ ( "<STR_LIT>" ) , <EOL> } . get ( category ) <EOL> @ classmethod <EOL> def get_title ( cls , category , product ) : <EOL> ensure_product ( product ) <EOL> return { <EOL> cls . MOBILE : _ ( "<STR_LIT>" ) , <EOL> cls . WEB : _ ( "<STR_LIT>" ) , <EOL> cls . ANALYTICS : _ ( "<STR_LIT>" ) , <EOL> cls . SMS : _ ( "<STR_LIT>" ) , <EOL> cls . USER_MANAGEMENT_AND_SECURITY : _ ( "<STR_LIT>" ) , <EOL> cls . SUPPORT : _ ( "<STR_LIT>" ) , <EOL> } . get ( category ) <EOL> @ classmethod <EOL> def get_features ( cls , category ) : <EOL> f = PricingTableFeatures <EOL> return { <EOL> cls . CORE : ( <EOL> f . PRICING , <EOL> f . MOBILE_LIMIT , <EOL> f . ADDITIONAL_MOBILE_USER , <EOL> ) , <EOL> cls . MOBILE : ( <EOL> f . JAVA_AND_ANDROID , <EOL> f . MULTIMEDIA_SUPPORT , <EOL> ) , <EOL> cls . WEB : ( <EOL> f . APP_BUILDER , <EOL> f . EXCHANGE , <EOL> f . API_ACCESS , <EOL> f . LOOKUP_TABLES , <EOL> f . WEB_APPS , <EOL> f . CUSTOM_BRANDING , <EOL> ) , <EOL> cls . ANALYTICS : ( <EOL> f . DATA_EXPORT , <EOL> f . STANDARD_REPORTS , <EOL> f . CUSTOM_REPORTS , <EOL> f . ADM , <EOL> ) , <EOL> cls . SMS : ( <EOL> f . OUTBOUND_SMS , <EOL> f . RULES_ENGINE , <EOL> f . ANDROID_GATEWAY , <EOL> f . SMS_DATA_COLLECTION , <EOL> f . INBOUND_SMS , <EOL> f . SMS_PRICING , <EOL> ) , <EOL> cls . USER_MANAGEMENT_AND_SECURITY : ( <EOL> f . USER_GROUPS , <EOL> f . DATA_SECURITY_PRIVACY , <EOL> f . ADVANCED_ROLES , <EOL> f . BULK_CASE_USER_MANAGEMENT , <EOL> f . HIPAA_COMPLIANCE , <EOL> f . DE_ID_DATA , <EOL> ) , <EOL> cls . SUPPORT : ( <EOL> f . COMMUNITY_SUPPORT , <EOL> f . EMAIL_SUPPORT , <EOL> f . APP_TROUBLESHOOTING , <EOL> f . DEDICATED_SUPPORT_STAFF , <EOL> f . DEDICATED_ACCOUNT_MANAGEMENT , <EOL> ) , <EOL> } [ category ] <EOL> class PricingTableFeatures ( object ) : <EOL> SOFTWARE_PLANS = '<STR_LIT>' <EOL> PRICING = '<STR_LIT>' <EOL> MOBILE_LIMIT = '<STR_LIT>' <EOL> ADDITIONAL_MOBILE_USER = '<STR_LIT>' <EOL> JAVA_AND_ANDROID = '<STR_LIT>' <EOL> MULTIMEDIA_SUPPORT = '<STR_LIT>' <EOL> APP_BUILDER = '<STR_LIT>' <EOL> EXCHANGE = '<STR_LIT>' <EOL> API_ACCESS = '<STR_LIT>' <EOL> LOOKUP_TABLES = '<STR_LIT>' <EOL> WEB_APPS = '<STR_LIT>' <EOL> CUSTOM_BRANDING = '<STR_LIT>' <EOL> DATA_EXPORT = '<STR_LIT>' <EOL> STANDARD_REPORTS = '<STR_LIT>' <EOL> CUSTOM_REPORTS = '<STR_LIT>' <EOL> ADM = '<STR_LIT>' <EOL> OUTBOUND_SMS = '<STR_LIT>' <EOL> RULES_ENGINE = '<STR_LIT>' <EOL> ANDROID_GATEWAY = '<STR_LIT>' <EOL> SMS_DATA_COLLECTION = '<STR_LIT>' <EOL> INBOUND_SMS = '<STR_LIT>' <EOL> SMS_PRICING = '<STR_LIT>' <EOL> USER_GROUPS = '<STR_LIT>' <EOL> DATA_SECURITY_PRIVACY = '<STR_LIT>' <EOL> ADVANCED_ROLES = '<STR_LIT>' <EOL> BULK_CASE_USER_MANAGEMENT = '<STR_LIT>' <EOL> HIPAA_COMPLIANCE = '<STR_LIT>' <EOL> DE_ID_DATA = '<STR_LIT>' <EOL> COMMUNITY_SUPPORT = '<STR_LIT>' <EOL> EMAIL_SUPPORT = '<STR_LIT>' <EOL> APP_TROUBLESHOOTING = '<STR_LIT>' <EOL> DEDICATED_SUPPORT_STAFF = '<STR_LIT>' <EOL> DEDICATED_ACCOUNT_MANAGEMENT = '<STR_LIT>' <EOL> @ classmethod <EOL> def get_title ( cls , feature , product ) : <EOL> ensure_product ( product ) <EOL> return { <EOL> cls . SOFTWARE_PLANS : _ ( "<STR_LIT>" ) , <EOL> cls . PRICING : _ ( "<STR_LIT>" ) , <EOL> cls . MOBILE_LIMIT : { <EOL> Product . COMMCARE : _ ( "<STR_LIT>" ) , <EOL> Product . COMMCONNECT : _ ( "<STR_LIT>" ) , <EOL> Product . COMMTRACK : _ ( "<STR_LIT>" ) <EOL> } [ product ] , <EOL> cls . ADDITIONAL_MOBILE_USER : { <EOL> Product . COMMCARE : _ ( "<STR_LIT>" ) , <EOL> Product . COMMCONNECT : _ ( "<STR_LIT>" ) , <EOL> Product . COMMTRACK : _ ( "<STR_LIT>" ) <EOL> } [ product ] , <EOL> cls . JAVA_AND_ANDROID : _ ( "<STR_LIT>" ) , <EOL> cls . MULTIMEDIA_SUPPORT : _ ( "<STR_LIT>" ) , <EOL> cls . APP_BUILDER : { <EOL> Product . COMMCARE : _ ( '<STR_LIT>' ) , <EOL> Product . COMMCONNECT : _ ( '<STR_LIT>' ) , <EOL> Product . COMMTRACK : _ ( '<STR_LIT>' ) , <EOL> } [ product ] , <EOL> cls . EXCHANGE : _ ( '<STR_LIT>' ) , <EOL> cls . API_ACCESS : _ ( "<STR_LIT>" ) , <EOL> cls . LOOKUP_TABLES : _ ( "<STR_LIT>" ) , <EOL> cls . WEB_APPS : _ ( '<STR_LIT>' ) , <EOL> cls . CUSTOM_BRANDING : _ ( "<STR_LIT>" ) , <EOL> cls . DATA_EXPORT : _ ( "<STR_LIT>" ) , <EOL> cls . STANDARD_REPORTS : _ ( "<STR_LIT>" ) , <EOL> cls . CUSTOM_REPORTS : _ ( "<STR_LIT>" ) , <EOL> cls . ADM : _ ( '<STR_LIT>' ) , <EOL> cls . OUTBOUND_SMS : _ ( "<STR_LIT>" ) , <EOL> cls . RULES_ENGINE : _ ( "<STR_LIT>" ) , <EOL> cls . ANDROID_GATEWAY : _ ( "<STR_LIT>" ) , <EOL> cls . SMS_DATA_COLLECTION : _ ( "<STR_LIT>" ) , <EOL> cls . INBOUND_SMS : _ ( "<STR_LIT>" ) , <EOL> cls . SMS_PRICING : _ ( "<STR_LIT>" ) , <EOL> cls . USER_GROUPS : _ ( "<STR_LIT>" ) , <EOL> cls . DATA_SECURITY_PRIVACY : _ ( "<STR_LIT>" ) , <EOL> cls . ADVANCED_ROLES : _ ( "<STR_LIT>" ) , <EOL> cls . BULK_CASE_USER_MANAGEMENT : _ ( "<STR_LIT>" ) , <EOL> cls . HIPAA_COMPLIANCE : _ ( "<STR_LIT>" ) , <EOL> cls . DE_ID_DATA : _ ( "<STR_LIT>" ) , <EOL> cls . COMMUNITY_SUPPORT : { <EOL> Product . COMMCARE : _ ( '<STR_LIT>' ) , <EOL> Product . COMMCONNECT : _ ( '<STR_LIT>' ) , <EOL> Product . COMMTRACK : _ ( '<STR_LIT>' ) , <EOL> } [ product ] , <EOL> cls . EMAIL_SUPPORT : _ ( "<STR_LIT>" ) , <EOL> cls . APP_TROUBLESHOOTING : _ ( "<STR_LIT>" ) , <EOL> cls . DEDICATED_SUPPORT_STAFF : _ ( "<STR_LIT>" ) , <EOL> cls . DEDICATED_ACCOUNT_MANAGEMENT : _ ( "<STR_LIT>" ) , <EOL> } [ feature ] <EOL> @ classmethod <EOL> def get_columns ( cls , feature ) : <EOL> from corehq . apps . domain . views import PublicSMSRatesView <EOL> return { <EOL> cls . SOFTWARE_PLANS : ( Edition . COMMUNITY , Edition . STANDARD , Edition . PRO , Edition . ADVANCED , Edition . ENTERPRISE ) , <EOL> cls . PRICING : ( _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) , _ ( '<STR_LIT>' ) ) , <EOL> cls . MOBILE_LIMIT : ( _ ( "<STR_LIT>" ) , _ ( "<STR_LIT:100>" ) , _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) ) , <EOL> cls . ADDITIONAL_MOBILE_USER : ( _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) , _ ( "<STR_LIT>" ) ) , <EOL> cls . JAVA_AND_ANDROID : ( True , True , True , True , True ) , <EOL> cls . MULTIMEDIA_SUPPORT : ( True , True , True , True , True ) , <EOL> cls . APP_BUILDER : ( True , True , True , True , True ) , <EOL> cls . EXCHANGE : ( True , True , True , True , True ) , <EOL> cls . API_ACCESS : ( False , True , True , True , True ) , <EOL> cls . LOOKUP_TABLES : ( False , True , True , True , True ) , <EOL> cls . WEB_APPS : ( False , False , True , True , True ) , <EOL> cls . CUSTOM_BRANDING : ( False , False , False , True , True ) , <EOL> cls . DATA_EXPORT : ( True , True , True , True , True ) , <EOL> cls . STANDARD_REPORTS : ( True , True , True , True , True ) , <EOL> cls . CUSTOM_REPORTS : ( False , False , True , True , True ) , <EOL> cls . ADM : ( False , False , False , True , True ) , <EOL> cls . OUTBOUND_SMS : ( False , True , True , True , True ) , <EOL> cls . RULES_ENGINE : ( False , True , True , True , True ) , <EOL> cls . ANDROID_GATEWAY : ( False , True , True , True , True ) , <EOL> cls . SMS_DATA_COLLECTION : ( False , False , True , True , True ) , <EOL> cls . INBOUND_SMS : ( False , False , True , True , True ) , <EOL> cls . SMS_PRICING : ( <EOL> False , <EOL> ) + ( <EOL> mark_safe ( '<STR_LIT>' % { <EOL> '<STR_LIT:url>' : reverse ( PublicSMSRatesView . urlname ) , <EOL> '<STR_LIT>' : ugettext ( '<STR_LIT>' ) , <EOL> } ) , <EOL> ) * <NUM_LIT:4> , <EOL> cls . USER_GROUPS : ( True , True , True , True , True ) , <EOL> cls . DATA_SECURITY_PRIVACY : ( True , True , True , True , True ) , <EOL> cls . ADVANCED_ROLES : ( False , True , True , True , True ) , <EOL> cls . BULK_CASE_USER_MANAGEMENT : ( False , True , True , True , True ) , <EOL> cls . DE_ID_DATA : ( False , False , True , True , True ) , <EOL> cls . HIPAA_COMPLIANCE : ( False , False , False , True , True ) , <EOL> cls . COMMUNITY_SUPPORT : ( True , True , True , True , True ) , <EOL> cls . EMAIL_SUPPORT : ( False , True , True , True , True ) , <EOL> cls . APP_TROUBLESHOOTING : ( False , False , True , True , True ) , <EOL> cls . DEDICATED_SUPPORT_STAFF : ( False , False , False , True , True ) , <EOL> cls . DEDICATED_ACCOUNT_MANAGEMENT : ( False , False , False , False , True ) , <EOL> } [ feature ] <EOL> class PricingTable ( object ) : <EOL> STRUCTURE_BY_PRODUCT = { <EOL> Product . COMMCARE : ( <EOL> PricingTableCategories . CORE , <EOL> PricingTableCategories . MOBILE , <EOL> PricingTableCategories . WEB , <EOL> PricingTableCategories . ANALYTICS , <EOL> PricingTableCategories . SMS , <EOL> PricingTableCategories . USER_MANAGEMENT_AND_SECURITY , <EOL> PricingTableCategories . SUPPORT , <EOL> ) , <EOL> Product . COMMCONNECT : ( <EOL> PricingTableCategories . CORE , <EOL> PricingTableCategories . MOBILE , <EOL> PricingTableCategories . WEB , <EOL> PricingTableCategories . ANALYTICS , <EOL> PricingTableCategories . SMS , <EOL> PricingTableCategories . USER_MANAGEMENT_AND_SECURITY , <EOL> PricingTableCategories . SUPPORT , <EOL> ) , <EOL> Product . COMMTRACK : ( <EOL> PricingTableCategories . CORE , <EOL> PricingTableCategories . MOBILE , <EOL> PricingTableCategories . SMS , <EOL> PricingTableCategories . WEB , <EOL> PricingTableCategories . ANALYTICS , <EOL> PricingTableCategories . USER_MANAGEMENT_AND_SECURITY , <EOL> PricingTableCategories . SUPPORT , <EOL> ) , <EOL> } <EOL> VISIT_WIKI_TEXT = ugettext_noop ( "<STR_LIT>" ) <EOL> @ classmethod <EOL> def get_footer_by_product ( cls , product , domain = None ) : <EOL> ensure_product ( product ) <EOL> from corehq . apps . domain . views import ProBonoStaticView <EOL> return ( <EOL> ugettext_noop ( <EOL> mark_safe ( <EOL> _ ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) % { <EOL> '<STR_LIT:url>' : ( reverse ( '<STR_LIT>' , args = [ domain ] ) if domain is <EOL> not None else reverse ( ProBonoStaticView . urlname ) ) , <EOL> } , <EOL> ) <EOL> ) , <EOL> _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> ) <EOL> @ classmethod <EOL> def get_table_by_product ( cls , product , domain = None ) : <EOL> ensure_product ( product ) <EOL> categories = cls . STRUCTURE_BY_PRODUCT [ product ] <EOL> editions = PricingTableFeatures . get_columns ( PricingTableFeatures . SOFTWARE_PLANS ) <EOL> edition_data = [ ( edition . lower ( ) , DESC_BY_EDITION [ edition ] ) for edition in editions ] <EOL> table_sections = [ ] <EOL> for category in categories : <EOL> features = PricingTableCategories . get_features ( category ) <EOL> feature_rows = [ ] <EOL> for feature in features : <EOL> feature_rows . append ( { <EOL> '<STR_LIT:title>' : PricingTableFeatures . get_title ( feature , product ) , <EOL> '<STR_LIT>' : [ ( editions [ ind ] . lower ( ) , col ) for ind , col in <EOL> enumerate ( PricingTableFeatures . get_columns ( feature ) ) ] , <EOL> } ) <EOL> table_sections . append ( { <EOL> '<STR_LIT:title>' : PricingTableCategories . get_title ( category , product ) , <EOL> '<STR_LIT:url>' : PricingTableCategories . get_wiki_url ( category ) , <EOL> '<STR_LIT>' : feature_rows , <EOL> '<STR_LIT>' : category , <EOL> } ) <EOL> table = { <EOL> '<STR_LIT>' : edition_data , <EOL> '<STR_LIT:title>' : PricingTableFeatures . get_title ( PricingTableFeatures . SOFTWARE_PLANS , product ) , <EOL> '<STR_LIT>' : table_sections , <EOL> '<STR_LIT>' : cls . VISIT_WIKI_TEXT , <EOL> '<STR_LIT>' : cls . get_footer_by_product ( product , domain = domain ) , <EOL> } <EOL> return table </s>
