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.

129 lines
3.4 KiB

  1. #include "stdafx.h"
  2. #include "compdata.h"
  3. #include "wizinfo.hpp"
  4. #include "ncgen.hpp"
  5. // FUTURE-2002-03/94/2002-dantra-This class has virtually no documentation.
  6. const DWORD NewClassGeneralPage::help_map[] =
  7. {
  8. IDC_CREATE_CLASS_CN, IDH_CREATE_CLASS_CN,
  9. IDC_CREATE_CLASS_LDN, IDH_CREATE_CLASS_LDN,
  10. IDC_CREATE_CLASS_OID, IDH_CREATE_CLASS_OID,
  11. IDC_DESCRIPTION_EDIT, IDH_CLASS_GENERAL_DESCRIPTION_EDIT,
  12. IDC_CREATE_CLASS_PARENT, IDH_CREATE_CLASS_PARENT,
  13. IDC_CREATE_CLASS_TYPE, IDH_CREATE_CLASS_TYPE,
  14. 0,0
  15. };
  16. BEGIN_MESSAGE_MAP(NewClassGeneralPage, CPropertyPage)
  17. ON_MESSAGE(WM_HELP, OnHelp)
  18. ON_MESSAGE(WM_CONTEXTMENU, OnContextHelp)
  19. END_MESSAGE_MAP()
  20. NewClassGeneralPage::NewClassGeneralPage(CreateClassWizardInfo* pWi)
  21. :
  22. CPropertyPage(IDD_CREATE_CLASS_GENERAL),
  23. m_editOID( CParsedEdit::EDIT_TYPE_OID )
  24. {
  25. ASSERT( pWi );
  26. pWiz_info = pWi;
  27. }
  28. BOOL
  29. NewClassGeneralPage::OnInitDialog()
  30. {
  31. CPropertyPage::OnInitDialog();
  32. // load the combo box
  33. HWND combo = ::GetDlgItem(m_hWnd, IDC_CREATE_CLASS_TYPE);
  34. ASSERT( combo );
  35. ComboBox_AddString(combo, g_StructuralClass);
  36. ComboBox_AddString(combo, g_AbstractClass);
  37. ComboBox_AddString(combo, g_AuxClass);
  38. ComboBox_SetCurSel(combo, 0);
  39. // set boundaries
  40. Edit_LimitText(::GetDlgItem(m_hWnd, IDC_CREATE_CLASS_CN), 64);
  41. Edit_LimitText(::GetDlgItem(m_hWnd, IDC_CREATE_CLASS_LDN), 256);
  42. Edit_LimitText(::GetDlgItem(m_hWnd, IDC_CREATE_CLASS_PARENT), 256);
  43. Edit_LimitText(::GetDlgItem(m_hWnd, IDC_DESCRIPTION_EDIT), 256);
  44. m_editOID.SubclassEdit( IDC_CREATE_CLASS_OID, this, cchMaxOID );
  45. return FALSE; // return TRUE unless you set the focus to a control
  46. // EXCEPTION: OCX Property Pages should return FALSE
  47. }
  48. BOOL
  49. NewClassGeneralPage::OnSetActive()
  50. {
  51. CPropertySheet* parent = (CPropertySheet*) GetParent();
  52. parent->SetWizardButtons(PSWIZB_NEXT);
  53. return TRUE;
  54. }
  55. void
  56. Gripe(HWND parent, CEdit* edit, unsigned messageResID)
  57. {
  58. ASSERT(edit);
  59. DoErrMsgBox(parent, TRUE, messageResID);
  60. edit->SetFocus();
  61. edit->SetSel(0, -1);
  62. }
  63. BOOL
  64. NewClassGeneralPage::OnKillActive()
  65. {
  66. // NTRAID#NTBUG9-562426-2002/03/04-dantra-GetDlgItemText Result being ignored
  67. // save the settings
  68. GetDlgItemText(IDC_CREATE_CLASS_CN, pWiz_info->cn);
  69. GetDlgItemText(IDC_CREATE_CLASS_LDN, pWiz_info->ldapDisplayName);
  70. GetDlgItemText(IDC_CREATE_CLASS_OID, pWiz_info->oid);
  71. GetDlgItemText(IDC_DESCRIPTION_EDIT, pWiz_info->description);
  72. GetDlgItemText(IDC_CREATE_CLASS_PARENT, pWiz_info->parentClass);
  73. pWiz_info->type = ComboBox_GetCurSel(::GetDlgItem(m_hWnd, IDC_CREATE_CLASS_TYPE));
  74. // validate
  75. // do cn first, as it appears at the top of the page
  76. if (pWiz_info->cn.IsEmpty())
  77. {
  78. Gripe(m_hWnd, (CEdit*) GetDlgItem(IDC_CREATE_CLASS_CN), IDS_MUST_ENTER_CN);
  79. return FALSE;
  80. }
  81. //
  82. // Check for valid OID
  83. //
  84. int errorTypeStrID = 0;
  85. if (!OIDHasValidFormat(pWiz_info->oid, errorTypeStrID))
  86. {
  87. CString errorType;
  88. CString text;
  89. VERIFY (errorType.LoadString(errorTypeStrID));
  90. text.FormatMessage(IDS_OID_FORMAT_INVALID, pWiz_info->oid, errorType);
  91. DoErrMsgBox( ::GetActiveWindow(), TRUE, text );
  92. return FALSE;
  93. }
  94. return TRUE;
  95. }