Exemple #1
0
    def writeContent(self):
        wr = self.writeln
        req = self.request()
        form = req.fields()
        ERROR = authenticate(form)
        if ERROR:
            wr('<h1 class="error">Login Failed</h1>')
            wr('<P>Here\'s why: %s</P>' % (ERROR))
            wr('<P>You can try again at the top of this page, or <a href="Login_Help">get some help</a>. </P>')

        else:
            username = form.get('username')
            userinfo = get_user_acct(username)
            # Set 10-year cookie.
            hvc = hash_string(userinfo.get('vcode'))
            ex1 = self.getCookieExpiry('maxAge', y=10)
            ex2 = self.getCookieExpiry('Expires', y=10)
            self.setCookie('username', username, ex1, ex2)
            self.setCookie('hash', hvc, ex1, ex2)
            possible_role = get_user_role(username)
            if possible_role:
                self.setCookie('role', possible_role, ex1, ex2)
#                if possible_role == RESDSTR:
#                    self.setCookie('g', 'r', ex1, ex2)
#                if possible_role == DIPLSTR:
#                    self.setCookie('g', 'd', ex1, ex2)

            # Redirect.
            from_url = form.get('from_url', '')
            if 'Login_Lookup' in from_url:
                from_url = 'Index'
            if not from_url:
                from_url = 'Index'

            self.response().sendRedirect(from_url)
Exemple #2
0
 def defaultAction(self):
     wr = self.writeln
     qs = self.request().fields()
     username = qs.get("username")
     d = get_user_acct(username)
     r = self.response()
     r.setHeader('Content-type', 'text/plain')
     self.write(json.dumps(d))
Exemple #3
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = self.request().fields()
            wr(form)
        else:
            wr('<h1><em>%s</em> Account Information</h1>' % (un))

            p = get_user_acct(un)

            wr('<P>You can make changes to your account information here.</P>')

            wr('<form method="POST" action="Account">')
            wr('<table id="contact_info">')

            wr('<tr><td colspan="3">')
            wr('<fieldset>')
            wr('<legend>Tell us about you.</legend>')
            wr('<tr><td><label>Salutation</label>')
            wr('<td>%s' %
               (text('salute', p.get('salute', ''), clss='input', size='5')))
            wr('<td class="hint">(e.g., Dr., Mr., Ms., etc.)')
            wr('<tr><td><label>First Name</label>')
            wr('<td>%s' % (text('fn', p.get('fn', ''), clss='input')))
            wr('<td class="req">required')
            wr('<tr><td><label>Middle Initial</label>')
            wr('<td>%s' %
               (text('mi', p.get('mi', ''), clss='input', size='2')))
            wr('<tr><td><label>Last Name</label>')
            wr('<td>%s' % (text('sn', p.get('sn', ''), clss='input')))
            wr('<td class="req">required')
            wr('</fieldset>')

            wr('<tr><td colspan="3">')
            wr('<fieldset>')
            wr('<legend>Where are you located?</legend>')
            wr('<tr><td><label>Address 1</label>')
            wr('<td>%s' % (text('addr1', p.get('addr1', ''), clss='input')))
            wr('<tr><td><label>Address 2</label>')
            wr('<td>%s' % (text('addr2', p.get('addr2', ''), clss='input')))
            wr('<tr><td><label>City</label>')
            wr('<td>%s' % (text('city', p.get('city', ''), clss='input')))
            wr('<td class="req">required')
            wr('<tr><td><label>State</label>')
            wr('<td>%s' % (select(name='state',
                                  opts=STATES,
                                  selected=p.get('state', ''),
                                  clss='input')))
            wr('<td class="req">required')
            wr('<tr><td><label>ZIP Code</label>')
            wr('<td>%s' %
               (text('zip', p.get('zip', ''), clss='input', size='6')))
            wr('</fieldset>')

            wr('</table>')
            wr('</form>')
Exemple #4
0
    def writeContent(self):
        wr = self.writeln
        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            C = self.request().cookies()
            un, hash = C.get('username'), C.get('hash')

            p = get_user_acct(un)

            form = self.request().fields()
            ERROR = None

            if (un == form.get('form_username')) and (
                    hash == form.get('form_hash')):

                required = {
                    'fn': 'first name',
                    'sn': 'surname',
                    'city': 'city',
                    'state': 'state',
                    'email': 'email',
                }
                if 'memoriam' in p.get('roles', []):
                    required = {
                        'fn': 'first name',
                        'sn': 'surname',
                    }

                for r in required.keys():
                    if not form.get(r):
                        ERROR = 'The field "%s" is required.' % (
                            required.get(r))

                if not ERROR:
                    if 'memoriam' not in p.get('roles', []):
                        ERROR = check_email_address(form.get('email'))

                if not ERROR:
                    if form.get('email') != form.get(
                            'original_email'):  # user changing email address
                        if is_email_registered(form.get('email')):
                            ERROR = 'We already have an account that uses the email address: %s.' % (
                                form.get('email'))

                if ERROR:
                    self.render_form_error('Account Error', ERROR)
                else:
                    save_user_info(form.get('form_username'), form)
                    self.response().sendRedirect('Account?ic=1')

            else:
                self.render_form_error('Account Error', 'Credentials failure.')
        else:
            self.render_form_error('Account Error', 'No post.')
Exemple #5
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = self.request().fields()
            wr(form)
        else:
            wr('<h1><em>%s</em> Account Information</h1>' % (un))

            p = get_user_acct(un)

            wr('<P>You can make changes to your account information here.</P>')

            wr('<form method="POST" action="Account">')
            wr('<table id="contact_info">')

            wr('<tr><td colspan="3">')
            wr('<fieldset>')
            wr('<legend>Tell us about you.</legend>')
            wr('<tr><td><label>Salutation</label>')
            wr('<td>%s' % (text('salute', p.get('salute', ''), clss='input', size='5')))
            wr('<td class="hint">(e.g., Dr., Mr., Ms., etc.)')
            wr('<tr><td><label>First Name</label>')
            wr('<td>%s' % (text('fn', p.get('fn', ''), clss='input')))
            wr('<td class="req">required')
            wr('<tr><td><label>Middle Initial</label>')
            wr('<td>%s' % (text('mi', p.get('mi', ''), clss='input', size='2')))
            wr('<tr><td><label>Last Name</label>')
            wr('<td>%s' % (text('sn', p.get('sn', ''), clss='input')))
            wr('<td class="req">required')
            wr('</fieldset>')

            wr('<tr><td colspan="3">')
            wr('<fieldset>')
            wr('<legend>Where are you located?</legend>')
            wr('<tr><td><label>Address 1</label>')
            wr('<td>%s' % (text('addr1', p.get('addr1', ''), clss='input')))
            wr('<tr><td><label>Address 2</label>')
            wr('<td>%s' % (text('addr2', p.get('addr2', ''), clss='input')))
            wr('<tr><td><label>City</label>')
            wr('<td>%s' % (text('city', p.get('city', ''), clss='input')))
            wr('<td class="req">required')
            wr('<tr><td><label>State</label>')
            wr('<td>%s' % (select (name='state', opts=STATES, selected=p.get('state', ''), clss='input')))
            wr('<td class="req">required')
            wr('<tr><td><label>ZIP Code</label>')
            wr('<td>%s' % (text('zip', p.get('zip', ''), clss='input', size='6')))
            wr('</fieldset>')

            wr('</table>')
            wr('</form>')
Exemple #6
0
 def writeContent(self):
     wr = self.writeln
     req = self.request()
     form = req.fields()
     username = form.get('u')
     userinfo = get_user_acct(username)
     possible_role = get_user_role(username)
     hvc = hash_string(userinfo.get('vcode', ''))
     ex1 = self.getCookieExpiry('maxAge', y=10)
     ex2 = self.getCookieExpiry('Expires', y=10)
     self.setCookie('username', username, ex1, ex2)
     self.setCookie('hash', hvc, ex1, ex2)
     self.setCookie('role', possible_role, ex1, ex2)
     self.setCookie('actingasuser', 'true', ex1, ex2)
     self.response().sendRedirect("Index")
