2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * INCLUDES _________________________________________________________________
15 #include <afs/param.h>
24 * DEFINITIONS _________________________________________________________________
31 * PROTOTYPES _________________________________________________________________
34 static void OnInitDialog(HWND hwndDlg);
35 static void ShowStatusMsg(UINT nMsgID);
39 * EXPORTED FUNCTIONS __________________________________________________________
44 * Dialog Proc _________________________________________________________________
47 BOOL CALLBACK RootAfsPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
49 if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
54 OnInitDialog(hwndDlg);
60 g_pWiz->SetState(sidSTEP_TEN);
64 g_pWiz->SetState(sidSTEP_EIGHT);
67 case IDC_DONT_CREATE_ROOT_VOLUMES:
68 g_CfgData.configRootVolumes = CS_DONT_CONFIGURE;
71 case IDC_CREATE_ROOT_VOLUMES:
72 g_CfgData.configRootVolumes = CS_CONFIGURE;
85 * STATIC FUNCTIONS _________________________________________________________________
90 * Event Handler Functions _________________________________________________________________
93 static void OnInitDialog(HWND hwndDlg)
97 g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
98 g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
99 g_pWiz->SetDefaultControl(IDNEXT);
101 if (g_CfgData.bFirstServer) {
102 ShowStatusMsg(IDS_MUST_CREATE_ROOT_AFS);
103 g_CfgData.configRootVolumes = CS_CONFIGURE;
107 if (g_CfgData.configRootVolumes == CS_ALREADY_CONFIGURED) {
108 ShowStatusMsg(IDS_ROOT_AFS_ALREADY_EXISTS);
112 // If the existence of the root volumes could not be determined, we'll
113 // ask the user if they want to create them if they don't already exist.
114 if (!g_CfgData.bRootVolumesExistanceKnown) {
115 SetWndText(hDlg, IDC_ROOT_AFS_QUESTION, IDS_CREATE_ROOT_VOLUMES_IF_NECESSARY_PROMPT);
116 SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES);
117 g_CfgData.configRootVolumes = CS_CONFIGURE;
121 // Should this step be disabled? Yes, if this machine does
122 // not have a partition to make root.afs on.
123 if (!ConfiguredOrConfiguring(g_CfgData.configPartition)) {
124 ShowStatusMsg(IDS_NO_PARTITION_EXISTS);
125 EnableStep(g_CfgData.configRootVolumes, FALSE);
129 // If root.afs exists already but root.cell does not exist, then
130 // the wizard cannot make root.cell and must disable this option.
131 // However, since the root volumes don't both exist, we will leave
132 // this option enabled, and only disable the yes check box.
133 // TODO: We should handle this better in a future version where we can
134 // add new messages. The message catalog is frozen for this version
135 // so we have to handle this case without adding new messages.
136 if (g_CfgData.bRootAfsExists && !g_CfgData.bRootCellExists) {
137 EnableWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE);
138 SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES);
139 g_CfgData.configRootVolumes = CS_DONT_CONFIGURE;
143 // Must do this in case it was disabled on the last run through
144 EnableStep(g_CfgData.configRootVolumes);
146 if (g_CfgData.configRootVolumes == CS_DONT_CONFIGURE)
147 SetCheck(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES);
149 SetCheck(hDlg, IDC_CREATE_ROOT_VOLUMES);
154 * Utility Functions _________________________________________________________________
157 static void ShowStatusMsg(UINT nMsgID)
159 TCHAR szMsg[cchRESOURCE];
161 GetString(szMsg, nMsgID);
163 // Hide the controls that are at the same position as the message
164 ShowWnd(hDlg, IDC_ROOT_AFS_QUESTION, FALSE);
165 ShowWnd(hDlg, IDC_CREATE_ROOT_VOLUMES, FALSE);
166 ShowWnd(hDlg, IDC_DONT_CREATE_ROOT_VOLUMES, FALSE);
168 SetWndText(hDlg, IDC_ROOT_AFS_MSG, szMsg);
169 ShowWnd(hDlg, IDC_ROOT_AFS_MSG);