Beispiel #1
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            ntype, redir = 'news', "News"
            if form.get('annual') == '1':
                ntype, redir = 'annual', "Annual"
            delete_news_item(id, ntype)
            self.response().sendRedirect(redir)

        else:
            wr('<form action="News_Delete" method="POST">')
            wr(hidden('id', id))
            if qs.get('annual') == '1':
                wr(hidden('annual', '1'))
            nii = get_news_item(id)

            wr('<h1>Are you sure you want to delete this news item?</h1>')
            wr('<h3>You cannot undo this operation.</h3>')

            wr('<h2>%s</h2>' % (nii.get('headline')))
            wr('<p>%s</p>' % (nii.get('description')))

            wr(submit('Delete News Item'))
            wr('</form>')
Beispiel #2
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            ntype, redir = 'news', "News"
            if form.get('annual') == '1':
                ntype, redir = 'annual', "Annual"
            delete_news_item(id, ntype)
            self.response().sendRedirect(redir)

        else:
            wr('<form action="News_Delete" method="POST">')
            wr(hidden('id', id))
            if qs.get('annual') == '1':
                wr(hidden('annual', '1'))
            nii = get_news_item(id)

            wr('<h1>Are you sure you want to delete this news item?</h1>')
            wr('<h3>You cannot undo this operation.</h3>')

            wr('<h2>%s</h2>' % (nii.get('headline')))
            wr('<p>%s</p>' % (nii.get('description')))

            wr(submit('Delete News Item'))
            wr('</form>')
Beispiel #3
0
 def writeContent(self):
     wr = self.writeln
     qs = self.request().fields()
     doctype, category, filename = qs.get('doctype'), qs.get('category'), qs.get('filename')
     IS_SITE_ADMIN = is_site_admin(self.request())
     if doctype and filename:
         if IS_SITE_ADMIN:
             if self.request()._environ.get('REQUEST_METHOD') == 'POST':
                 del_document(doctype, category, filename)
                 redir = ''
                 if doctype == 'document':
                     redir += 'Documents?cat=%s' % (category)
                 if doctype == 'report':
                     redir += 'Reports'
                 self.response().sendRedirect(redir)
             else:
                 wr('<h1>%s</h1>' % (self.title()))
                 wr('<P>Are you sure you want to delete this %s?</P>' % (doctype))
                 wr('<P>%s</P>' % (filename))
                 wr('<form method="POST" action="File_Deleter">')
                 wr(hidden('doctype', doctype))
                 wr(hidden('category', category))
                 wr(hidden('filename', filename))
                 wr(submit('Yes, delete the %s.' % (doctype)))
                 wr('<input type="button" value="Do nothing." onClick="javascript:history.go(-1)">')
                 wr('</form>')
         else:
             wr('<p>You are not a site administrator.</p>')
     else:
         wr('<p>No document type and/or filename.</p>')
Beispiel #4
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))
    
            if self.request()._environ.get('REQUEST_METHOD') == 'POST':
                form = self.request().fields()
                username = qs.get('u')
                delete_user_account(username)
                self.response().sendRedirect('UM_Index?delok=%s' % (username))
    
            else:
                wr('<P>Are you sure you want to delete user account: %s?</P>' % (username))
                wr('<form method="POST" action="UM_Delete_User">')
                wr(hidden('u', username))
                wr('<P>')
                wr(submit('Yes'))
                wr('<input type="button" value="No, leave this user account alone!" onclick="javascript:history.go(-1)">')
                wr('</P>')
                wr('</form>')
Beispiel #5
0
 def writeContent(self):
     wr = self.writeln
     ISA = is_site_admin(self.request())
     if ISA:
         if self.request()._environ.get('REQUEST_METHOD') == 'POST':
             form = self.request().fields()
             rm_doc_file(form.get('filename'))
             self.response().sendRedirect('DM_Index')
         else:
             qs = self.request().fields()
             filename = qs.get('fn')
             pick = get_document_properties(filename)
             wr('<h1>%s</h1>' % (self.title()))
             wr('<p>Are you sure you wish to delete this file?</p>')
             wr('<p><table>')
             wr('<tr><td>Filename:<td>%s' % (filename))
             wr('<tr><td>Title:<td>%s' % (pick.get('title', '')))
             wr('<tr><td>Categories:<td>%s' % (', '.join(pick.get('categories', []))))
             wr('<tr><td>Access:<td>%s' % (', '.join(pick.get('roles', []))))
             wr('</table></p>')
             wr('<p><form method="POST" action="DM_Delete_Doc">')
             wr(hidden('filename', filename))
             wr(submit('Yes.'))
             wr('<input type="button" value="No, better to leave well-enough alone." onclick="javascript:history.go(-1)">')
             wr('</form></p>')
