def get_per_domain_context(project, request=None): domain_type = get_domain_type(project, request) if domain_type == COMMTRACK: logo_url = static('hqstyle/img/commtrack-logo.png') site_name = "CommCare Supply" public_site = "http://www.commtrack.org" can_be_your = _("mobile logistics solution") else: logo_url = static('hqstyle/img/commcare-logo.png') site_name = "CommCare HQ" public_site = "http://www.commcarehq.org" can_be_your = _("mobile solution for your frontline workforce") if (project and project.has_custom_logo and domain_has_privilege(project.name, privileges.CUSTOM_BRANDING) ): logo_url = reverse('logo', args=[project.name]) return { 'DOMAIN_TYPE': domain_type, 'LOGO_URL': logo_url, 'SITE_NAME': site_name, 'CAN_BE_YOUR': can_be_your, 'PUBLIC_SITE': public_site, }
def _get_sdd_metadata(): """ sdd metadata that is passed through to the Angular app. See service-delivery-dashboard.directive.js for an example of using this. """ return { SDDSections.PW_LW_CHILDREN: { 'label': _('PW, LW & Children 0-3 years (0-1095 days)'), 'image': static('icds_reports/mobile/images/motherandchild.png') }, SDDSections.CHILDREN: { 'label': _('Children 3-6 years (1096-2190 days)'), 'image': static('icds_reports/mobile/images/babyboy.png') }, }
def _payload_id_and_search_link(self, payload_id): return ( '<a href="{url}?q={payload_id}">' '<img src="{flower}" title="Search in HQ" width="14px" height="14px" />' '</a> {payload_id}').format( url=reverse('global_quick_find'), flower=static('hqwebapp/images/commcare-flower.png'), payload_id=payload_id, )
def _payload_id_and_search_link(self, payload_id): return ( '<a href="{url}?q={payload_id}">' '<img src="{flower}" title="Search in HQ" width="14px" height="14px" />' '</a> {payload_id}' ).format( url=reverse('global_quick_find'), flower=static('hqwebapp/images/commcare-flower.png'), payload_id=payload_id, )
def get_per_domain_context(project, request=None): if project and project.commtrack_enabled: domain_type = 'commtrack' logo_url = static('hqstyle/img/commtrack-logo.png') site_name = "CommTrack" public_site = "http://www.commtrack.org" can_be_your = "mobile logistics solution" elif project and project.commconnect_enabled: domain_type = 'commconnect' logo_url = static('hqstyle/img/commconnect-logo.png') site_name = "CommConnect" public_site = "http://www.commcarehq.org" can_be_your = "mobile health solution" else: domain_type = 'commcare' logo_url = static('hqstyle/img/commcare-logo.png') site_name = "CommCare HQ" public_site = "http://www.commcarehq.org" can_be_your = "mobile health solution" try: if 'commtrack.org' in request.get_host(): logo_url = static('hqstyle/img/commtrack-logo.png') except Exception: # get_host might fail for bad requests, e.g. scheduled reports pass if project and project.has_custom_logo: try: ensure_request_has_privilege(request, privileges.CUSTOM_BRANDING) logo_url = reverse('logo', args=[project.name]) except PermissionDenied: pass return { 'DOMAIN_TYPE': domain_type, 'LOGO_URL': logo_url, 'SITE_NAME': site_name, 'CAN_BE_YOUR': can_be_your, 'PUBLIC_SITE': public_site, }
def _payload_id_and_search_link(self, payload_id): return format_html( '<a href="{url}?q={payload_id}">' '<img src="{flower}" title="Search in HQ" width="14px" height="14px" />' ' {payload_id}</a><br/>', '<a href="{log_url}?filter_payload={payload_id}" target="_blank">View Logs</a>', url=reverse('global_quick_find'), log_url=reverse('motech_log_list_view', args=[self.domain]), flower=static('hqwebapp/images/commcare-flower.png'), payload_id=payload_id, )
def _get_nav_metadatada(): """ Navigation metadata that is passed through to the Angular app. See program-summary.directive.js for an example of using this. """ return { NavigationSections.MATERNAL_CHILD: { 'label': _('Maternal and Child Nutrition'), 'image': static('icds_reports/mobile/images/motherandchild.png') }, NavigationSections.ICDS_CAS_REACH: { 'label': _('ICDS-CAS Reach'), 'image': static('icds_reports/mobile/images/statistics.png') }, NavigationSections.DEMOGRAPHICS: { 'label': _('Demographics'), 'image': static('icds_reports/mobile/images/threegroup.png') }, NavigationSections.AWC_INFRASTRUCTURE: { 'label': _('AWC Infrastructure'), 'image': static('icds_reports/mobile/images/bulb.png') }, }
def get_per_domain_context(project, request=None): if project and project.commtrack_enabled: domain_type = "commtrack" logo_url = static("hqstyle/img/commtrack-logo.png") site_name = "CommTrack" public_site = "http://www.commtrack.org" can_be_your = "mobile logistics solution" elif project and project.commconnect_enabled: domain_type = "commconnect" logo_url = static("hqstyle/img/commconnect-logo.png") site_name = "CommConnect" public_site = "http://www.commcarehq.org" can_be_your = "mobile health solution" else: domain_type = "commcare" logo_url = static("hqstyle/img/commcare-logo.png") site_name = "CommCare HQ" public_site = "http://www.commcarehq.org" can_be_your = "mobile health solution" try: if "commtrack.org" in request.get_host(): logo_url = static("hqstyle/img/commtrack-logo.png") except Exception: # get_host might fail for bad requests, e.g. scheduled reports pass if project and project.has_custom_logo and domain_has_privilege(project.name, privileges.CUSTOM_BRANDING): logo_url = reverse("logo", args=[project.name]) return { "DOMAIN_TYPE": domain_type, "LOGO_URL": logo_url, "SITE_NAME": site_name, "CAN_BE_YOUR": can_be_your, "PUBLIC_SITE": public_site, }
def page_context(self): context = {} context.update({ 'bulk_upload': { "download_url": static( 'data_interfaces/xlsx/forms_bulk_example.xlsx'), "adjective": _("example"), "verb": _("archive"), "plural_noun": _("forms"), }, }) context.update({ 'bulk_upload_form': get_bulk_upload_form(context), }) return context
def get_per_domain_context(project, request=None): domain_type = get_domain_type(project, request) if domain_type == COMMTRACK: logo_url = static('hqstyle/img/commcaresupply-logo.png') site_name = "CommCare Supply" public_site = "http://www.commtrack.org" can_be_your = _("mobile logistics solution") else: logo_url = static('hqstyle/img/commcare-logo.png') site_name = "CommCare HQ" public_site = "http://www.commcarehq.org" can_be_your = _("mobile solution for your frontline workforce") if (project and project.has_custom_logo and domain_has_privilege( project.name, privileges.CUSTOM_BRANDING)): logo_url = reverse('logo', args=[project.name]) return { 'DOMAIN_TYPE': domain_type, 'LOGO_URL': logo_url, 'SITE_NAME': site_name, 'CAN_BE_YOUR': can_be_your, 'PUBLIC_SITE': public_site, }
def page_context(self): context = {} context.update({ 'bulk_upload': { "download_url": static( 'data_interfaces/files/forms_bulk_example.xlsx'), "adjective": _("example"), "verb": _("archive"), "plural_noun": _("forms"), }, }) context.update({ 'bulk_upload_form': get_bulk_upload_form(context), }) return context
def get_per_domain_context(project): if project and project.commtrack_enabled: domain_type = 'commtrack' logo_url = static('hqstyle/img/commtrack-logo.png') site_name = "CommTrack" public_site = "http://www.commtrack.org" can_be_your = "mobile logistics solution" else: domain_type = 'commcare' logo_url = static('hqstyle/img/commcare-logo.png') site_name = "CommCare HQ" public_site = "http://www.commcarehq.org" can_be_your = "mobile health solution" if project and project.has_custom_logo: logo_url = reverse('logo', args=[project.name]) return { 'DOMAIN_TYPE': domain_type, 'LOGO_URL': logo_url, 'SITE_NAME': site_name, 'CAN_BE_YOUR': can_be_your, 'PUBLIC_SITE': public_site, }
def page_context(self): context = self.pagination_context context.update({ 'bulk_upload': { "download_url": static( 'data_interfaces/xlsx/cases_bulk_example.xlsx'), "adjective": _("case"), "plural_noun": _("cases"), }, 'bulk_upload_id': self.bulk_upload_id, 'update_case_group_form': self.update_case_group_form, 'group_name': self.case_group.name, }) context.update({ 'bulk_upload_form': get_bulk_upload_form(context), }) return context
def page_context(self): context = self.pagination_context context.update({ 'bulk_upload': { "download_url": static( 'data_interfaces/files/cases_bulk_example.xlsx'), "adjective": _("case"), "plural_noun": _("cases"), }, 'bulk_upload_id': self.bulk_upload_id, 'update_case_group_form': self.update_case_group_form, 'group_name': self.case_group.name, }) context.update({ 'bulk_upload_form': get_bulk_upload_form(context), }) return context
url(r'^champ_cameroon/', include('custom.champ.urls')), url(r'^motech/', include('corehq.motech.urls')), url(r'^dhis2/', include('corehq.motech.dhis2.urls')), url(r'^openmrs/', include('corehq.motech.openmrs.urls')), url(r'^_base_template/$', login_and_domain_required( lambda request, domain: render(request, 'hqwebapp/base.html', {'domain': domain}) )), url(r'^zapier/', include('corehq.apps.zapier.urls')), url(r'^remote_link/', include('corehq.apps.linked_domain.urls')), url(r'^translations/', include('corehq.apps.translations.urls')), url(r'^submit_feedback/$', submit_feedback, name='submit_feedback'), ] urlpatterns = [ url(r'^favicon\.ico$', RedirectView.as_view( url=static('hqwebapp/images/favicon2.png'), permanent=True)), url(r'^auditcare/', include('auditcare.urls')), url(r'^admin/', admin.site.urls), url(r'^analytics/', include('corehq.apps.analytics.urls')), url(r'^register/', include('corehq.apps.registration.urls')), url(r'^a/(?P<domain>%s)/' % legacy_domain_re, include(domain_specific)), url(r'^account/', include('corehq.apps.settings.urls')), url(r'', include('corehq.apps.hqwebapp.urls')), url(r'', include('corehq.apps.domain.urls')), url(r'^hq/accounting/', include('corehq.apps.accounting.urls')), url(r'^hq/sms/', include(sms_admin_interface_urls)), url(r'^hq/multimedia/', include('corehq.apps.hqmedia.urls')), url(r'^hq/admin/', include('corehq.apps.hqadmin.urls')), url(r'^hq/flags/', include('corehq.apps.toggle_ui.urls')), url(r'^hq/notifications/', include('corehq.apps.notifications.urls')), url(r'^unicel/', include('corehq.messaging.smsbackends.unicel.urls')),
(r'^dashboard/', include('corehq.apps.dashboard.urls')), (r'^configurable_reports/', include('corehq.apps.userreports.urls')), (r'^performance_messaging/', include('corehq.apps.performance_sms.urls')), (r'^preview_app/', include('corehq.apps.preview_app.urls')), (r'^', include('custom.icds_reports.urls')), (r'^', include('custom.enikshay.urls')), (r'^_base_template/$', login_and_domain_required( lambda request, domain: render(request, 'style/base.html', {'domain': domain}) )), (r'^zapier/', include('corehq.apps.zapier.urls', namespace='zapier')), (r'^zipline/', include('custom.zipline.urls')) ) urlpatterns = patterns('', (r'^favicon\.ico$', RedirectView.as_view( url=static('hqwebapp/img/favicon2.png'))), (r'^auditcare/', include('auditcare.urls')), (r'^admin/', include(admin.site.urls)), (r'^analytics/', include('corehq.apps.analytics.urls')), (r'^register/', include('corehq.apps.registration.urls')), (r'^a/(?P<domain>%s)/' % legacy_domain_re, include(domain_specific)), (r'^account/', include('corehq.apps.settings.urls')), (r'^project_store(.*)$', 'corehq.apps.appstore.views.rewrite_url'), (r'^exchange/', include('corehq.apps.appstore.urls')), (r'^webforms/', include('touchforms.formplayer.urls')), (r'', include('corehq.apps.hqwebapp.urls')), (r'', include('corehq.apps.domain.urls')), (r'^hq/accounting/', include('corehq.apps.accounting.urls')), (r'^hq/sms/', include(sms_admin_interface_urls)), (r'^hq/multimedia/', include('corehq.apps.hqmedia.urls')), (r'^hq/admin/', include('corehq.apps.hqadmin.urls')),
(r'^fri/', include('custom.fri.urls')), (r'^ilsgateway/', include('custom.ilsgateway.urls')), (r'^dhis2/', include('custom.dhis2.urls')), (r'^ewsghana/', include('custom.ewsghana.urls')), (r'^up_nrhm/', include('custom.up_nrhm.urls')), (r'^', include('custom.m4change.urls')), (r'^', include('custom.uth.urls')), (r'^dashboard/', include('corehq.apps.dashboard.urls')), (r'^configurable_reports/', include('corehq.apps.userreports.urls')), (r'^performance_messaging/', include('corehq.apps.performance_sms.urls')), (r'^', include('custom.icds.urls')), ) urlpatterns = patterns('', (r'^favicon\.ico$', RedirectView.as_view( url=static('hqwebapp/img/favicon2.png'))), (r'^auditcare/', include('auditcare.urls')), (r'^admin/', include(admin.site.urls)), (r'^analytics/', include('corehq.apps.analytics.urls')), (r'^register/', include('corehq.apps.registration.urls')), (r'^a/(?P<domain>%s)/' % legacy_domain_re, include(domain_specific)), (r'^account/', include('corehq.apps.settings.urls')), (r'^project_store(.*)$', 'corehq.apps.appstore.views.rewrite_url'), (r'^exchange/', include('corehq.apps.appstore.urls')), (r'^webforms/', include('touchforms.formplayer.urls')), (r'', include('corehq.apps.hqwebapp.urls')), (r'', include('corehq.apps.domain.urls')), (r'^hq/accounting/', include('corehq.apps.accounting.urls')), (r'^hq/sms/', include(sms_admin_interface_urls)), (r'^hq/multimedia/', include('corehq.apps.hqmedia.urls')), (r'^hq/admin/', include('corehq.apps.hqadmin.urls')),
def formatday(self, day, weekday): if day != 0: cssclass = self.cssclasses[weekday] this_day = date(self.year, self.month, day) if date.today() == this_day: cssclass += ' today' future = (date.today() < this_day) day_observations = filter_obs_for_day(this_day, self.observations) if len(day_observations) > 0: cssclass += ' filled' body = ['<div class="calendar-cell">'] day_data = DOTDay.merge_from_observations(day_observations) day_notes = set() for dose_data in [day_data.nonart, day_data.art]: body.append('') body.append('<div class="drug-cell">') body.append('<div class="drug-label">%s</div>' % dose_data.drug_class) for dose_num, obs_list in dose_data.dose_dict.items(): if len(obs_list) > 0: obs = obs_list[0] if obs.day_note is not None and len( obs.day_note) > 0: day_notes.add(obs.day_note) if obs.day_slot != '' and obs.day_slot is not None and obs.day_slot != -1: day_slot_string = DAY_SLOTS_BY_IDX.get( int(obs.day_slot), 'Unknown').title() body.append( '<div class="time-label">%s</div>' % day_slot_string) else: # do it by seq? body.append( '<div class="time-label">Dose %d</div>' % (int(dose_num) + 1)) body.append('<div class="time-cell">') body.append('<div class="observation">') if obs.adherence == DOT_ADHERENCE_UNCHECKED: body.append( '<span style="font-size:85%;color:#888;font-style:italic;">unchecked</span>' ) else: if obs.adherence == DOT_ADHERENCE_EMPTY: body.append('<img src="%s">' % static('pact/icons/check.jpg')) elif obs.adherence == DOT_ADHERENCE_PARTIAL: body.append('<img src="%s">' % static( 'pact/icons/exclamation-point.jpg')) elif obs.adherence == DOT_ADHERENCE_FULL: body.append( '<img src="%s">' % static('pact/icons/x-mark.png')) if obs.method == DOT_OBSERVATION_DIRECT: body.append('<img src="%s">' % static('pact/icons/plus.png')) elif obs.method == DOT_OBSERVATION_PILLBOX: body.append( '<img src="%s">' % static('pact/icons/bucket.png')) elif obs.method == DOT_OBSERVATION_SELF: body.append('<img src="%s">' % static('pact/icons/minus.png')) # close time-cell body.append( ' </div> <!-- close time-cell -->') else: # empty observations for this dose_num body.append( '<div class="time-label">Dose %d</div>' % (int(dose_num) + 1)) body.append('<div class="time-cell">') body.append('<div class="observation">') body.append("empty! </div>") # close observation body.append(' </div> <!-- close observation -->') # close calendar-cell body.append(' </div> <!-- close calendar cell -->') if len(day_notes) > 0: body.append('<div class="date-notes-block">') body.append('<i class="icon-info-sign"></i> ') body.append('<small>%s</small>' % ('<br>'.join(day_notes))) body.append('</div> <!-- end notes -->') return self.day_cell(cssclass, '%d %s' % (day, ''.join(body))) if weekday < 5 and not future: missing_link = [] return self.day_cell(cssclass, "%d %s" % (day, ''.join(missing_link))) elif weekday < 5 and future: return self.day_cell('future', "%d" % day) else: return self.day_cell(cssclass, day) return self.day_cell('noday', ' ')
url(r'^', include('custom.uth.urls')), url(r'^dashboard/', include('corehq.apps.dashboard.urls')), url(r'^configurable_reports/', include('corehq.apps.userreports.urls')), url(r'^performance_messaging/', include('corehq.apps.performance_sms.urls')), url(r'^', include('custom.icds_reports.urls')), url(r'^', include('custom.enikshay.urls')), url(r'^_base_template/$', login_and_domain_required( lambda request, domain: render(request, 'style/base.html', {'domain': domain}) )), url(r'^zapier/', include('corehq.apps.zapier.urls')), url(r'^zipline/', include('custom.zipline.urls')) ] urlpatterns = [ url(r'^favicon\.ico$', RedirectView.as_view( url=static('hqwebapp/img/favicon2.png'), permanent=True)), url(r'^auditcare/', include('auditcare.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^analytics/', include('corehq.apps.analytics.urls')), url(r'^register/', include('corehq.apps.registration.urls')), url(r'^a/(?P<domain>%s)/' % legacy_domain_re, include(domain_specific)), url(r'^account/', include('corehq.apps.settings.urls')), url(r'^project_store(.*)$', rewrite_url), url(r'^exchange/', include('corehq.apps.appstore.urls')), url(r'^webforms/', include('touchforms.formplayer.urls')), url(r'', include('corehq.apps.hqwebapp.urls')), url(r'', include('corehq.apps.domain.urls')), url(r'^hq/accounting/', include('corehq.apps.accounting.urls')), url(r'^hq/sms/', include(sms_admin_interface_urls)), url(r'^hq/multimedia/', include('corehq.apps.hqmedia.urls')), url(r'^hq/admin/', include('corehq.apps.hqadmin.urls')),
url(r'^dhis2/', include('corehq.motech.dhis2.urls')), url(r'^openmrs/', include('corehq.motech.openmrs.urls')), url( r'^_base_template/$', login_and_domain_required(lambda request, domain: render( request, 'hqwebapp/base.html', {'domain': domain}))), url(r'^zapier/', include('corehq.apps.zapier.urls')), url(r'^zipline/', include('custom.zipline.urls')), url(r'^remote_link/', include('corehq.apps.linked_domain.urls')), url(r'^translations/', include('corehq.apps.translations.urls')), ] urlpatterns = [ url( r'^favicon\.ico$', RedirectView.as_view(url=static('hqwebapp/images/favicon2.png'), permanent=True)), url(r'^auditcare/', include('auditcare.urls')), url(r'^admin/', admin.site.urls), url(r'^analytics/', include('corehq.apps.analytics.urls')), url(r'^register/', include('corehq.apps.registration.urls')), url(r'^a/(?P<domain>%s)/' % legacy_domain_re, include(domain_specific)), url(r'^account/', include('corehq.apps.settings.urls')), url(r'^project_store(.*)$', rewrite_url), url(r'^exchange/', include('corehq.apps.appstore.urls')), url(r'', include('corehq.apps.hqwebapp.urls')), url(r'', include('corehq.apps.domain.urls')), url(r'^hq/accounting/', include('corehq.apps.accounting.urls')), url(r'^hq/sms/', include(sms_admin_interface_urls)), url(r'^hq/multimedia/', include('corehq.apps.hqmedia.urls')), url(r'^hq/admin/', include('corehq.apps.hqadmin.urls')),
def formatday(self, day, weekday): if day != 0: cssclass = self.cssclasses[weekday] this_day = date(self.year, self.month, day) if date.today() == this_day: cssclass += ' today' future = (date.today() < this_day) day_observations = filter_obs_for_day(this_day, self.observations) if len(day_observations) > 0: cssclass += ' filled' body = ['<div class="calendar-cell">'] day_data = DOTDay.merge_from_observations(day_observations) day_notes = set() for dose_data in [day_data.nonart, day_data.art]: body.append('') body.append('<div class="drug-cell">') body.append('<div class="drug-label">%s</div>' % dose_data.drug_class) for dose_num, obs_list in dose_data.dose_dict.items(): if len(obs_list) > 0: obs = obs_list[0] if obs.day_note is not None and len(obs.day_note) > 0: day_notes.add(obs.day_note) if obs.day_slot != '' and obs.day_slot is not None and obs.day_slot != -1: day_slot_string = DAY_SLOTS_BY_IDX.get(int(obs.day_slot), 'Unknown').title() body.append('<div class="time-label">%s</div>' % day_slot_string) else: # do it by seq? body.append('<div class="time-label">Dose %d</div>' % (int(dose_num) + 1)) body.append('<div class="time-cell">') body.append('<div class="observation">') if obs.adherence == DOT_ADHERENCE_UNCHECKED: body.append('<span style="font-size:85%;color:#888;font-style:italic;">unchecked</span>') else: if obs.adherence == DOT_ADHERENCE_EMPTY: body.append('<img src="%s">' % static('pact/icons/check.jpg')) elif obs.adherence == DOT_ADHERENCE_PARTIAL: body.append('<img src="%s">' % static('pact/icons/exclamation-point.jpg')) elif obs.adherence == DOT_ADHERENCE_FULL: body.append('<img src="%s">' % static('pact/icons/x-mark.png')) if obs.method == DOT_OBSERVATION_DIRECT: body.append('<img src="%s">' % static('pact/icons/plus.png')) elif obs.method == DOT_OBSERVATION_PILLBOX: body.append('<img src="%s">' % static('pact/icons/bucket.png')) elif obs.method == DOT_OBSERVATION_SELF: body.append('<img src="%s">' % static('pact/icons/minus.png')) # close time-cell body.append(' </div> <!-- close time-cell -->') else: # empty observations for this dose_num body.append('<div class="time-label">Dose %d</div>' % (int(dose_num) + 1)) body.append('<div class="time-cell">') body.append('<div class="observation">') body.append("empty! </div>") # close observation body.append(' </div> <!-- close observation -->') # close calendar-cell body.append(' </div> <!-- close calendar cell -->') if len(day_notes) > 0: body.append('<div class="date-notes-block">') body.append('<i class="fa fa-info-circle"></i> ') body.append('<small>%s</small>' % ('<br>'.join(day_notes))) body.append('</div> <!-- end notes -->') return self.day_cell(cssclass, '%d %s' % (day, ''.join(body))) if weekday < 5 and not future: missing_link = [] return self.day_cell(cssclass, "%d %s" % (day, ''.join(missing_link))) elif weekday < 5 and future: return self.day_cell('future', "%d" % day) else: return self.day_cell(cssclass, day) return self.day_cell('noday', ' ')