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.

257 lines
7.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: recordui.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _RECORDUI_H
  11. #define _RECORDUI_H
  12. #include "uiutil.h"
  13. #include "aclpage.h"
  14. ///////////////////////////////////////////////////////////////////////////////
  15. // FORWARD DECLARATIONS
  16. class CDNSRecord;
  17. class CDNSRecordNodeBase;
  18. class CDNSDomainNode;
  19. class CDNSRecordPropertyPage;
  20. ////////////////////////////////////////////////////////////////////////
  21. // CDNSRecordPropertyPageHolder
  22. // page holder to contain DNS record property pages
  23. #define DNS_RECORD_MAX_PROPRETY_PAGES (4) // max # of pages a record can have
  24. class CDNSRecordPropertyPageHolder : public CPropertyPageHolderBase
  25. {
  26. public:
  27. CDNSRecordPropertyPageHolder(CDNSDomainNode* pDNSDomainNode, CDNSRecordNodeBase* pRecordNode,
  28. CComponentDataObject* pComponentData, WORD wPredefinedRecordType = 0);
  29. virtual ~CDNSRecordPropertyPageHolder();
  30. protected:
  31. virtual HRESULT OnAddPage(int nPage, CPropertyPageBase* pPage);
  32. public:
  33. // simple cast helpers
  34. CDNSRecordNodeBase* GetRecordNode() { return (CDNSRecordNodeBase*)GetTreeNode();}
  35. void SetRecordNode(CDNSRecordNodeBase* pRecordNode) { SetTreeNode((CTreeNode*)pRecordNode); }
  36. CDNSDomainNode* GetDomainNode() { return (CDNSDomainNode*)GetContainerNode();}
  37. void AddPagesFromCurrentRecordNode(BOOL bAddToSheet);
  38. void RemovePagesFromCurrentRecordNode(BOOL bRemoveFromSheet);
  39. CDNSRecord* GetTempDNSRecord() { return m_pTempDNSRecord;}
  40. void SetTempDNSRecord(CDNSRecord* pTempDNSRecord) { m_pTempDNSRecord = pTempDNSRecord;}
  41. void SetRecordSelection(WORD wRecordType, BOOL bAddToSheet); // Wizard mode only
  42. DNS_STATUS CreateNewRecord(BOOL bAllowDuplicates); // Wizard mode only
  43. virtual BOOL OnPropertyChange(BOOL bScopePane, long* pChangeMask); // Property Sheet only
  44. DNS_STATUS CreateNonExistentParentDomains(CDNSRecordNodeBase* pRecordNode,
  45. /*IN/OUT*/CDNSDomainNode** ppNewParentDomain);
  46. BOOL HasPredefinedType() { return m_wPredefinedRecordType != 0;}
  47. private:
  48. WORD m_wPredefinedRecordType; // Wizard mode only
  49. DNS_STATUS WriteCurrentRecordToServer();
  50. CDNSRecord* m_pTempDNSRecord; // temporary DNS record to write to
  51. CDNSRecordPropertyPage* m_pRecordPropPagesArr[DNS_RECORD_MAX_PROPRETY_PAGES];
  52. int m_nRecordPages;
  53. // optional security page
  54. CAclEditorPage* m_pAclEditorPage;
  55. };
  56. //////////////////////////////////////////////////////////////////////////
  57. // CSelectDNSRecordTypeDialog
  58. struct DNS_RECORD_INFO_ENTRY;
  59. class CSelectDNSRecordTypeDialog : public CHelpDialog
  60. {
  61. // Construction
  62. public:
  63. CSelectDNSRecordTypeDialog(CDNSDomainNode* pDNSDomainNode,
  64. CComponentDataObject* pComponentData);
  65. // Implementation
  66. protected:
  67. virtual BOOL OnInitDialog();
  68. afx_msg void OnSelchangeTypeList();
  69. afx_msg void OnDoubleClickSelTypeList();
  70. afx_msg void OnCreateRecord();
  71. private:
  72. // context pointers
  73. CDNSDomainNode* m_pDNSDomainNode;
  74. CComponentDataObject* m_pComponentData;
  75. // manage the Cancel/Done button label
  76. BOOL m_bFirstCreation;
  77. CDNSButtonToggleTextHelper m_cancelDoneTextHelper;
  78. void SyncDescriptionText();
  79. CListBox* GetRecordTypeListBox(){ return (CListBox*)GetDlgItem(IDC_RECORD_TYPE_LIST);}
  80. const DNS_RECORD_INFO_ENTRY* GetSelectedEntry();
  81. DECLARE_MESSAGE_MAP()
  82. };
  83. //////////////////////////////////////////////////////////////////////
  84. // CDNSRecordPropertyPage
  85. // common class for all the record property pages that have a TTL control
  86. class CDNSRecordPropertyPage : public CPropertyPageBase
  87. {
  88. // Construction
  89. public:
  90. CDNSRecordPropertyPage(UINT nIDTemplate, UINT nIDCaption = 0);
  91. virtual ~CDNSRecordPropertyPage();
  92. // Overrides
  93. public:
  94. virtual BOOL OnPropertyChange(BOOL bScopePane, long* pChangeMask);
  95. virtual BOOL CanCreateDuplicateRecords() { return TRUE; }
  96. // Implementation
  97. protected:
  98. virtual BOOL OnInitDialog();
  99. CDNSTTLControl* GetTTLCtrl();
  100. CButton* GetDeleteStale() { return (CButton*)GetDlgItem(IDC_DEFAULT_DELETE_STALE_RECORD); }
  101. CEdit* GetTimeStampEdit() { return (CEdit*)GetDlgItem(IDC_TIME_EDIT); }
  102. CStatic* GetTimeStampStatic() { return (CStatic*)GetDlgItem(IDC_STATIC_TIME_STAMP); }
  103. CDNSRecordPropertyPageHolder* GetDNSRecordHolder() // simple cast
  104. { return (CDNSRecordPropertyPageHolder*)GetHolder();}
  105. void EnableAgingCtrl(BOOL bShow);
  106. void EnableTTLCtrl(BOOL bShow);
  107. void SetValidState(BOOL bValid);
  108. // message map functions
  109. afx_msg void OnTTLChange();
  110. afx_msg void OnDeleteStaleRecord();
  111. DECLARE_MESSAGE_MAP()
  112. };
  113. //////////////////////////////////////////////////////////////////////
  114. // CDNSRecordStandardPropertyPage
  115. // common class for all the record property pages that have a TTL control
  116. // and a common editbox. Besides the SOA and WINS property pages, all RR
  117. // pages derive from this class
  118. class CDNSRecordStandardPropertyPage : public CDNSRecordPropertyPage
  119. {
  120. // Construction
  121. public:
  122. CDNSRecordStandardPropertyPage(UINT nIDTemplate, UINT nIDCaption = 0);
  123. // Overrides
  124. public:
  125. virtual BOOL OnSetActive(); // down
  126. virtual BOOL OnKillActive(); // down
  127. virtual BOOL OnApply(); // look at new way of doing it
  128. virtual DNS_STATUS ValidateRecordName(PCWSTR pszName, DWORD dwNameChecking);
  129. // Implementation
  130. protected:
  131. // RR name handling
  132. virtual void OnInitName();
  133. virtual void OnSetName(CDNSRecordNodeBase* pRecordNode);
  134. virtual void OnGetName(CString& s);
  135. virtual CEdit* GetRRNameEdit() { return (CEdit*)GetDlgItem(IDC_RR_NAME_EDIT); }
  136. CEdit* GetDomainEditBox() { return(CEdit*)GetDlgItem(IDC_RR_DOMAIN_EDIT);}
  137. void GetEditBoxText(CString& s);
  138. virtual void SetUIData();
  139. virtual DNS_STATUS GetUIDataEx(BOOL bSilent = TRUE);
  140. virtual BOOL OnInitDialog();
  141. afx_msg void OnEditChange();
  142. virtual BOOL CreateRecord();
  143. void SetTimeStampEdit(DWORD dwScavengStart);
  144. private:
  145. int m_nUTF8ParentLen;
  146. BOOL m_bAllowAtTheNode;
  147. DECLARE_MESSAGE_MAP()
  148. };
  149. // Useful macros for classes derived from CDNSRecordStandardPropertyPage
  150. #define STANDARD_REC_PP_PTRS(recType) \
  151. CDNSRecordPropertyPageHolder* pHolder = GetDNSRecordHolder(); \
  152. ASSERT(pHolder != NULL); \
  153. recType* pRecord = (recType*)pHolder->GetTempDNSRecord();\
  154. ASSERT(pRecord != NULL);
  155. #define STANDARD_REC_PP_SETUI_PROLOGUE(recType) \
  156. CDNSRecordStandardPropertyPage::SetUIData(); \
  157. STANDARD_REC_PP_PTRS(recType)
  158. #define STANDARD_REC_PP_GETUI_PROLOGUE(recType) \
  159. DNS_STATUS dwErr = CDNSRecordStandardPropertyPage::GetUIDataEx(bSilent); \
  160. STANDARD_REC_PP_PTRS(recType)
  161. //
  162. // This is a place holder for new pages
  163. //
  164. #if (FALSE)
  165. ///////////////////////////////////////////////////////////////////////
  166. // CDNSRecordDummyPropertyPage
  167. class CDNSRecordDummyPropertyPage : public CPropertyPageBase
  168. {
  169. public:
  170. CDNSRecordDummyPropertyPage();
  171. virtual BOOL OnApply();
  172. virtual void OnOK();
  173. };
  174. class CDNSDummyRecordPropertyPageHolder : public CPropertyPageHolderBase
  175. {
  176. public:
  177. CDNSDummyRecordPropertyPageHolder(CDNSDomainNode* pDNSDomainNode, CDNSRecordNodeBase* pRecordNode,
  178. CComponentDataObject* pComponentData, WORD wPredefinedRecordType = 0);
  179. virtual ~CDNSDummyRecordPropertyPageHolder();
  180. private:
  181. CDNSRecordDummyPropertyPage m_dummyPage;
  182. };
  183. #endif
  184. #endif // _RECORDUI_H