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>
21 #include "svr_window.h"
26 * PROTOTYPES _________________________________________________________________
30 BOOL CALLBACK
Filesets_Dump_DlgProc (HWND hDlg
, UINT msg
, WPARAM wp
, LPARAM lp
);
31 void Filesets_Dump_OnInitDialog (HWND hDlg
, LPSET_DUMP_PARAMS psdp
);
32 void Filesets_Dump_OnSelect (HWND hDlg
);
33 void Filesets_Dump_EnableOK (HWND hDlg
);
34 void Filesets_Dump_OnOK (HWND hDlg
, LPSET_DUMP_PARAMS psdp
);
35 void Filesets_Dump_OnBrowse (HWND hDlg
, LPSET_DUMP_PARAMS psdp
);
39 * ROUTINES ___________________________________________________________________
43 void Filesets_Dump (LPIDENT lpi
)
45 LPSET_DUMP_PARAMS psdp
= New (SET_DUMP_PARAMS
);
46 memset (psdp
, 0x00, sizeof(SET_DUMP_PARAMS
));
49 INT_PTR rc
= ModalDialogParam (IDD_SET_DUMP
, NULL
, (DLGPROC
)Filesets_Dump_DlgProc
, (LPARAM
)psdp
);
57 StartTask (taskSET_DUMP
, NULL
, psdp
);
62 BOOL CALLBACK
Filesets_Dump_DlgProc (HWND hDlg
, UINT msg
, WPARAM wp
, LPARAM lp
)
64 if (AfsAppLib_HandleHelp (IDD_SET_DUMP
, hDlg
, msg
, wp
, lp
))
67 static LPSET_DUMP_PARAMS psdp
= NULL
;
68 if (msg
== WM_INITDIALOG
)
69 psdp
= (LPSET_DUMP_PARAMS
)lp
;
76 Filesets_Dump_OnInitDialog (hDlg
, psdp
);
83 Filesets_Dump_OnOK (hDlg
, psdp
);
84 EndDialog (hDlg
, LOWORD(wp
));
88 EndDialog (hDlg
, LOWORD(wp
));
92 case IDC_DUMP_LIMIT_TIME
:
93 Filesets_Dump_OnSelect (hDlg
);
96 case IDC_DUMP_FILENAME
:
97 Filesets_Dump_EnableOK (hDlg
);
100 case IDC_DUMP_BROWSE
:
101 Filesets_Dump_OnBrowse (hDlg
, psdp
);
116 void Filesets_Dump_OnInitDialog (HWND hDlg
, LPSET_DUMP_PARAMS psdp
)
118 TCHAR szServer
[ cchNAME
];
119 TCHAR szAggregate
[ cchNAME
];
120 TCHAR szFileset
[ cchNAME
];
121 psdp
->lpi
->GetServerName (szServer
);
122 psdp
->lpi
->GetAggregateName (szAggregate
);
123 psdp
->lpi
->GetFilesetName (szFileset
);
125 TCHAR szText
[ cchRESOURCE
];
126 GetDlgItemText (hDlg
, IDC_DUMP_FULL
, szText
, cchRESOURCE
);
128 LPTSTR pszText
= FormatString (szText
, TEXT("%s%s%s"), szServer
, szAggregate
, szFileset
);
129 SetDlgItemText (hDlg
, IDC_DUMP_FULL
, pszText
);
130 FreeString (pszText
);
132 pszText
= FormatString (IDS_SET_DUMP_NAME
, TEXT("%s"), szFileset
);
133 SetDlgItemText (hDlg
, IDC_DUMP_FILENAME
, pszText
);
134 FreeString (pszText
);
136 // Get the local system time
140 SystemTimeToFileTime (&st
, &ft
);
142 FileTimeToLocalFileTime (&ft
, &lft
);
143 FileTimeToSystemTime (&lft
, &st
);
145 DA_SetDate (GetDlgItem (hDlg
, IDC_DUMP_DATE
), &st
);
146 TI_SetTime (GetDlgItem (hDlg
, IDC_DUMP_TIME
), &st
);
148 CheckDlgButton (hDlg
, IDC_DUMP_FULL
, TRUE
);
149 Filesets_Dump_OnSelect (hDlg
);
150 Filesets_Dump_EnableOK (hDlg
);
154 void Filesets_Dump_OnSelect (HWND hDlg
)
158 fEnable
= IsDlgButtonChecked (hDlg
, IDC_DUMP_LIMIT_TIME
);
159 EnableWindow (GetDlgItem (hDlg
, IDC_DUMP_DATE
), fEnable
);
160 EnableWindow (GetDlgItem (hDlg
, IDC_DUMP_TIME
), fEnable
);
164 void Filesets_Dump_EnableOK (HWND hDlg
)
166 TCHAR szText
[ MAX_PATH
];
167 GetDlgItemText (hDlg
, IDC_DUMP_FILENAME
, szText
, MAX_PATH
);
169 EnableWindow (GetDlgItem (hDlg
, IDOK
), (szText
[0] == TEXT('\0')) ? FALSE
: TRUE
);
173 void Filesets_Dump_OnOK (HWND hDlg
, LPSET_DUMP_PARAMS psdp
)
175 GetDlgItemText (hDlg
, IDC_DUMP_FILENAME
, psdp
->szFilename
, MAX_PATH
);
177 psdp
->fDumpByDate
= IsDlgButtonChecked (hDlg
, IDC_DUMP_LIMIT_TIME
);
178 memset (&psdp
->stDump
, 0x00, sizeof(SYSTEMTIME
));
179 DA_GetDate (GetDlgItem (hDlg
, IDC_DUMP_DATE
), &psdp
->stDump
);
180 TI_GetTime (GetDlgItem (hDlg
, IDC_DUMP_TIME
), &psdp
->stDump
);
184 void Filesets_Dump_OnBrowse (HWND hDlg
, LPSET_DUMP_PARAMS psdp
)
186 TCHAR szFilter
[ cchRESOURCE
];
187 GetString (szFilter
, IDS_RESTORE_FILTER
);
188 TCHAR chFilter
= szFilter
[ lstrlen(szFilter
)-1 ];
189 for (LPTSTR pszFilter
= szFilter
;
190 (*pszFilter
) && ((pszFilter
= (LPTSTR
)lstrchr (pszFilter
, chFilter
)) != NULL
);
193 *pszFilter
= TEXT('\0');
196 TCHAR szFilename
[ MAX_PATH
];
197 GetDlgItemText (hDlg
, IDC_DUMP_FILENAME
, szFilename
, MAX_PATH
);
200 memset (&sfn
, 0x00, sizeof(sfn
));
201 sfn
.lStructSize
= sizeof(sfn
);
202 sfn
.hwndOwner
= hDlg
;
203 sfn
.hInstance
= THIS_HINST
;
204 sfn
.lpstrFilter
= szFilter
;
205 sfn
.nFilterIndex
= 1;
206 sfn
.lpstrFile
= szFilename
;
207 sfn
.nMaxFile
= MAX_PATH
;
208 sfn
.Flags
= OFN_HIDEREADONLY
| OFN_OVERWRITEPROMPT
| OFN_PATHMUSTEXIST
;
209 sfn
.lpstrDefExt
= TEXT("dmp");
211 if (GetSaveFileName (&sfn
))
213 SetDlgItemText (hDlg
, IDC_DUMP_FILENAME
, szFilename
);
214 Filesets_Dump_EnableOK (hDlg
);