more-rx-updates-20060504
[openafs.git] / src / WINNT / afssvrcfg / file_server_page.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
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
8  */
9
10 /*
11  * INCLUDES _________________________________________________________________
12  *
13  */
14 #include <winsock2.h>
15 #include <ws2tcpip.h>
16
17 extern "C" {
18 #include <afs/param.h>
19 #include <afs/stds.h>
20 }
21
22 #include "afscfg.h"
23 #include "resource.h"
24
25
26 /*
27  * DEFINITIONS _________________________________________________________________
28  *
29  */
30 static HWND hDlg = 0;
31
32
33 /*
34  * PROTOTYPES _________________________________________________________________
35  *
36  */
37 static void OnInitDialog(HWND hwndDlg);
38 static void ConfigMsg(UINT nMsgID);
39
40
41 /*
42  * EXPORTED FUNCTIONS _________________________________________________________________
43  *
44  */
45
46 /*
47  * Dialog Proc _________________________________________________________________
48  *
49  */
50 BOOL CALLBACK FileServerPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
51 {
52         if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
53                 return FALSE;
54
55         switch (msg) {
56                 case WM_INITDIALOG:
57                  OnInitDialog(hwndDlg);
58                      break;
59
60                 case WM_COMMAND:
61                         switch (LOWORD(wp)) {
62                                 case IDNEXT:
63                                         g_pWiz->SetState(sidSTEP_SIX);
64                                         break;
65
66                                 case IDBACK:
67                                    g_pWiz->SetState(sidSTEP_FOUR);
68                                    break;
69
70                                 case IDC_DONT_CONFIG_FILE_SERVER:
71                                         g_CfgData.configFS = CS_DONT_CONFIGURE;
72                                         break;
73
74                                 case IDC_SHOULD_CONFIG_FILE_SERVER:
75                                         g_CfgData.configFS = CS_CONFIGURE;
76                                         break;
77                         }
78                 break;
79
80         }
81
82         return FALSE;
83 }
84
85
86 /*
87  * STATIC FUNCTIONS _________________________________________________________________
88  *
89  */
90
91 /*
92  * Event Handler Functions _________________________________________________________________
93  *
94  */
95 static void OnInitDialog(HWND hwndDlg)
96 {
97         hDlg = hwndDlg;
98
99         g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
100         g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
101         g_pWiz->SetDefaultControl(IDNEXT);
102
103         if (g_CfgData.bFirstServer) {
104                 ConfigMsg(IDS_MUST_CONFIG_FS);
105                 g_CfgData.configFS = CS_CONFIGURE;
106                 return;
107         }
108
109         switch (g_CfgData.configFS) {
110                 case CS_ALREADY_CONFIGURED:
111                         ConfigMsg(IDS_ALREADY_A_FS_SERVER);
112                         break;
113
114                 case CS_DONT_CONFIGURE:
115                         SetCheck(hDlg, IDC_DONT_CONFIG_FILE_SERVER);
116                         break;
117
118                 case CS_CONFIGURE:
119                 default:
120                         SetCheck(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER);
121                         break;
122         }
123 }
124
125
126 /*
127  * Utility Functions _________________________________________________________________
128  *
129  */
130 static void ConfigMsg(UINT nMsgID)
131 {
132         TCHAR szMsg[cchRESOURCE];
133
134         GetString(szMsg, nMsgID);
135
136         // Hide the controls that are at the same position as the message
137         ShowWnd(hDlg, IDC_CREATE_FS_QUESTION, FALSE);
138         ShowWnd(hDlg, IDC_SHOULD_CONFIG_FILE_SERVER, FALSE);
139         ShowWnd(hDlg, IDC_DONT_CONFIG_FILE_SERVER, FALSE);
140         
141         SetWndText(hDlg, IDC_MSG, szMsg);
142         ShowWnd(hDlg, IDC_MSG);
143 }
144