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
14 #include <afs/param.h>
26 * DEFINITIONS ________________________________________________________________
30 #define cREALLOC_ACTIONLIST 4
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 _______________________________________________________________
78 atSETFILESETREPPARAMS
,
111 * VARIABLES __________________________________________________________________
119 size_t cActionsInUse
;
120 BOOL fShowConfirmations
;
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
;
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;
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
);
352 pst
->wHour
= (int)( 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
);
367 if ((pch
= (LPTSTR
)lstrchr (pszTarget
, TEXT(' '))) != NULL
)
369 if ((pch
= (LPTSTR
)lstrchr (pszTarget
, TEXT('\t'))) != NULL
)
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
))
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
);
420 Main_SetActionMenus();
421 FL_StoreView (GetDlgItem (hDlg
, IDC_ACTION_LIST
), &gr
.viewAct
);
422 KillTimer (hDlg
, ID_ACTION_TIMER
);
426 if (FastList_GetItemCount (GetDlgItem (hDlg
, IDC_ACTION_LIST
)))
427 Action_Window_Refresh();
431 // if (lp==0), we're minimizing--don't call ResizeWindow().
435 ResizeWindow (hDlg
, awdActions
, rwaFixupGuts
);
436 GetWindowRect (hDlg
, &gr
.rActions
);
441 GetWindowRect (hDlg
, &gr
.rActions
);
449 DestroyWindow (hDlg
);
459 void Action_WindowToTop (BOOL fTop
)
461 if (g
.hAction
&& IsWindow(g
.hAction
))
465 SetWindowPos (g
.hAction
, HWND_TOPMOST
, 0, 0, 0, 0,
466 SWP_NOMOVE
| SWP_NOSIZE
| SWP_NOACTIVATE
);
470 SetWindowPos (g
.hAction
, g
.hMain
, 0, 0, 0, 0,
471 SWP_NOMOVE
| SWP_NOSIZE
| SWP_NOACTIVATE
);
477 void Action_Window_Refresh (void)
480 TCHAR szText
[ cchRESOURCE
];
482 HWND hList
= GetDlgItem (g
.hAction
, IDC_ACTION_LIST
);
485 LPARAM lpOld
= FL_StartChange (hList
, TRUE
);
487 for (size_t ii
= 0; ii
< l
.cActions
; ++ii
)
490 if ((pszDesc
= Action_GetDescription (ii
)) != NULL
)
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
);
498 FreeString (pszDesc
);
502 FL_EndChange (hList
, lpOld
);
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
])
525 switch (l
.aActions
[ ii
]->Type
)
528 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
529 pszDesc
= FormatString (IDS_ACTION_SCOUT
, TEXT("%s"), szText
);
533 pszDesc
= FormatString (IDS_ACTION_REFRESH
);
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
);
541 case atSETSERVERAUTH
:
542 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
543 pszDesc
= FormatString (IDS_ACTION_SETSERVERAUTH
, TEXT("%s"), szText
);
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
);
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
);
559 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
560 pszDesc
= FormatString (IDS_ACTION_PRUNEFILES
, TEXT("%s"), szText
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
657 case atRENAMEFILESET
:
658 pszDesc
= FormatString (IDS_ACTION_RENAMEFILESET
, TEXT("%s%s"), l
.aActions
[ ii
]->Params
.sz1
, l
.aActions
[ ii
]->Params
.sz2
);
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
);
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
);
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
);
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
);
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
);
691 case atADMINLIST_LOAD
:
692 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
693 pszDesc
= FormatString (IDS_ACTION_ADMINLIST_LOAD
, TEXT("%s"), szText
);
696 case atADMINLIST_SAVE
:
697 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
698 pszDesc
= FormatString (IDS_ACTION_ADMINLIST_SAVE
, TEXT("%s"), szText
);
701 case atHOSTLIST_LOAD
:
702 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
703 pszDesc
= FormatString (IDS_ACTION_HOSTLIST_LOAD
, TEXT("%s"), szText
);
706 case atHOSTLIST_SAVE
:
707 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
708 pszDesc
= FormatString (IDS_ACTION_HOSTLIST_SAVE
, TEXT("%s"), szText
);
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
);
719 pszDesc
= FormatString (IDS_ACTION_CLONESYS
);
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
));
730 pszDesc
= FormatString (IDS_ACTION_RESTORE
, TEXT("%s%s"), l
.aActions
[ ii
]->Params
.sz1
, FindBaseFileName(l
.aActions
[ ii
]->Params
.sz2
));
734 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
735 pszDesc
= FormatString (IDS_ACTION_SETRESTART
, TEXT("%s"), szText
);
739 l
.aActions
[ ii
]->Params
.lpi1
->GetServerName (szText
);
740 pszDesc
= FormatString (IDS_ACTION_CHANGEADDR
, TEXT("%s"), szText
);
744 pszDesc
= FormatString (IDS_ACTION_OPENCELL
, TEXT("%s"), l
.aActions
[ ii
]->Params
.sz1
);
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
)
782 if (pParams1
->lpi1
!= pParams2
->lpi1
)
784 if (pParams1
->lpi2
!= pParams2
->lpi2
)
786 if (lstrcmp (pParams1
->sz1
, pParams2
->sz1
))
788 if (lstrcmp (pParams1
->sz2
, pParams2
->sz2
))
790 if (pParams1
->dw1
!= pParams2
->dw1
)
797 PACTION
Action_Begin (ACTIONTYPE Type
, PNOTIFYPARAMS pParams
)
800 for (ii
= 0; ii
< l
.cActions
; ++ii
)
805 if (!REALLOC (l
.aActions
, l
.cActions
, 1+ii
, cREALLOC_ACTIONLIST
))
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
)
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
])
837 if (l
.aActions
[ ii
]->Type
!= Type
)
840 if (Action_CompareNotifyParams (&l
.aActions
[ ii
]->Params
, pParams
))
841 return l
.aActions
[ ii
];
848 void Action_End (PACTION pParams
, DWORD dwStatus
)
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
)
867 // don't show confirmation messages for these operations
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
);
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
))
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
])
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
));
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
));
1250 Action_End (pAction
, pParams
->status
);
1252 Action_SpecifyWindow (pAction
, hDlg
);
1258 void Action_Refresh_Update (PNOTIFYPARAMS pParams
)
1260 NOTIFYPARAMS ZeroParams
;
1261 memset (&ZeroParams
, 0x00, sizeof(NOTIFYPARAMS
));
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
));
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
));
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
)
1315 if ((lpi
= (LPIDENT
)lp
) != NULL
)
1317 LPTSTR pszDesc
= NULL
;
1318 TCHAR szName
[ cchRESOURCE
];
1322 lpi
->GetCellName (szName
);
1323 pszDesc
= FormatString (IDS_REFRESH_DESC_CELL
, TEXT("%s"), szName
);
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);
1342 case WM_REFRESH_UPDATE
:
1343 Action_Refresh_UpdateText (hDlg
, (LPIDENT
)lp
, (DWORD
)wp
);
1346 case WM_REFRESH_SETSECTION
:
1347 Action_Refresh_SetSection (hDlg
, (BOOL
)wp
, (int)lp
);
1351 Action_OnDestroy (hDlg
);
1359 DestroyWindow (hDlg
);
1362 case IDC_REFRESH_SKIP
:
1363 Action_Refresh_SkipSection (hDlg
);
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
);
1385 TCHAR szText
[ cchRESOURCE
];
1386 GetString (szText
, IDS_REFRESH_CURRENT_VLDB
);
1387 SetDlgItemText (hDlg
, IDC_REFRESH_CURRENT
, szText
);
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
;
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
)))
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
)
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
)
1462 if ((pAction
= Action_Begin (atMOVEFILESET
, pParams
)) != NULL
)
1464 HWND hDlg
= ModelessDialogParam (IDD_SET_MOVING
, NULL
, (DLGPROC
)Action_MoveFileset_DlgProc
, (LPARAM
)pAction
);
1467 Action_End (pAction
, pParams
->status
);
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
);
1487 Animate_Open (hAnimate
, MAKEINTRESOURCE( AVI_SETMOVE
));
1488 Animate_Play (hAnimate
, 0, -1, -1);
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
);
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
);
1515 Animate_Stop (hAnimate
);
1516 Animate_Close (hAnimate
);
1517 Action_OnDestroy (hDlg
);
1525 DestroyWindow (hDlg
);
1536 * DUMP-FILESET DIALOGS
1540 void Action_DumpFileset_Begin (PNOTIFYPARAMS pParams
)
1543 if ((pAction
= Action_Begin (atDUMP
, pParams
)) != NULL
)
1545 HWND hDlg
= ModelessDialogParam (IDD_SET_DUMPING
, NULL
, (DLGPROC
)Action_DumpFileset_DlgProc
, (LPARAM
)pAction
);
1548 Action_End (pAction
, pParams
->status
);
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
);
1566 Animate_Open (hAnimate
, MAKEINTRESOURCE( AVI_SETMOVE
));
1567 Animate_Play (hAnimate
, 0, -1, -1);
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
);
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
);
1590 Animate_Stop (hAnimate
);
1591 Animate_Close (hAnimate
);
1592 Action_OnDestroy (hDlg
);
1600 DestroyWindow (hDlg
);
1611 * RESTORE-FILESET DIALOGS
1615 void Action_RestoreFileset_Begin (PNOTIFYPARAMS pParams
)
1618 if ((pAction
= Action_Begin (atRESTORE
, pParams
)) != NULL
)
1620 HWND hDlg
= ModelessDialogParam (IDD_SET_RESTORING
, NULL
, (DLGPROC
)Action_RestoreFileset_DlgProc
, (LPARAM
)pAction
);
1623 Action_End (pAction
, pParams
->status
);
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
);
1641 Animate_Open (hAnimate
, MAKEINTRESOURCE( AVI_SETMOVE
));
1642 Animate_Play (hAnimate
, 0, -1, -1);
1645 if ((pAction
= (PACTION
)lp
) != NULL
)
1647 TCHAR szText
[ cchRESOURCE
];
1648 GetDlgItemText (hDlg
, IDC_RESTORESET_DESC
, szText
, cchRESOURCE
);
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
);
1658 Animate_Stop (hAnimate
);
1659 Animate_Close (hAnimate
);
1660 Action_OnDestroy (hDlg
);
1668 DestroyWindow (hDlg
);
1683 void Action_OpenCell_Begin (PNOTIFYPARAMS pParams
)
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
);
1693 Action_End (pAction
, pParams
->status
);
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
);
1715 AfsAppLib_StartAnimation (GetDlgItem (hDlg
, IDC_ANIMATE
));
1718 if ((pAction
= (PACTION
)lp
) != NULL
)
1720 TCHAR szText
[ cchRESOURCE
];
1721 GetDlgItemText (hDlg
, IDC_OPENCELL_DESC
, szText
, cchRESOURCE
);
1724 pszText
= FormatString (szText
, TEXT("%s"), pAction
->Params
.sz1
);
1725 SetDlgItemText (hDlg
, IDC_OPENCELL_DESC
, pszText
);
1726 FreeString (pszText
);
1731 Action_OnDestroy (hDlg
);
1739 DestroyWindow (hDlg
);