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.

197 lines
4.9 KiB

  1. // Copyright (c) 2001 Microsoft Corporation
  2. //
  3. // File: DecisionPage.cpp
  4. //
  5. // Synopsis: Defines Decision Page for the CYS
  6. // Wizard. This page lets the user choose
  7. // between the custom and express paths
  8. //
  9. // History: 02/08/2001 JeffJon Created
  10. #include "pch.h"
  11. #include "resource.h"
  12. #include "InstallationUnitProvider.h"
  13. #include "DecisionPage.h"
  14. static PCWSTR DECISION_PAGE_HELP = L"cys.chm::/cys_topnode.htm";
  15. DecisionPage::DecisionPage()
  16. :
  17. CYSWizardPage(
  18. IDD_DECISION_PAGE,
  19. IDS_DECISION_TITLE,
  20. IDS_DECISION_SUBTITLE,
  21. DECISION_PAGE_HELP)
  22. {
  23. LOG_CTOR(DecisionPage);
  24. }
  25. DecisionPage::~DecisionPage()
  26. {
  27. LOG_DTOR(DecisionPage);
  28. }
  29. void
  30. DecisionPage::OnInit()
  31. {
  32. LOG_FUNCTION(DecisionPage::OnInit);
  33. CYSWizardPage::OnInit();
  34. // Set the text that was too long for the resource
  35. String tooLongText;
  36. if (State::GetInstance().GetNICCount() > 1)
  37. {
  38. tooLongText = String::load(IDS_DECISION_EXPRESS_MULTIPLE_NICS);
  39. }
  40. else
  41. {
  42. tooLongText = String::load(IDS_DECISION_EXPRESS_TOO_LONG_TEXT);
  43. }
  44. Win::SetWindowText(
  45. Win::GetDlgItem(
  46. hwnd,
  47. IDC_EXPRESS_TOO_LONG_STATIC),
  48. tooLongText);
  49. // NTRAID#NTBUG9-511431-2002/1/14-JeffJon
  50. // Make the user choose which path to go down instead of providing a default
  51. // Win::Button_SetCheck(Win::GetDlgItem(hwnd, IDC_EXPRESS_RADIO), BST_CHECKED);
  52. }
  53. bool
  54. DecisionPage::OnSetActive()
  55. {
  56. LOG_FUNCTION(DecisionPage::OnSetActive);
  57. bool expressChecked =
  58. Win::Button_GetCheck(
  59. Win::GetDlgItem(hwnd, IDC_EXPRESS_RADIO));
  60. bool customChecked =
  61. Win::Button_GetCheck(
  62. Win::GetDlgItem(hwnd, IDC_CUSTOM_RADIO));
  63. if (expressChecked ||
  64. customChecked)
  65. {
  66. LOG(L"Enabling next and back");
  67. Win::PropSheet_SetWizButtons(
  68. Win::GetParent(hwnd),
  69. PSWIZB_NEXT | PSWIZB_BACK);
  70. }
  71. else
  72. {
  73. LOG(L"Enabling back");
  74. Win::PropSheet_SetWizButtons(
  75. Win::GetParent(hwnd),
  76. PSWIZB_BACK);
  77. }
  78. return true;
  79. }
  80. bool
  81. DecisionPage::OnCommand(
  82. HWND /* windowFrom */ ,
  83. unsigned controlIDFrom,
  84. unsigned code)
  85. {
  86. // LOG_FUNCTION(DecisionPage::OnCommand);
  87. switch (controlIDFrom)
  88. {
  89. case IDC_EXPRESS_RADIO:
  90. case IDC_CUSTOM_RADIO:
  91. if (code == BN_CLICKED)
  92. {
  93. bool expressChecked =
  94. Win::Button_GetCheck(
  95. Win::GetDlgItem(hwnd, IDC_EXPRESS_RADIO));
  96. bool customChecked =
  97. Win::Button_GetCheck(
  98. Win::GetDlgItem(hwnd, IDC_CUSTOM_RADIO));
  99. if (expressChecked ||
  100. customChecked)
  101. {
  102. Win::PropSheet_SetWizButtons(
  103. Win::GetParent(hwnd),
  104. PSWIZB_NEXT | PSWIZB_BACK);
  105. }
  106. else
  107. {
  108. Win::PropSheet_SetWizButtons(
  109. Win::GetParent(hwnd),
  110. PSWIZB_BACK);
  111. }
  112. }
  113. break;
  114. default:
  115. {
  116. // do nothing
  117. break;
  118. }
  119. }
  120. return false;
  121. }
  122. int
  123. DecisionPage::Validate()
  124. {
  125. LOG_FUNCTION(DecisionPage::Validate);
  126. int nextPage = -1;
  127. if (Win::Button_GetCheck(Win::GetDlgItem(hwnd, IDC_EXPRESS_RADIO)))
  128. {
  129. nextPage = IDD_AD_DOMAIN_NAME_PAGE;
  130. InstallationUnitProvider::GetInstance().SetCurrentInstallationUnit(EXPRESS_SERVER);
  131. // Make sure all the delegated installation units know we are in the
  132. // express path
  133. InstallationUnitProvider::GetInstance().GetDHCPInstallationUnit().SetExpressPathInstall(true);
  134. InstallationUnitProvider::GetInstance().GetDNSInstallationUnit().SetExpressPathInstall(true);
  135. InstallationUnitProvider::GetInstance().GetADInstallationUnit().SetExpressPathInstall(true);
  136. InstallationUnitProvider::GetInstance().GetRRASInstallationUnit().SetExpressPathInstall(true);
  137. }
  138. else if (Win::Button_GetCheck(Win::GetDlgItem(hwnd, IDC_CUSTOM_RADIO)))
  139. {
  140. // Make sure all the delegated installation units know we are no longer
  141. // in the express path (if we once were)
  142. InstallationUnitProvider::GetInstance().GetDHCPInstallationUnit().SetExpressPathInstall(false);
  143. InstallationUnitProvider::GetInstance().GetDNSInstallationUnit().SetExpressPathInstall(false);
  144. InstallationUnitProvider::GetInstance().GetADInstallationUnit().SetExpressPathInstall(false);
  145. InstallationUnitProvider::GetInstance().GetRRASInstallationUnit().SetExpressPathInstall(false);
  146. nextPage = IDD_CUSTOM_SERVER_PAGE;
  147. }
  148. else
  149. {
  150. ASSERT(false);
  151. }
  152. LOG(String::format(
  153. L"nextPage = %1!d!",
  154. nextPage));
  155. return nextPage;
  156. }