Beispiel #6
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id', {})
        fr = qs.get('fr', '')
        username = self.request().cookies().get('username')
        IS_SITE_ADMIN = is_site_admin(self.request())

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            delete_event(username, id)
            if fr:
                if fr == 'cal':
                    self.response().sendRedirect('Calendar')
                if fr == 'mgt':
                    self.response().sendRedirect('Events')
            else:
                self.response().sendRedirect('Calendar')

        else:
            if id:
                ei = get_event_info(id)
                event_owner = ei.get('username')
                if (username == event_owner) or IS_SITE_ADMIN:
                    wr('<h1>%s</h1>' % (self.title()))
                    wr('<h2>%s</h2>' % (ei.get('title')))
                    wr('<P>')
                    wr('<b>%s</b><br />' % (ei.get('display_date')))
                    wr('%s<br />' % (ei.get('description')))
                    wr('</P>')
                    wr('<P>Are you sure you want to delete this event?</P>')
                    wr('<form method="POST" action="Event_Delete">')
                    wr(hidden('id', id))
                    wr(hidden('fr', fr))
                    wr(hidden('username', username))
                    wr(submit('Yes, delete the event.'))
                    wr('<input type="button" value="Do nothing." onClick="javascript:history.go(-1)">'
                       )
                    wr('</form>')
                else:
                    wr('<h1>You are not the owner of this event.</h1>')

            else:
                wr('No event id.')
Beispiel #7
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id', {})
        fr = qs.get('fr', '')
        username = self.request().cookies().get('username')
        IS_SITE_ADMIN = is_site_admin(self.request())

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            delete_event(username, id)
            if fr:
                if fr == 'cal':
                    self.response().sendRedirect('Calendar')
                if fr == 'mgt':
                    self.response().sendRedirect('Events')
            else:
                self.response().sendRedirect('Calendar')

        else:
            if id:
                ei = get_event_info(id)
                event_owner = ei.get('username')
                if (username == event_owner) or IS_SITE_ADMIN:
                    wr('<h1>%s</h1>' % (self.title()))
                    wr('<h2>%s</h2>' % (ei.get('title')))
                    wr('<P>')
                    wr('<b>%s</b><br />' % (ei.get('display_date')))
                    wr('%s<br />' % (ei.get('description')))
                    wr('</P>')
                    wr('<P>Are you sure you want to delete this event?</P>')
                    wr('<form method="POST" action="Event_Delete">')
                    wr(hidden('id', id))
                    wr(hidden('fr', fr))
                    wr(hidden('username', username))
                    wr(submit('Yes, delete the event.'))
                    wr('<input type="button" value="Do nothing." onClick="javascript:history.go(-1)">')
                    wr('</form>')
                else:
                    wr('<h1>You are not the owner of this event.</h1>')

            else:
                wr('No event id.')
Beispiel #8
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')
        username = self.request().cookies().get('username')
        wr('<h1>%s</h1>' % (self.title()))

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            redir = "News"
            if form.get('annualnews') == 'true':
                redir = "Annual"
            if form.get('actionitem') == 'true':
                redir = "Action"
            save_news(form)
            self.response().sendRedirect(redir)
        else:
            wr('<form action="Action_Form" method="POST">')
            nii = {}
            if id:
                nii = get_news_item(id)
                wr(hidden('id', nii.get('id')))
            wr(hidden('username', username))
            wr(hidden('actionitem', 'true'))
            wr('<P>')
            wr('<b>Headline</b>')
            wr('<br />')
            wr(text('headline', value=nii.get('headline', ''), clss='input'))
            wr('</P>')

            wr('<P>')
            wr('<b>Description</b>')
            wr('<br />')
            wr('<textarea name="description" class="input" rows="8" cols="48" >%s</textarea>' % (nii.get('description', '')))
            wr('</P>')

            wr(submit('Save & Publish Action Item'))

            wr('</form>')
