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.

164 lines
4.3 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // servergroups.cpp
  8. //
  9. // SYNOPSIS
  10. //
  11. // Defines the classes ServerGroup and ServerGroups.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/10/2000 Original version.
  16. // 04/19/2000 SdoScopeItem::getSelf returns by value, not reference.
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #include <proxypch.h>
  20. #include <servergroups.h>
  21. #include <proxynode.h>
  22. #include <grouppage.h>
  23. #include <groupwiz.h>
  24. #include <policywiz.h>
  25. #include <iaslimits.h>
  26. HRESULT ServerGroup::createPropertyPages(
  27. SnapInView& view,
  28. LPPROPERTYSHEETCALLBACK provider,
  29. LONG_PTR handle
  30. )
  31. {
  32. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  33. ServerGroupPage* page = new ServerGroupPage(
  34. handle,
  35. (LPARAM)this,
  36. self
  37. );
  38. page->addToMMCSheet(provider);
  39. return S_OK;
  40. }
  41. HRESULT ServerGroup::onContextHelp(SnapInView& view) throw ()
  42. {
  43. return view.displayHelp(L"ias_ops.chm::/sag_ias_crp_rsg.htm");
  44. }
  45. UINT ServerGroup::mapResourceId(ResourceId id) const throw ()
  46. {
  47. static UINT resourceIds[] =
  48. {
  49. IMAGE_RADIUS_SERVER_GROUP,
  50. IDS_GROUP_DELETE_CAPTION,
  51. IDS_GROUP_DELETE_LOCAL,
  52. IDS_GROUP_DELETE_REMOTE,
  53. IDS_GROUP_DELETE_LOCAL,
  54. IDS_GROUP_DELETE_REMOTE,
  55. IDS_GROUP_E_CAPTION,
  56. IDS_GROUP_E_RENAME,
  57. IDS_GROUP_E_NAME_EMPTY
  58. };
  59. return resourceIds[id];
  60. }
  61. ServerGroups::ServerGroups(SdoConnection& connection)
  62. : SdoScopeItem(
  63. connection,
  64. IDS_GROUP_NODE,
  65. IDS_GROUP_E_CAPTION,
  66. IDS_GROUP_MENU_TOP,
  67. IDS_GROUP_MENU_NEW,
  68. IDS_GROUP_MENU_STATUS_BAR
  69. ),
  70. nameColumn(IDS_GROUP_COLUMN_NAME)
  71. { }
  72. HRESULT ServerGroups::onContextHelp(SnapInView& view) throw ()
  73. {
  74. return view.displayHelp(L"ias_ops.chm::/sag_ias_crp_rsg.htm");
  75. }
  76. SdoCollection ServerGroups::getSelf()
  77. {
  78. return cxn.getServerGroups();
  79. }
  80. void ServerGroups::getResultItems(SdoEnum& src, ResultItems& dst)
  81. {
  82. Sdo itemSdo;
  83. while (src.next(itemSdo))
  84. {
  85. CComPtr<ServerGroup> newItem(new (AfxThrow) ServerGroup(
  86. *this,
  87. itemSdo
  88. ));
  89. dst.push_back(newItem);
  90. }
  91. }
  92. void ServerGroups::insertColumns(IHeaderCtrl2* headerCtrl)
  93. {
  94. CheckError(headerCtrl->InsertColumn(0, nameColumn, LVCFMT_LEFT, 310));
  95. }
  96. HRESULT ServerGroups::onMenuCommand(
  97. SnapInView& view,
  98. long commandId
  99. )
  100. {
  101. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  102. // Fire up the wizard.
  103. NewGroupWizard wizard(cxn, NULL, true);
  104. INT_PTR result = wizard.DoModal();
  105. if (result == IAS_E_LICENSE_VIOLATION)
  106. {
  107. int retval;
  108. view.formatMessageBox(
  109. IDS_GROUP_E_CAPTION,
  110. IDS_GROUP_E_LICENSE,
  111. TRUE,
  112. MB_OK | MB_ICONWARNING,
  113. &retval
  114. );
  115. }
  116. else if (result != IDCANCEL)
  117. {
  118. // User finished, so create a new DataItem
  119. CComPtr<ServerGroup> newItem(new (AfxThrow) ServerGroup(
  120. *this,
  121. wizard.group
  122. ));
  123. // ... and add it to the result pane.
  124. addResultItem(view, *newItem);
  125. // Did the user want to create a policy as well ?
  126. if (wizard.createNewPolicy())
  127. {
  128. // Yes, so launch the new policy wizard.
  129. NewPolicyWizard policyWizard(cxn, &view);
  130. policyWizard.DoModal();
  131. }
  132. // Tell the service to reload.
  133. cxn.resetService();
  134. }
  135. return S_OK;
  136. }
  137. void ServerGroups::propertyChanged(SnapInView& view, IASPROPERTIES id)
  138. {
  139. if (id == PROPERTY_IAS_RADIUSSERVERGROUPS_COLLECTION)
  140. {
  141. view.updateAllViews(*this);
  142. }
  143. }