Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afssvrmgr / action.cpp
blob5d7e568ee2976e85a59549f42af6f9cb8dfd049d
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 */
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
18 #include "svrmgr.h"
19 #include "action.h"
20 #include "window.h"
21 #include "messages.h"
22 #include "display.h"
26 * DEFINITIONS ________________________________________________________________
30 #define cREALLOC_ACTIONLIST 4
32 typedef enum
34 actcolOPERATION,
35 actcolELAPSED,
36 } ACTIONCOLUMN;
38 static struct
40 int idsColumn;
41 int cxWidth;
43 ACTIONCOLUMNS[] =
45 { IDS_ACTCOL_OPERATION, 100 }, // actcolOPERATIONS
46 { IDS_ACTCOL_ELAPSED, 100 }, // actcolELAPSED
49 #define nACTIONCOLUMNS (sizeof(ACTIONCOLUMNS)/sizeof(ACTIONCOLUMNS[0]))
51 #define cxMIN_ACTION 75
52 #define cyMIN_ACTION 50
56 * ACTION TYPES _______________________________________________________________
60 typedef enum
62 atUNUSED = 0,
63 atOPENCELL,
64 atSCOUT,
65 atTIMEOUT,
66 atREFRESH,
67 atGETSERVERLOGFILE,
68 atSETSERVERAUTH,
69 atSTARTSERVICE,
70 atSTOPSERVICE,
71 atRESTARTSERVICE,
72 atCREATEFILESET,
73 atDELETEFILESET,
74 atMOVEFILESET,
75 atSETFILESETQUOTA,
76 atSYNCVLDB,
77 atSALVAGE,
78 atSETFILESETREPPARAMS,
79 atCREATEREPLICA,
80 atPRUNEFILES,
81 atINSTALLFILE,
82 atUNINSTALLFILE,
83 atRENAMEFILESET,
84 atCREATESERVICE,
85 atDELETESERVICE,
86 atRELEASEFILESET,
87 atGETFILEDATES,
88 atEXECUTECOMMAND,
89 atADMINLIST_LOAD,
90 atADMINLIST_SAVE,
91 atHOSTLIST_LOAD,
92 atHOSTLIST_SAVE,
93 atCLONE,
94 atCLONESYS,
95 atDUMP,
96 atRESTORE,
97 atSETRESTART,
98 atCHANGEADDR,
99 } ACTIONTYPE;
101 typedef struct
103 ACTIONTYPE Type;
104 NOTIFYPARAMS Params;
105 DWORD dwTickStart;
106 HWND hDlg;
107 } ACTION, *PACTION;
111 * VARIABLES __________________________________________________________________
115 static struct l
117 PACTION *aActions;
118 size_t cActions;
119 size_t cActionsInUse;
120 BOOL fShowConfirmations;
121 } l;
123 rwWindowData awdActions[] = {
124 { IDC_ACTION_DESC, raSizeX | raRepaint, 0, 0 },
125 { IDC_ACTION_LIST, raSizeX | raSizeY, MAKELONG(cxMIN_ACTION,cyMIN_ACTION), 0 },
126 { idENDLIST, 0, 0, 0 }
131 * PROTOTYPES _________________________________________________________________
135 void TicksToElapsedTime (LPSYSTEMTIME pst, DWORD dwTicks);
136 void CopyFirstWord (LPTSTR pszTarget, LPTSTR pszSource);
138 BOOL CALLBACK Action_Window_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
139 void Action_Window_Refresh (void);
140 LPTSTR Action_GetDescription (size_t ii);
142 BOOL Action_CompareNotifyParams (PNOTIFYPARAMS pParams1, PNOTIFYPARAMS pParams2);
143 PACTION Action_Begin (ACTIONTYPE Type, PNOTIFYPARAMS pParams);
144 PACTION Action_Find (ACTIONTYPE Type, PNOTIFYPARAMS pParams);
145 void Action_OnDestroy (HWND hDlg);
146 void Action_SpecifyWindow (PACTION pParams, HWND hDlg);
147 void Action_End (PACTION pParams, DWORD dwStatus);
149 void Action_GetServerLogFile_Begin (PNOTIFYPARAMS pParams);
150 void Action_GetServerLogFile_End (PNOTIFYPARAMS pParams);
151 void Action_SetServerAuth_Begin (PNOTIFYPARAMS pParams);
152 void Action_SetServerAuth_End (PNOTIFYPARAMS pParams);
153 void Action_InstallFile_Begin (PNOTIFYPARAMS pParams);
154 void Action_InstallFile_End (PNOTIFYPARAMS pParams);
155 void Action_UninstallFile_Begin (PNOTIFYPARAMS pParams);
156 void Action_UninstallFile_End (PNOTIFYPARAMS pParams);
157 void Action_PruneFiles_Begin (PNOTIFYPARAMS pParams);
158 void Action_PruneFiles_End (PNOTIFYPARAMS pParams);
159 void Action_StartService_Begin (PNOTIFYPARAMS pParams);
160 void Action_StartService_End (PNOTIFYPARAMS pParams);
161 void Action_StopService_Begin (PNOTIFYPARAMS pParams);
162 void Action_StopService_End (PNOTIFYPARAMS pParams);
163 void Action_RestartService_Begin (PNOTIFYPARAMS pParams);
164 void Action_RestartService_End (PNOTIFYPARAMS pParams);
165 void Action_CreateFileset_Begin (PNOTIFYPARAMS pParams);
166 void Action_CreateFileset_End (PNOTIFYPARAMS pParams);
167 void Action_DeleteFileset_Begin (PNOTIFYPARAMS pParams);
168 void Action_DeleteFileset_End (PNOTIFYPARAMS pParams);
169 void Action_SetFilesetQuota_Begin (PNOTIFYPARAMS pParams);
170 void Action_SetFilesetQuota_End (PNOTIFYPARAMS pParams);
171 void Action_SyncVLDB_Begin (PNOTIFYPARAMS pParams);
172 void Action_SyncVLDB_End (PNOTIFYPARAMS pParams);
173 void Action_Salvage_Begin (PNOTIFYPARAMS pParams);
174 void Action_Salvage_End (PNOTIFYPARAMS pParams);
175 void Action_Scout_Begin (PNOTIFYPARAMS pParams);
176 void Action_Scout_End (PNOTIFYPARAMS pParams);
177 void Action_SetFilesetRepParams_Begin (PNOTIFYPARAMS pParams);
178 void Action_SetFilesetRepParams_End (PNOTIFYPARAMS pParams);
179 void Action_CreateReplica_Begin (PNOTIFYPARAMS pParams);
180 void Action_CreateReplica_End (PNOTIFYPARAMS pParams);
181 void Action_RenameFileset_Begin (PNOTIFYPARAMS pParams);
182 void Action_RenameFileset_End (PNOTIFYPARAMS pParams);
183 void Action_CreateService_Begin (PNOTIFYPARAMS pParams);
184 void Action_CreateService_End (PNOTIFYPARAMS pParams);
185 void Action_DeleteService_Begin (PNOTIFYPARAMS pParams);
186 void Action_DeleteService_End (PNOTIFYPARAMS pParams);
187 void Action_ReleaseFileset_Begin (PNOTIFYPARAMS pParams);
188 void Action_ReleaseFileset_End (PNOTIFYPARAMS pParams);
189 void Action_GetFileDates_Begin (PNOTIFYPARAMS pParams);
190 void Action_GetFileDates_End (PNOTIFYPARAMS pParams);
191 void Action_ExecuteCommand_Begin (PNOTIFYPARAMS pParams);
192 void Action_ExecuteCommand_End (PNOTIFYPARAMS pParams);
193 void Action_AdminListLoad_Begin (PNOTIFYPARAMS pParams);
194 void Action_AdminListLoad_End (PNOTIFYPARAMS pParams);
195 void Action_AdminListSave_Begin (PNOTIFYPARAMS pParams);
196 void Action_AdminListSave_End (PNOTIFYPARAMS pParams);
197 void Action_HostListLoad_Begin (PNOTIFYPARAMS pParams);
198 void Action_HostListLoad_End (PNOTIFYPARAMS pParams);
199 void Action_HostListSave_Begin (PNOTIFYPARAMS pParams);
200 void Action_HostListSave_End (PNOTIFYPARAMS pParams);
201 void Action_Clone_Begin (PNOTIFYPARAMS pParams);
202 void Action_Clone_End (PNOTIFYPARAMS pParams);
203 void Action_Clonesys_Begin (PNOTIFYPARAMS pParams);
204 void Action_Clonesys_End (PNOTIFYPARAMS pParams);
205 void Action_SetRestart_Begin (PNOTIFYPARAMS pParams);
206 void Action_SetRestart_End (PNOTIFYPARAMS pParams);
207 void Action_ChangeAddr_Begin (PNOTIFYPARAMS pParams);
208 void Action_ChangeAddr_End (PNOTIFYPARAMS pParams);
210 void Action_Refresh_Begin (PNOTIFYPARAMS pParams);
211 void Action_Refresh_Update (PNOTIFYPARAMS pParams);
212 void Action_Refresh_SectionStart (PNOTIFYPARAMS pParams);
213 void Action_Refresh_SectionEnd (PNOTIFYPARAMS pParams);
214 void Action_Refresh_End (PNOTIFYPARAMS pParams);
215 void Action_Refresh_UpdateText (HWND hDlg, LPIDENT lpi, DWORD dwPerComplete);
216 void Action_Refresh_SetSection (HWND hDlg, BOOL fStart, int idSection);
217 void Action_Refresh_SkipSection (HWND hDlg);
218 BOOL CALLBACK Action_Refresh_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
220 void Action_MoveFileset_Begin (PNOTIFYPARAMS pParams);
221 void Action_MoveFileset_End (PNOTIFYPARAMS pParams);
222 BOOL CALLBACK Action_MoveFileset_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
224 void Action_DumpFileset_Begin (PNOTIFYPARAMS pParams);
225 void Action_DumpFileset_End (PNOTIFYPARAMS pParams);
226 BOOL CALLBACK Action_DumpFileset_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
228 void Action_RestoreFileset_Begin (PNOTIFYPARAMS pParams);
229 void Action_RestoreFileset_End (PNOTIFYPARAMS pParams);
230 BOOL CALLBACK Action_RestoreFileset_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
232 void Action_OpenCell_Begin (PNOTIFYPARAMS pParams);
233 void Action_OpenCell_End (PNOTIFYPARAMS pParams);
234 BOOL CALLBACK Action_OpenCell_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp);
238 * ROUTINES ___________________________________________________________________
242 void ActionNotification_MainThread (NOTIFYEVENT evt, PNOTIFYPARAMS pParams)
244 BOOL fRefresh = TRUE;
246 switch (evt)
249 // When Scout starts and stops checking a server, it'll notify us.
251 case evtScoutBegin: Action_Scout_Begin (pParams); break;
252 case evtScoutEnd: Action_Scout_End (pParams); break;
254 // If AFSClass is going to perform a lengthy refresh, it will send
255 // us notifications for when it starts, when it's done, and periodic
256 // updates about how far along it is. Use that information to present
257 // a dialog to the user...
259 case evtRefreshAllBegin: Action_Refresh_Begin (pParams); break;
260 case evtRefreshAllUpdate: Action_Refresh_Update (pParams); break;
261 case evtRefreshAllSectionStart: Action_Refresh_SectionStart (pParams); break;
262 case evtRefreshAllSectionEnd: Action_Refresh_SectionEnd (pParams); break;
263 case evtRefreshAllEnd: Action_Refresh_End(pParams); break;
265 case evtGetServerLogFileBegin: Action_GetServerLogFile_Begin (pParams); break;
266 case evtGetServerLogFileEnd: Action_GetServerLogFile_End (pParams); break;
267 case evtSetServerAuthBegin: Action_SetServerAuth_Begin (pParams); break;
268 case evtSetServerAuthEnd: Action_SetServerAuth_End (pParams); break;
269 case evtInstallFileBegin: Action_InstallFile_Begin (pParams); break;
270 case evtInstallFileEnd: Action_InstallFile_End (pParams); break;
271 case evtUninstallFileBegin: Action_UninstallFile_Begin (pParams); break;
272 case evtUninstallFileEnd: Action_UninstallFile_End (pParams); break;
273 case evtPruneFilesBegin: Action_PruneFiles_Begin (pParams); break;
274 case evtPruneFilesEnd: Action_PruneFiles_End (pParams); break;
275 case evtStartServiceBegin: Action_StartService_Begin (pParams); break;
276 case evtStartServiceEnd: Action_StartService_End (pParams); break;
277 case evtStopServiceBegin: Action_StopService_Begin (pParams); break;
278 case evtStopServiceEnd: Action_StopService_End (pParams); break;
279 case evtRestartServiceBegin: Action_RestartService_Begin (pParams); break;
280 case evtRestartServiceEnd: Action_RestartService_End (pParams); break;
281 case evtCreateFilesetBegin: Action_CreateFileset_Begin (pParams); break;
282 case evtCreateFilesetEnd: Action_CreateFileset_End (pParams); break;
283 case evtDeleteFilesetBegin: Action_DeleteFileset_Begin (pParams); break;
284 case evtDeleteFilesetEnd: Action_DeleteFileset_End (pParams); break;
285 case evtMoveFilesetBegin: Action_MoveFileset_Begin (pParams); break;
286 case evtMoveFilesetEnd: Action_MoveFileset_End (pParams); break;
287 case evtSetFilesetQuotaBegin: Action_SetFilesetQuota_Begin (pParams); break;
288 case evtSetFilesetQuotaEnd: Action_SetFilesetQuota_End (pParams); break;
289 case evtSyncVLDBBegin: Action_SyncVLDB_Begin (pParams); break;
290 case evtSyncVLDBEnd: Action_SyncVLDB_End (pParams); break;
291 case evtSalvageBegin: Action_Salvage_Begin (pParams); break;
292 case evtSalvageEnd: Action_Salvage_End (pParams); break;
293 case evtSetFilesetRepParamsBegin: Action_SetFilesetRepParams_Begin (pParams); break;
294 case evtSetFilesetRepParamsEnd: Action_SetFilesetRepParams_End (pParams); break;
295 case evtCreateReplicaBegin: Action_CreateReplica_Begin (pParams); break;
296 case evtCreateReplicaEnd: Action_CreateReplica_End (pParams); break;
297 case evtRenameFilesetBegin: Action_RenameFileset_Begin (pParams); break;
298 case evtRenameFilesetEnd: Action_RenameFileset_End (pParams); break;
299 case evtCreateServiceBegin: Action_CreateService_Begin (pParams); break;
300 case evtCreateServiceEnd: Action_CreateService_End (pParams); break;
301 case evtDeleteServiceBegin: Action_DeleteService_Begin (pParams); break;
302 case evtDeleteServiceEnd: Action_DeleteService_End (pParams); break;
303 case evtReleaseFilesetBegin: Action_ReleaseFileset_Begin (pParams); break;
304 case evtReleaseFilesetEnd: Action_ReleaseFileset_End (pParams); break;
305 case evtGetFileDatesBegin: Action_GetFileDates_Begin (pParams); break;
306 case evtGetFileDatesEnd: Action_GetFileDates_End (pParams); break;
307 case evtExecuteCommandBegin: Action_ExecuteCommand_Begin (pParams); break;
308 case evtExecuteCommandEnd: Action_ExecuteCommand_End (pParams); break;
309 case evtAdminListLoadBegin: Action_AdminListLoad_Begin (pParams); break;
310 case evtAdminListLoadEnd: Action_AdminListLoad_End (pParams); break;
311 case evtAdminListSaveBegin: Action_AdminListSave_Begin (pParams); break;
312 case evtAdminListSaveEnd: Action_AdminListSave_End (pParams); break;
313 case evtHostListLoadBegin: Action_HostListLoad_Begin (pParams); break;
314 case evtHostListLoadEnd: Action_HostListLoad_End (pParams); break;
315 case evtHostListSaveBegin: Action_HostListSave_Begin (pParams); break;
316 case evtHostListSaveEnd: Action_HostListSave_End (pParams); break;
317 case evtCloneBegin: Action_Clone_Begin (pParams); break;
318 case evtCloneEnd: Action_Clone_End (pParams); break;
319 case evtCloneMultipleBegin: Action_Clonesys_Begin (pParams); break;
320 case evtCloneMultipleEnd: Action_Clonesys_End (pParams); break;
321 case evtDumpFilesetBegin: Action_DumpFileset_Begin (pParams); break;
322 case evtDumpFilesetEnd: Action_DumpFileset_End (pParams); break;
323 case evtRestoreFilesetBegin: Action_RestoreFileset_Begin (pParams); break;
324 case evtRestoreFilesetEnd: Action_RestoreFileset_End (pParams); break;
325 case evtSetRestartTimesBegin: Action_SetRestart_Begin (pParams); break;
326 case evtSetRestartTimesEnd: Action_SetRestart_End (pParams); break;
327 case evtChangeAddressBegin: Action_ChangeAddr_Begin (pParams); break;
328 case evtChangeAddressEnd: Action_ChangeAddr_End (pParams); break;
329 case evtOpenCellBegin: Action_OpenCell_Begin (pParams); break;
330 case evtOpenCellEnd: Action_OpenCell_End (pParams); break;
332 default:
333 fRefresh = FALSE;
336 if (fRefresh)
337 Action_Window_Refresh();
341 void TicksToElapsedTime (LPSYSTEMTIME pst, DWORD dwTicks)
343 #define msecSECOND (1000L)
344 #define msecMINUTE (1000L * 60L)
345 #define msecHOUR (1000L * 60L * 60L)
346 #define msecDAY (1000L * 60L * 60L * 24L)
348 memset (pst, 0x00, sizeof(SYSTEMTIME));
350 pst->wDay = (int)( dwTicks / msecDAY );
351 dwTicks %= msecDAY;
352 pst->wHour = (int)( dwTicks / msecHOUR );
353 dwTicks %= msecHOUR;
354 pst->wMinute = (int)( dwTicks / msecMINUTE );
355 dwTicks %= msecMINUTE;
356 pst->wSecond = (int)( dwTicks / msecSECOND );
357 dwTicks %= msecSECOND;
358 pst->wMilliseconds = (int)( dwTicks );
362 void CopyFirstWord (LPTSTR pszTarget, LPTSTR pszSource)
364 lstrcpy (pszTarget, pszSource);
366 LPTSTR pch;
367 if ((pch = (LPTSTR)lstrchr (pszTarget, TEXT(' '))) != NULL)
368 *pch = TEXT('\0');
369 if ((pch = (LPTSTR)lstrchr (pszTarget, TEXT('\t'))) != NULL)
370 *pch = TEXT('\0');
374 void Action_OpenWindow (void)
376 if (!g.hAction || !IsWindow (g.hAction))
378 g.hAction = ModelessDialog (IDD_ACTIONS, NULL, (DLGPROC)Action_Window_DlgProc);
379 ShowWindow (g.hAction, SW_SHOW);
384 void Action_CloseWindow (void)
386 if (g.hAction && IsWindow (g.hAction))
388 DestroyWindow (g.hAction);
393 BOOL CALLBACK Action_Window_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
395 if (HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewAct))
396 return FALSE;
398 switch (msg)
400 case WM_INITDIALOG:
401 g.hAction = hDlg;
402 HWND hList;
403 hList = GetDlgItem (hDlg, IDC_ACTION_LIST);
404 FL_RestoreView (hList, &gr.viewAct);
406 if (gr.rActions.right == 0)
407 GetWindowRect (hDlg, &gr.rActions);
408 ResizeWindow (hDlg, awdActions, rwaMoveToHere, &gr.rActions);
410 Action_Window_Refresh();
411 SetTimer (hDlg, ID_ACTION_TIMER, 1000, NULL); // timer message every sec
413 SetWindowPos (g.hAction, HWND_TOPMOST, 0, 0, 0, 0,
414 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
415 break;
417 case WM_DESTROY:
418 gr.fActions = FALSE;
419 g.hAction = NULL;
420 Main_SetActionMenus();
421 FL_StoreView (GetDlgItem (hDlg, IDC_ACTION_LIST), &gr.viewAct);
422 KillTimer (hDlg, ID_ACTION_TIMER);
423 break;
425 case WM_TIMER:
426 if (FastList_GetItemCount (GetDlgItem (hDlg, IDC_ACTION_LIST)))
427 Action_Window_Refresh();
428 break;
430 case WM_SIZE:
431 // if (lp==0), we're minimizing--don't call ResizeWindow().
433 if (lp != 0)
435 ResizeWindow (hDlg, awdActions, rwaFixupGuts);
436 GetWindowRect (hDlg, &gr.rActions);
438 break;
440 case WM_MOVE:
441 GetWindowRect (hDlg, &gr.rActions);
442 break;
444 case WM_COMMAND:
445 switch (LOWORD(wp))
447 case IDOK:
448 case IDCANCEL:
449 DestroyWindow (hDlg);
450 break;
452 break;
455 return FALSE;
459 void Action_WindowToTop (BOOL fTop)
461 if (g.hAction && IsWindow(g.hAction))
463 if (fTop)
465 SetWindowPos (g.hAction, HWND_TOPMOST, 0, 0, 0, 0,
466 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
468 else //(!fTop)
470 SetWindowPos (g.hAction, g.hMain, 0, 0, 0, 0,
471 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
477 void Action_Window_Refresh (void)
479 size_t nItems = 0;
480 TCHAR szText[ cchRESOURCE ];
482 HWND hList = GetDlgItem (g.hAction, IDC_ACTION_LIST);
483 if (hList != NULL)
485 LPARAM lpOld = FL_StartChange (hList, TRUE);
487 for (size_t ii = 0; ii < l.cActions; ++ii)
489 LPTSTR pszDesc;
490 if ((pszDesc = Action_GetDescription (ii)) != NULL)
492 SYSTEMTIME st;
493 TicksToElapsedTime (&st, GetTickCount() - l.aActions[ ii ]->dwTickStart);
494 FormatElapsed (szText, TEXT("%s"), &st);
495 FL_AddItem (hList, &gr.viewAct, (LPARAM)ii, IMAGE_NOIMAGE, pszDesc, szText);
496 ++nItems;
498 FreeString (pszDesc);
502 FL_EndChange (hList, lpOld);
505 if (nItems == 0)
506 GetString (szText, IDS_ACTION_DESC_NONE);
507 else if (nItems == 1)
508 GetString (szText, IDS_ACTION_DESC_ONE);
509 else // (nItems >= 2)
510 GetString (szText, IDS_ACTION_DESC_MULT);
511 SetDlgItemText (g.hAction, IDC_ACTION_DESC, szText);
515 LPTSTR Action_GetDescription (size_t ii)
517 TCHAR szText[ cchRESOURCE ];
518 TCHAR szText2[ cchRESOURCE ];
519 TCHAR szText3[ cchRESOURCE ];
520 LPTSTR pszDesc = NULL;
522 if (!l.aActions[ ii ])
523 return NULL;
525 switch (l.aActions[ ii ]->Type)
527 case atSCOUT:
528 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
529 pszDesc = FormatString (IDS_ACTION_SCOUT, TEXT("%s"), szText);
530 break;
532 case atREFRESH:
533 pszDesc = FormatString (IDS_ACTION_REFRESH);
534 break;
536 case atGETSERVERLOGFILE:
537 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
538 pszDesc = FormatString (IDS_ACTION_GETSERVERLOGFILE, TEXT("%s%s"), szText, l.aActions[ ii ]->Params.sz1);
539 break;
541 case atSETSERVERAUTH:
542 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
543 pszDesc = FormatString (IDS_ACTION_SETSERVERAUTH, TEXT("%s"), szText);
544 break;
546 case atINSTALLFILE:
547 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
548 CopyBaseFileName (szText2, l.aActions[ ii ]->Params.sz1);
549 pszDesc = FormatString (IDS_ACTION_INSTALLFILE, TEXT("%s%s"), szText, szText2);
550 break;
552 case atUNINSTALLFILE:
553 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
554 CopyBaseFileName (szText2, l.aActions[ ii ]->Params.sz1);
555 pszDesc = FormatString (IDS_ACTION_UNINSTALLFILE, TEXT("%s%s"), szText, szText2);
556 break;
558 case atPRUNEFILES:
559 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
560 pszDesc = FormatString (IDS_ACTION_PRUNEFILES, TEXT("%s"), szText);
561 break;
563 case atSTARTSERVICE:
564 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
565 l.aActions[ ii ]->Params.lpi1->GetServiceName (szText2);
566 pszDesc = FormatString (IDS_ACTION_STARTSERVICE, TEXT("%s%s"), szText, szText2);
567 break;
569 case atSTOPSERVICE:
570 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
571 l.aActions[ ii ]->Params.lpi1->GetServiceName (szText2);
572 pszDesc = FormatString (IDS_ACTION_STOPSERVICE, TEXT("%s%s"), szText, szText2);
573 break;
575 case atRESTARTSERVICE:
576 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
577 l.aActions[ ii ]->Params.lpi1->GetServiceName (szText2);
578 pszDesc = FormatString (IDS_ACTION_RESTARTSERVICE, TEXT("%s%s"), szText, szText2);
579 break;
581 case atCREATEFILESET:
582 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
583 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
584 pszDesc = FormatString (IDS_ACTION_CREATEFILESET, TEXT("%s%s%s"), szText, szText2, l.aActions[ ii ]->Params.sz1);
585 break;
587 case atDELETEFILESET:
588 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
589 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
590 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
591 pszDesc = FormatString (IDS_ACTION_DELETEFILESET, TEXT("%s%s%s"), szText, szText2, szText3);
592 break;
594 case atMOVEFILESET:
595 l.aActions[ ii ]->Params.lpi2->GetServerName (szText);
596 l.aActions[ ii ]->Params.lpi2->GetAggregateName (szText2);
597 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
598 pszDesc = FormatString (IDS_ACTION_MOVEFILESET, TEXT("%s%s%s"), szText, szText2, szText3);
599 break;
601 case atSETFILESETQUOTA:
602 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
603 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
604 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
605 pszDesc = FormatString (IDS_ACTION_SETFILESETQUOTA, TEXT("%s%s%s"), szText, szText2, szText3);
606 break;
608 case atSETFILESETREPPARAMS:
609 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
610 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
611 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
612 pszDesc = FormatString (IDS_ACTION_SETREPPARAMS, TEXT("%s%s%s"), szText, szText2, szText3);
613 break;
615 case atCREATEREPLICA:
616 l.aActions[ ii ]->Params.lpi2->GetServerName (szText);
617 l.aActions[ ii ]->Params.lpi2->GetAggregateName (szText2);
618 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
619 pszDesc = FormatString (IDS_ACTION_CREATEREPLICA, TEXT("%s%s%s"), szText, szText2, szText3);
620 break;
622 case atSYNCVLDB:
623 if (l.aActions[ ii ]->Params.lpi1->fIsServer())
625 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
626 pszDesc = FormatString (IDS_ACTION_SYNCVLDB_SVR, TEXT("%s"), szText);
628 else
630 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
631 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
632 pszDesc = FormatString (IDS_ACTION_SYNCVLDB_AGG, TEXT("%s%s"), szText, szText2);
634 break;
636 case atSALVAGE:
637 if (l.aActions[ ii ]->Params.lpi1->fIsServer())
639 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
640 pszDesc = FormatString (IDS_ACTION_SALVAGE_SVR, TEXT("%s"), szText);
642 else if (l.aActions[ ii ]->Params.lpi1->fIsAggregate())
644 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
645 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
646 pszDesc = FormatString (IDS_ACTION_SALVAGE_AGG, TEXT("%s%s"), szText, szText2);
648 else // (l.aActions[ ii ]->Params.lpi1->fIsFileset())
650 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
651 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
652 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
653 pszDesc = FormatString (IDS_ACTION_SALVAGE_VOL, TEXT("%s%s%s"), szText, szText2, szText3);
655 break;
657 case atRENAMEFILESET:
658 pszDesc = FormatString (IDS_ACTION_RENAMEFILESET, TEXT("%s%s"), l.aActions[ ii ]->Params.sz1, l.aActions[ ii ]->Params.sz2);
659 break;
661 case atCREATESERVICE:
662 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
663 pszDesc = FormatString (IDS_ACTION_CREATESERVICE, TEXT("%s%s"), szText, l.aActions[ ii ]->Params.sz1);
664 break;
666 case atDELETESERVICE:
667 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
668 l.aActions[ ii ]->Params.lpi1->GetServiceName (szText2);
669 pszDesc = FormatString (IDS_ACTION_DELETESERVICE, TEXT("%s%s"), szText, szText2);
670 break;
672 case atRELEASEFILESET:
673 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
674 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
675 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
676 pszDesc = FormatString (IDS_ACTION_RELEASEFILESET, TEXT("%s%s%s"), szText, szText2, szText3);
677 break;
679 case atGETFILEDATES:
680 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
681 CopyBaseFileName (szText2, l.aActions[ ii ]->Params.sz1);
682 pszDesc = FormatString (IDS_ACTION_GETDATES, TEXT("%s%s"), szText, szText2);
683 break;
685 case atEXECUTECOMMAND:
686 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
687 CopyFirstWord (szText2, l.aActions[ ii ]->Params.sz1);
688 pszDesc = FormatString (IDS_ACTION_EXECUTE, TEXT("%s%s"), szText, szText2);
689 break;
691 case atADMINLIST_LOAD:
692 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
693 pszDesc = FormatString (IDS_ACTION_ADMINLIST_LOAD, TEXT("%s"), szText);
694 break;
696 case atADMINLIST_SAVE:
697 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
698 pszDesc = FormatString (IDS_ACTION_ADMINLIST_SAVE, TEXT("%s"), szText);
699 break;
701 case atHOSTLIST_LOAD:
702 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
703 pszDesc = FormatString (IDS_ACTION_HOSTLIST_LOAD, TEXT("%s"), szText);
704 break;
706 case atHOSTLIST_SAVE:
707 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
708 pszDesc = FormatString (IDS_ACTION_HOSTLIST_SAVE, TEXT("%s"), szText);
709 break;
711 case atCLONE:
712 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
713 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
714 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
715 pszDesc = FormatString (IDS_ACTION_CLONE, TEXT("%s%s%s"), szText, szText2, szText3);
716 break;
718 case atCLONESYS:
719 pszDesc = FormatString (IDS_ACTION_CLONESYS);
720 break;
722 case atDUMP:
723 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
724 l.aActions[ ii ]->Params.lpi1->GetAggregateName (szText2);
725 l.aActions[ ii ]->Params.lpi1->GetFilesetName (szText3);
726 pszDesc = FormatString (IDS_ACTION_DUMP, TEXT("%s%s%s%s"), szText, szText2, szText3, FindBaseFileName(l.aActions[ ii ]->Params.sz1));
727 break;
729 case atRESTORE:
730 pszDesc = FormatString (IDS_ACTION_RESTORE, TEXT("%s%s"), l.aActions[ ii ]->Params.sz1, FindBaseFileName(l.aActions[ ii ]->Params.sz2));
731 break;
733 case atSETRESTART:
734 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
735 pszDesc = FormatString (IDS_ACTION_SETRESTART, TEXT("%s"), szText);
736 break;
738 case atCHANGEADDR:
739 l.aActions[ ii ]->Params.lpi1->GetServerName (szText);
740 pszDesc = FormatString (IDS_ACTION_CHANGEADDR, TEXT("%s"), szText);
741 break;
743 case atOPENCELL:
744 pszDesc = FormatString (IDS_ACTION_OPENCELL, TEXT("%s"), l.aActions[ ii ]->Params.sz1);
745 break;
748 return pszDesc;
752 void Action_SetDefaultView (LPVIEWINFO lpvi)
754 lpvi->lvsView = FLS_VIEW_LIST;
755 lpvi->nColsAvail = nACTIONCOLUMNS;
757 for (size_t iCol = 0; iCol < nACTIONCOLUMNS; ++iCol)
759 lpvi->cxColumns[ iCol ] = ACTIONCOLUMNS[ iCol ].cxWidth;
760 lpvi->idsColumns[ iCol ] = ACTIONCOLUMNS[ iCol ].idsColumn;
763 lpvi->iSort = actcolELAPSED | COLUMN_SORTREV;
765 lpvi->nColsShown = 2;
766 lpvi->aColumns[0] = (int)actcolOPERATION;
767 lpvi->aColumns[1] = (int)actcolELAPSED;
771 void Action_ShowConfirmations (BOOL fShow)
773 l.fShowConfirmations = fShow;
777 BOOL Action_CompareNotifyParams (PNOTIFYPARAMS pParams1, PNOTIFYPARAMS pParams2)
779 if (!pParams1 || !pParams2)
780 return FALSE;
782 if (pParams1->lpi1 != pParams2->lpi1)
783 return FALSE;
784 if (pParams1->lpi2 != pParams2->lpi2)
785 return FALSE;
786 if (lstrcmp (pParams1->sz1, pParams2->sz1))
787 return FALSE;
788 if (lstrcmp (pParams1->sz2, pParams2->sz2))
789 return FALSE;
790 if (pParams1->dw1 != pParams2->dw1)
791 return FALSE;
793 return TRUE;
797 PACTION Action_Begin (ACTIONTYPE Type, PNOTIFYPARAMS pParams)
799 size_t ii;
800 for (ii = 0; ii < l.cActions; ++ii)
802 if (!l.aActions[ii])
803 break;
805 if (!REALLOC (l.aActions, l.cActions, 1+ii, cREALLOC_ACTIONLIST))
806 return NULL;
808 PACTION pAction = New (ACTION);
809 memcpy (&pAction->Params, pParams, sizeof(NOTIFYPARAMS));
810 pAction->Type = Type;
811 pAction->dwTickStart = GetTickCount();
812 pAction->hDlg = NULL;
814 l.aActions[ii] = pAction;
816 if (Type != atREFRESH)
817 l.cActionsInUse++;
819 return l.aActions[ii];
823 void Action_SpecifyWindow (PACTION pAction, HWND hDlg)
825 pAction->hDlg = hDlg;
826 ShowWindow (hDlg, SW_SHOW);
830 PACTION Action_Find (ACTIONTYPE Type, PNOTIFYPARAMS pParams)
832 for (size_t ii = 0; ii < l.cActions; ++ii)
834 if (!l.aActions[ ii ])
835 continue;
837 if (l.aActions[ ii ]->Type != Type)
838 continue;
840 if (Action_CompareNotifyParams (&l.aActions[ ii ]->Params, pParams))
841 return l.aActions[ ii ];
844 return NULL;
848 void Action_End (PACTION pParams, DWORD dwStatus)
850 if (!pParams)
851 return;
853 ACTIONTYPE TypeClosed = atUNUSED;
855 for (size_t ii = 0; ii < l.cActions; ++ii)
857 if (l.aActions[ ii ] == pParams)
859 if (l.fShowConfirmations && !dwStatus)
861 switch (l.aActions[ ii ]->Type)
863 case atUNUSED:
864 case atSCOUT:
865 case atTIMEOUT:
866 case atREFRESH:
867 // don't show confirmation messages for these operations
868 break;
870 default:
871 LPTSTR pszDesc;
872 if ((pszDesc = Action_GetDescription (ii)) != NULL)
874 Message (MB_OK | MB_ICONINFORMATION | MB_MODELESS, IDS_CONFIRMATION_TITLE, TEXT("%1"), TEXT("%s"), pszDesc);
875 FreeString (pszDesc);
877 break;
881 TypeClosed = l.aActions[ ii ]->Type;
883 if (IsWindow (l.aActions[ ii ]->hDlg))
884 PostMessage (l.aActions[ ii ]->hDlg, WM_COMMAND, IDCANCEL, 0);
886 Delete (l.aActions[ii]);
887 l.aActions[ii] = NULL;
891 // If we've finished all operations in progress, and if the user has
892 // already closed the app (well, tried to--we would've just hidden the
893 // window), close for real.
895 if ((TypeClosed != atUNUSED) && (TypeClosed != atREFRESH))
897 if ((--l.cActionsInUse) == 0)
899 if (g.lpiCell && !IsWindowVisible (g.hMain))
901 Quit (0);
908 BOOL Action_fAnyActive (void)
910 return (l.cActionsInUse >= 1) ? TRUE : FALSE;
914 void Action_OnDestroy (HWND hDlg)
916 for (size_t ii = 0; ii < l.cActions; ++ii)
918 if (!l.aActions[ ii ])
919 continue;
920 if (l.aActions[ ii ]->hDlg == hDlg)
921 l.aActions[ ii ]->hDlg = NULL;
927 * NO-DIALOG OPERATIONS
931 void Action_Scout_Begin (PNOTIFYPARAMS pParams)
933 Action_Begin (atSCOUT, pParams);
936 void Action_Scout_End (PNOTIFYPARAMS pParams)
938 Action_End (Action_Find (atSCOUT, pParams), pParams->status);
941 void Action_GetServerLogFile_Begin (PNOTIFYPARAMS pParams)
943 Action_Begin (atGETSERVERLOGFILE, pParams);
946 void Action_GetServerLogFile_End (PNOTIFYPARAMS pParams)
948 Action_End (Action_Find (atGETSERVERLOGFILE, pParams), pParams->status);
951 void Action_SetServerAuth_Begin (PNOTIFYPARAMS pParams)
953 Action_Begin (atSETSERVERAUTH, pParams);
956 void Action_SetServerAuth_End (PNOTIFYPARAMS pParams)
958 Action_End (Action_Find (atSETSERVERAUTH, pParams), pParams->status);
961 void Action_InstallFile_Begin (PNOTIFYPARAMS pParams)
963 Action_Begin (atINSTALLFILE, pParams);
966 void Action_InstallFile_End (PNOTIFYPARAMS pParams)
968 Action_End (Action_Find (atINSTALLFILE, pParams), pParams->status);
971 void Action_UninstallFile_Begin (PNOTIFYPARAMS pParams)
973 Action_Begin (atUNINSTALLFILE, pParams);
976 void Action_UninstallFile_End (PNOTIFYPARAMS pParams)
978 Action_End (Action_Find (atUNINSTALLFILE, pParams), pParams->status);
981 void Action_PruneFiles_Begin (PNOTIFYPARAMS pParams)
983 Action_Begin (atPRUNEFILES, pParams);
986 void Action_PruneFiles_End (PNOTIFYPARAMS pParams)
988 Action_End (Action_Find (atPRUNEFILES, pParams), pParams->status);
991 void Action_StartService_Begin (PNOTIFYPARAMS pParams)
993 Action_Begin (atSTARTSERVICE, pParams);
996 void Action_StartService_End (PNOTIFYPARAMS pParams)
998 Action_End (Action_Find (atSTARTSERVICE, pParams), pParams->status);
1001 void Action_StopService_Begin (PNOTIFYPARAMS pParams)
1003 Action_Begin (atSTOPSERVICE, pParams);
1006 void Action_StopService_End (PNOTIFYPARAMS pParams)
1008 Action_End (Action_Find (atSTOPSERVICE, pParams), pParams->status);
1011 void Action_RestartService_Begin (PNOTIFYPARAMS pParams)
1013 Action_Begin (atRESTARTSERVICE, pParams);
1016 void Action_RestartService_End (PNOTIFYPARAMS pParams)
1018 Action_End (Action_Find (atRESTARTSERVICE, pParams), pParams->status);
1021 void Action_CreateFileset_Begin (PNOTIFYPARAMS pParams)
1023 Action_Begin (atCREATEFILESET, pParams);
1026 void Action_CreateFileset_End (PNOTIFYPARAMS pParams)
1028 Action_End (Action_Find (atCREATEFILESET, pParams), pParams->status);
1031 void Action_DeleteFileset_Begin (PNOTIFYPARAMS pParams)
1033 Action_Begin (atDELETEFILESET, pParams);
1036 void Action_DeleteFileset_End (PNOTIFYPARAMS pParams)
1038 Action_End (Action_Find (atDELETEFILESET, pParams), pParams->status);
1041 void Action_SetFilesetQuota_Begin (PNOTIFYPARAMS pParams)
1043 Action_Begin (atSETFILESETQUOTA, pParams);
1046 void Action_SetFilesetQuota_End (PNOTIFYPARAMS pParams)
1048 Action_End (Action_Find (atSETFILESETQUOTA, pParams), pParams->status);
1051 void Action_SyncVLDB_Begin (PNOTIFYPARAMS pParams)
1053 Action_Begin (atSYNCVLDB, pParams);
1056 void Action_SyncVLDB_End (PNOTIFYPARAMS pParams)
1058 Action_End (Action_Find (atSYNCVLDB, pParams), pParams->status);
1061 void Action_Salvage_Begin (PNOTIFYPARAMS pParams)
1063 Action_Begin (atSALVAGE, pParams);
1066 void Action_Salvage_End (PNOTIFYPARAMS pParams)
1068 Action_End (Action_Find (atSALVAGE, pParams), pParams->status);
1071 void Action_SetFilesetRepParams_Begin (PNOTIFYPARAMS pParams)
1073 Action_Begin (atSETFILESETREPPARAMS, pParams);
1076 void Action_SetFilesetRepParams_End (PNOTIFYPARAMS pParams)
1078 Action_End (Action_Find (atSETFILESETREPPARAMS, pParams), pParams->status);
1081 void Action_CreateReplica_Begin (PNOTIFYPARAMS pParams)
1083 Action_Begin (atCREATEREPLICA, pParams);
1086 void Action_CreateReplica_End (PNOTIFYPARAMS pParams)
1088 Action_End (Action_Find (atCREATEREPLICA, pParams), pParams->status);
1091 void Action_RenameFileset_Begin (PNOTIFYPARAMS pParams)
1093 Action_Begin (atRENAMEFILESET, pParams);
1096 void Action_RenameFileset_End (PNOTIFYPARAMS pParams)
1098 Action_End (Action_Find (atRENAMEFILESET, pParams), pParams->status);
1101 void Action_CreateService_Begin (PNOTIFYPARAMS pParams)
1103 Action_Begin (atCREATESERVICE, pParams);
1106 void Action_CreateService_End (PNOTIFYPARAMS pParams)
1108 Action_End (Action_Find (atCREATESERVICE, pParams), pParams->status);
1111 void Action_DeleteService_Begin (PNOTIFYPARAMS pParams)
1113 Action_Begin (atDELETESERVICE, pParams);
1116 void Action_DeleteService_End (PNOTIFYPARAMS pParams)
1118 Action_End (Action_Find (atDELETESERVICE, pParams), pParams->status);
1121 void Action_ReleaseFileset_Begin (PNOTIFYPARAMS pParams)
1123 Action_Begin (atRELEASEFILESET, pParams);
1126 void Action_ReleaseFileset_End (PNOTIFYPARAMS pParams)
1128 Action_End (Action_Find (atRELEASEFILESET, pParams), pParams->status);
1131 void Action_GetFileDates_Begin (PNOTIFYPARAMS pParams)
1133 Action_Begin (atGETFILEDATES, pParams);
1136 void Action_GetFileDates_End (PNOTIFYPARAMS pParams)
1138 Action_End (Action_Find (atGETFILEDATES, pParams), pParams->status);
1141 void Action_ExecuteCommand_Begin (PNOTIFYPARAMS pParams)
1143 Action_Begin (atEXECUTECOMMAND, pParams);
1146 void Action_ExecuteCommand_End (PNOTIFYPARAMS pParams)
1148 Action_End (Action_Find (atEXECUTECOMMAND, pParams), pParams->status);
1151 void Action_AdminListLoad_Begin (PNOTIFYPARAMS pParams)
1153 Action_Begin (atADMINLIST_LOAD, pParams);
1156 void Action_AdminListLoad_End (PNOTIFYPARAMS pParams)
1158 Action_End (Action_Find (atADMINLIST_LOAD, pParams), pParams->status);
1161 void Action_AdminListSave_Begin (PNOTIFYPARAMS pParams)
1163 Action_Begin (atADMINLIST_SAVE, pParams);
1166 void Action_AdminListSave_End (PNOTIFYPARAMS pParams)
1168 Action_End (Action_Find (atADMINLIST_SAVE, pParams), pParams->status);
1171 void Action_HostListLoad_Begin (PNOTIFYPARAMS pParams)
1173 Action_Begin (atHOSTLIST_LOAD, pParams);
1176 void Action_HostListLoad_End (PNOTIFYPARAMS pParams)
1178 Action_End (Action_Find (atHOSTLIST_LOAD, pParams), pParams->status);
1181 void Action_HostListSave_Begin (PNOTIFYPARAMS pParams)
1183 Action_Begin (atHOSTLIST_SAVE, pParams);
1186 void Action_HostListSave_End (PNOTIFYPARAMS pParams)
1188 Action_End (Action_Find (atHOSTLIST_SAVE, pParams), pParams->status);
1191 void Action_Clone_Begin (PNOTIFYPARAMS pParams)
1193 Action_Begin (atCLONE, pParams);
1196 void Action_Clone_End (PNOTIFYPARAMS pParams)
1198 Action_End (Action_Find (atCLONE, pParams), pParams->status);
1201 void Action_Clonesys_Begin (PNOTIFYPARAMS pParams)
1203 Action_Begin (atCLONESYS, pParams);
1206 void Action_Clonesys_End (PNOTIFYPARAMS pParams)
1208 Action_End (Action_Find (atCLONESYS, pParams), pParams->status);
1211 void Action_SetRestart_Begin (PNOTIFYPARAMS pParams)
1213 Action_Begin (atSETRESTART, pParams);
1216 void Action_SetRestart_End (PNOTIFYPARAMS pParams)
1218 Action_End (Action_Find (atSETRESTART, pParams), pParams->status);
1221 void Action_ChangeAddr_Begin (PNOTIFYPARAMS pParams)
1223 Action_Begin (atCHANGEADDR, pParams);
1226 void Action_ChangeAddr_End (PNOTIFYPARAMS pParams)
1228 Action_End (Action_Find (atCHANGEADDR, pParams), pParams->status);
1233 * REFRESHALL DIALOGS
1237 void Action_Refresh_Begin (PNOTIFYPARAMS pParams)
1239 NOTIFYPARAMS ZeroParams;
1240 memset (&ZeroParams, 0x00, sizeof(NOTIFYPARAMS));
1242 PACTION pAction;
1243 if ((pAction = Action_Find (atREFRESH, &ZeroParams)) == NULL)
1245 if ((pAction = Action_Begin (atREFRESH, &ZeroParams)) != NULL)
1247 HWND hDlg = ModelessDialogParam (IDD_REFRESHALL, NULL, (DLGPROC)Action_Refresh_DlgProc, (LPARAM)(pParams->lpi1));
1249 if (hDlg == NULL)
1250 Action_End (pAction, pParams->status);
1251 else
1252 Action_SpecifyWindow (pAction, hDlg);
1258 void Action_Refresh_Update (PNOTIFYPARAMS pParams)
1260 NOTIFYPARAMS ZeroParams;
1261 memset (&ZeroParams, 0x00, sizeof(NOTIFYPARAMS));
1263 PACTION pAction;
1264 if ((pAction = Action_Find (atREFRESH, &ZeroParams)) != NULL)
1266 if (pAction->hDlg && IsWindow(pAction->hDlg))
1267 PostMessage (pAction->hDlg, WM_REFRESH_UPDATE, (WPARAM)pParams->dw1, (LPARAM)pParams->lpi1);
1272 void Action_Refresh_SectionStart (PNOTIFYPARAMS pParams)
1274 NOTIFYPARAMS ZeroParams;
1275 memset (&ZeroParams, 0x00, sizeof(NOTIFYPARAMS));
1277 PACTION pAction;
1278 if ((pAction = Action_Find (atREFRESH, &ZeroParams)) != NULL)
1280 if (pAction->hDlg && IsWindow(pAction->hDlg))
1281 PostMessage (pAction->hDlg, WM_REFRESH_SETSECTION, (WPARAM)TRUE, (LPARAM)pParams->dw1);
1286 void Action_Refresh_SectionEnd (PNOTIFYPARAMS pParams)
1288 NOTIFYPARAMS ZeroParams;
1289 memset (&ZeroParams, 0x00, sizeof(NOTIFYPARAMS));
1291 PACTION pAction;
1292 if ((pAction = Action_Find (atREFRESH, &ZeroParams)) != NULL)
1294 if (pAction->hDlg && IsWindow(pAction->hDlg))
1295 PostMessage (pAction->hDlg, WM_REFRESH_SETSECTION, (WPARAM)FALSE, (LPARAM)pParams->dw1);
1300 void Action_Refresh_End (PNOTIFYPARAMS pParams)
1302 NOTIFYPARAMS ZeroParams;
1303 memset (&ZeroParams, 0x00, sizeof(NOTIFYPARAMS));
1305 Action_End (Action_Find (atREFRESH, &ZeroParams), pParams->status);
1309 BOOL CALLBACK Action_Refresh_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
1311 switch (msg)
1313 case WM_INITDIALOG:
1314 LPIDENT lpi;
1315 if ((lpi = (LPIDENT)lp) != NULL)
1317 LPTSTR pszDesc = NULL;
1318 TCHAR szName[ cchRESOURCE ];
1320 if (lpi->fIsCell())
1322 lpi->GetCellName (szName);
1323 pszDesc = FormatString (IDS_REFRESH_DESC_CELL, TEXT("%s"), szName);
1325 else
1327 lpi->GetServerName (szName);
1328 pszDesc = FormatString (IDS_REFRESH_DESC_SERVER, TEXT("%s"), szName);
1330 if (pszDesc != NULL)
1332 SetDlgItemText (hDlg, IDC_REFRESH_DESC, pszDesc);
1333 FreeString (pszDesc);
1337 SendDlgItemMessage (hDlg, IDC_REFRESH_PERCENTBAR, PBM_SETRANGE, 0, MAKELPARAM(0,100));
1338 Action_Refresh_UpdateText (hDlg, lpi, 0);
1339 Action_Refresh_SetSection (hDlg, TRUE, -1);
1340 break;
1342 case WM_REFRESH_UPDATE:
1343 Action_Refresh_UpdateText (hDlg, (LPIDENT)lp, (DWORD)wp);
1344 break;
1346 case WM_REFRESH_SETSECTION:
1347 Action_Refresh_SetSection (hDlg, (BOOL)wp, (int)lp);
1348 break;
1350 case WM_DESTROY:
1351 Action_OnDestroy (hDlg);
1352 break;
1354 case WM_COMMAND:
1355 switch (LOWORD(wp))
1357 case IDOK:
1358 case IDCANCEL:
1359 DestroyWindow (hDlg);
1360 break;
1362 case IDC_REFRESH_SKIP:
1363 Action_Refresh_SkipSection (hDlg);
1364 break;
1366 break;
1369 return FALSE;
1373 void Action_Refresh_UpdateText (HWND hDlg, LPIDENT lpi, DWORD dwPerComplete)
1375 dwPerComplete = limit (0, dwPerComplete, 100);
1377 SendDlgItemMessage (hDlg, IDC_REFRESH_PERCENTBAR, PBM_SETPOS, (WPARAM)dwPerComplete, 0);
1379 LPTSTR pszComplete = FormatString (IDS_REFRESH_PERCENT, TEXT("%lu"), dwPerComplete);
1380 SetDlgItemText (hDlg, IDC_REFRESH_PERCENT, pszComplete);
1381 FreeString (pszComplete);
1383 if (lpi == NULL)
1385 TCHAR szText[ cchRESOURCE ];
1386 GetString (szText, IDS_REFRESH_CURRENT_VLDB);
1387 SetDlgItemText (hDlg, IDC_REFRESH_CURRENT, szText);
1389 else
1391 TCHAR szCell[ cchNAME ];
1392 TCHAR szServer[ cchNAME ];
1393 TCHAR szAggregate[ cchNAME ];
1394 TCHAR szFileset[ cchNAME ];
1395 TCHAR szService[ cchNAME ];
1397 lpi->GetCellName (szCell);
1398 if (!lpi->fIsCell())
1399 lpi->GetServerName (szServer);
1400 if (lpi->fIsAggregate() || lpi->fIsFileset())
1401 lpi->GetAggregateName (szAggregate);
1402 if (lpi->fIsFileset())
1403 lpi->GetFilesetName (szFileset);
1404 if (lpi->fIsService())
1405 lpi->GetServiceName (szService);
1407 LPTSTR pszCurrent = NULL;
1408 if (lpi->fIsCell())
1409 pszCurrent = FormatString (IDS_REFRESH_CURRENT_CELL, TEXT("%s"), szCell);
1410 if (lpi->fIsServer())
1411 pszCurrent = FormatString (IDS_REFRESH_CURRENT_SERVER, TEXT("%s%s"), szCell, szServer);
1412 else if (lpi->fIsAggregate())
1413 pszCurrent = FormatString (IDS_REFRESH_CURRENT_AGGREGATE, TEXT("%s%s%s"), szCell, szServer, szAggregate);
1414 else if (lpi->fIsFileset())
1415 pszCurrent = FormatString (IDS_REFRESH_CURRENT_FILESET, TEXT("%s%s%s%s"), szCell, szServer, szAggregate, szFileset);
1416 else if (lpi->fIsService())
1417 pszCurrent = FormatString (IDS_REFRESH_CURRENT_SERVICE, TEXT("%s%s%s"), szCell, szServer, szService);
1419 if (pszCurrent != NULL)
1421 SetDlgItemText (hDlg, IDC_REFRESH_CURRENT, pszCurrent);
1422 FreeString (pszCurrent);
1428 void Action_Refresh_SetSection (HWND hDlg, BOOL fStart, int idSection)
1430 // Are we ending a section that we don't care about?
1432 if ((!fStart) && (idSection != (int)GetWindowLongPtr (hDlg, DWLP_USER)))
1433 return;
1435 if (!fStart)
1436 idSection = -1; // ending a section means new section = -1 (invalid)
1438 SetWindowLongPtr (hDlg, DWLP_USER, idSection);
1439 EnableWindow (GetDlgItem (hDlg, IDC_REFRESH_SKIP), (idSection == -1) ? FALSE : TRUE);
1443 void Action_Refresh_SkipSection (HWND hDlg)
1445 int idSection;
1446 if ((idSection = (int)GetWindowLongPtr (hDlg, DWLP_USER)) != -1)
1448 AfsClass_SkipRefresh (idSection);
1449 Action_Refresh_SetSection (hDlg, FALSE, idSection);
1455 * MOVE-FILESET DIALOGS
1459 void Action_MoveFileset_Begin (PNOTIFYPARAMS pParams)
1461 PACTION pAction;
1462 if ((pAction = Action_Begin (atMOVEFILESET, pParams)) != NULL)
1464 HWND hDlg = ModelessDialogParam (IDD_SET_MOVING, NULL, (DLGPROC)Action_MoveFileset_DlgProc, (LPARAM)pAction);
1466 if (hDlg == NULL)
1467 Action_End (pAction, pParams->status);
1468 else
1469 Action_SpecifyWindow (pAction, hDlg);
1474 void Action_MoveFileset_End (PNOTIFYPARAMS pParams)
1476 Action_End (Action_Find (atMOVEFILESET, pParams), pParams->status);
1480 BOOL CALLBACK Action_MoveFileset_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
1482 HWND hAnimate = GetDlgItem (hDlg, IDC_ANIMATE);
1484 switch (msg)
1486 case WM_INITDIALOG:
1487 Animate_Open (hAnimate, MAKEINTRESOURCE( AVI_SETMOVE ));
1488 Animate_Play (hAnimate, 0, -1, -1);
1490 PACTION pAction;
1491 if ((pAction = (PACTION)lp) != NULL)
1493 TCHAR szServerSource[ cchNAME ];
1494 TCHAR szServerTarget[ cchNAME ];
1495 TCHAR szAggregateSource[ cchNAME ];
1496 TCHAR szAggregateTarget[ cchNAME ];
1497 TCHAR szFileset[ cchNAME ];
1498 pAction->Params.lpi1->GetServerName (szServerSource);
1499 pAction->Params.lpi1->GetAggregateName (szAggregateSource);
1500 pAction->Params.lpi1->GetFilesetName (szFileset);
1501 pAction->Params.lpi2->GetServerName (szServerTarget);
1502 pAction->Params.lpi2->GetAggregateName (szAggregateTarget);
1504 TCHAR szText[ cchRESOURCE ];
1505 GetDlgItemText (hDlg, IDC_MOVESET_DESC, szText, cchRESOURCE);
1507 LPTSTR pszText;
1508 pszText = FormatString (szText, TEXT("%s%s%s%s%s"), szServerSource, szAggregateSource, szFileset, szServerTarget, szAggregateTarget);
1509 SetDlgItemText (hDlg, IDC_MOVESET_DESC, pszText);
1510 FreeString (pszText);
1512 break;
1514 case WM_DESTROY:
1515 Animate_Stop (hAnimate);
1516 Animate_Close (hAnimate);
1517 Action_OnDestroy (hDlg);
1518 break;
1520 case WM_COMMAND:
1521 switch (LOWORD(wp))
1523 case IDOK:
1524 case IDCANCEL:
1525 DestroyWindow (hDlg);
1526 break;
1528 break;
1531 return FALSE;
1536 * DUMP-FILESET DIALOGS
1540 void Action_DumpFileset_Begin (PNOTIFYPARAMS pParams)
1542 PACTION pAction;
1543 if ((pAction = Action_Begin (atDUMP, pParams)) != NULL)
1545 HWND hDlg = ModelessDialogParam (IDD_SET_DUMPING, NULL, (DLGPROC)Action_DumpFileset_DlgProc, (LPARAM)pAction);
1547 if (hDlg == NULL)
1548 Action_End (pAction, pParams->status);
1549 else
1550 Action_SpecifyWindow (pAction, hDlg);
1554 void Action_DumpFileset_End (PNOTIFYPARAMS pParams)
1556 Action_End (Action_Find (atDUMP, pParams), pParams->status);
1559 BOOL CALLBACK Action_DumpFileset_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
1561 HWND hAnimate = GetDlgItem (hDlg, IDC_ANIMATE);
1563 switch (msg)
1565 case WM_INITDIALOG:
1566 Animate_Open (hAnimate, MAKEINTRESOURCE( AVI_SETMOVE ));
1567 Animate_Play (hAnimate, 0, -1, -1);
1569 PACTION pAction;
1570 if ((pAction = (PACTION)lp) != NULL)
1572 TCHAR szServer[ cchNAME ];
1573 TCHAR szAggregate[ cchNAME ];
1574 TCHAR szFileset[ cchNAME ];
1575 pAction->Params.lpi1->GetServerName (szServer);
1576 pAction->Params.lpi1->GetAggregateName (szAggregate);
1577 pAction->Params.lpi1->GetFilesetName (szFileset);
1579 TCHAR szText[ cchRESOURCE ];
1580 GetDlgItemText (hDlg, IDC_DUMPSET_DESC, szText, cchRESOURCE);
1582 LPTSTR pszText;
1583 pszText = FormatString (szText, TEXT("%s%s%s%s"), szServer, szAggregate, szFileset, FindBaseFileName(pAction->Params.sz1));
1584 SetDlgItemText (hDlg, IDC_DUMPSET_DESC, pszText);
1585 FreeString (pszText);
1587 break;
1589 case WM_DESTROY:
1590 Animate_Stop (hAnimate);
1591 Animate_Close (hAnimate);
1592 Action_OnDestroy (hDlg);
1593 break;
1595 case WM_COMMAND:
1596 switch (LOWORD(wp))
1598 case IDOK:
1599 case IDCANCEL:
1600 DestroyWindow (hDlg);
1601 break;
1603 break;
1606 return FALSE;
1611 * RESTORE-FILESET DIALOGS
1615 void Action_RestoreFileset_Begin (PNOTIFYPARAMS pParams)
1617 PACTION pAction;
1618 if ((pAction = Action_Begin (atRESTORE, pParams)) != NULL)
1620 HWND hDlg = ModelessDialogParam (IDD_SET_RESTORING, NULL, (DLGPROC)Action_RestoreFileset_DlgProc, (LPARAM)pAction);
1622 if (hDlg == NULL)
1623 Action_End (pAction, pParams->status);
1624 else
1625 Action_SpecifyWindow (pAction, hDlg);
1629 void Action_RestoreFileset_End (PNOTIFYPARAMS pParams)
1631 Action_End (Action_Find (atRESTORE, pParams), pParams->status);
1634 BOOL CALLBACK Action_RestoreFileset_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
1636 HWND hAnimate = GetDlgItem (hDlg, IDC_ANIMATE);
1638 switch (msg)
1640 case WM_INITDIALOG:
1641 Animate_Open (hAnimate, MAKEINTRESOURCE( AVI_SETMOVE ));
1642 Animate_Play (hAnimate, 0, -1, -1);
1644 PACTION pAction;
1645 if ((pAction = (PACTION)lp) != NULL)
1647 TCHAR szText[ cchRESOURCE ];
1648 GetDlgItemText (hDlg, IDC_RESTORESET_DESC, szText, cchRESOURCE);
1650 LPTSTR pszText;
1651 pszText = FormatString (szText, TEXT("%s%s"), ((LPTSTR)pAction->Params.sz1), FindBaseFileName(pAction->Params.sz2));
1652 SetDlgItemText (hDlg, IDC_RESTORESET_DESC, pszText);
1653 FreeString (pszText);
1655 break;
1657 case WM_DESTROY:
1658 Animate_Stop (hAnimate);
1659 Animate_Close (hAnimate);
1660 Action_OnDestroy (hDlg);
1661 break;
1663 case WM_COMMAND:
1664 switch (LOWORD(wp))
1666 case IDOK:
1667 case IDCANCEL:
1668 DestroyWindow (hDlg);
1669 break;
1671 break;
1674 return FALSE;
1679 * OPEN-CELL DIALOGS
1683 void Action_OpenCell_Begin (PNOTIFYPARAMS pParams)
1685 PACTION pAction;
1686 if ((pAction = Action_Begin (atOPENCELL, pParams)) != NULL)
1688 if (!IsWindow (g.hMain) || !IsWindowVisible (g.hMain))
1690 HWND hDlg = ModelessDialogParam (IDD_OPENINGCELL, NULL, (DLGPROC)Action_OpenCell_DlgProc, (LPARAM)pAction);
1692 if (hDlg == NULL)
1693 Action_End (pAction, pParams->status);
1694 else
1695 Action_SpecifyWindow (pAction, hDlg);
1700 void Action_OpenCell_End (PNOTIFYPARAMS pParams)
1702 Action_End (Action_Find (atOPENCELL, pParams), pParams->status);
1705 BOOL CALLBACK Action_OpenCell_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp)
1707 static int iFrameLast = 0;
1709 if (msg == WM_INITDIALOG)
1710 SetWindowLongPtr (hDlg, DWLP_USER, lp);
1712 switch (msg)
1714 case WM_INITDIALOG:
1715 AfsAppLib_StartAnimation (GetDlgItem (hDlg, IDC_ANIMATE));
1717 PACTION pAction;
1718 if ((pAction = (PACTION)lp) != NULL)
1720 TCHAR szText[ cchRESOURCE ];
1721 GetDlgItemText (hDlg, IDC_OPENCELL_DESC, szText, cchRESOURCE);
1723 LPTSTR pszText;
1724 pszText = FormatString (szText, TEXT("%s"), pAction->Params.sz1);
1725 SetDlgItemText (hDlg, IDC_OPENCELL_DESC, pszText);
1726 FreeString (pszText);
1728 break;
1730 case WM_DESTROY:
1731 Action_OnDestroy (hDlg);
1732 break;
1734 case WM_COMMAND:
1735 switch (LOWORD(wp))
1737 case IDOK:
1738 case IDCANCEL:
1739 DestroyWindow (hDlg);
1740 break;
1742 break;
1745 return FALSE;