Exemple #7
0
    def writeContent(self):
        wr = self.writeln
        req = self.request()
        form = req.fields()
        username = form.get('u')
#        wr(username)
        userinfo = get_user_acct(username)
#        wr(userinfo)
        hvc = hash_string(userinfo.get('vcode', ''))
#        wr(hvc)
        ex1 = self.getCookieExpiry('maxAge', y=10)
        ex2 = self.getCookieExpiry('Expires', y=10)
        self.setCookie('username', username, ex1, ex2)
        self.setCookie('hash', hvc, ex1, ex2)
        self.setCookie('actingasuser', 'true', ex1, ex2)
        self.response().sendRedirect("Index")
Exemple #8
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        username = qs.get('u')

        if self.request().cookies().get('username') == username:
            wr('<h1 class="error">You cannot manage your own account.</h1>')
            wr('<P>This is to keep you from accidentally deleting your account, or revoking your own administrative privileges.'
               )
        elif username == 'master':
            wr('<h1 class="error">You cannot manage the master account.</h1>')
            wr('<P>This is to keep you from accidentally revoking the site developer\'s access.'
               )

        else:
            wr('<h1>%s</h1>' % (self.title()))
            wr('<h1><em>%s</em></h1>' % (username))
            ud = get_user_acct(username)

            if self.request()._environ.get('REQUEST_METHOD') == 'POST':
                form = qs
                if form.get('roles'):
                    save_user_roles(form.get('u'), form.get('roles'))
                    self.response().sendRedirect('UM_Index?rolok=%s' %
                                                 (username))

                else:
                    wr('<h1 class="error">A user account must have at least one role specified.</h1>'
                       )
                    wr('<P>Please <a href="javascript:history.go(-1)">go back</a> &amp; try again.</P>'
                       )

            else:
                wr('<form method="POST" action="UM_Roles_Form">')
                wr(hidden('u', username))
                wr('<P><table>')
                for r in ALL_ROLES:
                    wr('<tr>')
                    wr('<td class="t14">')
                    wr(r.capitalize())
                    wr('<td class="t14">')
                    wr(checkbox('roles', r, (r in ud.get('roles'))))
                wr('</table></P>')
                wr(submit('Save'))
                wr('<input type="button" value="Never mind. Leave roles alone." onclick="javascript:history.go(-1)">'
                   )
                wr('</form>')
Exemple #9
0
    def writeContent(self):
        wr = self.writeln
        req = self.request()
        form = req.fields()

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            username = form.get('username')
            p = get_user_acct(username)
            email = p.get('email')
            if email:
                reset_password(username)

            wr('<h1>Please Check Your Email</h1>')
            wr('<P>You should receive a new message from us with your account\'s new password.</P>')
            wr('<P>If not, then something\'s gone wrong; please contact an ACVAA site administrator.</P>')

        else:
            wr('<h1>You do not have permission to access this page.</h1>')
Exemple #10
0
    def writeContent(self):
        wr = self.writeln
        req = self.request()
        form = req.fields()

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            username = form.get('username')
            p = get_user_acct(username)
            email = p.get('email')
            if email:
                reset_password(username)

            wr('<h1>Please Check Your Email</h1>')
            wr('<P>You should receive a new message from us with your account\'s new password.</P>'
               )
            wr('<P>If not, then something\'s gone wrong; please contact an ACVAA site administrator.</P>'
               )

        else:
            wr('<h1>You do not have permission to access this page.</h1>')
Exemple #11
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        username = qs.get('u')

        if self.request().cookies().get('username') == username:
            wr('<h1 class="error">You cannot manage your own account.</h1>')
            wr('<P>This is to keep you from accidentally deleting your account, or revoking your own administrative privileges.')
        elif username == 'master':
            wr('<h1 class="error">You cannot manage the master account.</h1>')
            wr('<P>This is to keep you from accidentally revoking the site developer\'s access.')

        else:
            wr('<h1>%s</h1>' % (self.title()))
            wr('<h1><em>%s</em></h1>' % (username))
            ud = get_user_acct(username)

            if self.request()._environ.get('REQUEST_METHOD') == 'POST':
                form = qs
                if form.get('roles'):
                    save_user_roles(form.get('u'), form.get('roles'))
                    self.response().sendRedirect('UM_Index?rolok=%s' % (username))

                else:
                    wr('<h1 class="error">A user account must have at least one role specified.</h1>')
                    wr('<P>Please <a href="javascript:history.go(-1)">go back</a> &amp; try again.</P>')

            else:
                wr('<form method="POST" action="UM_Roles_Form">')
                wr(hidden('u', username))
                wr('<P><table>')
                for r in ALL_ROLES:
                    wr('<tr>')
                    wr('<td class="t14">')
                    wr(r.capitalize())
                    wr('<td class="t14">')
                    wr(checkbox('roles', r, (r in ud.get('roles')) ))
                wr('</table></P>')
                wr(submit('Save'))
                wr('<input type="button" value="Never mind. Leave roles alone." onclick="javascript:history.go(-1)">')
                wr('</form>')
Exemple #12
0
    def writeContent(self):
        wr = self.writeln
        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            C = self.request().cookies()
            un, hash = C.get('username'), C.get('hash')

            p = get_user_acct(un)

            form = self.request().fields()
            ERROR = None

            if (un == form.get('form_username')) and (hash == form.get('form_hash')):

                required = {'fn': 'first name', 'sn': 'surname', 'city': 'city', 'state': 'state', 'email': 'email', }
                if 'memoriam' in p.get('roles', []):
                    required = {'fn': 'first name', 'sn': 'surname', }

                for r in required.keys():
                    if not form.get(r):
                        ERROR = 'The field "%s" is required.' % (required.get(r))

                if not ERROR:
                    if 'memoriam' not in p.get('roles', []):
                        ERROR = check_email_address(form.get('email'))

                if not ERROR:
                    if form.get('email') != form.get('original_email'): # user changing email address
                        if is_email_registered(form.get('email')):
                            ERROR = 'We already have an account that uses the email address: %s.' % (form.get('email'))

                if ERROR:
                    self.render_form_error('Account Error', ERROR)
                else:
                    save_user_info(form.get('form_username'), form)
                    self.response().sendRedirect('Account?ic=1')

            else:
                self.render_form_error('Account Error', 'Credentials failure.')
        else:
            self.render_form_error('Account Error', 'No post.')
Exemple #13
0
    def writeContent(self):
        wr = self.writeln
        req = self.request()
        form = req.fields()
        ERROR = authenticate(form)
        if ERROR:
            wr('<h1 class="error">Login Failed</h1>')
            wr('<P>Here\'s why: %s</P>' % (ERROR))
            wr('<P>You can try again at the top of this page, or <a href="Login_Help">get some help</a>. </P>'
               )

        else:
            username = form.get('username')
            userinfo = get_user_acct(username)
            # Set 10-year cookie.
            hvc = hash_string(userinfo.get('vcode'))
            ex1 = self.getCookieExpiry('maxAge', y=10)
            ex2 = self.getCookieExpiry('Expires', y=10)
            self.setCookie('username', username, ex1, ex2)
            self.setCookie('hash', hvc, ex1, ex2)
            possible_role = get_user_role(username)
            if possible_role:
                self.setCookie('role', possible_role, ex1, ex2)
#                if possible_role == RESDSTR:
#                    self.setCookie('g', 'r', ex1, ex2)
#                if possible_role == DIPLSTR:
#                    self.setCookie('g', 'd', ex1, ex2)

# Redirect.
            from_url = form.get('from_url', '')
            if 'Login_Lookup' in from_url:
                from_url = 'Index'
            if not from_url:
                from_url = 'Index'

            self.response().sendRedirect(from_url)