Beispiel #9
0
    def render_login_form (self):
        wr = self.writeln
        wr('''
<div class="login">
  <form class="form-inline" method="POST" action="/Login_Attempt">''')
        if not self.request().fields().has_key('from_url'):
            wr(hidden('from_url', self.get_from_url()))
        else:
            wr(hidden('from_url', self.request().fields().get('from_url')))
        wr('''
    <div class="form-group">
      <label class="sr-only" for="username">Username</label>
      <input type="text" class="form-control" id="username" name="username" placeholder="Username">
    </div>
    <div class="form-group">
      <label class="sr-only" for="password">Password</label>
      <input type="password" class="form-control" id="password" name="password" placeholder="Password">
    </div>
    <input class="btn btn-orange btn-sm" type="submit" value="Sign In">
    <span class="sm"><a href="Login_Help">Help?</a></span>
  </form>
</div>
            ''')
Beispiel #10
0
    def render_login_form (self):
        wr = self.writeln
        wr('''
<div class="login">
  <form class="form-inline" method="POST" action="/Login_Attempt">''')
        if not self.request().fields().has_key('from_url'):
            wr(hidden('from_url', self.get_from_url()))
        else:
            wr(hidden('from_url', self.request().fields().get('from_url')))
        wr('''
    <div class="form-group">
      <label class="sr-only" for="username">Username</label>
      <input type="text" class="form-control" id="username" name="username" placeholder="Username">
    </div>
    <div class="form-group">
      <label class="sr-only" for="password">Password</label>
      <input type="password" class="form-control" id="password" name="password" placeholder="Password">
    </div>
    <input class="btn btn-orange btn-sm" type="submit" value="Sign In">
    <span class="sm"><a href="Login_Help">Help?</a></span>
  </form>
</div>
            ''')
Beispiel #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>')
Beispiel #12
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>')
Beispiel #13
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            delete_news_item(id, "actionitem")
            self.response().sendRedirect("Action")

        else:
            wr('<form action="Action_Delete" method="POST">')
            wr(hidden('id', id))
            nii = get_news_item(id)

            wr('<h1>Are you sure you want to delete this action item?</h1>')
            wr('<h3>You cannot undo this operation.</h3>')

            wr('<h2>%s</h2>' % (nii.get('headline')))
            wr('<p>%s</p>' % (nii.get('description')))

            wr(submit('Delete Action Item'))
            wr('</form>')
Beispiel #14
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            delete_news_item(id, "actionitem")
            self.response().sendRedirect("Action")

        else:
            wr('<form action="Action_Delete" method="POST">')
            wr(hidden('id', id))
            nii = get_news_item(id)

            wr('<h1>Are you sure you want to delete this action item?</h1>')
            wr('<h3>You cannot undo this operation.</h3>')

            wr('<h2>%s</h2>' % (nii.get('headline')))
            wr('<p>%s</p>' % (nii.get('description')))

            wr(submit('Delete Action Item'))
            wr('</form>')
Beispiel #15
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))

            if self.request()._environ.get('REQUEST_METHOD') == 'POST':
                form = self.request().fields()
                username = qs.get('u')
                reset_password(username)
                wr('<P>An email containing a new password has been sent to this user.</P>'
                   )

            else:
                wr('<P>Are you sure you want to reset the password for user account: %s?</P>'
                   % (username))
                wr('<form method="POST" action="UM_Reset_User_Pass">')
                wr(hidden('u', username))
                wr('<P>')
                wr(submit('Yes'))
                wr('<input type="button" value="No, I\'ve made an error in judgment!" onclick="javascript:history.go(-1)">'
                   )
                wr('</P>')
                wr('</form>')
Beispiel #16
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')
        username = self.request().cookies().get('username')
        wr('<h1>%s</h1>' % (self.title()))

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            redir = "News"
            if form.get('annualnews') == 'true':
                redir = "Annual"
            save_news(form)
