Example #1
0
def SendConfirmationEmail(objHere, strEmailId):
    if not strEmailId:
        objMember = GetCurrentMember(objHere)
        for objEmailAddress in objMember.objectValues("E3EmailAddress"):
            if not objEmailAddress.Confirmed:
                objEmailAddress.RequestConfirmation()
                SetMessage(objHere, '', 'Confirmation request sent to %s' % objEmailAddress.EmailAddress)
    else:
        objEmailAddress = SearchOne(objHere, 'E3EmailAddress', 'id', strEmailId)
        if objEmailAddress:
            objEmailAddress.RequestConfirmation()
            SetMessage(objHere, '', 'Confirmation request sent to %s' % objEmailAddress.EmailAddress)
        else:
            print "Email address not found: ", strEmailId
Example #2
0
def EditProfileForm(objHere):
    objMember = GetCurrentMember(objHere)

    lstEmailAddresses = []
    for objEmailAddress in objMember.objectValues('E3EmailAddress'):
        lstEmailAddresses.append(objEmailAddress.EmailAddress)
    lstEmailAddresses.sort()

    lstPrivacyOptions = ('Hide', 'Members only', 'Show to all')

    lstForm = []

    lstForm.append(Fieldset('Your Privacy Settings', None,
        Paragraph(
            PureText('For some of your details you can choose whether they will be visible to everyone or to fellow list members only')),
        Paragraph(
            PureText('All the other details you enter below will automatically be visible to everyone'))))

    lstForm.append(Fieldset('Featured List Member', None,
        Paragraph(
            PureText('Once a day the system chooses a list member to feature on the website. For an example see the right hand side of this page')),
        Paragraph(
            PureText('You may be featured if you have entered your name, tag line and comments for potential clients. Your full name must be made visible to all if you want to be featured')),
        Paragraph(
            TextControl('Name', 'Name')),
        Paragraph(
            RadioButtonControl('Full name', 'ShowFullName', lstPrivacyOptions)),
        Paragraph(
            TextControl('Tagline or title', 'TagLine', strComments = '(for instance "Executive Coaching", "Coaching to be your best")')),
        Paragraph(
            TextArea('Comments for potential clients', 'CommercialComments'))))

    lstForm.append(Fieldset('Personal Details', None,
        Paragraph(
            SelectControl('Country', 'Country', cnCountryNames)),
        Paragraph(
            RadioButtonControl('Show country', 'ShowCountry', lstPrivacyOptions)),
        Paragraph(
            TextControl('Location', 'Location')),
        Paragraph(
            RadioButtonControl('Show location', 'ShowLocation', lstPrivacyOptions)),
        Paragraph(
            TextControl('Postcode', 'Postcode')),
        Paragraph(
            RadioButtonControl('Show postcode', 'ShowPostcode', lstPrivacyOptions)),
        Paragraph(
            TextArea('Languages', 'Languages'))))

    lstForm.append(Fieldset('Contact Details', None,
        Paragraph(
            SelectControl('Contact email address', 'ContactEmailAddress', lstEmailAddresses, strComments = 'Email addresses are entered on the <a href="/MyECL">MyECL page</a>')),
        Paragraph(
            RadioButtonControl('Show email address', 'ShowEmailAddress', lstPrivacyOptions)),
        Paragraph(
            TextControl('Website address', 'WebsiteAddress')),
        Paragraph(
            TextControl('Phone', 'PhoneNumber')),
        Paragraph(
            RadioButtonControl('Show phone number', 'ShowPhoneNumber', lstPrivacyOptions))))

    lstForm.append(Fieldset('Coaching communities', None,
            Paragraph(
                PureText("I am the host of the following coaching group (chapter, circle, network, etc):")),
            Paragraph(
                TextControl('Group name', 'HostOfChapter'))))

    lstForm.append(Fieldset('Personal comments', None,
            Paragraph(
                TextArea('Personal comments', 'CommunityComments')),
            Paragraph(
                RadioButtonControl('Show comments', 'ShowCommunityComments', lstPrivacyOptions))))

    lstForm.append(Fieldset('Your business or professional profile', None,
            Paragraph(
                TextArea('Biography', 'Biography')),
            Paragraph(
                RadioButtonControl('Show biography', 'ShowBiography', lstPrivacyOptions)),
            Paragraph(
                TextArea('Testimonials', 'Testimonials'))))
    lstForm.append(Fieldset('Save your changes', None,
            Paragraph(
                SubmitControl('Update profile'))))

    dictMemberProfile = LoadDataFromObject(objMember, cnProfileFieldNames)
    strForm = CreateForm(objHere, lstForm, dictMemberProfile, "", {'Action': 'UpdateProfile'})
