Esempio n. 1
0
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);
         }
      }
}
Esempio n. 2
0
void Server_CloseAll (BOOL fUserRequested)
{
   HWND hWnd;

   while ((hWnd = PropCache_Search (pcSERVER, ANYVALUE)) != NULL)
      {
      LPIDENT lpiServer = Server_GetServer (hWnd);

      Server_SaveRect (hWnd, !fUserRequested);
      DestroyWindow (hWnd);

      if (lpiServer && fUserRequested)
         {
         // If there's a subset active, the user may want us to stop
         // monitoring this server once its window is closed.
         //
         LPSERVER_PREF lpsp;
         if ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) != NULL)
            {
            if (g.sub && gr.fCloseUnmonitors && lpsp->fIsMonitored)
               {
               StartTask (taskSVR_MONITOR_ONOFF, NULL, lpiServer);
               }
            }
         }
      }
}
Esempio n. 3
0
void PropCache_Add (PropCache pcType, PVOID pv, HWND hDialog)
{
   if (!PropCache_Search (pcType, pv))
      {
      size_t iEntry;
      for (iEntry = 0; iEntry < PropCache_nEntries; ++iEntry)
         {
         if (!PropCache_apce[ iEntry ].fInUse)
            break;
         }

      if (iEntry == PropCache_nEntries)
         {
         if (!REALLOC (PropCache_apce, PropCache_nEntries, 1+iEntry, 16))
            return;
         }

      PropCache_apce[ iEntry ].fInUse = TRUE;
      PropCache_apce[ iEntry ].pcType = pcType;
      PropCache_apce[ iEntry ].pv = pv;
      PropCache_apce[ iEntry ].hDialog = hDialog;

      if (pcType != pcSERVER)
         AfsAppLib_RegisterModelessDialog (hDialog);
      }
}
Esempio n. 4
0
void Server_SyncVLDB (LPIDENT lpi)
{
   HWND hCurrent;
   if ((hCurrent = PropCache_Search (pcSVR_SYNCVLDB, lpi)) != NULL)
      {
      SetFocus (hCurrent);
      }
   else
      {
      ModelessDialogParam (IDD_SVR_SYNCVLDB, NULL, (DLGPROC)Server_SyncVLDB_DlgProc, (LPARAM)lpi);
      }
}
Esempio n. 5
0
void Filesets_Release (LPIDENT lpi)
{
   HWND hCurrent;
   if ((hCurrent = PropCache_Search (pcSET_RELEASE, lpi)) != NULL)
      {
      SetFocus (hCurrent);
      }
   else
      {
      HWND hDlg = ModelessDialogParam (IDD_SET_RELEASE, NULL, (DLGPROC)Filesets_Release_DlgProc, (LPARAM)lpi);
      ShowWindow (hDlg, SW_SHOW);
      }
}
Esempio n. 6
0
void Server_Salvage (LPIDENT lpi)
{
   HWND hCurrent;
   if ((hCurrent = PropCache_Search (pcSVR_SALVAGE, lpi)) != NULL)
      {
      SetFocus (hCurrent);
      }
   else
      {
      HWND hDlg = ModelessDialogParam (IDD_SVR_SALVAGE, NULL, (DLGPROC)Server_Salvage_DlgProc, (LPARAM)lpi);
      ShowWindow (hDlg, SW_SHOW);
      }
}
Esempio n. 7
0
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);
         }
      }
}
Esempio n. 8
0
void Server_Uninstall (LPIDENT lpiServer)
{
   HWND hCurrent;

   if ((hCurrent = PropCache_Search (pcSVR_UNINSTALL, NULL)) != NULL)
      {
      SetFocus (hCurrent);
      }
   else
      {
      LPSVR_UNINSTALL_PARAMS lpp = New (SVR_UNINSTALL_PARAMS);
      lpp->lpiServer = lpiServer;
      lpp->szUninstall[0] = TEXT('\0');

      HWND hDlg = ModelessDialogParam (IDD_SVR_UNINSTALL, NULL, (DLGPROC)Server_Uninstall_DlgProc, (LPARAM)lpp);
      ShowWindow (hDlg, SW_SHOW);
      }
}
Esempio n. 9
0
void Filesets_ShowProperties (LPIDENT lpiFileset, size_t nAlerts, BOOL fJumpToThreshold)
{
   HWND hCurrent;
   if ((hCurrent = PropCache_Search (pcSET_PROP, lpiFileset)) != 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 szCell[ cchNAME ];
      lpiFileset->GetCellName (szCell);

      TCHAR szFileset[ cchNAME ];
      lpiFileset->GetFilesetName (szFileset);

      LPTSTR pszTitle = FormatString (IDS_SET_PROP_TITLE, TEXT("%s"), szFileset);
      LPPROPSHEET psh = PropSheet_Create (pszTitle, FALSE);
      psh->fMadeCaption = TRUE;

      if (PropSheet_AddProblemsTab (psh, IDD_SET_PROBLEMS, lpiFileset, nAlerts) &&
          PropSheet_AddTab (psh, IDS_SET_GENERAL_TAB, IDD_SET_GENERAL, (DLGPROC)Filesets_General_DlgProc, (LPARAM)lpiFileset, TRUE))
         {
         if (fJumpToThreshold)
            psh->sh.nStartPage = psh->sh.nPages-1;
         PropSheet_ShowModeless (psh);
         }
      }
}
Esempio n. 10
0
void Server_Prune (LPIDENT lpiServer, BOOL fBAK, BOOL fOLD, BOOL fCore)
{
   HWND hCurrent;

   if ((hCurrent = PropCache_Search (pcSVR_PRUNE, NULL)) != NULL)
      {
      SetFocus (hCurrent);
      }
   else
      {
      LPSVR_PRUNE_PARAMS lpp = New (SVR_PRUNE_PARAMS);
      lpp->lpiServer = lpiServer;
      lpp->fBAK = fBAK;
      lpp->fOLD = fOLD;
      lpp->fCore = fCore;

      HWND hDlg = ModelessDialogParam (IDD_SVR_PRUNE, NULL, (DLGPROC)Server_Prune_DlgProc, (LPARAM)lpp);
      ShowWindow (hDlg, SW_SHOW);
      }
}
Esempio n. 11
0
void Server_Open (LPIDENT lpiServer, LPRECT prWindow)
{
   HWND hServer;

   if ((hServer = PropCache_Search (pcSERVER, lpiServer)) != NULL)
      {
      SetFocus (hServer);
      }
   else
      {
      // First off, if this server isn't being monitored, we have
      // to start monitoring it or we can't open a window (nothing to
      // show otherwise).
      //
      LPSERVER_PREF lpsp;
      if ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) != NULL)
         {
         BOOL fCanShowWindow = (gr.fOpenMonitors || lpsp->fIsMonitored);

         if (gr.fOpenMonitors && !lpsp->fIsMonitored)
            {
            StartTask (taskSVR_MONITOR_ONOFF, NULL, lpiServer);
            }

         if (fCanShowWindow)
            {
            hServer = ModelessDialogParam (IDD_SERVER, NULL, (DLGPROC)Server_DlgProc, (LPARAM)lpiServer);
            Server_SelectServer (hServer, lpiServer);

            if (prWindow->right != 0)
               {
               SetWindowPos (hServer, NULL, prWindow->left, prWindow->top,
                             cxRECT(*prWindow), cyRECT(*prWindow),
                             SWP_NOZORDER | SWP_NOACTIVATE);
               }

            ShowWindow (hServer, SW_NORMAL);
            }
         }
      }
}
Esempio n. 12
0
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);
      }
}
Esempio n. 13
0
void Server_Close (LPIDENT lpiServer)
{
   HWND hWnd;

   if ((hWnd = PropCache_Search (pcSERVER, lpiServer)) != NULL)
      {
      Server_SaveRect (hWnd, FALSE);
      DestroyWindow (hWnd);

      // If there's a subset active, the user may want us to stop
      // monitoring this server once its window is closed.
      //
      LPSERVER_PREF lpsp;
      if ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) != NULL)
         {
         if (g.sub && gr.fCloseUnmonitors && lpsp->fIsMonitored && !gr.fPreview)
            {
            StartTask (taskSVR_MONITOR_ONOFF, NULL, lpiServer);
            }
         }
      }
}
Esempio n. 14
0
BOOL Columns_OnApply (HWND hDlg, LPVIEWINFO lpviDefault)
{
   BOOL fPostMessage = FALSE;

   for (size_t iCol = 0; iCol < nCOLUMNS; ++iCol)
      {
      if (COLUMNS[ iCol ].fChanged)
         {
         CHILDTAB iTab = (CHILDTAB)-1;
         int idcList;

         VIEWINFO vi;
         memcpy (&vi, &COLUMNS[ iCol ].vi, sizeof(VIEWINFO));

         LPVIEWINFO lpviTarget = NULL;

         switch (iCol)
            {
            case ceSERVERS:
               if (gr.fPreview && !gr.fVert)
                  lpviTarget = &gr.diHorz.viewSvr;
               else
                  lpviTarget = &gr.diVert.viewSvr;
               FL_RestoreView (GetDlgItem (g.hMain, IDC_SERVERS), &COLUMNS[ iCol ].vi);
               UpdateDisplay_Servers (FALSE, NULL, 0);
               break;

            case ceFILESETS:
               lpviTarget = &gr.viewSet;
               iTab = tabFILESETS;
               idcList = IDC_SET_LIST;
               break;

            case ceAGGREGATES:
               lpviTarget = &gr.viewAgg;
               iTab = tabAGGREGATES;
               idcList = IDC_AGG_LIST;
               break;

            case ceSERVICES:
               lpviTarget = &gr.viewSvc;
               iTab = tabSERVICES;
               idcList = IDC_SVC_LIST;
               break;

            case ceREPLICAS:
               lpviTarget = &gr.viewRep;
               break;

            case ceAGGS_MOVE:
               lpviTarget = &gr.viewAggMove;
               break;

            case ceAGGS_CREATE:
               lpviTarget = &gr.viewAggCreate;
               break;

            case ceAGGS_RESTORE:
               lpviTarget = &gr.viewAggRestore;
               break;
            }

         if (lpviTarget != NULL)
            {
            memcpy (lpviTarget, &COLUMNS[ iCol ].vi, sizeof(VIEWINFO));
            if (lpviDefault == &COLUMNS[ iCol ].vi)
               fPostMessage = TRUE;
            }

         if (iTab != (CHILDTAB)-1)
            {
            for (HWND hServer = g.hMain;
                 hServer != NULL;
                 hServer = PropCache_Search (pcSERVER, ANYVALUE, hServer))
               {
               HWND hTab = GetDlgItem (hServer, IDC_TABS);
               int iTabShown = TabCtrl_GetCurSel (hTab);

               if (iTab == iTabShown)
                  {
                  HWND hChild = Server_GetCurrentTab (hServer);
                  HWND hList = GetDlgItem (hChild, idcList);

                  TCHAR szClassName[ cchRESOURCE ];
                  if (GetClassName (hList, szClassName, cchRESOURCE))
                     {
                     if (lstrcmp (szClassName, WC_FASTLIST))
                        continue;
                     }

                  FL_StoreView (hList, &vi);
                  COLUMNS[ iCol ].vi.lvsView = vi.lvsView;
                  FL_RestoreView (hList, &COLUMNS[ iCol ].vi);
                  Server_ForceRedraw (hServer);
                  }

               if (hServer == g.hMain)
                  hServer = NULL;
               }
            }
         }
      }

   return fPostMessage;
}
Esempio n. 15
0
void Server_ShowParticularPopupMenu (HWND hParent, POINT ptScreen, LPIDENT lpiServer)
{
   HMENU hm;

   if (lpiServer == NULL)
      hm = TaLocale_LoadMenu (MENU_SVR_NONE);
   else
      hm = TaLocale_LoadMenu (MENU_SVR);

   if (hm != NULL)
      {
      if (lpiServer == NULL)
         {
         int lvs = (gr.fPreview && !gr.fVert) ? gr.diHorz.viewSvr.lvsView : gr.diVert.viewSvr.lvsView;
         HMENU hmView = GetSubMenu (hm, 0);

         CheckMenuRadioItem (hmView,
                             M_SVR_VIEW_LARGE, M_SVR_VIEW_REPORT,
                             ( (lvs == FLS_VIEW_SMALL) ? M_SVR_VIEW_SMALL :
                               (lvs == FLS_VIEW_LIST)  ? M_SVR_VIEW_REPORT :
                                                         M_SVR_VIEW_LARGE ),
                             MF_BYCOMMAND);

         ICONVIEW ivSvr = Display_GetServerIconView();

         CheckMenuRadioItem (hmView,
                             M_SVR_VIEW_ONEICON, M_SVR_VIEW_STATUS,
                             (ivSvr == ivTWOICONS) ? M_SVR_VIEW_TWOICONS :
                             (ivSvr == ivONEICON)  ? M_SVR_VIEW_ONEICON : M_SVR_VIEW_STATUS,
                             MF_BYCOMMAND);

         if (lvs != FLS_VIEW_LIST)
            {
            EnableMenu (hmView, M_SVR_VIEW_ONEICON,  FALSE);
            EnableMenu (hmView, M_SVR_VIEW_TWOICONS, FALSE);
            EnableMenu (hmView, M_SVR_VIEW_STATUS,   FALSE);
            }

         if (!PropCache_Search (pcSERVER, ANYVALUE))
            EnableMenu (hmView, M_SVR_CLOSEALL, FALSE);
         }
      else
         {
         BOOL fOpenNow = (BOOL)!!(PropCache_Search (pcSERVER, lpiServer));

         LPSERVER_PREF lpsp;
         if ( ((lpsp = (LPSERVER_PREF)lpiServer->GetUserParam()) == NULL) ||
              (lpsp->fIsMonitored) )
            {
            EnableMenu (hm, M_SVR_OPEN,  !fOpenNow);
            EnableMenu (hm, M_SVR_CLOSE,  fOpenNow);
            CheckMenu (hm, M_SVR_MONITOR, TRUE);
            }
         else
            {
            if (!fOpenNow)
               EnableMenu (hm, M_SVR_CLOSE, FALSE);
            if (fOpenNow || !gr.fOpenMonitors)
               EnableMenu (hm, M_SVR_OPEN, FALSE);

            CheckMenu (hm, M_SVR_MONITOR, FALSE);

            EnableMenu (hm, M_SVR_SECURITY,  FALSE);
            EnableMenu (hm, M_SALVAGE,  FALSE);
            EnableMenu (hm, M_SET_CLONE,  FALSE);
            EnableMenu (hm, M_SET_UNLOCK, FALSE);
            EnableMenu (hm, M_SYNCVLDB,   FALSE);
            }
         }

      DisplayContextMenu (hm, ptScreen, hParent);
      }
}