Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
5.2 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved
  3. Module Name:
  4. PrMrLsRc.cpp
  5. Abstract:
  6. Recall limit Property Page
  7. Author:
  8. Rohde Wakefield [rohde] 08-Aug-1997
  9. Revision History:
  10. --*/
  11. #include "stdafx.h"
  12. #include "PrMrLsRc.h"
  13. static DWORD pHelpIds[] =
  14. {
  15. IDC_EXEMPT_ADMINS, idh_runaway_recall_exemption,
  16. IDC_EDIT_RECALL_LIMIT, idh_runaway_recall_limit,
  17. IDC_SPIN_RECALL_LIMIT, idh_runaway_recall_limit,
  18. IDC_EDIT_RECALL_LIMIT_LABEL, idh_runaway_recall_limit,
  19. IDC_EDIT_COPYFILES_LIMIT, idh_concurrent_drives_limit,
  20. IDC_SPIN_COPYFILES_LIMIT, idh_concurrent_drives_limit,
  21. IDC_SPIN_COPYFILES_LIMIT_LABEL, idh_concurrent_drives_limit,
  22. 0, 0
  23. };
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CPrMrLsRec property page
  26. CPrMrLsRec::CPrMrLsRec() : CSakPropertyPage(IDD)
  27. {
  28. WsbTraceIn( L"CPrMrLsRec::CPrMrLsRec", L"" );
  29. //{{AFX_DATA_INIT(CPrMrLsRec)
  30. m_RecallLimit = 0;
  31. m_ExemptAdmins = FALSE;
  32. m_CopyFilesLimit = 1;
  33. //}}AFX_DATA_INIT
  34. m_RecallChanged = FALSE;
  35. m_CopyFilesChanged = FALSE;
  36. m_pHelpIds = pHelpIds;
  37. WsbTraceOut( L"CPrMrLsRec::CPrMrLsRec", L"" );
  38. }
  39. CPrMrLsRec::~CPrMrLsRec()
  40. {
  41. }
  42. void CPrMrLsRec::DoDataExchange(CDataExchange* pDX)
  43. {
  44. WsbTraceIn( L"CPrMrLsRec::DoDataExchange", L"" );
  45. CSakPropertyPage::DoDataExchange(pDX);
  46. //{{AFX_DATA_MAP(CPrMrLsRec)
  47. DDX_Control(pDX, IDC_SPIN_COPYFILES_LIMIT, m_spinCopyFilesLimit);
  48. DDX_Control(pDX, IDC_EDIT_COPYFILES_LIMIT, m_editCopyFilesLimit);
  49. DDX_Control(pDX, IDC_EDIT_RECALL_LIMIT, m_editRecallLimit);
  50. DDX_Control(pDX, IDC_SPIN_RECALL_LIMIT, m_spinRecallLimit);
  51. DDX_Text(pDX, IDC_EDIT_RECALL_LIMIT, m_RecallLimit);
  52. DDV_MinMaxUInt(pDX, m_RecallLimit, 0, 9999);
  53. DDX_Check(pDX, IDC_EXEMPT_ADMINS, m_ExemptAdmins);
  54. DDX_Text(pDX, IDC_EDIT_COPYFILES_LIMIT, m_CopyFilesLimit);
  55. DDV_MinMaxDWord(pDX, m_CopyFilesLimit, 1, 99);
  56. //}}AFX_DATA_MAP
  57. WsbTraceOut( L"CPrMrLsRec::DoDataExchange", L"" );
  58. }
  59. BEGIN_MESSAGE_MAP(CPrMrLsRec, CSakPropertyPage)
  60. //{{AFX_MSG_MAP(CPrMrLsRec)
  61. ON_EN_CHANGE(IDC_EDIT_RECALL_LIMIT, OnChangeEditRecallLimit)
  62. ON_BN_CLICKED(IDC_EXEMPT_ADMINS, OnExemptAdmins)
  63. ON_EN_CHANGE(IDC_EDIT_COPYFILES_LIMIT, OnChangeEditCopyfilesLimit)
  64. //}}AFX_MSG_MAP
  65. END_MESSAGE_MAP()
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CPrMrLsRec message handlers
  68. BOOL CPrMrLsRec::OnInitDialog()
  69. {
  70. WsbTraceIn( L"CPrMrLsRec::OnInitDialog", L"" );
  71. CSakPropertyPage::OnInitDialog();
  72. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  73. m_spinRecallLimit.SetRange( 0, 9999 );
  74. m_editRecallLimit.SetLimitText( 4 );
  75. m_spinCopyFilesLimit.SetRange( 1, 99 );
  76. m_editCopyFilesLimit.SetLimitText( 2 );
  77. HRESULT hr = S_OK;
  78. try {
  79. // Get HSM relevant objects
  80. WsbAffirmHr( m_pParent->GetFsaFilter( &m_pFsaFilter ) );
  81. WsbAffirmHr( m_pParent->GetHsmServer( &m_pHsmServer ) );
  82. // Set controls to values from the object
  83. WsbAffirmHr( m_pFsaFilter->GetAdminExemption( &m_ExemptAdmins ) );
  84. ULONG lMaxRecalls;
  85. WsbAffirmHr( m_pFsaFilter->GetMaxRecalls( &lMaxRecalls ) );
  86. m_RecallLimit = lMaxRecalls;
  87. WsbAffirmHr(m_pHsmServer->GetCopyFilesUserLimit(&m_CopyFilesLimit));
  88. UpdateData( FALSE );
  89. m_RecallChanged = FALSE;
  90. m_CopyFilesChanged = FALSE;
  91. } WsbCatch( hr );
  92. WsbTraceOut( L"CPrMrLsRec::OnInitDialog", L"" );
  93. return TRUE;
  94. }
  95. BOOL CPrMrLsRec::OnApply()
  96. {
  97. WsbTraceIn( L"CPrMrLsRec::OnApply", L"" );
  98. HRESULT hr = S_OK;
  99. UpdateData( TRUE );
  100. try {
  101. if( m_RecallChanged ) {
  102. WsbAffirmHr( m_pFsaFilter->SetMaxRecalls( m_RecallLimit ) );
  103. m_RecallChanged = FALSE;
  104. WsbAffirmHr( m_pFsaFilter->SetAdminExemption( m_ExemptAdmins ) );
  105. // Save it
  106. CComPtr<IFsaServer> pFsaServer;
  107. WsbAffirmHr( m_pParent->GetFsaServer( &pFsaServer ) );
  108. WsbAffirmHr( RsServerSaveAll( pFsaServer ) );
  109. }
  110. if( m_CopyFilesChanged ) {
  111. WsbAffirmHr(m_pHsmServer->SetCopyFilesUserLimit(m_CopyFilesLimit));
  112. m_CopyFilesChanged = FALSE;
  113. // Save it
  114. WsbAffirmHr(RsServerSaveAll(m_pHsmServer));
  115. }
  116. } WsbCatch( hr );
  117. WsbTraceOut( L"CPrMrLsRec::OnApply", L"" );
  118. return CSakPropertyPage::OnApply();
  119. }
  120. void CPrMrLsRec::OnChangeEditRecallLimit()
  121. {
  122. WsbTraceIn( L"CPrMrLsRec::OnChangeEditRecallLimit", L"" );
  123. SetModified( TRUE );
  124. m_RecallChanged = TRUE;
  125. WsbTraceOut( L"CPrMrLsRec::OnChangeEditRecallLimit", L"" );
  126. }
  127. void CPrMrLsRec::OnExemptAdmins()
  128. {
  129. WsbTraceIn( L"CPrMrLsRec::OnExemptAdmins", L"" );
  130. SetModified( TRUE );
  131. m_RecallChanged = TRUE;
  132. WsbTraceOut( L"CPrMrLsRec::OnExemptAdmins", L"" );
  133. }
  134. void CPrMrLsRec::OnChangeEditCopyfilesLimit()
  135. {
  136. WsbTraceIn( L"CPrMrLsRec::OnChangeEditCopyfilesLimit", L"" );
  137. SetModified( TRUE );
  138. m_CopyFilesChanged = TRUE;
  139. WsbTraceOut( L"CPrMrLsRec::OnChangeEditCopyfilesLimit", L"" );
  140. }