1 // This file is part of BOINC.
2 // http://boinc.berkeley.edu
3 // Copyright (C) 2008 University of California
4 //
5 // BOINC is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Lesser General Public License
7 // as published by the Free Software Foundation,
8 // either version 3 of the License, or (at your option) any later version.
9 //
10 // BOINC is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 // See the GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
17 //
18 #ifndef BOINC_WIZARDATTACH_H
19 #define BOINC_WIZARDATTACH_H
20 
21 #if defined(__GNUG__) && !defined(__APPLE__)
22 #pragma interface "WizardAttach.cpp"
23 #endif
24 
25 
26 // Wizard Identifiers
27 //
28 #define ID_ATTACHWIZARD 10000
29 #define SYMBOL_CWIZARDATTACH_IDNAME ID_ATTACHWIZARD
30 
31 
32 // Page Identifiers
33 //
34 
35 // Generic Pages
36 #define ID_ACCOUNTINFOPAGE 10102
37 #define ID_COMPLETIONPAGE 10103
38 #define ID_COMPLETIONERRORPAGE 10104
39 #define ID_ERRNOTDETECTEDPAGE 10105
40 #define ID_ERRUNAVAILABLEPAGE 10106
41 #define ID_ERRNOINTERNETCONNECTIONPAGE 10108
42 #define ID_ERRNOTFOUNDPAGE 10109
43 #define ID_ERRALREADYEXISTSPAGE 10110
44 #define ID_ERRPROXYINFOPAGE 10111
45 #define ID_ERRPROXYPAGE 10112
46 #define ID_TERMSOFUSEPAGE 10113
47 
48 // Attach to Project Wizard Pages
49 #define ID_PROJECTINFOPAGE 10200
50 #define ID_PROJECTPROPERTIESPAGE 10201
51 #define ID_PROJECTPROCESSINGPAGE 10202
52 #define ID_PROJECTWELCOMEPAGE 10203
53 
54 // Account Manager Wizard Pages
55 #define ID_ACCOUNTMANAGERINFOPAGE 10300
56 #define ID_ACCOUNTMANAGERPROPERTIESPAGE 10301
57 #define ID_ACCOUNTMANAGERPROCESSINGPAGE 10302
58 
59 
60 // Control Identifiers
61 //
62 
63 // Bitmap Progress Control
64 #define ID_PROGRESSCTRL 11000
65 
66 // BOINC Hyperlink Control
67 #define ID_BOINCHYPERLINK 11001
68 
69 // Completion Error Page Multiline Text Control
70 #define ID_TEXTCTRL 11002
71 
72 // Welcome Page Controls
73 #define ID_WELCOMESELECTWIZARDPROJECT 11100
74 #define ID_WELCOMESELECTWIZARDACCOUNTMGR 11101
75 #define ID_WELCOMECHANGEAPPS 11102
76 
77 // Project Info/Account Manager Info Controls
78 #define ID_CATEGORIES 11200
79 #define ID_PROJECTS 11201
80 #define ID_PROJECTDESCRIPTION 11202
81 #define ID_PROJECTLISTCTRL 11203
82 #define ID_PROJECTURLSTATICCTRL 11204
83 #define ID_PROJECTURLCTRL 11205
84 #define ID_PROJECTWEBPAGECTRL 11206
85 
86 // Terms Of Use Controls
87 #define ID_TERMSOFUSECTRL 11300
88 #define ID_TERMSOFUSEAGREECTRL 11301
89 #define ID_TERMSOFUSEDISAGREECTRL 11302
90 
91 // Account Info Controls
92 #define ID_ACCOUNTCREATECTRL 11400
93 #define ID_ACCOUNTUSEEXISTINGCTRL 11401
94 #define ID_ACCOUNTEMAILADDRESSSTATICCTRL 11402
95 #define ID_ACCOUNTEMAILADDRESSCTRL 11403
96 #define ID_ACCOUNTUSERNAMESTATICCTRL 11404
97 #define ID_ACCOUNTUSERNAMECTRL 11405
98 #define ID_ACCOUNTPASSWORDSTATICCTRL 11406
99 #define ID_ACCOUNTPASSWORDCTRL 11407
100 #define ID_ACCOUNTCONFIRMPASSWORDSTATICCTRL 11408
101 #define ID_ACCOUNTCONFIRMPASSWORDCTRL 11409
102 #define ID_ACCOUNTREQUIREMENTSSTATICCTRL 11410
103 #define ID_ACCOUNTLINKLABELSTATICCTRL 11411
104 #define ID_ACCOUNTFORGOTPASSWORDCTRL 11412
105 #define ID_ACCOUNTCOOKIEDETECTIONFAILEDCTRL 11413
106 
107 // Proxy Page Controls
108 #define ID_PROXYHTTPSERVERSTATICCTRL 11500
109 #define ID_PROXYHTTPSERVERCTRL 11501
110 #define ID_PROXYHTTPPORTSTATICCTRL 11502
111 #define ID_PROXYHTTPPORTCTRL 11503
112 #define ID_PROXYHTTPUSERNAMESTATICCTRL 11504
113 #define ID_PROXYHTTPUSERNAMECTRL 11505
114 #define ID_PROXYHTTPPASSWORDSTATICCTRL 11506
115 #define ID_PROXYHTTPPASSWORDCTRL 11507
116 #define ID_PROXYHTTPAUTODETECTCTRL 11508
117 #define ID_PROXYSOCKSSERVERSTATICCTRL 11509
118 #define ID_PROXYSOCKSSERVERCTRL 11510
119 #define ID_PROXYSOCKSPORTSTATICCTRL 11511
120 #define ID_PROXYSOCKSPORTCTRL 11512
121 #define ID_PROXYSOCKSUSERNAMESTATICCTRL 11513
122 #define ID_PROXYSOCKSUSERNAMECTRL 11514
123 #define ID_PROXYSOCKSPASSWORDSTATICCTRL 11515
124 #define ID_PROXYSOCKSPASSWORDCTRL 11516
125 
126 // Account Manager Status Controls
127 #define ID_ACCTMANAGERNAMECTRL 11600
128 #define ID_ACCTMANAGERLINKCTRL 11601
129 #define ID_ACCTMANAGERUPDATECTRL 11602
130 #define ID_ACCTMANAGERREMOVECTRL 11603
131 
132 
133 // Forward declare the generic page classes
134 //
135 class CAccountInfoPage;
136 class CTermsOfUsePage;
137 class CCompletionPage;
138 class CCompletionErrorPage;
139 class CErrNotDetectedPage;
140 class CErrUnavailablePage;
141 class CErrAlreadyAttachedPage;
142 class CErrNoInternetConnectionPage;
143 class CErrNotFoundPage;
144 class CErrAlreadyExistsPage;
145 class CErrProxyInfoPage;
146 class CErrProxyPage;
147 class CErrUserDisagreesPage;
148 class CProjectInfoPage;
149 class CProjectPropertiesPage;
150 class CProjectProcessingPage;
151 class CProjectWelcomePage;
152 class CAccountManagerInfoPage;
153 class CAccountManagerPropertiesPage;
154 class CAccountManagerProcessingPage;
155 
156 // Forward declare PROJECT_INIT_STATUS
157 struct PROJECT_INIT_STATUS;
158 
159 
160 // Wizard Detection
161 //
162 #define IS_ATTACHTOPROJECTWIZARD() \
163     ((CWizardAttach*)GetParent())->IsAttachToProjectWizard
164 
165 #define IS_ACCOUNTMANAGERWIZARD() \
166     ((CWizardAttach*)GetParent())->IsAccountManagerWizard
167 
168 #define IS_ACCOUNTMANAGERUPDATEWIZARD() \
169     ((CWizardAttach*)GetParent())->IsAccountManagerUpdateWizard
170 
171 #define IS_CHANGEWCGAPPS() \
172 	((CWizardAttach*)GetParent())->IsChangeWCGApps
173 
174 
175 // Commonly defined macros
176 //
177 #define PAGE_TRANSITION_NEXT(id) \
178     ((CWizardAttach*)GetParent())->PushPageTransition((wxWizardPageEx*)this, id)
179 
180 #define PAGE_TRANSITION_BACK \
181     ((CWizardAttach*)GetParent())->PopPageTransition()
182 
183 #define PROCESS_CANCELEVENT(event) \
184     ((CWizardAttach*)GetParent())->ProcessCancelEvent(event)
185 
186 #define CHECK_CLOSINGINPROGRESS() \
187     ((CWizardAttach*)GetParent())->IsCancelInProgress()
188 
189 
190 /*!
191  * CWizardAttach class declaration
192  */
193 
194 class CWizardAttach: public CBOINCBaseWizard
195 {
196     DECLARE_DYNAMIC_CLASS( CWizardAttach )
197     DECLARE_EVENT_TABLE()
198 
199 public:
200     /// Constructors
201     CWizardAttach( );
202     CWizardAttach( wxWindow* parent, wxWindowID id = SYMBOL_CWIZARDATTACH_IDNAME, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE );
203 
204     /// Creation
205     bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CWIZARDATTACH_IDNAME, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE );
206 
207     /// Creates the controls and sizers
208     void CreateControls();
209 
210 ////@begin CWizardAttachProject event handler declarations
211 
212     /// wxEVT_WIZARD_FINISHED event handler for ID_ATTACHWIZARD
213     void OnFinished( wxWizardExEvent& event );
214 
215 ////@end CWizardAttachProject event handler declarations
216 
217     /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_BACKWARD
218     void OnWizardBack( wxCommandEvent& event );
219     /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_FORWARD
220     void OnWizardNext( wxCommandEvent& event );
221 
222 ////@begin CWizardAttachProject member function declarations
223 
224     /// Runs the wizard.
225     bool Run(
226         wxString strProjectName,
227         wxString strProjectURL,
228         wxString strProjectAuthenticator,
229         wxString strProjectInstitution,
230         wxString strProjectDescription,
231         wxString strProjectKnown,
232         wxString strProjectSetupCookie,
233         bool     bAccountKeyDetected,
234         bool     bEmbedded
235     );
236 
237     /// Synchronize to Account Manager
238     bool SyncToAccountManager();
239 
240     /// Retrieves bitmap resources
241     wxBitmap GetBitmapResource( const wxString& name );
242 
243     /// Retrieves icon resources
244     wxIcon GetIconResource( const wxString& name );
245 
246     ////@end CWizardAttachProject member function declarations
247 
248     /// Overrides
249     virtual bool HasNextPage( wxWizardPageEx* page );
250     virtual bool HasPrevPage( wxWizardPageEx* page );
251 
252     /// Track page transitions
253     wxWizardPageEx* TranslatePage(unsigned long ulPageID);
254     wxWizardPageEx* PopPageTransition();
255     wxWizardPageEx* PushPage( unsigned long ulPageID );
256     wxWizardPageEx* PushPageTransition( wxWizardPageEx* pCurrentPage, unsigned long ulPageID );
257 
258     /// Cancel Event Infrastructure
259     void _ProcessCancelEvent( wxWizardExEvent& event );
260 
261     /// Finish Button Environment
GetAccountCreatedSuccessfully()262     bool GetAccountCreatedSuccessfully() const { return account_created_successfully ; }
SetAccountCreatedSuccessfully(bool value)263     void SetAccountCreatedSuccessfully(bool value) { account_created_successfully = value ; }
264 
GetAttachedToProjectSuccessfully()265     bool GetAttachedToProjectSuccessfully() const { return attached_to_project_successfully ; }
SetAttachedToProjectSuccessfully(bool value)266     void SetAttachedToProjectSuccessfully(bool value) { attached_to_project_successfully = value ; }
267 
GetProjectName()268     wxString GetProjectName() const { return m_strProjectName ; }
SetProjectName(wxString value)269     void SetProjectName(wxString value) { m_strProjectName = value ; }
270 
GetProjectURL()271     wxString GetProjectURL() const { return m_strProjectUrl ; }
SetProjectURL(wxString value)272     void SetProjectURL(wxString value) { m_strProjectUrl = value ; }
273 
GetProjectUserName()274     wxString GetProjectUserName() const { return m_strProjectUserName ; }
SetProjectUserName(wxString value)275     void SetProjectUserName(wxString value) { m_strProjectUserName = value ; }
276 
GetProjectAuthenticator()277     wxString GetProjectAuthenticator() const { return m_strProjectAuthenticator ; }
SetProjectAuthenticator(wxString value)278     void SetProjectAuthenticator(wxString value) { m_strProjectAuthenticator = value ; }
279 
GetProjectInstitution()280     wxString GetProjectInstitution() const { return m_strProjectInstitution ; }
SetProjectInstitution(wxString value)281     void SetProjectInstitution(wxString value) { m_strProjectInstitution = value ; }
282 
GetProjectDescription()283     wxString GetProjectDescription() const { return m_strProjectDescription ; }
SetProjectDescription(wxString value)284     void SetProjectDescription(wxString value) { m_strProjectDescription = value ; }
285 
GetProjectSetupCookie()286     wxString GetProjectSetupCookie() const { return m_strProjectSetupCookie ; }
SetProjectSetupCookie(wxString value)287     void SetProjectSetupCookie(wxString value) { m_strProjectSetupCookie = value ; }
288 
IsProjectKnown()289     bool IsProjectKnown() const { return m_bProjectKnown ; }
SetProjectKnown(bool value)290     void SetProjectKnown(bool value) { m_bProjectKnown = value ; }
291 
GetAccountEmailAddress()292     wxString GetAccountEmailAddress() const { return m_strAccountEmailAddress ; }
SetAccountEmailAddress(wxString value)293     void SetAccountEmailAddress(wxString value) { m_strAccountEmailAddress = value ; }
294 
GetAccountUsername()295     wxString GetAccountUsername() const { return m_strAccountUsername ; }
SetAccountUsername(wxString value)296     void SetAccountUsername(wxString value) { m_strAccountUsername = value ; }
297 
GetAccountPassword()298     wxString GetAccountPassword() const { return m_strAccountPassword ; }
SetAccountPassword(wxString value)299     void SetAccountPassword(wxString value) { m_strAccountPassword = value ; }
300 
GetAccountConfirmPassword()301     wxString GetAccountConfirmPassword() const { return m_strAccountConfirmPassword ; }
SetAccountConfirmPassword(wxString value)302     void SetAccountConfirmPassword(wxString value) { m_strAccountConfirmPassword = value ; }
303 
GetReturnURL()304     wxString GetReturnURL() const { return m_strReturnURL ; }
SetReturnURL(wxString value)305     void SetReturnURL(wxString value) { m_strReturnURL = value ; }
306 
GetCookieFailureURL()307     wxString GetCookieFailureURL() const { return m_strCookieFailureURL ; }
SetCookieFailureURL(wxString value)308     void SetCookieFailureURL(wxString value) { m_strCookieFailureURL = value ; }
309 
IsCredentialsCached()310     bool IsCredentialsCached() const { return m_bCredentialsCached ; }
SetCredentialsCached(bool value)311     void SetCredentialsCached(bool value) { m_bCredentialsCached = value ; }
312 
IsCredentialsDetected()313     bool IsCredentialsDetected() const { return m_bCredentialsDetected ; }
SetCredentialsDetected(bool value)314     void SetCredentialsDetected(bool value) { m_bCredentialsDetected = value ; }
315 
IsCloseWhenCompleted()316     bool IsCloseWhenCompleted() const { return m_bCloseWhenCompleted ; }
SetCloseWhenCompleted(bool value)317     void SetCloseWhenCompleted(bool value) { m_bCloseWhenCompleted = value ; }
318 
IsCookieRequired()319     bool IsCookieRequired() const { return m_bCookieRequired ; }
SetCookieRequired(bool value)320     void SetCookieRequired(bool value) { m_bCookieRequired = value ; }
321 
322     /// Should we show tooltips?
323     static bool ShowToolTips();
324 
325 ////@begin CWizardAttachProject member variables
326     CProjectInfoPage* m_ProjectInfoPage;
327     CProjectPropertiesPage* m_ProjectPropertiesPage;
328     CProjectProcessingPage* m_ProjectProcessingPage;
329     CProjectWelcomePage* m_ProjectWelcomePage;
330     CAccountManagerInfoPage* m_AccountManagerInfoPage;
331     CAccountManagerPropertiesPage* m_AccountManagerPropertiesPage;
332     CAccountManagerProcessingPage* m_AccountManagerProcessingPage;
333     CTermsOfUsePage* m_TermsOfUsePage;
334     CAccountInfoPage* m_AccountInfoPage;
335     CCompletionPage* m_CompletionPage;
336     CCompletionErrorPage* m_CompletionErrorPage;
337     CErrNotDetectedPage* m_ErrNotDetectedPage;
338     CErrUnavailablePage* m_ErrUnavailablePage;
339     CErrNoInternetConnectionPage* m_ErrNoInternetConnectionPage;
340     CErrNotFoundPage* m_ErrNotFoundPage;
341     CErrAlreadyExistsPage* m_ErrAlreadyExistsPage;
342     CErrProxyInfoPage* m_ErrProxyInfoPage;
343     CErrProxyPage* m_ErrProxyPage;
344     CErrUserDisagreesPage* m_ErrUserDisagreesPage;
345 ////@end CWizardAttachProject member variables
346 
347     /// Wizard Detection
348     bool                IsAttachToProjectWizard;
349     bool                IsAccountManagerWizard;
350     bool                IsAccountManagerUpdateWizard;
351 	bool				IsChangeWCGApps;
352 	/// For WCG, need to not launch project page when first opened
353 	bool				IsFirstPass;
354 
355     /// Global Wizard Status
356     PROJECT_CONFIG      project_config;
357     ACCOUNT_IN          account_in;
358     ACCOUNT_OUT         account_out;
359     bool                account_created_successfully;
360     bool                attached_to_project_successfully;
361     bool                m_bCloseWhenCompleted;
362     bool                m_bCredentialsCached;
363     bool                m_bCredentialsDetected;
364     bool                m_bCookieRequired;
365     wxString            m_strProjectName;
366     wxString            m_strProjectUrl;
367     wxString            m_strProjectAuthenticator;
368     wxString            m_strProjectInstitution;
369     wxString            m_strProjectDescription;
370     wxString            m_strProjectSetupCookie;
371     wxString            m_strProjectUserName;
372     bool                m_bProjectKnown;
373     wxString            m_strAccountEmailAddress;
374     wxString            m_strAccountUsername;
375     wxString            m_strAccountPassword;
376     wxString            m_strAccountConfirmPassword;
377     wxString            m_strReturnURL;
378     wxString            m_strCookieFailureURL;
379 };
380 
381 #endif
382