Source code of Windows XP (NT5)
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.

150 lines
3.8 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. HRESULT ServerGroup::createPropertyPages(
  26. SnapInView& view,
  27. LPPROPERTYSHEETCALLBACK provider,
  28. LONG_PTR handle
  29. )
  30. {
  31. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  32. ServerGroupPage* page = new ServerGroupPage(
  33. handle,
  34. (LPARAM)this,
  35. self
  36. );
  37. page->addToMMCSheet(provider);
  38. return S_OK;
  39. }
  40. HRESULT ServerGroup::onContextHelp(SnapInView& view) throw ()
  41. {
  42. return view.displayHelp(L"ias_ops.chm::/sag_ias_crp_rsg.htm");
  43. }
  44. UINT ServerGroup::mapResourceId(ResourceId id) const throw ()
  45. {
  46. static UINT resourceIds[] =
  47. {
  48. IMAGE_RADIUS_SERVER_GROUP,
  49. IDS_GROUP_DELETE_CAPTION,
  50. IDS_GROUP_DELETE_LOCAL,
  51. IDS_GROUP_DELETE_REMOTE,
  52. IDS_GROUP_DELETE_LOCAL,
  53. IDS_GROUP_DELETE_REMOTE,
  54. IDS_GROUP_E_CAPTION,
  55. IDS_GROUP_E_RENAME,
  56. IDS_GROUP_E_NAME_EMPTY
  57. };
  58. return resourceIds[id];
  59. }
  60. ServerGroups::ServerGroups(SdoConnection& connection)
  61. : SdoScopeItem(
  62. connection,
  63. IDS_GROUP_NODE,
  64. IDS_GROUP_E_CAPTION,
  65. IDS_GROUP_MENU_TOP,
  66. IDS_GROUP_MENU_NEW
  67. ),
  68. nameColumn(IDS_GROUP_COLUMN_NAME)
  69. { }
  70. HRESULT ServerGroups::onContextHelp(SnapInView& view) throw ()
  71. {
  72. return view.displayHelp(L"ias_ops.chm::/sag_ias_crp_rsg.htm");
  73. }
  74. SdoCollection ServerGroups::getSelf()
  75. {
  76. return cxn.getServerGroups();
  77. }
  78. void ServerGroups::getResultItems(SdoEnum& src, ResultItems& dst)
  79. {
  80. Sdo itemSdo;
  81. while (src.next(itemSdo))
  82. {
  83. CComPtr<ServerGroup> newItem(new (AfxThrow) ServerGroup(
  84. *this,
  85. itemSdo
  86. ));
  87. dst.push_back(newItem);
  88. }
  89. }
  90. void ServerGroups::insertColumns(IHeaderCtrl2* headerCtrl)
  91. {
  92. CheckError(headerCtrl->InsertColumn(0, nameColumn, LVCFMT_LEFT, 310));
  93. }
  94. HRESULT ServerGroups::onMenuCommand(
  95. SnapInView& view,
  96. long commandId
  97. )
  98. {
  99. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  100. // Fire up the wizard.
  101. NewGroupWizard wizard(cxn, NULL, true);
  102. if (wizard.DoModal() != IDCANCEL)
  103. {
  104. // User finished, so create a new DataItem
  105. CComPtr<ServerGroup> newItem(new (AfxThrow) ServerGroup(
  106. *this,
  107. wizard.group
  108. ));
  109. // ... and add it to the result pane.
  110. addResultItem(view, *newItem);
  111. // Did the user want to create a policy as well ?
  112. if (wizard.createNewPolicy())
  113. {
  114. // Yes, so launch the new policy wizard.
  115. NewPolicyWizard policyWizard(cxn, &view);
  116. policyWizard.DoModal();
  117. }
  118. // Tell the service to reload.
  119. cxn.resetService();
  120. }
  121. return S_OK;
  122. }
  123. void ServerGroups::propertyChanged(SnapInView& view, IASPROPERTIES id)
  124. {
  125. if (id == PROPERTY_IAS_RADIUSSERVERGROUPS_COLLECTION)
  126. {
  127. CheckError(view.getConsole()->UpdateAllViews(this, 0, 0));
  128. }
  129. }