#            wr(form)
            self.response().sendRedirect(redir)
        else:
            wr('<form action="News_Form" method="POST">')
            nii = {}
            if id:
                nii = get_news_item(id)
                wr(hidden('id', nii.get('id')))
            wr(hidden('username', username))
            wr('<P>')
            wr('<b>Headline</b>')
            wr('<br />')
            wr(text('headline', value=nii.get('headline', ''), clss='input'))
            wr('</P>')
            wr('<P>')
            wr('<lable for="annewsck"><input type="checkbox" name="annualnews" value="true" id="annewsck"')
            if qs.get('annual') == '1':
                wr(' CHECKED')
            wr('> Check this box if this is for the Annual Meeting.</label>')
            wr('</P>')

#             wr('<P>')
#             wr('<b>Who can view this news item?</b>')
#             wr('<br />')
#             self.write('<input type="radio" name="visibility" value="all" id="vizall"')
#             if (nii.get('visibility') == 'all') or (not id):
#                 self.write(' CHECKED ')
#             wr('/> <label for="vizall">Everyone</label>')
#             wr('<br />')
#             self.write('<input type="radio" name="visibility" value="restricted" id="vizres"')
#             if nii.get('visibility') == 'restricted':
#                 self.write(' CHECKED ')
#             wr('/> <label for="vizres">Diplomates &amp; Candidates Only</label>')
#             wr('</P>')

#             wr('<P>')
#             wr('<b>Website</b>')
#             wr('<br />')
#             wr('Is there another website you\'d like this news item linked to? If so, provide its URL here.')
#             wr('<br />')
#             wr(text('url', value=nii.get('url', ''), clss='input'))
#             wr('</P>')

            wr('<P>')
            wr('<b>Description</b>')
            wr('<br />')
            wr('<textarea name="description" class="input" rows="8" cols="48" >%s</textarea>' % (nii.get('description', '')))
            wr('</P>')

            wr(submit('Save & Publish News Item'))

            wr('</form>')
Beispiel #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 -->')
Beispiel #18
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')
        username = self.request().cookies().get('username')
        IS_SITE_ADMIN = is_site_admin(self.request())

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            ERROR, ERROR_TYPE = ck_new_event(form)
            if ERROR:
                self.render_form_error(ERROR_TYPE, ERROR)
            else:
                if form.has_key('orig_id'):
                    delete_event(form.get('username'), form.get('orig_id'))
                new_id = save_event(form)
                self.response().sendRedirect('Calendar#%s' % (new_id))
        else:
            ei, event_owner = {}, None
            SHOWFORM = False
            if id:  # Event edit
                ei = get_event_info(id)
                event_owner = ei.get('username')
                if (username == event_owner) or IS_SITE_ADMIN:
                    SHOWFORM = True
            else:  # Event add
                SHOWFORM = True

            if SHOWFORM:
                wr('<h1>%s</h1>' % (self.title()))
                wr('<form name="chooseDateForm" id="chooseDateForm" action="Event_Form" method="POST">'
                   )
                if id:
                    wr(hidden('orig_id', id))
                    wr(hidden('username',
                              event_owner))  # preserve ownership on edit
                else:
                    wr(hidden('username', username))  # assign ownership on add

                wr('<P>')
                wr('<b>Event Title</b>')
                wr('<br />')
                wr(text('title', value=ei.get('title', ''), clss='input'))
                wr('</P>')

                # 'date': ['12', '30', '2009']
                eim, eid, eiy = int(ei.get('date', [0, 0, 0])[0]), int(
                    ei.get('date',
                           [0, 0, 0])[1]), int(ei.get('date', [0, 0, 0])[2])
                wr('<P>')
                wr('<b>Event Date</b>')
                wr('<br />')
                self.render_date_picker(eiy, eim, eid)
                wr('</P>')

                wr('<P>')
                wr('<b>Who can see this event on the calendar?</b>')
                wr('<br />')
                self.write(
                    '<input type="radio" name="visibility" value="all" id="vizall"'
                )
                if (ei.get('visibility') == 'all') or (not id):
                    self.write(' CHECKED ')
                wr('/> <label for="vizall">Everyone</label>')
                wr('<br />')
                self.write(
                    '<input type="radio" name="visibility" value="restricted" id="vizres"'
                )
                if ei.get('visibility') == 'restricted':
                    self.write(' CHECKED ')
                wr('/> <label for="vizres">Diplomates &amp; Candidates Only</label>'
                   )
                wr('</P>')

                wr('<P>')
                wr('<b>Would you like to provide a link to another website?</b>'
                   )
                wr('<br />')
                wr('<b>Text to be Linked</b> (e.g., "Visit the association website for more info.")'
                   )
                wr('<br />')
                wr(
                    text('link_text',
                         value=ei.get('link_text', ''),
                         clss='input'))
                wr('<br />')
                wr('<b>Link Address</b> (e.g., http://www.example.com/)')
                wr('<br />')
                wr(text('link_url', value=ei.get('link_url', ''),
                        clss='input'))
                wr('</P>')

                wr('<P>')
                wr('<b>Description</b>')
                wr('<br />')
                wr('<textarea name="description" class="input" rows="8" cols="48" >%s</textarea>'
                   % (ei.get('description', '')))
                wr('</P>')

                wr(submit('Save & Publish Event'))

                wr('</form>')

            else:  # edit but not owner
                wr('<h1>You are not the owner of this event.</h1>')
