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 #include <afs/param.h>
16 #include "svr_syncvldb.h"
17 #include "propcache.h"
21 * DEFINITIONS ________________________________________________________________
27 * PROTOTYPES _________________________________________________________________
31 BOOL CALLBACK Server_SyncVLDB_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
32 void Server_SyncVLDB_OnInitDialog (HWND hDlg, LPIDENT lpi);
33 void Server_SyncVLDB_OnOK (HWND hDlg, LPIDENT lpi);
34 void Server_SyncVLDB_OnEndTask_Init (HWND hDlg, LPTASKPACKET ptp);
38 * ROUTINES ___________________________________________________________________
42 void Server_SyncVLDB (LPIDENT lpi)
45 if ((hCurrent = PropCache_Search (pcSVR_SYNCVLDB, lpi)) != NULL)
51 ModelessDialogParam (IDD_SVR_SYNCVLDB, NULL, (DLGPROC)Server_SyncVLDB_DlgProc, (LPARAM)lpi);
56 BOOL CALLBACK Server_SyncVLDB_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
58 if (AfsAppLib_HandleHelp (IDD_SVR_SYNCVLDB, hDlg, msg, wp, lp))
61 if (msg == WM_INITDIALOG)
62 SetWindowLong (hDlg, DWL_USER, lp);
65 if ((lpi = (LPIDENT)GetWindowLong (hDlg, DWL_USER)) != NULL)
70 PropCache_Add (pcSVR_SYNCVLDB, lpi, hDlg);
71 Server_SyncVLDB_OnInitDialog (hDlg, lpi);
76 if ((ptp = (LPTASKPACKET)lp) != NULL)
78 if (ptp->idTask == taskAGG_FIND_GHOST)
79 Server_SyncVLDB_OnEndTask_Init (hDlg, ptp);
88 Server_SyncVLDB_OnOK (hDlg, lpi);
99 PropCache_Delete (pcSVR_SYNCVLDB, lpi);
108 void Server_SyncVLDB_OnInitDialog (HWND hDlg, LPIDENT lpi)
110 if (lpi->fIsServer())
112 TCHAR szServer[ cchNAME ];
113 lpi->GetServerName (szServer);
115 LPTSTR pszText = FormatString (IDS_SYNCVLDB_SVR_DESC, TEXT("%s"), szServer);
116 SetDlgItemText (hDlg, IDC_SYNC_DESC, pszText);
117 FreeString (pszText);
118 pszText = FormatString (IDS_SYNCVLDB_SVR_DESC2, TEXT("%s"), szServer);
119 SetDlgItemText (hDlg, IDC_SYNC_DESC2, pszText);
120 FreeString (pszText);
122 ShowWindow (hDlg, SW_SHOW);
124 else // (lpi->fIsAggregate())
126 TCHAR szServer[ cchNAME ];
127 lpi->GetServerName (szServer);
128 TCHAR szAggregate[ cchNAME ];
129 lpi->GetAggregateName (szAggregate);
131 LPTSTR pszText = FormatString (IDS_SYNCVLDB_AGG_DESC, TEXT("%s%s"), szServer, szAggregate);
132 SetDlgItemText (hDlg, IDC_SYNC_DESC, pszText);
133 FreeString (pszText);
134 pszText = FormatString (IDS_SYNCVLDB_AGG_DESC2, TEXT("%s%s"), szServer, szAggregate);
135 SetDlgItemText (hDlg, IDC_SYNC_DESC2, pszText);
136 FreeString (pszText);
138 StartTask (taskAGG_FIND_GHOST, hDlg, lpi);
143 void Server_SyncVLDB_OnEndTask_Init (HWND hDlg, LPTASKPACKET ptp)
145 if (ptp->rc && (!(TASKDATA(ptp)->wGhost & GHOST_HAS_SERVER_ENTRY)))
147 LPIDENT lpi = (LPIDENT)( ptp->lpUser );
149 TCHAR szServer[ cchNAME ];
150 lpi->GetServerName (szServer);
151 TCHAR szAggregate[ cchNAME ];
152 lpi->GetAggregateName (szAggregate);
154 ErrorDialog (0, IDS_ERROR_CANT_SYNC_GHOST_AGGREGATE, TEXT("%s%s"), szServer, szAggregate);
155 DestroyWindow (hDlg);
159 ShowWindow (hDlg, SW_SHOW);
163 void Server_SyncVLDB_OnOK (HWND hDlg, LPIDENT lpi)
165 LPSVR_SYNCVLDB_PARAMS lpp = New (SVR_SYNCVLDB_PARAMS);
166 lpp->lpi = (LPIDENT)GetWindowLong (hDlg, DWL_USER);
168 StartTask (taskSVR_SYNCVLDB, NULL, lpp);