Exemple #14
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()

        rolestr = self.request().cookies().get('role', '')
        IS_DIP = rolestr == DIPLSTR

        wr('<h1><em>%s</em> Account Information</h1>' % (un))

        if qs.get('pc'):
            self.render_special_msg('Password changed successfully.')
        if qs.get('ic'):
            self.render_special_msg('Contact info saved.')
        if qs.get('pv'):
            self.render_special_msg('Privacy settings saved.')
        if qs.get('fh'):
            self.render_special_msg('Consultancy setting saved.')

        p = get_user_acct(un)

        wr('''

<div role="tabpanel">

<!-- Nav tabs -->
<ul class="nav nav-pills nav-justified" role="tablist">
<li role="presentation" class="active"><a href="#contact-page" aria-controls="Contact Info" role="tab" data-toggle="tab">Contact Info</a></li>
<li role="presentation"><a href="#password-page" aria-controls="Change Password" role="tab" data-toggle="tab">Change Password</a></li>
<li role="presentation"><a href="#privacy-page" aria-controls="Privacy Settings" role="tab" data-toggle="tab">Privacy Settings</a></li>
            ''')

        if IS_DIP:
            wr('<li role="presentation"><a href="#forhire-page" aria-controls="For Hire?" role="tab" data-toggle="tab">For Hire?</a></li>')

        wr('''
</ul><!-- .nav .nav-pills -->

<div id="acct-container" class="acct-tabs">

<!-- Tab panes -->
<div class="tab-content">
            ''')

        ######################################################

        wr('''
<div role="tabpanel" class="tab-pane active" id="contact-page">
<h2>Your Contact Information</h2>
<form method="POST" action="Acct_Edit_Info" class="form-inline" role="form">
<input type="hidden" name="form_username" value="%s">
<input type="hidden" name="form_hash" value="%s">
            ''' % (un, self.request().cookies().get('hash')))

        wr('''
<div class="form-group">
<label for="fn">First</label>
<input type="text" class="form-control" id="fn" name="fn" value="%s">
</div>
            ''' % ( p.get('fn', '') ))
        wr('''
<div class="form-group">
<label for="mi">MI</label>
<input type="text" class="form-control" id="mi" name="mi" value="%s" size="2">
</div>
            ''' % ( p.get('mi', '') ))
        wr('''
<div class="form-group">
<label for="sn">Last</label>
<input type="text" class="form-control" id="sn" name="sn" value="%s">
</div>
<br>
            ''' % ( p.get('sn', '') ))
        wr('''
<div class="form-group">
<label for="degrees">Degrees Held</label>
<input type="text" class="form-control" id="degrees" name="degrees" value="%s">
</div>
<br>
            ''' % ( p.get('degrees', '') ))
        wr('''
<div class="form-group">
<label for="country">Country</label>
<input type="text" class="form-control" id="country" name="country" value="%s">
</div>
<br>
            ''' % ( p.get('country', '') ))
        wr('''
<div class="form-group">
<label for="addr1">Addr 1</label>
<input type="text" class="form-control" id="addr1" name="addr1" value="%s">
</div>
            ''' % ( p.get('addr1', '') ))
        wr('''
<div class="form-group">
<label for="addr1">Addr 2</label>
<input type="text" class="form-control" id="addr2" name="addr2" value="%s">
</div>
<br>
            ''' % ( p.get('addr2', '') ))
        wr('''
<div class="form-group">
<label for="city">City</label>
<input type="text" class="form-control" id="city" name="city" value="%s">
</div>
            ''' % ( p.get('city', '') ))
        wr('''
<div class="form-group">
<label for="state">State/Prov.</label>
<input type="text" class="form-control" id="state" name="state" value="%s">
</div>
            ''' % ( p.get('state', '') ))
        wr('''
<div class="form-group">
<label for="zip">ZIP/Postal Code</label>
<input type="text" class="form-control" id="zip" name="zip" value="%s">
</div>
<br>
            ''' % ( p.get('zip', '') ))
        wr('''
<div class="form-group">
<label for="zip">Email</label>
<input type="email" class="form-control" id="email" name="email" value="%s">
</div>
<br>
<input type="hidden" name="original_email" value="%s">
            ''' % ( p.get('email', ''), p.get('email', '') ))
        wr('''
<div class="form-group">
<label for="zip">Phone</label>
<input type="text" class="form-control" id="phone" name="phone" value="%s">
</div>
<br>
            ''' % ( p.get('phone', '') ))
        wr('''
<div class="form-group">
<label for="zip">Fax</label>
<input type="text" class="form-control" id="fax" name="fax" value="%s">
</div>
<br>
            ''' % ( p.get('fax', '') ))
        wr('''
<div class="form-group">
<label for="institution">Institution(s)</label>
<input type="text" class="form-control" id="institution" name="institution" value="%s">
</div>
<br>
            ''' % ( p.get('institution', '') ))

        if 'honorary' in p.get('roles', []):
            wr('''
<div class="form-group">
<label for="conferred">Honorary Diplomate Year Conferred</label>
<input type="text" class="form-control" id="conferred" name="conferred" value="%s">
</div>
<br>
                ''' % ( p.get('conferred', '') ))

        if 'memoriam' in p.get('roles', []):
            wr('''
<div class="form-group">
<label for="birthyear">In Memoriam: Born</label>
<input type="text" class="form-control" id="birthyear" name="birthyear" value="%s" size="4">
</div>
<div class="form-group">
<label for="deathyear">Died</label>
<input type="text" class="form-control" id="deathyear" name="deathyear" value="%s" size="4">
</div>
<br>
                ''' % ( p.get('birthyear', ''), p.get('deathyear', '') ))

        wr('''
<input type="submit" value="Save Contact Info" class="btn btn-orange">
</form>
</div><!-- #contact-page -->
            ''')

        ######################################################
        wr('''
<div role="tabpanel" class="tab-pane" id="password-page">
<h2>Change Your Password</h2>
<p>If you wish to keep your current password, you shouldn\'t do anything here.</p>
<form method="POST" action="Acct_Change_Pass" class="form-inline" role="form">
<input type="hidden" name="form_username" value="%s">
<input type="hidden" name="form_hash" value="%s">
<p>Enter your new password twice:</p>
            ''' % (un, self.request().cookies().get('hash')))

        wr('''
<div class="form-group">
<label for="pw1">Password</label>
<input type="password" class="form-control" id="pw1" name="pw1" value="">
</div>
<br>
<div class="form-group">
<label for="pw2">Password</label>
<input type="password" class="form-control" id="pw2" name="pw2" value="">
</div>
<br>
<input type="submit" value="Change Password" class="btn btn-orange">
</form>
</div><!-- #password-page -->
            ''')

        ######################################################
        # radio_jq (name, value='', clss='', id='', checked=False)

        wr('''
<div role="tabpanel" class="tab-pane" id="privacy-page">
<h2>Your Privacy Settings</h2>
<p>Your current privacy settings are shown below. Change them as you see fit.</p>
<form method="POST" action="Acct_Change_Privacy" class="form-inline" role="form">
<input type="hidden" name="form_username" value="%s">
<input type="hidden" name="form_hash" value="%s">
            ''' % (un, self.request().cookies().get('hash')))
        wr('''
<fieldset>
<legend>Please select your overall security posture:</legend>
<div class="radio">
  <label for="sec-paranoid">
    %s Hide all my information from everyone
  </label>
</div>
            ''' % (radio_jq('sec_policy', 'paranoid', '', 'sec-paranoid', (p.get('sec_policy')=='paranoid'))))
        wr('''
<div class="radio">
  <label for="sec-permissive">
    %s Display some of my information, specified below
  </label>
</div>
</fieldset>
            ''' % (radio_jq('sec_policy', 'permissive', '', 'sec-permissive', (p.get('sec_policy')=='permissive'))))

        # ------------------------------------------------------

        wr('''
<fieldset>
<legend class="sec-legend">Who should be allowed to view your full postal address?</legend>
<div class="radio">
  <label for="hide1">
    %s Nobody; show only my city &amp; state
  </label>
</div>
<br>
            ''' % (radio_jq('show_address', 'hide', 'sec-sub', 'hide1', (p.get('show_address')=='hide'))))
        wr('''
<div class="radio">
  <label for="dips1">
    %s ACVAA Diplomates only
  </label>
</div>
<br>
            ''' % (radio_jq('show_address', 'diplomates', 'sec-sub', 'dips1', (p.get('show_address')=='diplomates'))))
        wr('''
<div class="radio">
  <label for="both1">
    %s ACVAA Diplomates &amp; Candidates
  </label>
</div>
<br>
            ''' % (radio_jq('show_address', 'both', 'sec-sub', 'both1', (p.get('show_address')=='both'))))
        wr('''
<div class="radio">
  <label for="all1">
    %s Everyone, even the general public
  </label>
</div>
</fieldset>
            ''' % (radio_jq('show_address', 'all', 'sec-sub', 'all1', (p.get('show_address')=='all'))))

        # ------------------------------------------------------
        wr('''
<fieldset>
<legend class="sec-legend">Who should be allowed to view your email address?</legend>

<div class="radio">
  <label for="hide2">
    %s Nobody
  </label>
</div>
<br>
            ''' % (radio_jq('show_email', 'hide', 'sec-sub', 'hide2', (p.get('show_email')=='hide'))))
        wr('''
<div class="radio">
  <label for="dips2">
    %s ACVAA Diplomates only
  </label>
</div>
<br>
            ''' % (radio_jq('show_email', 'diplomates', 'sec-sub', 'dips2', (p.get('show_email')=='diplomates'))))
        wr('''
<div class="radio">
  <label for="both2">
    %s ACVAA Diplomates &amp; Candidates
  </label>
</div>
<br>
            ''' % (radio_jq('show_email', 'both', 'sec-sub', 'both2', (p.get('show_email')=='both'))))
        wr('''
<div class="radio">
  <label for="all2">
    %s Everyone, even the general public
  </label>
</div>
</fieldset>
            ''' % (radio_jq('show_email', 'all', 'sec-sub', 'all2', (p.get('show_email')=='all'))))

        # ------------------------------------------------------

        wr('''
<fieldset>
<legend class="sec-legend">Who should be allowed to view your phone &amp; fax numbers?</legend>

<div class="radio">
  <label for="hide3">
    %s Nobody
  </label>
</div>
<br>
            ''' % (radio_jq('show_numbers', 'hide', 'sec-sub', 'hide3', (p.get('show_numbers')=='hide'))))
        wr('''
<div class="radio">
  <label for="dips3">
    %s ACVAA Diplomates only
  </label>
</div>
<br>
            ''' % (radio_jq('show_numbers', 'diplomates', 'sec-sub', 'dips3', (p.get('show_numbers')=='diplomates'))))
        wr('''
<div class="radio">
  <label for="both3">
    %s ACVAA Diplomates &amp; Candidates
  </label>
</div>
<br>
            ''' % (radio_jq('show_numbers', 'both', 'sec-sub', 'both3', (p.get('show_numbers')=='both'))))
        wr('''
<div class="radio">
  <label for="all3">
    %s Everyone, even the general public
  </label>
</div>
</fieldset>
<br>
<input type="submit" value="Save Privacy Settings" class="btn btn-orange">
</form>
</div><!-- #privacy-page -->
            ''' % (radio_jq('show_numbers', 'all', 'sec-sub', 'all3', (p.get('show_numbers')=='all'))))

        ######################################################

        if IS_DIP:
            wr('''
<div role="tabpanel" class="tab-pane" id="forhire-page">
<h2>For Hire?</h2>
<p>Control whether or not you wish to be listed in our "Consultants for Hire" section, which is intended to help other vets connect with ACVAA members.</p>
                ''')
            if p.get('sec_policy')=='paranoid':
                wr('''
<p>Unfortunately, you have selected to hide all your information. You must <em>adjust your privacy settings</em> to allow some information about you be available to the public before you can be included in the "Consultants for Hire" list.</p>
                    ''')
            else:
                wr('''
<form method="POST" action="Acct_Change_Hire" class="form-inline" role="form">
<input type="hidden" name="form_username" value="%s">
<input type="hidden" name="form_hash" value="%s">
                    ''' % (un, self.request().cookies().get('hash')))

                wr('''
<fieldset>
<legend class="sec-legend">Do you wish to be listed as a Consultant for Hire?</legend>

<div class="radio">
  <label for="for-hire-yes">
    %s Yes, that would be fantastic.
  </label>
</div>
<br>
                    ''' % (radio_jq('show_for_hire', 'yes', 'sec-sub', 'for-hire-yes', (p.get('show_for_hire')=='yes'))))
                wr('''
<div class="radio">
  <label for="for-hire-no">
    %s No.
  </label>
</div>
</fieldset>
                    ''' % (radio_jq('show_for_hire', 'no', 'sec-sub', 'for-hire-no', (p.get('show_for_hire')!='yes'))))
                wr('''
<div id="for-hire-extra-info">
  <div>
    <b>What geographic area(s) do you serve?</b><br />
    <textarea name="for_hire_areas" class="form-control" rows="3" cols="60">%s</textarea>
  </div>
                    ''' % (p.get('for_hire_areas', '')))
                wr('''
  <div>
    <b>What services do you provide?</b><br />
    <textarea name="for_hire_services" class="form-control" rows="3" cols="60">%s</textarea>
  </div>
                    ''' % (p.get('for_hire_services', '')))
                wr('''
  <div>
    <div class="form-group">
      <label for="for_hire_url">If you have a website, provide it here:</label><br>
      <input type="text" class="form-control" id="for_hire_url" name="for_hire_url" value="%s">
    </div>
  </div>
</div><!-- #for-hire-extra-info -->

<br>
<input type="submit" value="Save Consultancy Status" class="btn btn-orange">
</form>
</div><!-- #forhire-page -->

</div><!-- tab-content -->
</div><!-- acct-container -->
</div><!-- tabpanel -->
                    ''' % (p.get('for_hire_url', '')))