Beispiel #19
0
    def writeContent(self):
        wr = self.writeln
        qs = self.request().fields()
        id = qs.get('id')
        username = self.request().cookies().get('username')
        IS_SITE_ADMIN = is_site_admin(self.request())

        if self.request()._environ.get('REQUEST_METHOD') == 'POST':
            form = qs
            ERROR, ERROR_TYPE = ck_new_event(form)
            if ERROR:
                self.render_form_error(ERROR_TYPE, ERROR)
            else:
                if form.has_key('orig_id'):
                    delete_event(form.get('username'), form.get('orig_id'))
                new_id = save_event(form)
                self.response().sendRedirect('Calendar#%s' % (new_id))
        else:
            ei, event_owner = {}, None
            SHOWFORM = False
            if id: # Event edit
                ei = get_event_info(id)
                event_owner = ei.get('username')
                if (username == event_owner) or IS_SITE_ADMIN:
                    SHOWFORM = True
            else: # Event add
                SHOWFORM = True

            if SHOWFORM:
                wr('<h1>%s</h1>' % (self.title()))
                wr('<form name="chooseDateForm" id="chooseDateForm" action="Event_Form" method="POST">')
                if id:
                    wr(hidden('orig_id', id))
                    wr(hidden('username', event_owner)) # preserve ownership on edit
                else:
                    wr(hidden('username', username)) # assign ownership on add

                wr('<P>')
                wr('<b>Event Title</b>')
                wr('<br />')
                wr(text('title', value=ei.get('title', ''), clss='input'))
                wr('</P>')
    
                # 'date': ['12', '30', '2009']
                eim, eid, eiy = int(ei.get('date', [0,0,0])[0]), int(ei.get('date', [0,0,0])[1]), int(ei.get('date', [0,0,0])[2])
                wr('<P>')
                wr('<b>Event Date</b>')
                wr('<br />')
                self.render_date_picker(eiy, eim, eid)
                wr('</P>')
    
                wr('<P>')
                wr('<b>Who can see this event on the calendar?</b>')
                wr('<br />')
                self.write('<input type="radio" name="visibility" value="all" id="vizall"')
                if (ei.get('visibility') == 'all') or (not id):
                    self.write(' CHECKED ')
                wr('/> <label for="vizall">Everyone</label>')
                wr('<br />')
                self.write('<input type="radio" name="visibility" value="restricted" id="vizres"')
                if ei.get('visibility') == 'restricted':
                    self.write(' CHECKED ')
                wr('/> <label for="vizres">Diplomates &amp; Candidates Only</label>')
                wr('</P>')
    
                wr('<P>')
                wr('<b>Would you like to provide a link to another website?</b>')
                wr('<br />')
                wr('<b>Text to be Linked</b> (e.g., "Visit the association website for more info.")')
                wr('<br />')
                wr(text('link_text', value=ei.get('link_text', ''), clss='input'))
                wr('<br />')
                wr('<b>Link Address</b> (e.g., http://www.example.com/)')
                wr('<br />')
                wr(text('link_url', value=ei.get('link_url', ''), clss='input'))
                wr('</P>')
    
                wr('<P>')
                wr('<b>Description</b>')
                wr('<br />')
                wr('<textarea name="description" class="input" rows="8" cols="48" >%s</textarea>' % (ei.get('description', '')))
                wr('</P>')
    
                wr(submit('Save & Publish Event'))
    
                wr('</form>')

            else: # edit but not owner
                wr('<h1>You are not the owner of this event.</h1>')
