Ejemplo n.º 1
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', '')))
Ejemplo n.º 2
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 -->')
Ejemplo n.º 3
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 -->')
Ejemplo n.º 4
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()))