Ejemplo n.º 1
0
 def writeContent(self):
     wr = self.writeln
     wr('<h1>Find an ACVAA Doctor</h1>')
     locs = get_locations()
     countries = locs.keys()
     countries.sort()
     for country in countries:
         wr('<h2 style="margin-top: 20px; border-top: 2px solid #b4c3d3;">%s %s</h2>'
            % (country, get_flag(country)))
         cdict = locs[country]
         states = cdict.keys()
         states.sort()
         for state in states:
             wr('<h3 style="margin-top: 10px; margin-left: 10px; border-top: 1px dashed #b4c3d3;">%s</h3>'
                % (state))
             sdict = cdict[state]
             cities = sdict.keys()
             cities.sort()
             for city in cities:
                 wr('<div class="t14" style="margin-top: 10px; margin-left: 20px;">%s</div>'
                    % (city))
                 dr_list = sdict[city]
                 for drid, drname in dr_list:
                     wr('<div class="t12" style="margin-left: 32px;">')
                     wr('<a href="Directory?view=%s">%s</a>' %
                        (drid, drname))
                     wr('</div>')
Ejemplo n.º 2
0
    def writeContent(self):
        wr = self.writeln
        wr('<h1>Find an ACVAA Doctor</h1>')
        wr('<P>Click the name of any country to expand and view all of its doctors.</P>')
        locs = get_locations()
        countries = locs.keys()
        countries.sort()

        if 'USA' in countries:
            del countries[countries.index('USA')]
        countries = ['USA'] + countries

        for country in countries:
            ctyid = country.translate(None, string.punctuation)
            ctyid = ctyid.replace(' ', '-')
            wr('<h2 style="margin-top: 20px; border-top: 2px solid #b4c3d3;" id="%s">%s %s</h2>' % (ctyid, country, get_flag(country)))
            wr('<div id="%s" class="country">' % (ctyid))
            cdict = locs[country]
            states = cdict.keys()
            states.sort()
            for state in states:
                wr('<h3 style="margin-top: 10px; margin-left: 10px; border-top: 1px dashed #b4c3d3;">%s</h3>' % (state))
                sdict = cdict[state]
                cities = sdict.keys()
                cities.sort()
                for city in cities:
                    wr('<div class="t14" style="margin-top: 10px; margin-left: 20px;">%s</div>' % (city))
                    dr_list = sdict[city]
                    for drid, drname in dr_list:
                        wr('<div class="t12" style="margin-left: 32px;">')
                        wr('<a href="Directory?view=%s">%s</a>' % (drid, drname))
                        wr('</div>')
            wr('</div><!-- country id -->')