Beispiel #20
0
    def writeContent(self):
        wr = self.writeln
        ISA = is_site_admin(self.request())
        if ISA:
            form = self.request().fields()
            if self.request()._environ.get('REQUEST_METHOD') == 'POST':
                ERRORS = []
                if not form.get('title'):
                    ERRORS.append('You must provide a title for this document.')
                if not form.get('role'):
                    ERRORS.append('You must allow access to one or more roles.')
                if not form.get('category'):
                    ERRORS.append('You must select one or more categories for this document.')

                if form.get('formaction') == 'add':
                    fobj = form.get('datafile')
                    try:
                        filename = fobj.filename
                    except:
                        ERRORS.append('You must select a file on your computer to upload.')

                if ERRORS:
                    self.render_form_error('Upload Error', '<br>'.join(ERRORS))

                else:
                    if form.get('formaction') == 'add':
                        save_doc_file(form)
                        self.response().sendRedirect('DM_Index')
                    if form.get('formaction') == 'edit':
                        edit_doc_file(form)
                        self.response().sendRedirect('DM_Index')

            else:
                qs = form
                if qs.get('fn'):
                    filename = qs.get('fn')
                    pick = get_document_properties(filename)
                    hideval = 'edit'
                    ttl = 'Edit Document Properties'
                    subval = 'Save Changes'
                else:
                    filename = ''
                    pick = {}
                    hideval = 'add'
                    ttl = 'Add a New Document'
                    subval = 'Save Changes'

                wr('<h1>%s</h1>' % (ttl))
                wr('<p><a href="DM_Index" class="btn btn-default btn-sm"><i class="fa fa-arrow-left">&nbsp;</i>Document Management</a>')

                wr('<p>All form fields are required (except description).</p>')
                wr('<form method="POST" action="DM_Add_Edit_Doc" enctype="multipart/form-data">')
                wr(hidden('formaction', hideval))
                wr(hidden('filename', filename))

                wr('<table>')
                wr('<tr><td>Title:<td>')
                wr(text('title', pick.get('title', '')))
                wr('<tr><td>Description:<br><small>(optional)</small><td><textarea name="description">%s</textarea>' % (pick.get('description', '')))

                wr('<tr><td>Categories:<br><small>(pick at least one)</small><td>')
                for cat in get_all_possible_categories():
                    wr('<label for="%s"><input type="checkbox" name="category" value="%s" id="%s"' % (cat, cat, cat))
                    if cat in pick.get('categories', []):
                        self.write(' checked')
                    wr('> %s</label><br>' % (cat))
                wr('<hr>')
                wr('<td><a href="DM_Edit_Categories" class="btn btn-default btn-sm"><i class="fa fa-pencil">&nbsp;</i>Edit Categories</a>')
                wr('<tr><td>Allowed access:<br><small>(pick at least one)</small><td>')
                for role in MASTER_ROLES_LIST:
                    wr('<label for="%s"><input type="checkbox" name="role" value="%s" id="%s"' % (role, role, role))
                    if role in pick.get('roles', []):
                        self.write(' checked')
                    wr('> %s</label><br>' % (role))
                if not qs.get('fn'):
                    wr('<tr><td>File:<td><input type="file" name="datafile"><br />')
                wr('<tr><td><td>')
                wr(submit(subval))
                wr('</table>')
                wr('</form>')
Beispiel #21
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()))
Beispiel #22
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 -->')