Exemple #15
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()

        # Admins can change others.
        ISA = is_site_admin(self.request())
        asuserid = qs.get('asuserid')

        rolestr = self.request().cookies().get('role', '')
        IS_DIP = rolestr == DIPLSTR

        wr('<h1><em>%s</em> Account Information</h1>' % (un))

        if qs.get('pc'):
            self.render_special_msg('Password changed successfully.')
        if qs.get('ic'):
            self.render_special_msg('Contact info saved.')
        if qs.get('pv'):
            self.render_special_msg('Privacy settings saved.')
        if qs.get('fh'):
            self.render_special_msg('Consultancy setting saved.')

        p = get_user_acct(un)
        if ISA and asuserid:
            p = get_user_acct(asuserid)

        wr('<div id="acct-container" class="acct-tabs"> ')
        wr('<ul class="idTabs">')
        wr('<li><a class="selected" href="#tab1">Contact Info</a></li> ')
        wr('<li><a href="#tab2">Change Password</a></li> ')
        wr('<li><a href="#tab3">Privacy Settings</a></li> ')
        if IS_DIP:
            wr('<li><a href="#tab4">For Hire?</a></li> ')
        wr('</ul> ')
        ######################################################
        wr('<div id="tab1">')
        wr('<h2>Your Contact Information</h2>')
        wr('<form method="POST" action="Acct_Edit_Info">')
        wr(hidden('form_username', un))
        wr(hidden('form_hash', self.request().cookies().get('hash')))
        wr('<div><table id="contact_info">')
        wr('<tr><td><label>First</label>')
        wr('<td>%s' % (text('fn', p.get('fn', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>MI</label>')
        wr('<td>%s' % (text('mi', p.get('mi', ''), 'input', 2)))
        wr('<tr><td><label>Last</label>')
        wr('<td>%s' % (text('sn', p.get('sn', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>Degrees Held</label>')
        wr('<td>%s' % (text('degrees', p.get('degrees', ''), 'input', 6)))
        wr('<td class="hint">(e.g., Ph.D., MBA, MS, etc.)')
        wr('<tr><td><label>Country</label>')
        wr('<td>%s' % (text('country', p.get('country', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>Addr 1</label>')
        wr('<td>%s' % (text('addr1', p.get('addr1', ''), 'input')))
        wr('<tr><td><label>Addr 2</label>')
        wr('<td>%s' % (text('addr2', p.get('addr2', ''), 'input')))
        wr('<tr><td><label>City</label>')
        wr('<td>%s' % (text('city', p.get('city', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>State/Prov.</label>')
        wr('<td>%s' % (text('state', p.get('state', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>ZIP/Postal Code</label>')
        wr('<td>%s' % (text('zip', p.get('zip', ''), 'input', 6)))
        wr('<tr><td><label>Email</label>')
        wr(hidden('original_email', p.get('email', '')))
        wr('<td>%s' % (text('email', p.get('email', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>Phone</label>')
        wr('<td>%s' % (text('phone', p.get('phone', ''), 'input')))
        wr('<tr><td><label>Fax</label>')
        wr('<td>%s' % (text('fax', p.get('fax', ''), 'input')))
        wr('<tr><td colspan="3">')
        wr(submit('Save Contact Info'))
        wr('</table></div>')
        wr('</form>')
        wr('</div><!-- tab1 -->')
        ######################################################
        wr('<div id="tab2">')
        wr('<h2>Change Your Password</h2>')
        wr('<div>If you wish to keep your current password, you shouldn\'t do anything here.</div>')
        wr('<form method="POST" action="Acct_Change_Pass">')
        wr(hidden('form_username', un))
        wr(hidden('form_hash', self.request().cookies().get('hash')))
        wr('<div>Enter your new password twice:</div>')
        wr('<div>%s</div>' % ( passwd('pw1', '', 'input', 24) ))
        wr('<div>%s</div>' % ( passwd('pw2', '', 'input', 24) ))
        wr('<div>%s</div>' % ( submit('Change Password') ))
        wr('</form>')
        wr('</div><!-- tab2 -->')
        ######################################################
        # radio_jq (name, value='', clss='', id='', checked=False)
        wr('<div id="tab3">')
        wr('<h2>Your Privacy Settings</h2>')
        wr('<div>Your current privacy settings are shown below. Change them as you see fit.</div>')
        wr('<form method="POST" action="Acct_Change_Privacy">')
        wr(hidden('form_username', un))
        wr(hidden('form_hash', self.request().cookies().get('hash')))
        wr('<div><table id="contact_info">')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend>Please select your overall security posture:</legend>')
        wr('<tr><td>')
        wr('<label for="sec-paranoid">%s Hide all my information from everyone</label><br />' % \
            (radio_jq('sec_policy', 'paranoid', '', 'sec-paranoid', (p.get('sec_policy')=='paranoid') )))
        wr('<label for="sec-permissive">%s Display some of my information, specified below</label>' % \
            (radio_jq('sec_policy', 'permissive', '', 'sec-permissive', (p.get('sec_policy')=='permissive') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend class="sec-legend">Who should be allowed to view your full postal address?</legend>')
        wr('<tr><td class="sec-td">')
        wr('<label for="hide1">%s Nobody; show only my city &amp; state</label><br />' % \
            (radio_jq('show_address', 'hide', 'sec-sub', 'hide1', (p.get('show_address')=='hide') )))
        wr('<label for="dips1">%s ACVA Diplomates only</label><br />' % \
            (radio_jq('show_address', 'diplomates', 'sec-sub', 'dips1', (p.get('show_address')=='diplomates') )))
        wr('<label for="both1">%s ACVA Diplomates &amp; Candidates</label><br />' % \
            (radio_jq('show_address', 'both', 'sec-sub', 'both1', (p.get('show_address')=='both') )))
        wr('<label for="all1">%s Everyone, even the general public</label>' % \
            (radio_jq('show_address', 'all', 'sec-sub', 'all1', (p.get('show_address')=='all') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend class="sec-legend">Who should be allowed to view your email address?</legend>')
        wr('<tr><td class="sec-td">')
        wr('<label for="hide2">%s Nobody</label><br />' % \
            (radio_jq('show_email', 'hide', 'sec-sub', 'hide2', (p.get('show_email')=='hide') )))
        wr('<label for="dips2">%s ACVA Diplomates only</label><br />' % \
            (radio_jq('show_email', 'diplomates', 'sec-sub', 'dips2', (p.get('show_email')=='diplomates') )))
        wr('<label for="both2">%s ACVA Diplomates &amp; Candidates</label><br />' % \
            (radio_jq('show_email', 'both', 'sec-sub', 'both2', (p.get('show_email')=='both') )))
        wr('<label for="all2">%s Everyone, even the general public</label>' % \
            (radio_jq('show_email', 'all', 'sec-sub', 'all2', (p.get('show_email')=='all') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend class="sec-legend">Who should be allowed to view your phone &amp; fax numbers?</legend>')
        wr('<tr><td class="sec-td">')
        wr('<label for="hide3">%s Nobody</label><br />' % \
            (radio_jq('show_numbers', 'hide', 'sec-sub', 'hide3', (p.get('show_numbers')=='hide') )))
        wr('<label for="dips3">%s ACVA Diplomates only</label><br />' % \
            (radio_jq('show_numbers', 'diplomates', 'sec-sub', 'dips3', (p.get('show_numbers')=='diplomates') )))
        wr('<label for="both3">%s ACVA Diplomates &amp; Candidates</label><br />' % \
            (radio_jq('show_numbers', 'both', 'sec-sub', 'both3', (p.get('show_numbers')=='both') )))
        wr('<label for="all3">%s Everyone, even the general public</label>' % \
            (radio_jq('show_numbers', 'all', 'sec-sub', 'all3', (p.get('show_numbers')=='all') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<tr><td>%s' % (submit('Save Privacy Settings')))
        wr('</table></div>')
        wr('</form>')
        wr('</div><!-- tab3 -->')
        ######################################################
        if IS_DIP:
            wr('<div id="tab4">')
            wr('<h2>For Hire?</h2>')
            wr('<div>Control whether or not you wish to be listed in our "Consultants for Hire" section, which is intended to help other vets connect with ACVA members.</div>')
            if p.get('sec_policy')=='paranoid':
                wr('<div>Unfortunately, you have selected to hide all your information. You must <em>adjust your privacy settings</em> to allow some information about you be available to the public before you can be included in the "Consultants for Hire" list.</div>')
            else:
                wr('<form method="POST" action="Acct_Change_Hire">')
                wr(hidden('form_username', un))
                wr(hidden('form_hash', self.request().cookies().get('hash')))
                wr('<div>')
                wr('<fieldset>')
                wr('<legend class="sec-legend">Do you wish to be listed as a Consultant for Hire?</legend>')
                wr('')
                wr('<label for="for-hire-yes">%s Yes, that would be fantastic.</label><br />' % \
                    (radio_jq('show_for_hire', 'yes', 'sec-sub', 'for-hire-yes', (p.get('show_for_hire')=='yes') )))
                wr('<label for="for-hire-no">%s No.</label><br />' % \
                    (radio_jq('show_for_hire', 'no', 'sec-sub', 'for-hire-no', (p.get('show_for_hire')!='yes') )))
                wr('</fieldset>')
                wr('<div id="for-hire-extra-info">')

                wr('<div>')
                wr('<b>What geographic area(s) do you serve?</b><br />')
                wr('<textarea name="for_hire_areas" class="input" cols="60" rows="3">%s</textarea>' % (p.get('for_hire_areas', '')))
                wr('</div>')

                wr('<div>')
                wr('<b>What services do you provide?</b><br />')
                wr('<textarea name="for_hire_services" class="input" cols="60" rows="3">%s</textarea>' % (p.get('for_hire_services', '')))
                wr('</div>')

                wr('<div>')
                wr('<b>If you have a website, provide it here:</b><br />')
                wr(text('for_hire_url', value=p.get('for_hire_url', ''), clss='input'))
                wr('</div>')

                wr('</div>')
                wr('%s' % (submit('Save Consultancy Status')))
                wr('</div>')
                wr('</form>')
    
            wr('</div><!-- tab4 -->')
        ######################################################
        wr('</div><!-- acct-container -->')
Exemple #16
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 -->')
Exemple #17
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()

        # Admins can change others.
        ISA = is_site_admin(self.request())
        asuserid = qs.get('asuserid')

        rolestr = self.request().cookies().get('role', '')
        IS_DIP = rolestr == DIPLSTR

        wr('<h1><em>%s</em> Account Information</h1>' % (un))

        if qs.get('pc'):
            self.render_special_msg('Password changed successfully.')
        if qs.get('ic'):
            self.render_special_msg('Contact info saved.')
        if qs.get('pv'):
            self.render_special_msg('Privacy settings saved.')
        if qs.get('fh'):
            self.render_special_msg('Consultancy setting saved.')

        p = get_user_acct(un)
        if ISA and asuserid:
            p = get_user_acct(asuserid)

        wr('<div id="acct-container" class="acct-tabs"> ')
        wr('<ul class="idTabs">')
        wr('<li><a class="selected" href="#tab1">Contact Info</a></li> ')
        wr('<li><a href="#tab2">Change Password</a></li> ')
        wr('<li><a href="#tab3">Privacy Settings</a></li> ')
        if IS_DIP:
            wr('<li><a href="#tab4">For Hire?</a></li> ')
        wr('</ul> ')
        ######################################################
        wr('<div id="tab1">')
        wr('<h2>Your Contact Information</h2>')
        wr('<form method="POST" action="Acct_Edit_Info">')
        wr(hidden('form_username', un))
        wr(hidden('form_hash', self.request().cookies().get('hash')))
        wr('<div><table id="contact_info">')
        wr('<tr><td><label>First</label>')
        wr('<td>%s' % (text('fn', p.get('fn', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>MI</label>')
        wr('<td>%s' % (text('mi', p.get('mi', ''), 'input', 2)))
        wr('<tr><td><label>Last</label>')
        wr('<td>%s' % (text('sn', p.get('sn', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>Degrees Held</label>')
        wr('<td>%s' % (text('degrees', p.get('degrees', ''), 'input', 6)))
        wr('<td class="hint">(e.g., Ph.D., MBA, MS, etc.)')
        wr('<tr><td><label>Country</label>')
        wr('<td>%s' % (text('country', p.get('country', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>Addr 1</label>')
        wr('<td>%s' % (text('addr1', p.get('addr1', ''), 'input')))
        wr('<tr><td><label>Addr 2</label>')
        wr('<td>%s' % (text('addr2', p.get('addr2', ''), 'input')))
        wr('<tr><td><label>City</label>')
        wr('<td>%s' % (text('city', p.get('city', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>State/Prov.</label>')
        wr('<td>%s' % (text('state', p.get('state', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>ZIP/Postal Code</label>')
        wr('<td>%s' % (text('zip', p.get('zip', ''), 'input', 6)))
        wr('<tr><td><label>Email</label>')
        wr(hidden('original_email', p.get('email', '')))
        wr('<td>%s' % (text('email', p.get('email', ''), 'input')))
        wr('<td class="req">required')
        wr('<tr><td><label>Phone</label>')
        wr('<td>%s' % (text('phone', p.get('phone', ''), 'input')))
        wr('<tr><td><label>Fax</label>')
        wr('<td>%s' % (text('fax', p.get('fax', ''), 'input')))
        wr('<tr><td colspan="3">')
        wr(submit('Save Contact Info'))
        wr('</table></div>')
        wr('</form>')
        wr('</div><!-- tab1 -->')
        ######################################################
        wr('<div id="tab2">')
        wr('<h2>Change Your Password</h2>')
        wr('<div>If you wish to keep your current password, you shouldn\'t do anything here.</div>'
           )
        wr('<form method="POST" action="Acct_Change_Pass">')
        wr(hidden('form_username', un))
        wr(hidden('form_hash', self.request().cookies().get('hash')))
        wr('<div>Enter your new password twice:</div>')
        wr('<div>%s</div>' % (passwd('pw1', '', 'input', 24)))
        wr('<div>%s</div>' % (passwd('pw2', '', 'input', 24)))
        wr('<div>%s</div>' % (submit('Change Password')))
        wr('</form>')
        wr('</div><!-- tab2 -->')
        ######################################################
        # radio_jq (name, value='', clss='', id='', checked=False)
        wr('<div id="tab3">')
        wr('<h2>Your Privacy Settings</h2>')
        wr('<div>Your current privacy settings are shown below. Change them as you see fit.</div>'
           )
        wr('<form method="POST" action="Acct_Change_Privacy">')
        wr(hidden('form_username', un))
        wr(hidden('form_hash', self.request().cookies().get('hash')))
        wr('<div><table id="contact_info">')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend>Please select your overall security posture:</legend>')
        wr('<tr><td>')
        wr('<label for="sec-paranoid">%s Hide all my information from everyone</label><br />' % \
            (radio_jq('sec_policy', 'paranoid', '', 'sec-paranoid', (p.get('sec_policy')=='paranoid') )))
        wr('<label for="sec-permissive">%s Display some of my information, specified below</label>' % \
            (radio_jq('sec_policy', 'permissive', '', 'sec-permissive', (p.get('sec_policy')=='permissive') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend class="sec-legend">Who should be allowed to view your full postal address?</legend>'
           )
        wr('<tr><td class="sec-td">')
        wr('<label for="hide1">%s Nobody; show only my city &amp; state</label><br />' % \
            (radio_jq('show_address', 'hide', 'sec-sub', 'hide1', (p.get('show_address')=='hide') )))
        wr('<label for="dips1">%s ACVA Diplomates only</label><br />' % \
            (radio_jq('show_address', 'diplomates', 'sec-sub', 'dips1', (p.get('show_address')=='diplomates') )))
        wr('<label for="both1">%s ACVA Diplomates &amp; Candidates</label><br />' % \
            (radio_jq('show_address', 'both', 'sec-sub', 'both1', (p.get('show_address')=='both') )))
        wr('<label for="all1">%s Everyone, even the general public</label>' % \
            (radio_jq('show_address', 'all', 'sec-sub', 'all1', (p.get('show_address')=='all') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend class="sec-legend">Who should be allowed to view your email address?</legend>'
           )
        wr('<tr><td class="sec-td">')
        wr('<label for="hide2">%s Nobody</label><br />' % \
            (radio_jq('show_email', 'hide', 'sec-sub', 'hide2', (p.get('show_email')=='hide') )))
        wr('<label for="dips2">%s ACVA Diplomates only</label><br />' % \
            (radio_jq('show_email', 'diplomates', 'sec-sub', 'dips2', (p.get('show_email')=='diplomates') )))
        wr('<label for="both2">%s ACVA Diplomates &amp; Candidates</label><br />' % \
            (radio_jq('show_email', 'both', 'sec-sub', 'both2', (p.get('show_email')=='both') )))
        wr('<label for="all2">%s Everyone, even the general public</label>' % \
            (radio_jq('show_email', 'all', 'sec-sub', 'all2', (p.get('show_email')=='all') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<fieldset>')
        wr('<legend class="sec-legend">Who should be allowed to view your phone &amp; fax numbers?</legend>'
           )
        wr('<tr><td class="sec-td">')
        wr('<label for="hide3">%s Nobody</label><br />' % \
            (radio_jq('show_numbers', 'hide', 'sec-sub', 'hide3', (p.get('show_numbers')=='hide') )))
        wr('<label for="dips3">%s ACVA Diplomates only</label><br />' % \
            (radio_jq('show_numbers', 'diplomates', 'sec-sub', 'dips3', (p.get('show_numbers')=='diplomates') )))
        wr('<label for="both3">%s ACVA Diplomates &amp; Candidates</label><br />' % \
            (radio_jq('show_numbers', 'both', 'sec-sub', 'both3', (p.get('show_numbers')=='both') )))
        wr('<label for="all3">%s Everyone, even the general public</label>' % \
            (radio_jq('show_numbers', 'all', 'sec-sub', 'all3', (p.get('show_numbers')=='all') )))
        wr('</fieldset>')
        # ------------------------------------------------------
        wr('<tr><td>%s' % (submit('Save Privacy Settings')))
        wr('</table></div>')
        wr('</form>')
        wr('</div><!-- tab3 -->')
        ######################################################
        if IS_DIP:
            wr('<div id="tab4">')
            wr('<h2>For Hire?</h2>')
            wr('<div>Control whether or not you wish to be listed in our "Consultants for Hire" section, which is intended to help other vets connect with ACVA members.</div>'
               )
            if p.get('sec_policy') == 'paranoid':
                wr('<div>Unfortunately, you have selected to hide all your information. You must <em>adjust your privacy settings</em> to allow some information about you be available to the public before you can be included in the "Consultants for Hire" list.</div>'
                   )
            else:
                wr('<form method="POST" action="Acct_Change_Hire">')
                wr(hidden('form_username', un))
                wr(hidden('form_hash', self.request().cookies().get('hash')))
                wr('<div>')
                wr('<fieldset>')
                wr('<legend class="sec-legend">Do you wish to be listed as a Consultant for Hire?</legend>'
                   )
                wr('')
                wr('<label for="for-hire-yes">%s Yes, that would be fantastic.</label><br />' % \
                    (radio_jq('show_for_hire', 'yes', 'sec-sub', 'for-hire-yes', (p.get('show_for_hire')=='yes') )))
                wr('<label for="for-hire-no">%s No.</label><br />' % \
                    (radio_jq('show_for_hire', 'no', 'sec-sub', 'for-hire-no', (p.get('show_for_hire')!='yes') )))
                wr('</fieldset>')
                wr('<div id="for-hire-extra-info">')

                wr('<div>')
                wr('<b>What geographic area(s) do you serve?</b><br />')
                wr('<textarea name="for_hire_areas" class="input" cols="60" rows="3">%s</textarea>'
                   % (p.get('for_hire_areas', '')))
                wr('</div>')

                wr('<div>')
                wr('<b>What services do you provide?</b><br />')
                wr('<textarea name="for_hire_services" class="input" cols="60" rows="3">%s</textarea>'
                   % (p.get('for_hire_services', '')))
                wr('</div>')

                wr('<div>')
                wr('<b>If you have a website, provide it here:</b><br />')
                wr(
                    text('for_hire_url',
                         value=p.get('for_hire_url', ''),
                         clss='input'))
                wr('</div>')

                wr('</div>')
                wr('%s' % (submit('Save Consultancy Status')))
                wr('</div>')
                wr('</form>')

            wr('</div><!-- tab4 -->')
        ######################################################
        wr('</div><!-- acct-container -->')
Exemple #18
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        wr('<h1>%s</h1>' % (self.title()))

        harvest_code = qs.get('hc')
        if harvest_code == HARV_DIPL:
            acct_type = 'Diplomate'
        elif harvest_code == HARV_RESD:
            acct_type = 'Candidate'

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = self.request().fields()
            ERROR = None
            required = {'hc': 'validation code', 'fn': 'first name', 'sn': 'surname', 'city': 'city', 'state': 'state', 'email': 'email', 'pw1': 'first password', 'pw2': 'second password'}
            for r in required.keys():
                if not form.get(r):
                    ERROR = 'The field "%s" is required.' % (required.get(r))
            if form.get('pw1') != form.get('pw2'):
                ERROR = 'The two passwords you entered are not the same.'
            if not ERROR:
                ERROR = check_email_address(form.get('email'))
            if not ERROR:
                if is_email_registered(form.get('email')):
                    ERROR = 'We already have an account that uses the email address: %s.' % (form.get('email'))

            if ERROR:
                self.render_form_error('Registration Error', ERROR)
            else:
                newid = save_registration(form)

                # Auto Login
                userinfo = get_user_acct(newid)
                hvc = hash_string(userinfo.get('vcode'))
                ex1 = self.getCookieExpiry('maxAge', y=10)
                ex2 = self.getCookieExpiry('Expires', y=10)
                self.setCookie('username', newid, ex1, ex2)
                self.setCookie('hash', hvc, ex1, ex2)
                possible_role = get_user_role(newid)
                if possible_role:
                    self.setCookie('role', possible_role, ex1, ex2)

                wr('<h2>Success!</h2>')
                wr('<P>Your ACVAA %s account has been created. Your site user name is:</P>' % (acct_type))
                wr('<h3>%s</h3>' % (newid))
                wr('''
<P><em>IMPORTANT!</em> Don\'t lose your user name.</P>

<P>An email confirming your account registration will be sent ASAP; it will also include your site user name.</P>

<p>
You are now logged in. You can:
</p>

<p>
<a href="Account">Manage your account</a><br />
You can also change your privacy settings here.
</p>

<p>
<a href="Directory">View the member directory</a>
</p>

<p>
<a href="Calendar">Check out the events calendar</a>
</p>
                    ''')

        else:
            if harvest_code and (harvest_code in [HARV_DIPL, HARV_RESD]):
                wr('<div class="sb"><div class="st">')
                wr('<h3>Note</h3>')
                wr('<P>Submitting this form will create a new %s account for you on the ACVAA site.</P>' % (acct_type))
                wr('<P>Please provide as much information as possible; you can specify your privacy settings as you go.</P>')
                wr('</div></div>')
                wr('<form method="POST" action="Register">')
                wr(hidden('hc', harvest_code))
                wr('<h2>%s</h2>' % (acct_type))
                wr('<P><table id="contact_info">')
                wr('<tr><td colspan="3">')
                wr('<fieldset>')
                wr('<legend>Tell us about you.</legend>')
                wr('<tr><td colspan="3">This information will be available to the public.')
                wr('<tr><td><label>First Name</label>')
                wr('<td>%s' % (text('fn', '', clss='input')))
                wr('<td class="req">required')
                wr('<tr><td><label>Middle Initial</label>')
                wr('<td>%s' % (text('mi', '', clss='input', size='2')))
                wr('<tr><td><label>Last Name</label>')
                wr('<td>%s' % (text('sn', '', clss='input')))
                wr('<td class="req">required')
                wr('<tr><td><label>Degrees Held</label>')
                wr('<td>%s' % (text('degrees', '', clss='input', size='6')))
                wr('<td class="hint">(e.g., Ph.D., MBA, MS, etc.)')
                wr('</fieldset>')
                wr('<tr><td colspan="3">')
                wr('<fieldset>')
                wr('<legend>Where are you located?</legend>')
                wr('<tr><td><label>Country</label>')
                wr('<td>%s' % (COUNTRY_SELECT))
                wr('<td class="req">required')
                wr('<tr><td><label>Address 1</label>')
                wr('<td>%s' % (text('addr1', '', clss='input')))
                wr('<tr><td><label>Address 2</label>')
                wr('<td>%s' % (text('addr2', '', clss='input')))
                wr('<tr><td><label>City</label>')
                wr('<td>%s' % (text('city', '', clss='input')))
                wr('<td class="req">required')
                wr('<tr><td><label>State/Prov.</label>')
                wr('<td id="state_slot">')
                wr('<td class="req">required')
                wr('<tr><td><label>ZIP/Postal Code</label>')
                wr('<td>%s' % (text('zip', '', clss='input', size='6')))
                wr('<tr><td colspan="3">Who should be allowed to view your full address?')
                # radio_jq (name, value='', clss='', id='', checked=False)
                wr('<tr><td><td colspan="2">')
                wr('''
                    <label for="hide1">
                    %s
                    Nobody; show only my city &amp; state
                    </label><br />
                    ''' % (radio_jq('show_address', 'hide', '', 'hide1', checked=True)))
                wr('''
                    <label for="dips1">
                    %s
                    ACVAA Diplomates only
                    </label><br />
                    ''' % (radio_jq('show_address', 'diplomates', '', 'dips1', checked=False)))
                wr('''
                    <label for="both1">
                    %s
                    ACVAA Diplomates &amp; Candidates
                    </label><br />
                    ''' % (radio_jq('show_address', 'both', '', 'both1', checked=False)))
                wr('''
                    <label for="all1">
                    %s
                    Everyone, even the general public
                    </label>
                    ''' % (radio_jq('show_address', 'all', '', 'all1', checked=False)))
                wr('</fieldset>')
                wr('<tr><td colspan="3">')
                wr('<fieldset>')
                wr('<legend>How can you be contacted?</legend>')
                wr('<tr><td><label>Email</label>')
                wr('<td>%s' % (text('email', '', clss='input')))
                wr('<td class="req">required')
                wr('<tr><td colspan="3">Who should be allowed to view your email address?')
                wr('<tr><td><td colspan="2">')
                wr('''
                    <label for="hide2">
                    %s
                    Nobody
                    </label><br />
                    ''' % (radio_jq('show_email', 'hide', '', 'hide2', checked=True)))
                wr('''
                    <label for="dips2">
                    %s
                    ACVAA Diplomates only
                    </label><br />
                    ''' % (radio_jq('show_email', 'diplomates', '', 'dips2', checked=False)))
                wr('''
                    <label for="both2">
                    %s
                    ACVAA Diplomates &amp; Candidates
                    </label><br />
                    ''' % (radio_jq('show_email', 'both', '', 'both2', checked=False)))
                wr('''
                    <label for="all2">
                    %s
                    Everyone, even the general public
                    </label>
                    ''' % (radio_jq('show_email', 'all', '', 'all2', checked=False)))
                wr('<tr><td><label>Phone</label>')
                wr('<td>%s' % (text('phone', '', clss='input')))
                wr('<tr><td><label>Fax</label>')
                wr('<td>%s' % (text('fax', '', clss='input')))
                wr('<tr><td colspan="3">Who should be allowed to view your phone &amp; fax numbers?')
                wr('<tr><td><td colspan="2">')
                wr('''
                    <label for="hide3">
                    %s
                    Nobody
                    </label><br />
                    ''' % (radio_jq('show_numbers', 'hide', '', 'hide3', checked=True)))
                wr('''
                    <label for="dips3">
                    %s
                    ACVAA Diplomates only
                    </label><br />
                    ''' % (radio_jq('show_numbers', 'diplomates', '', 'dips3', checked=False)))
                wr('''
                    <label for="both3">
                    %s
                    ACVAA Diplomates &amp; Candidates
                    </label><br />
                    ''' % (radio_jq('show_numbers', 'both', '', 'both3', checked=False)))
                wr('''
                    <label for="all3">
                    %s
                    Everyone, even the general public
                    </label>
                    ''' % (radio_jq('show_numbers', 'all', '', 'all3', checked=False)))
                wr('<tr><td colspan="3">')
                wr('<fieldset>')
                wr('<legend>Choose a password &amp; enter it twice.</legend>')
                wr('<tr><td><label>Password</label>')
                wr('<td>%s' % (passwd('pw1', '', clss='input')))
                wr('<td class="req">required')
                wr('<tr><td><label>Password</label>')
                wr('<td>%s' % (passwd('pw2', '', clss='input')))
                wr('<td class="req">required')
                wr('</fieldset>')
                wr('<tr><td><td colspan="2">')
                wr('<input type="image" src="/g/create_acct_button.png" style="margin-top: 20px;">')
                wr('</table></P>')
                wr('</form>')
            else:
                wr('''<h1 class="error">Validation Error</h1>
                <P>
                Sorry, but you cannot register with the ACVAA site unless you
                use a web address with a proper validation code.
                <em>This is most likely due to the web address having been
                mistyped.</em>
                </P>
                <P>
                Please use only the address provided in the email from ACVAA.
                <em>Copying &amp; pasting the address into your browser is the
                easiest way to avoid mistakes.</em>
                </P>
                <P>
                If you have further problems or questions, please contact
                %s or %s.
                </P>''' % (self.lydia(), self.steph()))
Exemple #19
0
    def writeContent(self):
        wr = self.writeln
        ISA = is_site_admin(self.request())
        ILI = is_logged_in(self.request())
        qs = self.request().fields()
        role = qs.get('role')
        archived = qs.get('archived', None)
        display_results = False
        docslist = []
        titlerole = 'Everyone'
        role_to_check = []

        if role: # Explicit
            if role not in RESTRICTED_ROLES:
                titlerole = role
                docslist = get_docs_by_access(role, archived)
                display_results = True
                role_to_check = role

        else: # Role-based
            if ILI:
                username = self.request().cookies().get('username')
                useracct = get_user_acct(username)
                userroles = useracct.get('roles')
                modroles = modify_user_roles(userroles)
                role_to_check = modroles
                titlerole = ' & '.join(listify_a_thing(modroles))
                docslist = get_docs_by_access(modroles, archived)
                display_results = True

        if ISA:
            wr('<p><a href="DM_Index" class="btn btn-default">Document Management</a></p>')

        # Show archives sidebar?
        archives_exist = do_archived_docs_exist(role_to_check)
        if archives_exist:
            if archived:
                arch_url = 'DM_View?'
                arch_text = 'Active Documents'
            else:
                arch_url = 'DM_View?archived=True'
                arch_text = 'Archived Documents'
            if role:
                arch_url += '&role=%s' % (role)
            wr('<div class="sb"><div class="st"><a href="%s">%s</a></div></div>' % (arch_url, arch_text))

        # Display the documents' info
        if display_results:
            desc_dict = get_descriptions()
            if docslist:
                wr('<h1>')
                if archived:
                    wr('Archived')
                wr('Documents for %s</h1>' % (titlerole))
                wr('<div style="font-size: 10pt;">Click the <i class="fa fa-caret-down"></i> or <i class="fa fa-caret-right"></i> to show/hide sections.</div>')

                all_cats_sorted = get_all_possible_categories()
                docs_by_cat = group_docs_by_category(docslist)

                for MCAT in all_cats_sorted:
                    if MCAT in docs_by_cat:
                        wr('<h2 style="color: #324150; border-top: 1px dotted #324150;">%s' % (MCAT))
                        wr('<i class="fa fa-caret-down doc_hider" id="%s"></i>' % (MCAT))
                        wr('</h2>')
                        wr('<div id="%s_content">' % (MCAT))
                        local_doc_list = docs_by_cat.get(MCAT, [])
                        for doctitle, docfile in local_doc_list:
                            wr('<h3><a href="/DocRepo/%s">%s</a></h3>' % (docfile, doctitle))
                            wr('<p style="margin-top: 0px;">')
                            if desc_dict.get(docfile):
                                wr('<span style="font-style: italic; color: #999999;">%s</span><br>' % (desc_dict.get(docfile)))
                            wr('Filename: %s</p>' % (docfile))
                        wr('</div>')

            else:
                wr('<h3>Sorry, there are no documents to display.</h3>')
        else:
            wr('<h3>Sorry, there are no documents to display.</h3>')