def person_heard(request, dshUid, offset, personTable, eventTable, itemTable, noDemographics=False): """ 10/04/01. called by views.person_heard() modeled after person_answered(). noDemographics=True when called by dvoice side. """ response = views.page_header( 'messages heard by this person', includeMp3Player=True) success,msg = dsh_common_db.person_row( personTable, dshUid, noDemographics=noDemographics) response += msg if not success: response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response) success,msg = dsh_common_db.heard_message_list( personTable, eventTable, itemTable, dshUid, offset) response += msg if not success: response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response) response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response)
def person_answered(request, dshUid, offset, personTable, eventTable, itemTable): """ 10/03/25: called by views.person_answered(). """ response = views.page_header( 'messages answered by this person', includeMp3Player=True) success,msg = dsh_common_db.person_row(personTable, dshUid) response += msg if not success: response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response) success,msg = dsh_common_db.answered_message_list( personTable, eventTable, itemTable, dshUid, offset) response += msg if not success: response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response) response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response)
def conversation_history(request, dshUid, itemTable, eventTable): """ 10/03/28: called by views.conversation_history(). """ response = views.page_header('conversation history', includeMp3Player=True) response += dsh_common_db.conversation_history( dshUid, itemTable, eventTable) response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response)
def demographics(request, dshUid, personTable): """ 10/03/13: called by views.demographics(). """ if dsh_django_request.deny_it(request): return views.please_log_in() response = views.page_header('demographics', includeMp3Player=True) person = dsh_django_utils.get_foreign_key(personTable, dshUid) if not person: message = 'dsh_common_views.demographics: no person found: ' + dshUid response += dsh_utils.red_error_break_msg(message) dsh_django_utils.error_event(message, errorLevel='ERR') response += page_footer() return HttpResponse(response) personEditUrl = dsh_django_config.lookup('PERSON_DETAIL_URL') + \ str(person.id) thumb = dsh_django_utils.thumbnail( person, person.mugshot, noCenter=True) url = '<a href=%s title="edit person details">%s</a>' % \ (personEditUrl, thumb) response += url response += '<BR><BR>' response += '<TABLE BORDER=1>' name = person.__unicode__() if name: response += '<TR><TD>name</TD><TD>%s</TD></TR>' % (name,) if person.spoken_name: spokenName = person.spoken_name_display_field() if spokenName: response += '<TR><TD>spoken name</TD><TD>%s</TD></TR>' % \ (spokenName) response += '<TR><TD>dsh uid</TD><TD>%s</TD></TR>' % (person.dsh_uid,) if person.phone_number: response += '<TR><TD>phone</TD><TD>%s</TD></TR>' % \ (person.phone_number,) if person.organization and person.organization.alias: response += '<TR><TD>org.</TD><TD>%s</TD></TR>' % \ (person.organization.alias,) if person.ptype: response += '<TR><TD>type</TD><TD>%s</TD></TR>' % (person.ptype,) if person.gender: response += '<TR><TD>gender</TD><TD>%s</TD></TR>' % (person.gender,) if person.date_birth: if person.birth_date_approximate: dateStr = str(person.date_birth.year) else: dateStr = person.date_birth.isoformat() response += '<TR><TD>birth date</TD><TD>%s</TD></TR>' % (dateStr,) if person.birth_date_approximate: response += '<TR><TD>birth date approximate</TD><TD>True</TD></TR>' if person.date_birth: years = dsh_common_db.calculate_age(person) if years: response += '<TR><TD>age</TD><TD>%s</TD></TR>' % (str(years),) if person.modify_datetime: timeStr = person.modify_datetime.strftime( '%#Y-%#m-%#d %#H:%#M:%#S') response += '<TR><TD>modify time</TD><TD>%s</TD></TR>' % (timeStr,) response += '</TABLE>' response += views.mp3_widget_control() response += views.page_footer() return HttpResponse(response)