From 269e8db2e7b4d6931d4100de3e81a648620eb18b Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 25 Nov 2008 17:34:29 +0000 Subject: [PATCH] - MGR: Make the error message processing work for the get_project_config rpc, use the same scheme as the ACCOUNT_OUT structure. clientgui/ ProjectProcessingPage.cpp ProjectPropertiesPage.cpp, .h lib/ gui_rpc_client.h gui_rpc_client_ops.cpp svn path=/trunk/boinc/; revision=16557 --- checkin_notes | 12 ++++++++++++ clientgui/ProjectProcessingPage.cpp | 2 +- clientgui/ProjectPropertiesPage.cpp | 26 ++++++++++++++++++++++++++ clientgui/ProjectPropertiesPage.h | 4 ++++ lib/gui_rpc_client.h | 2 +- lib/gui_rpc_client_ops.cpp | 7 ++----- 6 files changed, 46 insertions(+), 7 deletions(-) diff --git a/checkin_notes b/checkin_notes index db75c5c01f..3aea090655 100644 --- a/checkin_notes +++ b/checkin_notes @@ -9589,3 +9589,15 @@ David 24 Nov 2008 html/ops/ bossa_admin.php + +Rom 25 Nov 2008 + - MGR: Make the error message processing work for the + get_project_config rpc, use the same scheme as + the ACCOUNT_OUT structure. + + clientgui/ + ProjectProcessingPage.cpp + ProjectPropertiesPage.cpp, .h + lib/ + gui_rpc_client.h + gui_rpc_client_ops.cpp diff --git a/clientgui/ProjectProcessingPage.cpp b/clientgui/ProjectProcessingPage.cpp index de5d912660..6b301eca63 100644 --- a/clientgui/ProjectProcessingPage.cpp +++ b/clientgui/ProjectProcessingPage.cpp @@ -192,7 +192,7 @@ wxWizardPageEx* CProjectProcessingPage::GetNext() const // The requested account does not exist or the password is bad return PAGE_TRANSITION_NEXT(ID_ERRNOTFOUNDPAGE); } else { - // Ann error must have occurred + // An error must have occurred return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } return NULL; diff --git a/clientgui/ProjectPropertiesPage.cpp b/clientgui/ProjectPropertiesPage.cpp index a444c712cd..4d96bfef65 100644 --- a/clientgui/ProjectPropertiesPage.cpp +++ b/clientgui/ProjectPropertiesPage.cpp @@ -37,6 +37,7 @@ #include "WizardAttachProject.h" #include "ProjectPropertiesPage.h" #include "ProjectInfoPage.h" +#include "CompletionErrorPage.h" ////@begin XPM images @@ -111,6 +112,7 @@ bool CProjectPropertiesPage::Create( CBOINCBaseWizard* parent ) m_bProjectAccountCreationDisabled = false; m_bProjectClientAccountCreationDisabled = false; m_bNetworkConnectionDetected = false; + m_bServerReportedError = false; m_iBitmapIndex = 0; m_iCurrentState = PROJPROP_INIT; @@ -192,6 +194,9 @@ wxWizardPageEx* CProjectPropertiesPage::GetNext() const } else if (GetProjectPropertiesURLFailure()) { // Not a BOINC based project return PAGE_TRANSITION_NEXT(ID_ERRNOTDETECTEDPAGE); + } else if (GetServerReportedError()) { + // Server reported an error, display the error + return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE); } else { // The project must be down for maintenance return PAGE_TRANSITION_NEXT(ID_ERRUNAVAILABLEPAGE); @@ -359,6 +364,7 @@ void CProjectPropertiesPage::OnStateChange( CProjectPropertiesPageEvent& WXUNUSE wxDateTime dtStartExecutionTime; wxDateTime dtCurrentExecutionTime; wxTimeSpan tsExecutionTime; + wxString strBuffer = wxEmptyString; bool bPostNewEvent = true; bool bSuccessfulCondition = false; int iReturnValue = 0; @@ -442,6 +448,7 @@ void CProjectPropertiesPage::OnStateChange( CProjectPropertiesPageEvent& WXUNUSE SetNextState(PROJPROP_CLEANUP); } else { SetProjectPropertiesSucceeded(false); + bSuccessfulCondition = (!iReturnValue) && (ERR_FILE_NOT_FOUND == pc->error_num) || (!iReturnValue) && (ERR_GETHOSTBYNAME == pc->error_num) || @@ -451,6 +458,25 @@ void CProjectPropertiesPage::OnStateChange( CProjectPropertiesPageEvent& WXUNUSE } else { SetProjectPropertiesURLFailure(false); } + + bSuccessfulCondition = + ((!iReturnValue) && (ERR_FILE_NOT_FOUND != pc->error_num)) && + ((!iReturnValue) && (ERR_GETHOSTBYNAME != pc->error_num)) && + ((!iReturnValue) && (ERR_XML_PARSE != pc->error_num)) && + (!iReturnValue); + if (bSuccessfulCondition || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) { + SetServerReportedError(true); + + strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); + if (pc->error_msg.size()) { + strBuffer += wxString(pc->error_msg.c_str(), wxConvUTF8) + wxString(wxT("\n")); + } + pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); + + } else { + SetServerReportedError(false); + } + SetNextState(PROJPROP_DETERMINENETWORKSTATUS_BEGIN); } break; diff --git a/clientgui/ProjectPropertiesPage.h b/clientgui/ProjectPropertiesPage.h index a2735fbe90..4143a09d15 100644 --- a/clientgui/ProjectPropertiesPage.h +++ b/clientgui/ProjectPropertiesPage.h @@ -124,6 +124,9 @@ public: bool GetNetworkConnectionDetected() const { return m_bNetworkConnectionDetected ; } void SetNetworkConnectionDetected(bool value) { m_bNetworkConnectionDetected = value ; } + bool GetServerReportedError() const { return m_bServerReportedError ; } + void SetServerReportedError(bool value) { m_bServerReportedError = value ; } + wxInt32 GetCurrentState() const { return m_iCurrentState ; } void SetNextState(wxInt32 value) { m_iCurrentState = value ; } @@ -145,6 +148,7 @@ public: bool m_bProjectClientAccountCreationDisabled; bool m_bProjectAlreadyAttached; bool m_bNetworkConnectionDetected; + bool m_bServerReportedError; int m_iBitmapIndex; int m_iCurrentState; }; diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index 72b34f3431..f6088702e1 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -461,7 +461,7 @@ struct PROJECT_CONFIG { bool uses_username; bool account_creation_disabled; bool client_account_creation_disabled; - std::vector messages; + std::string error_msg; std::string terms_of_use; // if present, show this text in an "accept terms of use?" dialog // before allowing attachment to continue. diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp index e142a70ec7..e309ee7cf2 100644 --- a/lib/gui_rpc_client_ops.cpp +++ b/lib/gui_rpc_client_ops.cpp @@ -911,10 +911,7 @@ int PROJECT_CONFIG::parse(MIOFILE& in) { if (parse_bool(buf, "uses_username", uses_username)) continue; if (parse_bool(buf, "account_creation_disabled", account_creation_disabled)) continue; if (parse_bool(buf, "client_account_creation_disabled", client_account_creation_disabled)) continue; - if (parse_str(buf, "", msg)) { - messages.push_back(msg); - continue; - } + if (parse_str(buf, "", error_msg)) continue; if (parse_str(buf, "", msg)) { while (in.fgets(buf, 256)) { if (match_tag(buf, "")) break; @@ -929,7 +926,7 @@ int PROJECT_CONFIG::parse(MIOFILE& in) { void PROJECT_CONFIG::clear() { error_num = 0; name.clear(); - messages.clear(); + error_msg.clear(); terms_of_use.clear(); min_passwd_length = 6; account_manager = false;