Ejemplo n.º 3
0
    def format_list(self, all, list_type=""):
        wr = self.writeln
        qs = self.request().fields()
        FOR_HIRE = qs.get('consult')
        ILI = is_logged_in(self.request())
        viewer = self.request().cookies().get('username', '')
        rolestr = self.request().cookies().get('role', '')
        IS_RES = rolestr == RESDSTR
        IS_DIP = rolestr == DIPLSTR
        aks = all.keys()
        aks = sorted(aks,
                     key=lambda x: (x.isdigit() and float(x)) or x.lower())

        wr('<div id="directory">')
        for k in aks:
            d = all[k]
            if d.get('sec_policy') == 'paranoid':
                pass
            else:
                wr('<div class="dir-entry">')
                dname = ''
                if d.get('salute'):
                    dname = '%s ' % (d['salute'])
                dname += '%s %s %s' % (d.get('fn', ''), d.get(
                    'mi', ''), d.get('sn', ''))
                if d.get('title'):
                    dname += ', %s' % (d['title'])
                if d.get('degrees'):
                    dname += ', %s' % (d['degrees'])

                if d.get('username') == viewer:
                    wr('<span class="button"><a href="Account">Your Account</a></span>'
                       )
                    wr('<h2>%s</h2>' % (dname))
                else:
                    # Country Flag Icon - Neato!
                    try:
                        wr(get_flag(d.get('country'), align="right"))
                    except AttributeError:
                        pass
                    wr('<h2>%s</h2>' % (dname))

                if list_type == 'h':
                    if d.get('institution'):
                        wr('%s<br>' % (d.get('institution')))
                    if d.get('country'):
                        wr('%s<br>' % (d.get('country')))
                    if d.get('conferred'):
                        wr('Conferred: %s' % (d.get('conferred')))
                elif list_type == 'm':
                    if d.get('institution'):
                        wr('%s<br>' % (d.get('institution')))
                    if d.get('country'):
                        wr('%s<br>' % (d.get('country')))
                    if d.get('birthyear') or d.get('deathyear'):
                        wr('%s&ndash;%s' %
                           (d.get('birthyear', ''), d.get('deathyear', '')))
                else:

                    wr('<table><tr><td>')  ####====####
                    ##################
                    # ADDRESS
                    ##################
                    addr = '%s, %s' % (d.get('city'), d.get('state'))
                    if d.get('show_address') == 'hide':
                        pass
                    elif d.get('show_address') == 'diplomates':
                        if ILI and IS_DIP:
                            addr = self.get_full_addr(d)
                    elif d.get('show_address') == 'both':
                        if ILI and (IS_DIP or IS_RES):
                            addr = self.get_full_addr(d)
                    elif d.get('show_address') == 'all':
                        addr = self.get_full_addr(d)
                    wr('<P>%s</P>' % (addr))
                    wr('<td style="padding-left: 30px;">')  ####====####
                    ##################
                    # NUMBERS
                    ##################
                    nums = ''
                    if d.get('show_numbers') == 'hide':
                        pass
                    elif d.get('show_address') == 'diplomates':
                        if ILI and IS_DIP:
                            nums = self.get_numbers(d)
                    elif d.get('show_address') == 'both':
                        if ILI and (IS_DIP or IS_RES):
                            nums = self.get_numbers(d)
                    elif d.get('show_address') == 'all':
                        nums = self.get_numbers(d)
                    wr('<P>%s</P>' % (nums))
                    wr('<td style="padding-left: 30px;">')  ####====####
                    ##################
                    # EMAIL
                    ##################
                    email = ''
                    if d.get('show_email') == 'hide':
                        pass
                    elif d.get('show_email') == 'diplomates':
                        if ILI and IS_DIP:
                            email = d.get('email', '')
                    elif d.get('show_email') == 'both':
                        if ILI and (IS_DIP or IS_RES):
                            email = d.get('email', '')
                    elif d.get('show_email') == 'all':
                        email = d.get('email', '')
                    wr('<P>%s</P>' % (email))
                    wr('</table>')  ####====####

                if FOR_HIRE:
                    fh_area = d.get('for_hire_areas')
                    if fh_area:
                        wr('<p>')
                        wr('<b>Area(s) Served:</b><br />')
                        fh_area = fh_area.replace('\r', '<br />')
                        wr(fh_area)
                        wr('</p>')

                    fh_svcs = d.get('for_hire_services')
                    if fh_svcs:
                        wr('<p>')
                        wr('<b>Services Offered:</b><br />')
                        fh_svcs = fh_svcs.replace('\r', '<br />')
                        wr(fh_svcs)
                        wr('</p>')

                    fh_url = d.get('for_hire_url')
                    if fh_url:
                        wr('<p>')
                        wr('<a href="%s">%s</a>' % (fh_url, fh_url))
                        wr('</p>')

                wr('</div><!-- .dir-entry -->')

        wr('</div><!-- directory -->')
Ejemplo n.º 4
0
 def writeContent(self):
     wr = self.writeln
     wr('<h1>Find an ACVAA Doctor</h1>')
     locs = get_locations()
     countries = locs.keys()
     countries.sort()
     for country in countries:
         wr('<h2 style="margin-top: 20px; border-top: 2px solid #b4c3d3;">%s %s</h2>' % (country, get_flag(country)))
         cdict = locs[country]
         states = cdict.keys()
         states.sort()
         for state in states:
             wr('<h3 style="margin-top: 10px; margin-left: 10px; border-top: 1px dashed #b4c3d3;">%s</h3>' % (state))
             sdict = cdict[state]
             cities = sdict.keys()
             cities.sort()
             for city in cities:
                 wr('<div class="t14" style="margin-top: 10px; margin-left: 20px;">%s</div>' % (city))
                 dr_list = sdict[city]
                 for drid, drname in dr_list:
                     wr('<div class="t12" style="margin-left: 32px;">')
                     wr('<a href="Directory?view=%s">%s</a>' % (drid, drname))
                     wr('</div>')