wxWizardPageEx* CAccountInfoPage::GetNext() const { if (CHECK_CLOSINGINPROGRESS()) { // Cancel Event Detected return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } else if (IS_ATTACHTOPROJECTWIZARD()) { return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE); } else if (IS_ACCOUNTMANAGERWIZARD()) { return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE); } return NULL; }
wxWizardPageEx* CTermsOfUsePage::GetNext() const { if (CHECK_CLOSINGINPROGRESS()) { // Cancel Event Detected return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } else if (IS_ATTACHTOPROJECTWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) { return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE); } else if (IS_ACCOUNTMANAGERWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) { return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE); } else if (GetUserAgrees()) { return PAGE_TRANSITION_NEXT(ID_ACCOUNTINFOPAGE); } else { return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } return NULL; }
void CAccountInfoPage::OnPageChanging( wxWizardExEvent& event ) { if (event.GetDirection() == false) return; CWizardAttach* pWA = ((CWizardAttach*)GetParent()); PROJECT_CONFIG& pc = pWA->project_config; wxString strTitle; wxString strMessage = wxT(""); bool bDisplayError = false; wxString strBaseConfigLocation = wxString(wxT("/Wizards")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); if (!CHECK_CLOSINGINPROGRESS()) { // We are leaving this page, so store the email address for future // use. pConfig->SetPath(strBaseConfigLocation); pConfig->Write(wxT("DefaultEmailAddress"), m_strAccountEmailAddress); pConfig->Write(wxT("DefaultUsername"), m_strAccountUsername); pConfig->Flush(); // Construct potiental dialog title if (IS_ATTACHTOPROJECTWIZARD()) { strTitle = _("Add project"); } else if (IS_ACCOUNTMANAGERWIZARD() && IS_ACCOUNTMANAGERUPDATEWIZARD()) { strTitle = _("Update account manager"); } else if (IS_ACCOUNTMANAGERWIZARD()) { strTitle = _("Use account manager"); } // Verify minimum username length if (!m_pAccountUseExistingCtrl->GetValue()) { if (!(m_pAccountPasswordCtrl->GetValue().Length() > 0)) { if (pc.uses_username) { if (IS_ATTACHTOPROJECTWIZARD()) { strMessage.Printf( _("The minimum username length for this project is 1. Please enter a different username.") ); } if (IS_ACCOUNTMANAGERWIZARD()) { strMessage.Printf( _("The minimum username length for this account manager is 1. Please enter a different username.") ); } } else { if (IS_ATTACHTOPROJECTWIZARD()) { strMessage.Printf( _("The minimum email address length for this project is 1. Please enter a different email address.") ); } if (IS_ACCOUNTMANAGERWIZARD()) { strMessage.Printf( _("The minimum email address length for this account manager is 1. Please enter a different email address.") ); } } bDisplayError = true; } } // Verify minimum password length if (!m_pAccountUseExistingCtrl->GetValue()) { if (m_pAccountPasswordCtrl->GetValue().Length() < (size_t)pc.min_passwd_length) { if (IS_ATTACHTOPROJECTWIZARD()) { strMessage.Printf( _("The minimum password length for this project is %d. Please enter a different password."), pc.min_passwd_length ); } if (IS_ACCOUNTMANAGERWIZARD()) { strMessage.Printf( _("The minimum password length for this account manager is %d. Please enter a different password."), pc.min_passwd_length ); } bDisplayError = true; } } // Verify that the password and confirmation password math. if (!IS_ACCOUNTMANAGERWIZARD() && m_pAccountCreateCtrl->GetValue()) { if (m_pAccountPasswordCtrl->GetValue() != m_pAccountConfirmPasswordCtrl->GetValue()) { strMessage = _("The password and confirmation password do not match. Please type them again."); bDisplayError = true; } } if (bDisplayError) { wxGetApp().SafeMessageBox( strMessage, strTitle, wxICON_ERROR | wxOK, this ); event.Veto(); } } }
void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) { if (event.GetDirection() == false) return; CWizardAttach* pWA = ((CWizardAttach*)GetParent()); CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); CSkinWizardATAM* pSkinWizardATAM = wxGetApp().GetSkinManager()->GetWizards()->GetWizardATAM(); PROJECT_CONFIG& pc = pWA->project_config; wxString strBaseConfigLocation = wxString(wxT("/Wizards")); wxConfigBase* pConfig = wxConfigBase::Get(FALSE); wxASSERT(pSkinAdvanced); wxASSERT(pSkinWizardATAM); wxASSERT(m_pTitleStaticCtrl); wxASSERT(m_pCookieDetectionFailedStaticCtrl); wxASSERT(m_pCookieDetectionFailedCtrl); wxASSERT(m_pAccountQuestionStaticCtrl); wxASSERT(m_pAccountInformationStaticCtrl); wxASSERT(m_pAccountCreateCtrl); wxASSERT(m_pAccountUseExistingCtrl); wxASSERT(m_pAccountEmailAddressStaticCtrl); wxASSERT(m_pAccountEmailAddressCtrl); wxASSERT(m_pAccountUsernameStaticCtrl); wxASSERT(m_pAccountUsernameCtrl); wxASSERT(m_pAccountPasswordStaticCtrl); wxASSERT(m_pAccountPasswordCtrl); wxASSERT(m_pAccountConfirmPasswordStaticCtrl); wxASSERT(m_pAccountConfirmPasswordCtrl); wxASSERT(m_pAccountPasswordRequirmentsStaticCtrl); wxASSERT(m_pAccountManagerLinkLabelStaticCtrl); wxASSERT(m_pAccountForgotPasswordCtrl); wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced)); wxASSERT(wxDynamicCast(pSkinWizardATAM, CSkinWizardATAM)); // We are entering this page, so reterieve the previously used email // address and/or username. pConfig->SetPath(strBaseConfigLocation); m_strAccountEmailAddress = pConfig->Read(wxT("DefaultEmailAddress")); m_strAccountUsername = pConfig->Read(wxT("DefaultUsername")); // Setup the desired controls and default values. static bool bRunOnce = true; if (bRunOnce) { bRunOnce = false; if (!IS_ACCOUNTMANAGERWIZARD()) { m_pAccountCreateCtrl->SetValue(true); m_pAccountUseExistingCtrl->SetValue(false); } } if (IS_ACCOUNTMANAGERWIZARD()) { if (!(pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected)) { m_pCookieDetectionFailedStaticCtrl->Hide(); m_pCookieDetectionFailedCtrl->Hide(); } else { m_pCookieDetectionFailedStaticCtrl->Show(); m_pCookieDetectionFailedCtrl->Show(); } m_pAccountQuestionStaticCtrl->Hide(); m_pAccountCreateCtrl->SetValue(false); m_pAccountCreateCtrl->Hide(); m_pAccountUseExistingCtrl->SetValue(true); m_pAccountUseExistingCtrl->Hide(); m_pAccountConfirmPasswordStaticCtrl->Hide(); m_pAccountConfirmPasswordCtrl->Hide(); m_pAccountPasswordRequirmentsStaticCtrl->Hide(); if (pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected) { m_pAccountManagerLinkLabelStaticCtrl->Hide(); m_pAccountForgotPasswordCtrl->Hide(); } } else { m_pCookieDetectionFailedStaticCtrl->Hide(); m_pCookieDetectionFailedCtrl->Hide(); if (pc.account_creation_disabled || pc.client_account_creation_disabled) { m_pAccountCreateCtrl->SetValue(false); m_pAccountCreateCtrl->Hide(); m_pAccountUseExistingCtrl->SetValue(true); m_pAccountUseExistingCtrl->Hide(); } else { m_pAccountCreateCtrl->Show(); m_pAccountCreateCtrl->Enable(); m_pAccountUseExistingCtrl->Show(); } m_pAccountManagerLinkLabelStaticCtrl->Hide(); } wxString str; wxString name = wxString(pc.name.c_str(), wxConvUTF8); str.Printf(_("Identify your account at %s"), name.c_str()); m_pTitleStaticCtrl->SetLabel(str); if (!IS_ACCOUNTMANAGERWIZARD() && !IS_ACCOUNTMANAGERUPDATEWIZARD()) { if (pc.client_account_creation_disabled) { m_pAccountQuestionStaticCtrl->SetLabel( _("Please enter your account information\n(to create an account, visit the project's web site)") ); } else if (pc.account_creation_disabled) { m_pAccountQuestionStaticCtrl->SetLabel( _("This project is not currently accepting new accounts.\nYou can add it only if you already have an account.") ); } else { m_pAccountQuestionStaticCtrl->SetLabel( _("Are you already running this project?") ); } m_pAccountCreateCtrl->SetLabel( _("&No, new user") ); m_pAccountUseExistingCtrl->SetLabel( _("&Yes, existing user") ); } else { if (pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected) { m_pCookieDetectionFailedStaticCtrl->SetLabel( _("We were not able to set up your account information\nautomatically.\n\nPlease click on the 'Find login information' link\nbelow to find out what to put in the email address and\npassword fields.") ); m_pCookieDetectionFailedCtrl->SetLabel( _("Find login information") ); m_pCookieDetectionFailedCtrl->SetURL( pWA->m_strCookieFailureURL ); } if (pSkinAdvanced->IsBranded() && !pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) { m_pAccountInformationStaticCtrl->SetLabel( pSkinWizardATAM->GetAccountInfoMessage() ); } } if (m_pAccountUseExistingCtrl->GetValue()) { m_pAccountConfirmPasswordStaticCtrl->Hide(); m_pAccountConfirmPasswordCtrl->Hide(); m_pAccountPasswordRequirmentsStaticCtrl->Hide(); m_pAccountPasswordStaticCtrl->SetLabel( _("&Password:"******"Choose a &password:"******"C&onfirm password:"******"Are you already running %s?"), pWA->GetProjectName().c_str() ); m_pAccountQuestionStaticCtrl->SetLabel(strQuestion); } if (pc.uses_username) { if (IS_ACCOUNTMANAGERWIZARD()) { if (pSkinAdvanced->IsBranded() && !pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) { m_pAccountInformationStaticCtrl->SetLabel( pSkinWizardATAM->GetAccountInfoMessage() ); } } m_pAccountEmailAddressCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, &m_strAccountEmailAddress) ); m_pAccountUsernameCtrl->SetValidator( wxTextValidator(wxFILTER_ASCII, &m_strAccountUsername) ); m_pAccountEmailAddressStaticCtrl->Hide(); m_pAccountEmailAddressCtrl->Hide(); m_pAccountUsernameStaticCtrl->Show(); m_pAccountUsernameCtrl->Show(); m_pAccountUsernameStaticCtrl->SetLabel( _("&Username:"******"&Email address:") ); m_pAccountEmailAddressCtrl->SetValue(m_strAccountEmailAddress); } if (pc.min_passwd_length) { wxString str; str.Printf(_("minimum length %d"), pc.min_passwd_length); m_pAccountPasswordRequirmentsStaticCtrl->SetLabel( str ); } if (!IS_ACCOUNTMANAGERWIZARD()) { m_pAccountForgotPasswordCtrl->SetLabel( _("Forgot your password?") ); m_pAccountForgotPasswordCtrl->SetURL( wxString(pWA->m_ProjectInfoPage->GetProjectURL() + _T("get_passwd.php")) ); } else { m_pAccountManagerLinkLabelStaticCtrl->SetLabel( _("If you have not yet registered with this account manager,\nplease do so before proceeding. Click on the link below\nto register or to retrieve a forgotten password." ) ); m_pAccountForgotPasswordCtrl->SetLabel( _("Account manager website") ); m_pAccountForgotPasswordCtrl->SetURL( wxString(pWA->m_AccountManagerInfoPage->GetProjectURL()) ); } if (pc.uses_username) { m_pAccountUsernameCtrl->SetFocus(); } else { m_pAccountEmailAddressCtrl->SetFocus(); } Fit(); }