void Server_SyncVLDB_OnInitDialog (HWND hDlg, LPIDENT lpi) { if (lpi->fIsServer()) { TCHAR szServer[ cchNAME ]; lpi->GetServerName (szServer); LPTSTR pszText = FormatString (IDS_SYNCVLDB_SVR_DESC, TEXT("%s"), szServer); SetDlgItemText (hDlg, IDC_SYNC_DESC, pszText); FreeString (pszText); pszText = FormatString (IDS_SYNCVLDB_SVR_DESC2, TEXT("%s"), szServer); SetDlgItemText (hDlg, IDC_SYNC_DESC2, pszText); FreeString (pszText); ShowWindow (hDlg, SW_SHOW); } else // (lpi->fIsAggregate()) { TCHAR szServer[ cchNAME ]; lpi->GetServerName (szServer); TCHAR szAggregate[ cchNAME ]; lpi->GetAggregateName (szAggregate); LPTSTR pszText = FormatString (IDS_SYNCVLDB_AGG_DESC, TEXT("%s%s"), szServer, szAggregate); SetDlgItemText (hDlg, IDC_SYNC_DESC, pszText); FreeString (pszText); pszText = FormatString (IDS_SYNCVLDB_AGG_DESC2, TEXT("%s%s"), szServer, szAggregate); SetDlgItemText (hDlg, IDC_SYNC_DESC2, pszText); FreeString (pszText); StartTask (taskAGG_FIND_GHOST, hDlg, lpi); } }
LPTSTR Alert_GetDescription (LPIDENT lpi, size_t iAlert, BOOL fFull) { LPOBJECTALERTS lpoa; if ((lpoa = Alert_GetObjectAlerts (lpi)) == NULL) return NULL; if (!lpoa->nAlerts && lpi->fIsServer()) { LPSERVER_PREF lpsp; if ((lpsp = (LPSERVER_PREF)lpi->GetUserParam()) != NULL) { if (!lpsp->fIsMonitored) { TCHAR szName[ cchNAME ]; lpi->GetServerName (szName); return FormatString (IDS_ALERT_DESCSHORT_UNMONITORED, TEXT("%s"), szName); } } } if (iAlert >= lpoa->nAlerts) return NULL; if (lpoa->aAlerts[ iAlert ].alert == alertSECONDARY) { return Alert_GetDescriptionFunc (lpoa->aAlerts[ iAlert ].aiSECONDARY.lpiSecondary, lpoa->aAlerts[ iAlert ].aiSECONDARY.iSecondary, lpi, fFull); } return Alert_GetDescriptionFunc (lpi, iAlert, NULL, fFull); }
void Filesets_General_OnInitDialog (HWND hDlg, LPIDENT lpi) { TCHAR szText[ cchRESOURCE ]; TCHAR szSvrName[ cchNAME ]; TCHAR szAggName[ cchNAME ]; TCHAR szSetName[ cchNAME ]; VOLUMEID vidFileset; lpi->GetServerName (szSvrName); lpi->GetAggregateName (szAggName); lpi->GetFilesetName (szSetName); lpi->GetFilesetID (&vidFileset); GetDlgItemText (hDlg, IDC_SET_NAME, szText, cchRESOURCE); LPTSTR pszText = FormatString (szText, TEXT("%s%s%s"), szSvrName, szAggName, szSetName); SetDlgItemText (hDlg, IDC_SET_NAME, pszText); FreeString (pszText); pszText = FormatString (TEXT("%1"), TEXT("%lu"), vidFileset); SetDlgItemText (hDlg, IDC_SET_ID, pszText); FreeString (pszText); EnableWindow (GetDlgItem (hDlg, IDC_SET_LOCK), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_UNLOCK), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_QUOTA), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DEF), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_PERCENT), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DESC), FALSE); }
void Server_SelectServer (HWND hDlg, LPIDENT lpiNew, BOOL fForceRedraw) { LPIDENT lpiOld = Server_GetServer (hDlg); if (lpiNew != lpiOld) { SetWindowLongPtr (hDlg, DWLP_USER, (LONG_PTR)lpiNew); if (hDlg != g.hMain) { if (lpiOld) PropCache_Delete (pcSERVER, lpiOld); if (lpiNew) { PropCache_Add (pcSERVER, lpiNew, hDlg); TCHAR szName[ cchNAME ]; lpiNew->GetServerName (szName); LPTSTR pszTitle = FormatString (IDS_SERVER_TITLE, TEXT("%s"), szName); SetWindowText (hDlg, pszTitle); FreeString (pszTitle); } } fForceRedraw = TRUE; } if (fForceRedraw) { Server_ForceRedraw (hDlg); } }
void Server_Salvage_OnEndTask_Salvage (HWND hDlg, LPIDENT lpiSalvage, LPTASKPACKET ptp) { if (!ptp->rc) { ErrorDialog (ptp->status, IDS_ERROR_CANT_SALVAGE); DestroyWindow (hDlg); } else { if (TASKDATA(ptp)->pszText1) { SetDlgItemText (hDlg, IDC_SALVAGE_DETAILS, TASKDATA(ptp)->pszText1); } else { TCHAR szServer[ cchNAME ]; lpiSalvage->GetServerName (szServer); LPTSTR pszNoLog = FormatString (IDS_ERROR_CANT_READ_SALVAGE_LOG, TEXT("%s"), szServer); SetDlgItemText (hDlg, IDC_SALVAGE_DETAILS, pszNoLog); FreeString (pszNoLog); } ShowWindow (hDlg, SW_SHOW); } }
void Server_ShowProperties (LPIDENT lpiServer, size_t nAlerts) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcSVR_PROP, lpiServer)) != NULL) { SetFocus (hCurrent); } else { TCHAR szName[ cchNAME ]; lpiServer->GetServerName (szName); LPTSTR pszTitle = FormatString (IDS_SVR_PROP_TITLE, TEXT("%s"), szName); LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE); psh->fMadeCaption = TRUE; if ( (PropSheet_AddProblemsTab (psh, IDD_SVR_PROBLEMS, lpiServer, nAlerts)) && (PropSheet_AddTab (psh, IDS_SVR_GENERAL_TAB, IDD_SVR_GENERAL, (DLGPROC)Server_General_DlgProc, (LPARAM)lpiServer, TRUE)) && (PropSheet_AddTab (psh, IDS_SVR_SCOUT_TAB, IDD_SVR_SCOUT, (DLGPROC)Server_Scout_DlgProc, (LPARAM)lpiServer, TRUE)) ) { PropSheet_ShowModeless (psh); } } }
void Server_General_OnInitDialog (HWND hDlg, LPIDENT lpiServer) { TCHAR szText[ cchRESOURCE ]; lpiServer->GetServerName (szText); SetDlgItemText (hDlg, IDC_SVR_NAME, szText); EnableWindow (GetDlgItem (hDlg, IDC_SVR_AUTH_YES), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_AUTH_NO), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_CHANGEADDR), FALSE); }
void Server_Scout_OnEndTask_Apply (HWND hDlg, LPTASKPACKET ptp) { if (!ptp->rc) { LPIDENT lpiServer = (LPIDENT)GetWindowLongPtr (hDlg, DWLP_USER); TCHAR szText[ cchNAME ]; lpiServer->GetServerName (szText); ErrorDialog (ptp->status, IDS_ERROR_CHANGE_SERVER_STATUS, TEXT("%s"), szText); } }
void Aggregates_General_OnEndTask_Apply (HWND hDlg, LPTASKPACKET ptp) { if (!ptp->rc) { LPIDENT lpi = (LPIDENT)GetWindowLongPtr (hDlg, DWLP_USER); TCHAR szSvrName[ cchNAME ]; TCHAR szAggName[ cchNAME ]; lpi->GetServerName (szSvrName); lpi->GetAggregateName (szAggName); ErrorDialog (ptp->status, IDS_ERROR_CHANGE_AGGREGATE_STATUS, TEXT("%s%s"), szSvrName, szAggName); } }
void Services_Delete_OnInitDialog (HWND hDlg, LPIDENT lpi) { TCHAR szServer[ cchNAME ]; TCHAR szService[ cchNAME ]; lpi->GetServerName (szServer); lpi->GetServiceName (szService); TCHAR szOld[ cchRESOURCE ]; GetDlgItemText (hDlg, IDC_DELSVC_DESC, szOld, cchRESOURCE); LPTSTR pszNew = FormatString (szOld, TEXT("%s%s"), szServer, szService); SetDlgItemText (hDlg, IDC_DELSVC_DESC, pszNew); FreeString (pszNew); }
void Aggregates_ShowProperties (LPIDENT lpiAggregate, size_t nAlerts, BOOL fJumpToThreshold, HWND hParentModal) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcAGG_PROP, lpiAggregate)) != NULL) { SetFocus (hCurrent); if (fJumpToThreshold) { HWND hTab; if ((hTab = GetDlgItem (hCurrent, IDC_PROPSHEET_TABCTRL)) != NULL) { int nTabs = TabCtrl_GetItemCount (hTab); TabCtrl_SetCurSel (hTab, nTabs-1); NMHDR nm; nm.hwndFrom = hTab; nm.idFrom = IDC_PROPSHEET_TABCTRL; nm.code = TCN_SELCHANGE; SendMessage (hCurrent, WM_NOTIFY, 0, (LPARAM)&nm); } } } else { TCHAR szSvrName[ cchNAME ]; TCHAR szAggName[ cchNAME ]; lpiAggregate->GetServerName (szSvrName); lpiAggregate->GetAggregateName (szAggName); LPTSTR pszTitle = FormatString (IDS_AGG_PROP_TITLE, TEXT("%s%s"), szSvrName, szAggName); LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE); psh->fMadeCaption = TRUE; psh->sh.hwndParent = hParentModal; if (PropSheet_AddProblemsTab (psh, IDD_AGG_PROBLEMS, lpiAggregate, nAlerts) && PropSheet_AddTab (psh, IDS_AGG_GENERAL_TAB, IDD_AGG_GENERAL, (DLGPROC)Aggregates_General_DlgProc, (LPARAM)lpiAggregate, TRUE, FALSE)) { if (fJumpToThreshold) psh->sh.nStartPage = psh->sh.nPages-1; if (hParentModal) PropSheet_ShowModal (psh, PumpMessage); else PropSheet_ShowModeless (psh); } } }
void Server_SyncVLDB_OnEndTask_Init (HWND hDlg, LPTASKPACKET ptp) { if (ptp->rc && (!(TASKDATA(ptp)->wGhost & GHOST_HAS_SERVER_ENTRY))) { LPIDENT lpi = (LPIDENT)( ptp->lpUser ); TCHAR szServer[ cchNAME ]; lpi->GetServerName (szServer); TCHAR szAggregate[ cchNAME ]; lpi->GetAggregateName (szAggregate); ErrorDialog (0, IDS_ERROR_CANT_SYNC_GHOST_AGGREGATE, TEXT("%s%s"), szServer, szAggregate); DestroyWindow (hDlg); return; } ShowWindow (hDlg, SW_SHOW); }
LPTSTR Server_GetColumnText (LPIDENT lpi, SERVERCOLUMN svrcol) { static TCHAR aszBuffer[ nSERVERCOLUMNS ][ cchRESOURCE ]; static size_t iBufferNext = 0; LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ]; if (iBufferNext == nSERVERCOLUMNS) iBufferNext = 0; *pszBuffer = TEXT('\0'); LPSERVERSTATUS lpss = NULL; LPSERVER_PREF lpsp; if ((lpsp = (LPSERVER_PREF)lpi->GetUserParam()) != NULL) { lpss = &lpsp->ssLast; } switch (svrcol) { case svrcolNAME: lpi->GetServerName (pszBuffer); break; case svrcolADDRESS: if (lpss) FormatSockAddr (pszBuffer, TEXT("%a"), &lpss->aAddresses[0]); break; case svrcolSTATUS: { LPTSTR pszDesc; if ((pszDesc = Alert_GetQuickDescription (lpi)) == NULL) GetString (pszBuffer, IDS_STATUS_NOALERTS); else { lstrcpy (pszBuffer, pszDesc); FreeString (pszDesc); } } break; } return pszBuffer; }
void Filesets_Release_OnInitDialog (HWND hDlg, LPIDENT lpi) { TCHAR szServer[ cchNAME ]; TCHAR szAggregate[ cchNAME ]; TCHAR szFileset[ cchNAME ]; lpi->GetServerName (szServer); lpi->GetAggregateName (szAggregate); lpi->GetFilesetName (szFileset); TCHAR szOld[ cchRESOURCE ]; GetDlgItemText (hDlg, IDC_RELSET_DESC, szOld, cchRESOURCE); LPTSTR pszText = FormatString (szOld, TEXT("%s%s%s"), szServer, szAggregate, szFileset); SetDlgItemText (hDlg, IDC_RELSET_DESC, pszText); FreeString (pszText); CheckDlgButton (hDlg, IDC_RELSET_NORMAL, TRUE); CheckDlgButton (hDlg, IDC_RELSET_FORCE, FALSE); }
void Aggregates_General_OnInitDialog (HWND hDlg) { LPIDENT lpi = (LPIDENT)GetWindowLongPtr (hDlg, DWLP_USER); TCHAR szSvrName[ cchNAME ]; TCHAR szAggName[ cchNAME ]; lpi->GetServerName (szSvrName); lpi->GetAggregateName (szAggName); TCHAR szText[ cchRESOURCE ]; GetDlgItemText (hDlg, IDC_AGG_NAME, szText, cchRESOURCE); LPTSTR pszText = FormatString (szText, TEXT("%s%s"), szSvrName, szAggName); SetDlgItemText (hDlg, IDC_AGG_NAME, pszText); FreeString (pszText); EnableWindow (GetDlgItem (hDlg, IDC_AGG_WARNALLOC), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_AGG_WARN), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_AGG_WARN_AGGFULL_DEF), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_AGG_WARN_AGGFULL), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_AGG_WARN_AGGFULL_PERCENT), FALSE); }
void Server_General_OnEndTask_InitDialog (HWND hDlg, LPIDENT lpiServer, LPTASKPACKET ptp) { TCHAR szText[ cchRESOURCE ]; if (!ptp->rc) { GetString (szText, IDS_UNKNOWN); SetDlgItemText (hDlg, IDC_SVR_NUMAGGREGATES, szText); SetDlgItemText (hDlg, IDC_SVR_CAPACITY, szText); SetDlgItemText (hDlg, IDC_SVR_ALLOCATION, szText); LB_StartChange (GetDlgItem (hDlg, IDC_SVR_ADDRESSES), TRUE); LB_AddItem (GetDlgItem (hDlg, IDC_SVR_ADDRESSES), szText, (LPARAM)-1); LB_EndChange (GetDlgItem (hDlg, IDC_SVR_ADDRESSES), (LPARAM)-1); lpiServer->GetServerName (szText); ErrorDialog (ptp->status, IDS_ERROR_REFRESH_SERVER_STATUS, TEXT("%s"), szText); } else { EnableWindow (GetDlgItem (hDlg, IDC_SVR_AUTH_YES), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_AUTH_NO), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_CHANGEADDR), TRUE); wsprintf (szText, TEXT("%lu"), TASKDATA(ptp)->nAggr); SetDlgItemText (hDlg, IDC_SVR_NUMAGGREGATES, szText); LPTSTR pszText = FormatString (IDS_SVR_CAPACITY, TEXT("%.1B"), (double)TASKDATA(ptp)->ckCapacity * 1024.0); SetDlgItemText (hDlg, IDC_SVR_CAPACITY, pszText); FreeString (pszText); DWORD dwPercentUsed = 100; if (TASKDATA(ptp)->ckCapacity) dwPercentUsed = (DWORD)( (double)100 * TASKDATA(ptp)->ckAllocation / TASKDATA(ptp)->ckCapacity ); pszText = FormatString (IDS_SVR_ALLOCATION, TEXT("%.1B%lu"), (double)TASKDATA(ptp)->ckAllocation * 1024.0, dwPercentUsed); SetDlgItemText (hDlg, IDC_SVR_ALLOCATION, pszText); FreeString (pszText); Server_FillAddrList (hDlg, &TASKDATA(ptp)->ss); } }
void Server_Hosts (LPIDENT lpiServer) { HWND hCurrent; if ((hCurrent = PropCache_Search (pcSVR_HOSTS, lpiServer)) != NULL) { SetFocus (hCurrent); } else { LPSVR_HOSTS_PARAMS lpp = New (SVR_HOSTS_PARAMS); memset (lpp, 0x00, sizeof(SVR_HOSTS_PARAMS)); lpp->lpiServer = lpiServer; TCHAR szServer[ cchNAME ]; lpiServer->GetServerName (szServer); LPTSTR pszTitle = FormatString (IDS_SVR_HOSTS_TITLE, TEXT("%s"), szServer); LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE); PropSheet_AddTab (psh, IDS_SVR_HOST_TAB, IDD_SVR_HOSTS, (DLGPROC)Server_Hosts_DlgProc, (LONG_PTR)lpp, TRUE); PropSheet_ShowModeless (psh); FreeString (pszTitle); } }
LPTSTR Replicas_GetColumnText (LPIDENT lpi, REPLICACOLUMN repcol) { static TCHAR aszBuffer[ nREPLICACOLUMNS ][ cchRESOURCE ]; static size_t iBufferNext = 0; LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ]; if (iBufferNext == nREPLICACOLUMNS) iBufferNext = 0; LPFILESETSTATUS lpfs = NULL; LPFILESET_PREF lpfp; if ((lpfp = (LPFILESET_PREF)lpi->GetUserParam()) != NULL) { lpfs = &lpfp->fsLast; } switch (repcol) { case repcolSERVER: lpi->GetServerName (pszBuffer); break; case repcolAGGREGATE: lpi->GetAggregateName (pszBuffer); break; case repcolDATE_UPDATE: if (!lpfs) *pszBuffer = TEXT('\0'); else if (!FormatTime (pszBuffer, TEXT("%s"), &lpfs->timeLastUpdate)) *pszBuffer = TEXT('\0'); break; default: pszBuffer = NULL; break; } return pszBuffer; }
void Server_Salvage_Results_OnInitDialog (HWND hDlg, LPIDENT lpiSalvage) { TCHAR szServer[ cchNAME ]; lpiSalvage->GetServerName (szServer); TCHAR szAggregate[ cchNAME ]; if (!lpiSalvage->fIsServer()) lpiSalvage->GetAggregateName (szAggregate); TCHAR szFileset[ cchNAME ]; if (lpiSalvage->fIsFileset()) lpiSalvage->GetFilesetName (szFileset); LPTSTR pszTitle; if (lpiSalvage->fIsServer()) pszTitle = FormatString (IDS_SALVAGE_SVR, TEXT("%s"), szServer); else if (lpiSalvage->fIsAggregate()) pszTitle = FormatString (IDS_SALVAGE_AGG, TEXT("%s%s"), szServer, szAggregate); else // (lpiSalvage->fIsFileset()) pszTitle = FormatString (IDS_SALVAGE_SET, TEXT("%s%s%s"), szServer, szAggregate, szFileset); SetDlgItemText (hDlg, IDC_SALVAGE_TITLE, pszTitle); FreeString (pszTitle); }
LPTSTR Alert_GetDescriptionFunc (LPIDENT lpiPrimary, size_t iAlertPrimary, LPIDENT lpiServer, BOOL fFull) { LPOBJECTALERTS lpoa; if ((lpoa = Alert_GetObjectAlerts (lpiPrimary)) != NULL) { int ids; TCHAR szServer[ cchRESOURCE ]; TCHAR szService[ cchRESOURCE ]; TCHAR szAggregate[ cchRESOURCE ]; TCHAR szFileset[ cchRESOURCE ]; switch (lpoa->aAlerts[ iAlertPrimary ].alert) { case alertTIMEOUT: ids = (fFull) ? IDS_ALERT_DESCFULL_TIMEOUT : IDS_ALERT_DESCSHORT_TIMEOUT; lpiPrimary->GetServerName (szServer); return FormatString (ids, TEXT("%s%t%e"), szServer, &lpoa->aAlerts[ iAlertPrimary ].aiTIMEOUT.stLastAttempt, lpoa->aAlerts[ iAlertPrimary ].aiTIMEOUT.status); case alertFULL: lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); if (lpiPrimary->fIsAggregate()) { ids = (fFull) ? IDS_ALERT_DESCFULL_AGG_FULL : IDS_ALERT_DESCSHORT_AGG_FULL; return FormatString (ids, TEXT("%s%s%d%.1B"), szServer, szAggregate, lpoa->aAlerts[ iAlertPrimary ].aiFULL.perWarning, 1024.0 * (double)lpoa->aAlerts[ iAlertPrimary ].aiFULL.ckWarning); } else if (lpiPrimary->fIsFileset()) { ids = (fFull) ? IDS_ALERT_DESCFULL_SET_FULL : IDS_ALERT_DESCSHORT_SET_FULL; lpiPrimary->GetFilesetName (szFileset); return FormatString (ids, TEXT("%s%s%s%d%.1B"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiFULL.perWarning, 1024.0 * (double)lpoa->aAlerts[ iAlertPrimary ].aiFULL.ckWarning); } break; case alertNO_VLDBENT: ids = (fFull) ? IDS_ALERT_DESCFULL_NO_VLDBENT : IDS_ALERT_DESCSHORT_NO_VLDBENT; lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); lpiPrimary->GetFilesetName (szFileset); return FormatString (ids, TEXT("%s%s%s"), szServer, szAggregate, szFileset); case alertNO_SVRENT: if (lpiPrimary->fIsFileset()) { ids = (fFull) ? IDS_ALERT_DESCFULL_NO_SVRENT_SET : IDS_ALERT_DESCSHORT_NO_SVRENT_SET; lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); lpiPrimary->GetFilesetName (szFileset); return FormatString (ids, TEXT("%s%s%s"), szServer, szAggregate, szFileset); } else { ids = (fFull) ? IDS_ALERT_DESCFULL_NO_SVRENT_AGG : IDS_ALERT_DESCSHORT_NO_SVRENT_AGG; lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); return FormatString (ids, TEXT("%s%s"), szServer, szAggregate); } break; case alertSTOPPED: ids = (fFull) ? IDS_ALERT_DESCFULL_STOPPED : IDS_ALERT_DESCSHORT_STOPPED; lpiPrimary->GetServerName (szServer); lpiPrimary->GetServiceName (szService); return FormatString (ids, TEXT("%s%s%t%t%lu"), szServer, szService, &lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.stStopped, &lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.stLastError, lpoa->aAlerts[ iAlertPrimary ].aiSTOPPED.errLastError); case alertBADCREDS: ids = (fFull) ? IDS_ALERT_DESCFULL_BADCREDS : IDS_ALERT_DESCSHORT_BADCREDS; lpiPrimary->GetServerName (szServer); return FormatString (ids, TEXT("%s"), szServer); case alertOVERALLOC: lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); ids = (fFull) ? IDS_ALERT_DESCFULL_AGG_ALLOC : IDS_ALERT_DESCSHORT_AGG_ALLOC; return FormatString (ids, TEXT("%s%s%.1B%.1B"), szServer, szAggregate, 1024.0 * (double)(lpoa->aAlerts[ iAlertPrimary ].aiOVERALLOC.ckCapacity), 1024.0 * (double)(lpoa->aAlerts[ iAlertPrimary ].aiOVERALLOC.ckAllocated)); case alertSTATE_NO_VNODE: ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_NO_VNODE : IDS_ALERT_DESCSHORT_STATE_NO_VNODE; lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); lpiPrimary->GetFilesetName (szFileset); return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State); case alertSTATE_NO_SERVICE: ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_NO_SERVICE : IDS_ALERT_DESCSHORT_STATE_NO_SERVICE; lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); lpiPrimary->GetFilesetName (szFileset); return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State); case alertSTATE_OFFLINE: ids = (fFull) ? IDS_ALERT_DESCFULL_STATE_OFFLINE : IDS_ALERT_DESCSHORT_STATE_OFFLINE; lpiPrimary->GetServerName (szServer); lpiPrimary->GetAggregateName (szAggregate); lpiPrimary->GetFilesetName (szFileset); return FormatString (ids, TEXT("%s%s%s%08lX"), szServer, szAggregate, szFileset, lpoa->aAlerts[ iAlertPrimary ].aiSTATE.State); } } return NULL; }
LPTSTR Aggregates_GetColumnText (LPIDENT lpi, AGGREGATECOLUMN aggcol, BOOL fShowServerName) { static TCHAR aszBuffer[ nAGGREGATECOLUMNS ][ cchRESOURCE ]; static size_t iBufferNext = 0; LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ]; if (iBufferNext == nAGGREGATECOLUMNS) iBufferNext = 0; pszBuffer[0] = TEXT('\0'); LPAGGREGATE_PREF lpap; LPAGGREGATESTATUS lpas = NULL; LPTSTR pszDevice = NULL; if ((lpap = (LPAGGREGATE_PREF)lpi->GetUserParam()) != NULL) { lpas = &lpap->asLast; pszDevice = lpap->szDevice; } switch (aggcol) { case aggcolNAME: if (!fShowServerName) lpi->GetAggregateName (pszBuffer); else { TCHAR szNameSvr[ cchNAME ]; TCHAR szNameAgg[ cchNAME ]; lpi->GetServerName (szNameSvr); lpi->GetAggregateName (szNameAgg); LPTSTR pszName = FormatString (IDS_SERVER_AGGREGATE, TEXT("%s%s"), szNameSvr, szNameAgg); lstrcpy (pszBuffer, pszName); FreeString (pszName); } break; case aggcolID: if (lpas) wsprintf (pszBuffer, TEXT("%lu"), lpas->dwID); break; case aggcolDEVICE: if (pszDevice) lstrcpy (pszBuffer, pszDevice); break; case aggcolUSED: if (lpas) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%.1B"), 1024.0 * (lpas->ckStorageTotal - lpas->ckStorageFree)); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case aggcolUSED_PER: if (lpas) { DWORD dwPer = 100; if (lpas->ckStorageTotal != 0) dwPer = (DWORD)( 100.0 * (lpas->ckStorageTotal - lpas->ckStorageFree) / lpas->ckStorageTotal ); dwPer = limit( 0, dwPer, 100 ); LPTSTR psz = FormatString (IDS_PERCENTAGE, TEXT("%lu"), dwPer); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case aggcolALLOCATED: if (lpas) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%.1B"), 1024.0 * lpas->ckStorageAllocated); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case aggcolFREE: if (lpas) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%.1B"), 1024.0 * lpas->ckStorageFree); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case aggcolTOTAL: if (lpas) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%.1B"), 1024.0 * lpas->ckStorageTotal); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case aggcolSTATUS: LPTSTR pszDesc; if ((pszDesc = Alert_GetQuickDescription (lpi)) == NULL) GetString (pszBuffer, IDS_STATUS_NOALERTS); else { lstrcpy (pszBuffer, pszDesc); FreeString (pszDesc); } break; } return pszBuffer; }
void Aggregates_General_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp) { LPIDENT lpi = (LPIDENT)GetWindowLongPtr (hDlg, DWLP_USER); if (!ptp->rc) { TCHAR szUnknown[ cchRESOURCE ]; GetString (szUnknown, IDS_UNKNOWN); SetDlgItemText (hDlg, IDC_AGG_ID, szUnknown); SetDlgItemText (hDlg, IDC_AGG_DEVICE, szUnknown); SetDlgItemText (hDlg, IDC_AGG_FILESETS, szUnknown); SetDlgItemText (hDlg, IDC_AGG_USAGE, szUnknown); TCHAR szSvrName[ cchNAME ]; TCHAR szAggName[ cchNAME ]; lpi->GetServerName (szSvrName); lpi->GetAggregateName (szAggName); ErrorDialog (ptp->status, IDS_ERROR_REFRESH_AGGREGATE_STATUS, TEXT("%s%s"), szSvrName, szAggName); } else { TCHAR szText[ cchRESOURCE ]; wsprintf (szText, TEXT("%lu"), TASKDATA(ptp)->as.dwID); SetDlgItemText (hDlg, IDC_AGG_ID, szText); SetDlgItemText (hDlg, IDC_AGG_DEVICE, TASKDATA(ptp)->pszText1); LPTSTR pszText = FormatString (IDS_AGG_FILESETS, TEXT("%lu%.1B"), TASKDATA(ptp)->nFilesets, (double)cb1KB * (double)(TASKDATA(ptp)->as.ckStorageAllocated)); SetDlgItemText (hDlg, IDC_AGG_FILESETS, pszText); FreeString (pszText); double dUsed = 1024.0 * (TASKDATA(ptp)->as.ckStorageTotal - TASKDATA(ptp)->as.ckStorageFree); double dTotal = 1024.0 * TASKDATA(ptp)->as.ckStorageTotal; DWORD dwPer = 100; if (TASKDATA(ptp)->as.ckStorageTotal != 0) { dwPer = (DWORD)( 100.0 * (TASKDATA(ptp)->as.ckStorageTotal - TASKDATA(ptp)->as.ckStorageFree) / TASKDATA(ptp)->as.ckStorageTotal ); dwPer = limit( 0, dwPer, 100 ); } LPTSTR pszUsage = FormatString (IDS_USAGE_AGGREGATE, TEXT("%.1B%.1B%lu"), dUsed, dTotal, dwPer); SetDlgItemText (hDlg, IDC_AGG_USAGE, pszUsage); FreeString (pszUsage); SendDlgItemMessage (hDlg, IDC_AGG_USAGEBAR, PBM_SETRANGE, 0, MAKELPARAM(0,100)); SendDlgItemMessage (hDlg, IDC_AGG_USAGEBAR, PBM_SETPOS, (WPARAM)dwPer, 0); if (TASKDATA(ptp)->lpsp->fWarnAggAlloc) { EnableWindow (GetDlgItem (hDlg, IDC_AGG_WARNALLOC), TRUE); CheckDlgButton (hDlg, IDC_AGG_WARNALLOC, TASKDATA(ptp)->lpap->fWarnAggAlloc); } EnableWindow (GetDlgItem (hDlg, IDC_AGG_WARN), TRUE); if (TASKDATA(ptp)->lpsp->perWarnAggFull == 0) { GetString (szText, IDS_AGGFULL_WARN_OFF); SetDlgItemText (hDlg, IDC_AGG_WARN_AGGFULL_DEF, szText); } else { pszText = FormatString (IDS_AGGFULL_WARN_ON, TEXT("%lu"), TASKDATA(ptp)->lpsp->perWarnAggFull); SetDlgItemText (hDlg, IDC_AGG_WARN_AGGFULL_DEF, pszText); FreeString (pszText); } CheckDlgButton (hDlg, IDC_AGG_WARN, (TASKDATA(ptp)->lpap->perWarnAggFull != 0)); if (TASKDATA(ptp)->lpap->perWarnAggFull != 0) { if (TASKDATA(ptp)->lpap->perWarnAggFull != -1) CheckDlgButton (hDlg, IDC_AGG_WARN_AGGFULL, TRUE); else CheckDlgButton (hDlg, IDC_AGG_WARN_AGGFULL_DEF, TRUE); } CreateSpinner (GetDlgItem (hDlg, IDC_AGG_WARN_AGGFULL_PERCENT), 10, FALSE, // base, signed 1, (TASKDATA(ptp)->lpap->perWarnAggFull == 0 || TASKDATA(ptp)->lpap->perWarnAggFull == -1) ? perDEFAULT_AGGFULL_WARNING : TASKDATA(ptp)->lpap->perWarnAggFull, 100); // min, default, max Aggregates_General_OnWarnings (hDlg); } }
void Server_Scout_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp) { LPIDENT lpiServer = (LPIDENT)GetWindowLongPtr (hDlg, DWLP_USER); if (!ptp->rc) { TCHAR szText[ cchNAME ]; lpiServer->GetServerName (szText); ErrorDialog (ptp->status, IDS_ERROR_REFRESH_SERVER_STATUS, TEXT("%s"), szText); } else { EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_AGGFULL), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_AGGFULL_PERCENT), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_SETFULL), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_SETFULL_PERCENT), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_AGGALLOC), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_SVCSTOP), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_TIMEOUT), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_SETNOVLDB), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_SETNOSERV), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_WARN_AGGNOSERV), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_AUTOREFRESH), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SVR_AUTOREFRESH_MINUTES), TRUE); CheckDlgButton (hDlg, IDC_SVR_WARN_AGGFULL, (TASKDATA(ptp)->lpsp->perWarnAggFull != 0)); CheckDlgButton (hDlg, IDC_SVR_WARN_SETFULL, (TASKDATA(ptp)->lpsp->perWarnSetFull != 0)); CheckDlgButton (hDlg, IDC_SVR_WARN_AGGALLOC, TASKDATA(ptp)->lpsp->fWarnAggAlloc); CheckDlgButton (hDlg, IDC_SVR_WARN_SVCSTOP, TASKDATA(ptp)->lpsp->fWarnSvcStop); CheckDlgButton (hDlg, IDC_SVR_WARN_TIMEOUT, TASKDATA(ptp)->lpsp->fWarnSvrTimeout); CheckDlgButton (hDlg, IDC_SVR_WARN_SETNOVLDB, TASKDATA(ptp)->lpsp->fWarnSetNoVLDB); CheckDlgButton (hDlg, IDC_SVR_WARN_SETNOSERV, TASKDATA(ptp)->lpsp->fWarnSetNoServ); CheckDlgButton (hDlg, IDC_SVR_WARN_AGGNOSERV, TASKDATA(ptp)->lpsp->fWarnAggNoServ); CheckDlgButton (hDlg, IDC_SVR_AUTOREFRESH, (TASKDATA(ptp)->lpsp->oa.cTickRefresh != 0)); CreateSpinner (GetDlgItem (hDlg, IDC_SVR_AUTOREFRESH_MINUTES), 10, FALSE, // base, signed 1, TASKDATA(ptp)->lpsp->oa.cTickRefresh / cmsec1MINUTE, 60L * 24L); // maximum refresh rate of one day Server_Scout_OnAutoRefresh (hDlg, lpiServer); CreateSpinner (GetDlgItem (hDlg, IDC_SVR_WARN_AGGFULL_PERCENT), 10, FALSE, // base, signed 1, (TASKDATA(ptp)->lpsp->perWarnAggFull == 0) ? perDEFAULT_AGGFULL_WARNING : TASKDATA(ptp)->lpsp->perWarnAggFull, 100L); Server_Scout_OnAggWarn (hDlg, lpiServer); CreateSpinner (GetDlgItem (hDlg, IDC_SVR_WARN_SETFULL_PERCENT), 10, FALSE, // base, signed 1, (TASKDATA(ptp)->lpsp->perWarnSetFull == 0) ? perDEFAULT_SETFULL_WARNING : TASKDATA(ptp)->lpsp->perWarnSetFull, 100L); Server_Scout_OnSetWarn (hDlg, lpiServer); } }
LPTSTR Filesets_GetColumnText (LPIDENT lpi, FILESETCOLUMN setcol, BOOL fShowServerName) { static TCHAR aszBuffer[ nFILESETCOLUMNS ][ cchRESOURCE ]; static size_t iBufferNext = 0; LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ]; if (iBufferNext == nFILESETCOLUMNS) iBufferNext = 0; *pszBuffer = TEXT('\0'); LPFILESETSTATUS lpfs = NULL; LPIDENT lpiRW = NULL; LPFILESET_PREF lpfp; if ((lpfp = (LPFILESET_PREF)lpi->GetUserParam()) != NULL) { lpfs = &lpfp->fsLast; lpiRW = lpfp->lpiRW; } switch (setcol) { case setcolNAME: lpi->GetFilesetName (pszBuffer); break; case setcolAGGREGATE: if (!fShowServerName) lpi->GetAggregateName (pszBuffer); else { TCHAR szNameSvr[ cchNAME ]; TCHAR szNameAgg[ cchNAME ]; lpi->GetServerName (szNameSvr); lpi->GetAggregateName (szNameAgg); LPTSTR pszName = FormatString (IDS_SERVER_AGGREGATE, TEXT("%s%s"), szNameSvr, szNameAgg); lstrcpy (pszBuffer, pszName); FreeString (pszName); } break; case setcolTYPE: if (lpfs) { switch (lpfs->Type) { case ftREADWRITE: GetString (pszBuffer, IDS_FILESETTYPE_RW); break; case ftCLONE: GetString (pszBuffer, IDS_FILESETTYPE_CLONE); break; case ftREPLICA: if (lpiRW == NULL) GetString (pszBuffer, IDS_FILESETTYPE_RO); else if (lpiRW->GetServer() != lpi->GetServer()) GetString (pszBuffer, IDS_FILESETTYPE_RO); else GetString (pszBuffer, IDS_FILESETTYPE_RO_STAGE); break; } } break; case setcolDATE_CREATE: if (lpfs) { if (!FormatTime (pszBuffer, TEXT("%s"), &lpfs->timeCreation)) pszBuffer[0] = TEXT('\0'); } break; case setcolDATE_UPDATE: if (lpfs) { if (!FormatTime (pszBuffer, TEXT("%s"), &lpfs->timeLastUpdate)) pszBuffer[0] = TEXT('\0'); } break; case setcolDATE_ACCESS: if (lpfs) { if (!FormatTime (pszBuffer, TEXT("%s"), &lpfs->timeLastAccess)) pszBuffer[0] = TEXT('\0'); } break; case setcolDATE_BACKUP: if (lpfs) { if (!FormatTime (pszBuffer, TEXT("%s"), &lpfs->timeLastBackup)) pszBuffer[0] = TEXT('\0'); } break; case setcolQUOTA_USED: if (lpfs) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%.1B"), 1024.0 * lpfs->ckUsed); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case setcolQUOTA_USED_PER: if (lpfs && lpfs->Type == ftREADWRITE) { DWORD dwPer = 100; if (lpfs->ckQuota != 0) dwPer = (DWORD)( 100.0 * lpfs->ckUsed / lpfs->ckQuota ); dwPer = max( 0, dwPer ); LPTSTR psz = FormatString (IDS_PERCENTAGE, TEXT("%lu"), dwPer); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case setcolQUOTA_FREE: if (lpfs && lpfs->Type == ftREADWRITE) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%.1B"), 1024.0 * (lpfs->ckQuota - lpfs->ckUsed)); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case setcolQUOTA_TOTAL: if (lpfs && lpfs->Type == ftREADWRITE) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%.1B"), 1024.0 * lpfs->ckQuota); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case setcolSTATUS: LPTSTR pszDesc; if ((pszDesc = Alert_GetQuickDescription (lpi)) != NULL) { lstrcpy (pszBuffer,pszDesc); FreeString (pszDesc); } else if (!lpfs) { GetString (pszBuffer, IDS_STATUS_NOALERTS); } else { if (lpfs->State & fsBUSY) GetString (pszBuffer, IDS_SETSTATUS_BUSY); else if (lpfs->State & fsSALVAGE) GetString (pszBuffer, IDS_SETSTATUS_SALVAGE); else if (lpfs->State & fsMOVED) GetString (pszBuffer, IDS_SETSTATUS_MOVED); else if (lpfs->State & fsLOCKED) GetString (pszBuffer, IDS_SETSTATUS_LOCKED); else if (lpfs->State & fsNO_VOL) GetString (pszBuffer, IDS_SETSTATUS_NO_VOL); else GetString (pszBuffer, IDS_STATUS_NOALERTS); } break; case setcolID: if (lpfs) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%ld"), lpfs->id); lstrcpy (pszBuffer, psz); FreeString (psz); } break; case setcolFILES: if (lpfs) { LPTSTR psz = FormatString (TEXT("%1"), TEXT("%ld"), lpfs->nFiles); lstrcpy (pszBuffer, psz); FreeString (psz); } break; } return pszBuffer; }
BOOL CALLBACK Aggregates_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) { if (HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewAgg)) return FALSE; switch (msg) { case WM_INITDIALOG: { RECT rTab; GetClientRect (GetParent(hDlg), &rTab); TabCtrl_AdjustRect (GetParent (hDlg), FALSE, &rTab); ResizeWindow (hDlg, awdAggregates, rwaMoveToHere, &rTab); FL_RestoreView (GetDlgItem (hDlg, IDC_AGG_LIST), &gr.viewAgg); FastList_SetTextCallback (GetDlgItem (hDlg, IDC_AGG_LIST), GetItemText, &gr.viewAgg); Aggregates_SubclassList (hDlg); } break; case WM_HELP: WinHelp (hDlg, cszHELPFILENAME, HELP_FINDER, 0); break; case WM_DESTROY: DontNotifyMeEver (hDlg); FL_StoreView (GetDlgItem (hDlg, IDC_AGG_LIST), &gr.viewAgg); break; case WM_SIZE: // if (lp==0), we're minimizing--don't call ResizeWindow(). // if (lp != 0) ResizeWindow (hDlg, awdAggregates, rwaFixupGuts); break; case WM_SERVER_CHANGED: { LPIDENT lpiServer = Server_GetServerForChild (hDlg); DontNotifyMeEver (hDlg); NotifyMe (WHEN_AGGS_CHANGE, lpiServer, hDlg, 0); // Fix the text at the top of the Aggregates tab: // TCHAR szName[ cchRESOURCE ]; LPTSTR pszText; if (lpiServer != NULL) { LPSERVER_PREF lpsp = (LPSERVER_PREF)lpiServer->GetUserParam(); lpiServer->GetServerName (szName); if (lpsp && !lpsp->fIsMonitored) pszText = FormatString (IDS_AGGREGATE_UNMON, TEXT("%s"), szName); else pszText = FormatString (IDS_AGGREGATES_IN_SERVER, TEXT("%s"), szName); } else if (g.lpiCell != NULL) { g.lpiCell->GetCellName (szName); if (g.sub) pszText = FormatString (IDS_AGGREGATE_SOME, TEXT("%s"), szName); else pszText = FormatString (IDS_AGGREGATES_IN_CELL, TEXT("%s"), szName); } else { pszText = FormatString (IDS_AGGREGATES_IN_NOTHING); } SetDlgItemText (hDlg, IDC_AGG_DESC, pszText); FreeString (pszText); UpdateDisplay_Aggregates (FALSE, GetDlgItem (hDlg, IDC_AGG_LIST), NULL, 0, NULL, NULL, NULL); } break; case WM_NOTIFY_FROM_DISPATCH: Aggregates_OnNotifyFromDispatch ((LPNOTIFYSTRUCT)lp); Delete ((LPNOTIFYSTRUCT)lp); break; case WM_NOTIFY: switch (((LPNMHDR)lp)->code) { case FLN_LDBLCLICK: if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_AGG_LIST)) { if (FL_GetSelectedData (GetDlgItem (hDlg, IDC_AGG_LIST))) PostMessage (GetDlgItem (hDlg, IDC_AGG_LIST), WM_COMMAND, M_PROPERTIES, 0); return TRUE; } break; } break; case WM_CONTEXTMENU: { POINT ptScreen; POINT ptClient; ptScreen.x = LOWORD(lp); ptScreen.y = HIWORD(lp); ptClient = ptScreen; ScreenToClient ((HWND)wp, &ptClient); if ((HWND)wp == GetDlgItem (hDlg, IDC_AGG_LIST)) Aggregates_ShowPopupMenu ((HWND)wp, ptClient, ptScreen); } break; case WM_COMMAND: switch (LOWORD(wp)) { case IDC_AGG_CREATESET: SendMessage (GetDlgItem (hDlg, IDC_AGG_LIST), WM_COMMAND, M_SET_CREATE, 0); break; } break; } return FALSE; }
LPTSTR Services_GetColumnText (LPIDENT lpi, SERVICECOLUMN svccol, BOOL fShowServerName) { static TCHAR aszBuffer[ nSERVICECOLUMNS ][ cchRESOURCE ]; static size_t iBufferNext = 0; LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ]; if (iBufferNext == nSERVICECOLUMNS) iBufferNext = 0; *pszBuffer = TEXT('\0'); LPSERVICESTATUS lpss = NULL; LPSERVICE_PREF lpsp; if ((lpsp = (LPSERVICE_PREF)lpi->GetUserParam()) != NULL) lpss = &lpsp->ssLast; switch (svccol) { case svccolNAME: if (!fShowServerName) lpi->GetServiceName (pszBuffer); else { TCHAR szNameSvr[ cchNAME ]; TCHAR szNameSvc[ cchNAME ]; lpi->GetServerName (szNameSvr); lpi->GetServiceName (szNameSvc); LPTSTR pszName = FormatString (IDS_SERVER_SERVICE, TEXT("%s%s"), szNameSvr, szNameSvc); lstrcpy (pszBuffer, pszName); FreeString (pszName); } break; case svccolTYPE: if (lpss) { if (lpss->type == SERVICETYPE_SIMPLE) GetString (pszBuffer, IDS_SERVICETYPE_SIMPLE); else if (lpss->type == SERVICETYPE_FS) GetString (pszBuffer, IDS_SERVICETYPE_FS); else GetString (pszBuffer, IDS_SERVICETYPE_CRON); } break; case svccolPARAMS: if (lpss) { lstrncpy (pszBuffer, lpss->szParams, cchRESOURCE-1); pszBuffer[ cchRESOURCE-1 ] = TEXT('\0'); for (LPTSTR pch = pszBuffer; *pch; ++pch) { if (*pch == TEXT('\r') || *pch == TEXT('\t') || *pch == TEXT('\n')) *pch = TEXT(' '); } } break; case svccolNOTIFIER: if (lpss) { lstrncpy (pszBuffer, lpss->szNotifier, cchRESOURCE-1); pszBuffer[ cchRESOURCE-1 ] = TEXT('\0'); for (LPTSTR pch = pszBuffer; *pch; ++pch) { if (*pch == TEXT('\r') || *pch == TEXT('\t') || *pch == TEXT('\n')) *pch = TEXT(' '); } } break; case svccolSTATUS: if (lpss) { if (lpss->state == SERVICESTATE_RUNNING) GetString (pszBuffer, IDS_SERVICESTATE_RUNNING); else if (lpss->state == SERVICESTATE_STOPPING) GetString (pszBuffer, IDS_SERVICESTATE_STOPPING); else if (lpss->state == SERVICESTATE_STARTING) GetString (pszBuffer, IDS_SERVICESTATE_STARTING); else GetString (pszBuffer, IDS_SERVICESTATE_STOPPED); } break; case svccolDATE_START: if (lpss) { if (!FormatTime (pszBuffer, TEXT("%s"), &lpss->timeLastStart)) pszBuffer[0] = TEXT('\0'); } break; case svccolDATE_STOP: if (lpss) { if (!FormatTime (pszBuffer, TEXT("%s"), &lpss->timeLastStop)) pszBuffer[0] = TEXT('\0'); } break; case svccolDATE_STARTSTOP: if (lpss) { LPSYSTEMTIME pst; int ids; if ((lpss->state == SERVICESTATE_RUNNING) || (lpss->state == SERVICESTATE_STARTING)) { ids = IDS_SERVICE_STARTDATE; pst = &lpss->timeLastStart; } else { ids = IDS_SERVICE_STOPDATE; pst = &lpss->timeLastStop; } TCHAR szDate[ cchRESOURCE ]; if (FormatTime (szDate, TEXT("%s"), pst)) { LPTSTR psz = FormatString (ids, TEXT("%s"), szDate); lstrcpy (pszBuffer, psz); FreeString (psz); } } break; case svccolDATE_FAILED: if (lpss) { if (!FormatTime (pszBuffer, TEXT("%s"), &lpss->timeLastFail)) pszBuffer[0] = TEXT('\0'); } break; case svccolLASTERROR: if (lpss) { LPTSTR psz = FormatString (IDS_SERVICE_LASTERROR, TEXT("%ld"), lpss->dwErrLast); lstrcpy (pszBuffer, psz); FreeString (psz); } break; } return pszBuffer; }
BOOL CALLBACK Filesets_DlgProc (HWND hDlg, UINT msg, WPARAM wp, LPARAM lp) { if (HandleColumnNotify (hDlg, msg, wp, lp, &gr.viewSet)) return FALSE; switch (msg) { case WM_INITDIALOG: { RECT rTab; GetClientRect (GetParent(hDlg), &rTab); TabCtrl_AdjustRect (GetParent (hDlg), FALSE, &rTab); ResizeWindow (hDlg, awdFilesets, rwaMoveToHere, &rTab); FL_RestoreView (GetDlgItem (hDlg, IDC_SET_LIST), &gr.viewSet); FastList_SetTextCallback (GetDlgItem (hDlg, IDC_SET_LIST), GetItemText, &gr.viewSet); Filesets_SubclassList (hDlg); Filesets_OnView (hDlg); Filesets_OnSelect (hDlg); } break; case WM_HELP: WinHelp (hDlg, cszHELPFILENAME, HELP_FINDER, 0); break; case WM_DESTROY: FL_StoreView (GetDlgItem (hDlg, IDC_SET_LIST), &gr.viewSet); DontNotifyMeEver (hDlg); break; case WM_SIZE: // if (lp==0), we're minimizing--don't call ResizeWindow(). // if (lp != 0) ResizeWindow (hDlg, awdFilesets, rwaFixupGuts); break; case WM_CONTEXTMENU: { POINT ptScreen; POINT ptClient; ptScreen.x = LOWORD(lp); ptScreen.y = HIWORD(lp); ptClient = ptScreen; ScreenToClient ((HWND)wp, &ptClient); if ((HWND)wp == GetDlgItem (hDlg, IDC_SET_LIST)) Filesets_ShowPopupMenu ((HWND)wp, ptClient, ptScreen); } break; case WM_SERVER_CHANGED: { LPIDENT lpiServer = Server_GetServerForChild (hDlg); DontNotifyMeEver (hDlg); NotifyMe (WHEN_OBJECT_CHANGES, NULL, hDlg, 0); // Fix the text at the top of the Aggregates tab: // TCHAR szName[ cchRESOURCE ]; LPTSTR pszText; if (lpiServer != NULL) { LPSERVER_PREF lpsp = (LPSERVER_PREF)lpiServer->GetUserParam(); lpiServer->GetServerName (szName); if (lpsp && !lpsp->fIsMonitored) pszText = FormatString (IDS_FILESET_UNMON, TEXT("%s"), szName); else pszText = FormatString (IDS_FILESETS_IN_SERVER, TEXT("%s"), szName); } else if (g.lpiCell != NULL) { g.lpiCell->GetCellName (szName); if (g.sub) pszText = FormatString (IDS_FILESET_SOME, TEXT("%s"), szName); else pszText = FormatString (IDS_FILESETS_IN_CELL, TEXT("%s"), szName); } else { pszText = FormatString (IDS_FILESETS_IN_NOTHING); } SetDlgItemText (hDlg, IDC_SET_DESC, pszText); FreeString (pszText); UpdateDisplay_Filesets (FALSE, GetDlgItem (hDlg, IDC_SET_LIST), NULL, 0, NULL, NULL, NULL); } break; case WM_NOTIFY_FROM_DISPATCH: Filesets_OnNotifyFromDispatch ((LPNOTIFYSTRUCT)lp); Delete ((LPNOTIFYSTRUCT)lp); break; case WM_COMMAND: switch (LOWORD(wp)) { case IDC_SET_CREATE: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_CREATE, 0); break; case IDC_SET_DELETE: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_DELETE, 0); break; case IDC_SET_REP: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_REPLICATION, 0); break; case IDC_SET_SETQUOTA: SendMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_SET_SETQUOTA, 0); break; } break; case WM_MOUSEMOVE: Filesets_ContinueDrag (hDlg); break; case WM_LBUTTONDOWN: if (l.fDragging && l.fRightBtn) Filesets_FinishDrag (hDlg, FALSE, FALSE); break; case WM_RBUTTONDOWN: if (l.fDragging && !l.fRightBtn) Filesets_FinishDrag (hDlg, FALSE, FALSE); break; case WM_LBUTTONUP: if (l.fDragging && !l.fRightBtn) Filesets_FinishDrag (hDlg, TRUE, FALSE); break; case WM_RBUTTONUP: if (l.fDragging && l.fRightBtn) Filesets_FinishDrag (hDlg, TRUE, TRUE); break; case WM_ENDTASK: LPTASKPACKET ptp; if ((ptp = (LPTASKPACKET)lp) != NULL) { if (ptp->idTask == taskSET_SELECT) Filesets_OnEndTask_Select (hDlg, ptp); else if (ptp->idTask == taskSET_BEGINDRAG) Filesets_OnEndTask_BeginDrag (hDlg, ptp); else if (ptp->idTask == taskSET_DRAGMENU) Filesets_OnEndTask_DragMenu (hDlg, ptp); else if (ptp->idTask == taskSET_MENU) Filesets_OnEndTask_Menu (hDlg, ptp); FreeTaskPacket (ptp); } break; case WM_NOTIFY: switch (((LPNMHDR)lp)->code) { case FLN_ITEMSELECT: if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST)) { Filesets_OnSelect (hDlg); } break; case FLN_ITEMEXPAND: if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST)) { HLISTITEM hItem = ((LPFLN_ITEMEXPAND_PARAMS)lp)->hItem; LPIDENT lpi = (LPIDENT)FastList_GetItemParam (GetDlgItem (hDlg, IDC_SET_LIST), hItem); BOOL fExpanded = ((LPFLN_ITEMEXPAND_PARAMS)lp)->fExpanded; if (lpi && lpi->fIsServer()) { LPSERVER_PREF lpsp; if ((lpsp = (LPSERVER_PREF)lpi->GetUserParam()) != NULL) { lpsp->fExpandTree = fExpanded; Server_SavePreferences (lpi); } } else if (lpi && lpi->fIsAggregate()) { LPAGGREGATE_PREF lpap; if ((lpap = (LPAGGREGATE_PREF)lpi->GetUserParam()) != NULL) { lpap->fExpandTree = fExpanded; Aggregates_SavePreferences (lpi); } } } break; case FLN_BEGINDRAG: return Filesets_BeginDrag (hDlg, ((LPFLN_DRAG_PARAMS)lp)->fRightButton); case FLN_LDBLCLICK: if (((LPNMHDR)lp)->hwndFrom == GetDlgItem (hDlg, IDC_SET_LIST)) { BOOL fShowProperties = TRUE; HLISTITEM hItem; if ((hItem = FastList_GetFocus (GetDlgItem (hDlg, IDC_SET_LIST))) != NULL) { if (FastList_FindFirstChild (GetDlgItem (hDlg, IDC_SET_LIST), hItem)) fShowProperties = FALSE; } LPIDENT lpi = Filesets_GetFocused (hDlg); if (lpi && !lpi->fIsCell() && fShowProperties) { PostMessage (GetDlgItem (hDlg, IDC_SET_LIST), WM_COMMAND, M_PROPERTIES, 0); return TRUE; } } break; } break; } return FALSE; }
void Filesets_General_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPIDENT lpi) { LPTSTR pszText; TCHAR szUnknown[ cchRESOURCE ]; GetString (szUnknown, IDS_UNKNOWN); if (!ptp->rc) { SetDlgItemText (hDlg, IDC_SET_CREATEDATE, szUnknown); SetDlgItemText (hDlg, IDC_SET_UPDATEDATE, szUnknown); SetDlgItemText (hDlg, IDC_SET_ACCESSDATE, szUnknown); SetDlgItemText (hDlg, IDC_SET_BACKUPDATE, szUnknown); SetDlgItemText (hDlg, IDC_SET_USAGE, szUnknown); SetDlgItemText (hDlg, IDC_SET_STATUS, szUnknown); SetDlgItemText (hDlg, IDC_SET_FILES, szUnknown); TCHAR szSvrName[ cchNAME ]; TCHAR szAggName[ cchNAME ]; TCHAR szSetName[ cchNAME ]; lpi->GetServerName (szSvrName); lpi->GetAggregateName (szAggName); lpi->GetFilesetName (szSetName); ErrorDialog (ptp->status, IDS_ERROR_REFRESH_FILESET_STATUS, TEXT("%s%s%s"), szSvrName, szAggName, szSetName); } else { TCHAR szText[ cchRESOURCE ]; EnableWindow (GetDlgItem (hDlg, IDC_SET_LOCK), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SET_UNLOCK), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SET_QUOTA), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DEF), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_PERCENT), TRUE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DESC), TRUE); if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeCreation)) SetDlgItemText (hDlg, IDC_SET_CREATEDATE, szUnknown); else SetDlgItemText (hDlg, IDC_SET_CREATEDATE, szText); if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeLastUpdate)) SetDlgItemText (hDlg, IDC_SET_UPDATEDATE, szUnknown); else SetDlgItemText (hDlg, IDC_SET_UPDATEDATE, szText); if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeLastAccess)) SetDlgItemText (hDlg, IDC_SET_ACCESSDATE, szUnknown); else SetDlgItemText (hDlg, IDC_SET_ACCESSDATE, szText); if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeLastBackup)) SetDlgItemText (hDlg, IDC_SET_BACKUPDATE, szUnknown); else SetDlgItemText (hDlg, IDC_SET_BACKUPDATE, szText); wsprintf (szText, TEXT("%lu"), TASKDATA(ptp)->fs.nFiles); SetDlgItemText (hDlg, IDC_SET_FILES, szText); size_t nAlerts = Alert_GetCount (lpi); if (nAlerts == 1) { GetString (szText, IDS_SETSTATUS_1ALERT); SetDlgItemText (hDlg, IDC_SET_STATUS, szText); } else if (nAlerts > 1) { pszText = FormatString (IDS_SETSTATUS_2ALERT, TEXT("%lu"), nAlerts); SetDlgItemText (hDlg, IDC_SET_STATUS, pszText); FreeString (pszText); } else // (nAlerts == 0) { if (TASKDATA(ptp)->fs.State & fsBUSY) GetString (szText, IDS_SETSTATUS_BUSY); else if (TASKDATA(ptp)->fs.State & fsSALVAGE) GetString (szText, IDS_SETSTATUS_SALVAGE); else if (TASKDATA(ptp)->fs.State & fsMOVED) GetString (szText, IDS_SETSTATUS_MOVED); else if (TASKDATA(ptp)->fs.State & fsLOCKED) GetString (szText, IDS_SETSTATUS_LOCKED); else if (TASKDATA(ptp)->fs.State & fsNO_VOL) GetString (szText, IDS_SETSTATUS_NO_VOL); else GetString (szText, IDS_STATUS_NOALERTS); SetDlgItemText (hDlg, IDC_SET_STATUS, szText); } if (TASKDATA(ptp)->fs.Type == ftREADWRITE) { Filesets_DisplayQuota (hDlg, &TASKDATA(ptp)->fs); } else { if (TASKDATA(ptp)->fs.Type == ftREPLICA) GetString (szText, IDS_USAGE_REPLICA); else // (TASKDATA(ptp)->fs.Type == ftCLONE) GetString (szText, IDS_USAGE_CLONE); pszText = FormatString (szText, TEXT("%.1B"), (double)TASKDATA(ptp)->fs.ckUsed * cb1KB); SetDlgItemText (hDlg, IDC_SET_USAGE, pszText); FreeString (pszText); if (GetDlgItem (hDlg, IDC_SET_USAGEBAR)) { RECT rUsagebar; GetRectInParent (GetDlgItem (hDlg, IDC_SET_USAGEBAR), &rUsagebar); HFONT hf = (HFONT)SendMessage (GetDlgItem (hDlg, IDC_SET_USAGEBAR), WM_GETFONT, 0, 0); DestroyWindow (GetDlgItem (hDlg, IDC_SET_USAGEBAR)); if (TASKDATA(ptp)->fs.Type == ftREPLICA) GetString (szText, IDS_NO_QUOTA_REPLICA); else // (TASKDATA(ptp)->fs.Type == ftCLONE) GetString (szText, IDS_NO_QUOTA_CLONE); HWND hDesc = CreateWindow (TEXT("static"), szText, WS_CHILD | SS_SIMPLE, rUsagebar.left, rUsagebar.top, cxRECT(rUsagebar), cyRECT(rUsagebar), hDlg, (HMENU)-1, THIS_HINST, 0); SendMessage (hDesc, WM_SETFONT, (WPARAM)hf, MAKELPARAM(TRUE,0)); ShowWindow (hDesc, SW_SHOW); } EnableWindow (GetDlgItem (hDlg, IDC_SET_QUOTA), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DEF), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_PERCENT), FALSE); EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DESC), FALSE); } if (TASKDATA(ptp)->lpsp->perWarnSetFull == 0) { GetString (szText, IDS_SETFULL_WARN_OFF); SetDlgItemText (hDlg, IDC_SET_WARN_SETFULL_DEF, szText); } else { GetString (szText, IDS_SETFULL_WARN_ON); pszText = FormatString (szText, TEXT("%lu"), TASKDATA(ptp)->lpsp->perWarnSetFull); SetDlgItemText (hDlg, IDC_SET_WARN_SETFULL_DEF, pszText); FreeString (pszText); } CheckDlgButton (hDlg, IDC_SET_WARN, (TASKDATA(ptp)->lpfp->perWarnSetFull != 0)); if (TASKDATA(ptp)->lpfp->perWarnSetFull != 0) { if (TASKDATA(ptp)->lpfp->perWarnSetFull != -1) CheckDlgButton (hDlg, IDC_SET_WARN_SETFULL, TRUE); else CheckDlgButton (hDlg, IDC_SET_WARN_SETFULL_DEF, TRUE); } CreateSpinner (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_PERCENT), 10, FALSE, // base, signed 1, (TASKDATA(ptp)->lpfp->perWarnSetFull == 0 || TASKDATA(ptp)->lpfp->perWarnSetFull == -1) ? perDEFAULT_SETFULL_WARNING : TASKDATA(ptp)->lpfp->perWarnSetFull, 100); // min, default, max Filesets_General_OnWarnings (hDlg, lpi); } }