Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afssvrcfg / backup_server_page.cpp
blobd8bf518dac0c37c64e450b23fb363cb1e3b61253
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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 */
11 * INCLUDES _________________________________________________________________
14 #include <winsock2.h>
15 #include <ws2tcpip.h>
17 extern "C" {
18 #include <afs/param.h>
19 #include <afs/stds.h>
22 #include "afscfg.h"
23 #include "resource.h"
27 * DEFINITIONS _________________________________________________________________
30 static HWND hDlg = 0;
31 int nOptionButtonSeparationHeight; // This is used by sys_control_page.cpp
35 * PROTOTYPES _________________________________________________________________
38 static void OnInitDialog(HWND hwndDlg);
39 static void CantBackup(UINT nMsgID);
40 static void CalcOptionButtonSeparationHeight();
44 * EXPORTED FUNCTIONS _________________________________________________________________
49 * Dialog Proc _________________________________________________________________
52 BOOL CALLBACK BackupPageDlgProc(HWND hwndDlg, UINT msg, WPARAM wp, LPARAM lp)
54 if (WizStep_Common_DlgProc (hwndDlg, msg, wp, lp))
55 return FALSE;
57 switch (msg) {
58 case WM_INITDIALOG:
59 OnInitDialog(hwndDlg);
60 break;
62 case WM_COMMAND:
63 switch (LOWORD(wp)) {
64 case IDNEXT:
65 g_pWiz->SetState(sidSTEP_EIGHT);
66 break;
68 case IDBACK:
69 g_pWiz->SetState(sidSTEP_SIX);
70 break;
72 case IDC_DONT_CONFIG_BACKUP_SERVER:
73 g_CfgData.configBak = CS_DONT_CONFIGURE;
74 break;
76 case IDC_CONFIG_BACKUP_SERVER:
77 g_CfgData.configBak = CS_CONFIGURE;
78 break;
80 break;
84 return FALSE;
89 * STATIC FUNCTIONS _________________________________________________________________
94 * Event Handler Functions _________________________________________________________________
97 static void OnInitDialog(HWND hwndDlg)
99 hDlg = hwndDlg;
101 CalcOptionButtonSeparationHeight();
103 g_pWiz->EnableButtons(BACK_BUTTON | NEXT_BUTTON);
104 g_pWiz->SetButtonText(IDNEXT, IDS_NEXT);
105 g_pWiz->SetDefaultControl(IDNEXT);
107 if (g_CfgData.configBak == CS_ALREADY_CONFIGURED) {
108 CantBackup(IDS_ALREADY_A_BACKUP_SERVER);
109 return;
112 // Should this step be disabled? Yes, if this machine
113 // is not configured as a database server.
114 if (!ConfiguredOrConfiguring(g_CfgData.configDB)) {
115 CantBackup(IDS_NOT_A_DB_SERVER);
116 EnableStep(g_CfgData.configBak, FALSE);
117 return;
120 // Enable this in case it was disabled the last time
121 EnableStep(g_CfgData.configBak);
123 if (g_CfgData.configBak == CS_DONT_CONFIGURE)
124 SetCheck(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER);
125 else if (g_CfgData.configBak == CS_CONFIGURE)
126 SetCheck(hDlg, IDC_CONFIG_BACKUP_SERVER);
131 * Utility Functions _________________________________________________________________
134 static void CantBackup(UINT nMsgID)
136 TCHAR szMsg[cchRESOURCE];
138 GetString(szMsg, nMsgID);
140 ShowWnd(hDlg, IDC_BACKUP_SERVER_QUESTION, FALSE);
141 ShowWnd(hDlg, IDC_CONFIG_BACKUP_SERVER, FALSE);
142 ShowWnd(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER, FALSE);
144 ShowWnd(hDlg, IDC_CANT_BACKUP_MSG);
145 SetWndText(hDlg, IDC_CANT_BACKUP_MSG, szMsg);
148 static void CalcOptionButtonSeparationHeight()
150 RECT rectOB1, rectOB2;
152 GetWindowRect(GetDlgItem(hDlg, IDC_CONFIG_BACKUP_SERVER), &rectOB1);
153 GetWindowRect(GetDlgItem(hDlg, IDC_DONT_CONFIG_BACKUP_SERVER), &rectOB2);
155 nOptionButtonSeparationHeight = rectOB2.top - rectOB1.top;