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.

271 lines
6.9 KiB

  1. // ChooseServerSitePages.cpp: implementation of the CChooseServerSitePages class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "certwiz.h"
  6. #include "Certificat.h"
  7. #include "Certutil.h"
  8. #include "ChooseServerSite.h"
  9. #include "ChooseServerSitePages.h"
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char THIS_FILE[]=__FILE__;
  13. #define new DEBUG_NEW
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CChooseServerSitePages property page
  17. IMPLEMENT_DYNCREATE(CChooseServerSitePages, CIISWizardPage)
  18. CChooseServerSitePages::CChooseServerSitePages(CCertificate * pCert)
  19. : CIISWizardPage(CChooseServerSitePages::IDD, IDS_CERTWIZ, TRUE),
  20. m_pCert(pCert)
  21. {
  22. //{{AFX_DATA_INIT(CChooseServerSitePages)
  23. m_ServerSiteInstance = 0;
  24. m_ServerSiteInstancePath = _T("");
  25. m_ServerSiteDescription = _T("");
  26. //}}AFX_DATA_INIT
  27. }
  28. CChooseServerSitePages::~CChooseServerSitePages()
  29. {
  30. }
  31. void CChooseServerSitePages::DoDataExchange(CDataExchange* pDX)
  32. {
  33. CIISWizardPage::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(CChooseServerSitePages)
  35. DDX_Text(pDX, IDC_SERVER_SITE_NAME, m_ServerSiteInstance);
  36. //}}AFX_DATA_MAP
  37. }
  38. LRESULT
  39. CChooseServerSitePages::OnWizardBack()
  40. /*++
  41. Routine Description:
  42. Prev button handler
  43. Arguments:
  44. None
  45. Return Value:
  46. 0 to automatically advance to the prev page;
  47. 1 to prevent the page from changing.
  48. To jump to a page other than the prev one,
  49. return the identifier of the dialog to be displayed.
  50. --*/
  51. {
  52. return IDD_PAGE_PREV;
  53. }
  54. LRESULT
  55. CChooseServerSitePages::OnWizardNext()
  56. {
  57. LRESULT lres = IDD_PAGE_NEXT;
  58. UpdateData(TRUE);
  59. // Get the site # and create an instance path
  60. m_ServerSiteInstancePath.Format(_T("/LM/W3SVC/%d"),m_ServerSiteInstance);
  61. m_pCert->m_WebSiteInstanceName_Remote = m_ServerSiteInstancePath;
  62. if (m_pCert->m_DeleteAfterCopy)
  63. {
  64. lres = IDD_PAGE_NEXT2;
  65. }
  66. else
  67. {
  68. lres = IDD_PAGE_NEXT;
  69. }
  70. return lres;
  71. }
  72. BOOL
  73. CChooseServerSitePages::OnSetActive()
  74. {
  75. ASSERT(m_pCert != NULL);
  76. m_ServerSiteInstancePath = m_pCert->m_WebSiteInstanceName_Remote;
  77. m_ServerSiteInstance = CMetabasePath::GetInstanceNumber(m_ServerSiteInstancePath);
  78. UpdateData(FALSE);
  79. SetWizardButtons(m_ServerSiteInstance <=0 ? PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  80. return CIISWizardPage::OnSetActive();
  81. }
  82. BOOL
  83. CChooseServerSitePages::OnKillActive()
  84. {
  85. UpdateData();
  86. m_pCert->m_WebSiteInstanceName_Remote = m_ServerSiteInstancePath;
  87. return CIISWizardPage::OnKillActive();
  88. }
  89. BEGIN_MESSAGE_MAP(CChooseServerSitePages, CIISWizardPage)
  90. //{{AFX_MSG_MAP(CChooseServerSitePages)
  91. ON_EN_CHANGE(IDC_SERVER_SITE_NAME, OnEditchangeServerSiteName)
  92. ON_BN_CLICKED(IDC_BROWSE_BTN, OnBrowseForMachineWebSite)
  93. //}}AFX_MSG_MAP
  94. END_MESSAGE_MAP()
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CSiteNamePage message handlers
  97. void CChooseServerSitePages::OnEditchangeServerSiteName()
  98. {
  99. UpdateData(TRUE);
  100. SetWizardButtons(m_ServerSiteInstance <=0 ?
  101. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  102. CString str;
  103. SetDlgItemText(IDC_ERROR_TEXT, str);
  104. }
  105. void CChooseServerSitePages::OnBrowseForMachineWebSite()
  106. {
  107. CString strWebSite;
  108. CChooseServerSite dlg(TRUE,strWebSite,m_pCert);
  109. if (dlg.DoModal() == IDOK)
  110. {
  111. // Get the one that they selected...
  112. strWebSite = dlg.m_strSiteReturned;
  113. m_ServerSiteInstancePath = strWebSite;
  114. m_ServerSiteInstance = CMetabasePath::GetInstanceNumber(m_ServerSiteInstancePath);
  115. CString Temp;
  116. Temp.Format(_T("%d"),m_ServerSiteInstance);
  117. SetDlgItemText(IDC_SERVER_SITE_NAME, Temp);
  118. }
  119. return;
  120. }
  121. /////////////////////////////////////////////////////////////////////////////
  122. // CChooseServerSitePages property page
  123. IMPLEMENT_DYNCREATE(CChooseServerSitePagesTo, CIISWizardPage)
  124. CChooseServerSitePagesTo::CChooseServerSitePagesTo(CCertificate * pCert)
  125. : CIISWizardPage(CChooseServerSitePagesTo::IDD, IDS_CERTWIZ, TRUE),
  126. m_pCert(pCert)
  127. {
  128. //{{AFX_DATA_INIT(CChooseServerSitePagesTo)
  129. m_ServerSiteInstance = 0;
  130. m_ServerSiteInstancePath = _T("");
  131. m_ServerSiteDescription = _T("");
  132. //}}AFX_DATA_INIT
  133. }
  134. CChooseServerSitePagesTo::~CChooseServerSitePagesTo()
  135. {
  136. }
  137. void CChooseServerSitePagesTo::DoDataExchange(CDataExchange* pDX)
  138. {
  139. CIISWizardPage::DoDataExchange(pDX);
  140. //{{AFX_DATA_MAP(CChooseServerSitePagesTo)
  141. DDX_Text(pDX, IDC_SERVER_SITE_NAME, m_ServerSiteInstance);
  142. //}}AFX_DATA_MAP
  143. }
  144. LRESULT
  145. CChooseServerSitePagesTo::OnWizardBack()
  146. /*++
  147. Routine Description:
  148. Prev button handler
  149. Arguments:
  150. None
  151. Return Value:
  152. 0 to automatically advance to the prev page;
  153. 1 to prevent the page from changing.
  154. To jump to a page other than the prev one,
  155. return the identifier of the dialog to be displayed.
  156. --*/
  157. {
  158. return IDD_PAGE_PREV;
  159. }
  160. LRESULT
  161. CChooseServerSitePagesTo::OnWizardNext()
  162. {
  163. LRESULT lres = IDD_PAGE_NEXT;
  164. UpdateData(TRUE);
  165. // Get the site # and create an instance path
  166. m_ServerSiteInstancePath.Format(_T("/LM/W3SVC/%d"),m_ServerSiteInstance);
  167. m_pCert->m_WebSiteInstanceName_Remote = m_ServerSiteInstancePath;
  168. if (m_pCert->m_DeleteAfterCopy)
  169. {
  170. lres = IDD_PAGE_NEXT2;
  171. }
  172. else
  173. {
  174. lres = IDD_PAGE_NEXT;
  175. }
  176. return lres;
  177. }
  178. BOOL
  179. CChooseServerSitePagesTo::OnSetActive()
  180. {
  181. ASSERT(m_pCert != NULL);
  182. m_ServerSiteInstancePath = m_pCert->m_WebSiteInstanceName_Remote;
  183. m_ServerSiteInstance = CMetabasePath::GetInstanceNumber(m_ServerSiteInstancePath);
  184. UpdateData(FALSE);
  185. SetWizardButtons(m_ServerSiteInstance <=0 ? PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  186. return CIISWizardPage::OnSetActive();
  187. }
  188. BOOL
  189. CChooseServerSitePagesTo::OnKillActive()
  190. {
  191. UpdateData();
  192. m_pCert->m_WebSiteInstanceName_Remote = m_ServerSiteInstancePath;
  193. return CIISWizardPage::OnKillActive();
  194. }
  195. BEGIN_MESSAGE_MAP(CChooseServerSitePagesTo, CIISWizardPage)
  196. //{{AFX_MSG_MAP(CChooseServerSitePagesTo)
  197. ON_EN_CHANGE(IDC_SERVER_SITE_NAME, OnEditchangeServerSiteName)
  198. ON_BN_CLICKED(IDC_BROWSE_BTN, OnBrowseForMachineWebSite)
  199. //}}AFX_MSG_MAP
  200. END_MESSAGE_MAP()
  201. /////////////////////////////////////////////////////////////////////////////
  202. // CSiteNamePage message handlers
  203. void CChooseServerSitePagesTo::OnEditchangeServerSiteName()
  204. {
  205. UpdateData(TRUE);
  206. SetWizardButtons(m_ServerSiteInstance <=0 ?
  207. PSWIZB_BACK : PSWIZB_BACK | PSWIZB_NEXT);
  208. CString str;
  209. SetDlgItemText(IDC_ERROR_TEXT, str);
  210. }
  211. void CChooseServerSitePagesTo::OnBrowseForMachineWebSite()
  212. {
  213. CString strWebSite;
  214. CChooseServerSite dlg(FALSE,strWebSite,m_pCert);
  215. if (dlg.DoModal() == IDOK)
  216. {
  217. // Get the one that they selected...
  218. strWebSite = dlg.m_strSiteReturned;
  219. m_ServerSiteInstancePath = strWebSite;
  220. m_ServerSiteInstance = CMetabasePath::GetInstanceNumber(m_ServerSiteInstancePath);
  221. CString Temp;
  222. Temp.Format(_T("%d"),m_ServerSiteInstance);
  223. SetDlgItemText(IDC_SERVER_SITE_NAME, Temp);
  224. }
  225. return;
  226. }