Exemplo n.º 1
0
def get_locations():
    # {Country: {State: {City: [(d1id, d1name), (d2id ,d2name)], }, }, }
    MASTER = {}
    dips = get_users('d')
    ks = dips.keys()
    ks.sort()
    for k in ks:
        ddict = dips[k]
        if ddict.get('sec_policy') == 'paranoid':
            pass
        else:
            country = ddict.get('country', 'Undefined')
            if not MASTER.has_key(country):
                MASTER[country] = {}
            CDICT = MASTER[country]

            state = ddict.get('state', 'Undefined')
            if not CDICT.has_key(state):
                CDICT[state] = {}
            SDICT = CDICT[state]

            city = ddict.get('city', 'Undefined')
            if not SDICT.has_key(city):
                SDICT[city] = []

            did = ddict.get('username')
            dname = '%s %s %s' % (ddict.get('fn', ''), ddict.get(
                'mi', ''), ddict.get('sn', ''))
            if ddict.get('title'):
                dname += ', %s' % (ddict['title'])

            tupe = (did, dname)
            SDICT[city].append(tupe)
    return MASTER
Exemplo n.º 2
0
def get_locations ():
    # {Country: {State: {City: [(d1id, d1name), (d2id ,d2name)], }, }, }
    MASTER = {}
    dips = get_users('d')
    ks = dips.keys()
    ks.sort()
    for k in ks:
        ddict = dips[k]
        if ddict.get('sec_policy') == 'paranoid':
            pass
        else:
            country = ddict.get('country', 'Undefined')
            if not MASTER.has_key(country):
                MASTER[country] = {}
            CDICT = MASTER[country]
    
            state = ddict.get('state', 'Undefined')
            if not CDICT.has_key(state):
                CDICT[state] = {}
            SDICT = CDICT[state]
    
            city = ddict.get('city', 'Undefined')
            if not SDICT.has_key(city):
                SDICT[city] = []
    
            did = ddict.get('username')
            dname = '%s %s %s' % (ddict.get('fn', ''), ddict.get('mi', ''), ddict.get('sn', ''))
            if ddict.get('title'):
                dname += ', %s' % (ddict['title'])
    
            tupe = (did, dname)
            SDICT[city].append(tupe)
    return MASTER
Exemplo n.º 3
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        FOR_HIRE = qs.get('consult')

        wr('<h1>%s</h1>' % (self.title()))

        if qs.get('view'):
            dr_id = qs.get('view')
            #            wr(dr_id)
            upick = get_user_acct(dr_id)
            upick['username'] = dr_id
            uuid = '%s_%s_%s' % (upick.get('sn'), upick.get('fn'), dr_id)
            self.format_list({uuid: upick})

        else:
            Ds = get_users(utype='d')
            FOR_HIRE = qs.get('consult')
            if FOR_HIRE:
                Rs = {}
                hires = {}
                for k in Ds.keys():
                    vetdict = Ds.get(k)
                    if vetdict.get('show_for_hire') == 'yes':
                        hires[k] = Ds[k]
                Ds = hires
            else:
                Rs = get_users(utype='r')

            Es = get_users(utype='e')  # Emeritus
            Hs = get_users(utype='h')  # Honorary
            Ms = get_users(utype='m')  # Memoriam

            wr('<div role="tabpanel">')

            if FOR_HIRE:
                pass
            else:
                wr('<!-- Nav tabs -->')
                wr('<ul class="nav nav-pills nav-justified" role="tablist">')

                if Ds:
                    wr('<li role="presentation" class="active"><a href="#Diplomates" aria-controls="Diplomates" role="tab" data-toggle="tab">Diplomates</a></li>'
                       )
                if Rs:
                    wr('<li role="presentation"><a href="#Candidates" aria-controls="Candidates" role="tab" data-toggle="tab">Candidates</a></li>'
                       )
                if Es:
                    wr('<li role="presentation"><a href="#Emeritus" aria-controls="Emeritus Diplomates" role="tab" data-toggle="tab">Emeritus Diplomates</a></li>'
                       )
                if Hs:
                    wr('<li role="presentation"><a href="#Honorary" aria-controls="Honorary Diplomates" role="tab" data-toggle="tab">Honorary Diplomates</a></li>'
                       )
                if Ms:
                    wr('<li role="presentation"><a href="#Memoriam" aria-controls="In Memoriam" role="tab" data-toggle="tab">In Memoriam</a></li>'
                       )
                wr('</ul>')
            wr('<!-- Tab panes -->')

            wr('<div class="tab-content">')
            if Ds:
                wr('<div role="tabpanel" class="tab-pane active" id="Diplomates">'
                   )
                self.format_list(Ds)
                wr('</div>')
            else:
                if FOR_HIRE:
                    wr('<P>There are no ACVAA members who have marked themselves as for hire at this time.</P>'
                       )

            if Rs:
                wr('<div role="tabpanel" class="tab-pane" id="Candidates">')
                self.format_list(Rs)
                wr('</div>')

            if Es and (not FOR_HIRE):
                wr('<div role="tabpanel" class="tab-pane" id="Emeritus">')
                self.format_list(Es)
                wr('</div>')

            if Hs and (not FOR_HIRE):
                wr('<div role="tabpanel" class="tab-pane" id="Honorary">')
                self.format_list(Hs, list_type="h")
                wr('</div>')

            if Ms and (not FOR_HIRE):
                wr('<div role="tabpanel" class="tab-pane" id="Memoriam">')
                self.format_list(Ms, list_type="m")
                wr('</div>')
            wr('</div><!-- .tab-content -->')

            wr('</div><!-- tabpanel -->')