#    strForm = unicode(strForm, 'utf-8', 'replace')
#    strResult = "Testing"
    return strForm
Example #3
0
def JoiningPage(objHere):
    # If doesn't have a form, or blank email address, assume they got to this page directly
    strStep = GetParameter(objHere, "JoinStep")
    if not strStep:
        strStep = "JoinNow"

    strEmailAddress = GetParameter(objHere, "EmailAddress")
    strEmailAddress = strEmailAddress.lower().replace(" ", "")
    strCallingURL = GetParameter(objHere, "CallingURL")
    if not strCallingURL:
        strCallingURL = objHere.REQUEST.HTTP_REFERER
        strCallingURL = RemoveAction(strCallingURL)

    if strStep == "JoinNow":
        if not strEmailAddress:
            return JoiningForm(objHere, strCallingURL, strEmailAddress)

        if strEmailAddress.lower().replace(" ", "") == "emailaddress":
            return JoiningForm(objHere, strCallingURL, strEmailAddress)

        if not ValidEmailAddress(strEmailAddress):
            return JoiningForm(objHere, strCallingURL, strEmailAddress, "Warning: Invalid email address entered. Please submit a correct email address")

        objMember = GetCurrentMember(objHere)
        if not objMember:
            objMember = GetMemberForEmailAddress(objHere, strEmailAddress)
            if objMember:
                objMember.SendPasswordReminder("someone just tried to register using your email address: %s" % strEmailAddress)
                strErrorMessage = "Warning: This email address is already registered. Please log in (using the form on the left hand side) instead of (re-)joining or enter the correct email address. A reminder of your log in details has been sent to %s" % strEmailAddress
            else:
                strErrorMessage = """An unknown error occurred. Please try again or <a href="/ContactDetails">contact the list owner</a>"""
            return JoiningForm(objHere, strCallingURL, strEmailAddress, strErrorMessage)


        # Note: Actual creating of new member happens in E3StartStop.JoinProcessing
        dictLoginDetails = LoadDataFromObject(objMember, ("Username", ))
        return WelcomeScreen(objMember, strCallingURL, dictLoginDetails)

    elif strStep == "UpdateLoginDetails":
        objMember = GetCurrentMember(objHere)
        lstFields = ("Username", "Password", "PasswordConfirmation")
        dictLoginDetails = GetDataFromForm(objHere, objHere.REQUEST.form, lstFields)
        dictErrors = ValidLoginDetails(objMember, dictLoginDetails)
        if dictErrors:
            return WelcomeScreen(objMember, strCallingURL, dictLoginDetails, dictErrors = dictErrors)

        SaveLoginDetails(objMember, dictLoginDetails)
        dictLoginDetails = LoadDataFromObject(objMember, ("Username", ))
        objMember.SendPasswordReminder()
        return WelcomeScreen(objMember, strCallingURL, dictLoginDetails, strLoginMessage = "Log in details updated")

    elif "SwitchTo" in strStep:
        objMember = GetCurrentMember(objHere)

        if strStep == "SwitchToDirectListDelivery":
            objMember.EmailFrequency_ECL = "Direct"

        elif strStep == "SwitchToDailyListDigest":
            objMember.EmailFrequency_ECL = "Daily"

        elif strStep == "SwitchToDirectAdvertDelivery":
            objMember.EmailFrequency_ECL_Advert = "Direct"

        elif strStep == "SwitchToDailyAdvertDigest":
            objMember.EmailFrequency_ECL_Advert = "Daily"

        dictLoginDetails = LoadDataFromObject(objMember, ("Username", ))
        return WelcomeScreen(objMember, strCallingURL, dictLoginDetails, strDeliveryMessage = "Email delivery updated")

    return "<p>This is the joining page</p>"