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.

277 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. httppage.h
  5. Abstract:
  6. HTTP Headers property page definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __HTTPPAGE_H__
  14. #define __HTTPPAGE_H__
  15. //{{AFX_INCLUDES()
  16. #include "rat.h"
  17. //}}AFX_INCLUDES
  18. class CHeader : public CObjectPlus
  19. /*++
  20. Class Description:
  21. HTTP Header definition
  22. Public Interface:
  23. CHeader : Constructor
  24. DisplayString : Build display string
  25. CrackDisplayString : Convert from crack display string
  26. --*/
  27. {
  28. //
  29. // Constructor
  30. //
  31. public:
  32. CHeader(
  33. IN LPCTSTR lpstrHeader,
  34. IN LPCTSTR lpstrValue
  35. );
  36. //
  37. // Parse header info from name:value string
  38. //
  39. CHeader(LPCTSTR lpstrDisplayString);
  40. //
  41. // Access
  42. //
  43. public:
  44. LPCTSTR QueryHeader() const { return m_strHeader; }
  45. LPCTSTR QueryValue() const { return m_strValue; }
  46. CString & GetHeader() { return m_strHeader;}
  47. CString & GetValue() { return m_strValue; }
  48. void SetHeader(LPCTSTR lpszHeader);
  49. void SetValue(LPCTSTR lpszValue);
  50. //
  51. // Interface:
  52. public:
  53. //
  54. // Build output display string
  55. //
  56. LPCTSTR DisplayString(OUT CString & str);
  57. protected:
  58. //
  59. // Parse the display string into fields
  60. //
  61. static void CrackDisplayString(
  62. IN LPCTSTR lpstrDisplayString,
  63. OUT CString & strHeader,
  64. OUT CString & strValue
  65. );
  66. private:
  67. CString m_strHeader;
  68. CString m_strValue;
  69. };
  70. class CW3HTTPPage : public CInetPropertyPage
  71. /*++
  72. Class Description:
  73. HTTP Custom Headers property page
  74. Public Interface:
  75. CW3HTTPPage : Constructor
  76. --*/
  77. {
  78. DECLARE_DYNCREATE(CW3HTTPPage)
  79. //
  80. // Construction
  81. //
  82. public:
  83. CW3HTTPPage(IN CInetPropertySheet * pSheet = NULL);
  84. ~CW3HTTPPage();
  85. //
  86. // Dialog Data
  87. //
  88. protected:
  89. enum
  90. {
  91. RADIO_IMMEDIATELY,
  92. RADIO_EXPIRE,
  93. RADIO_EXPIRE_ABS,
  94. };
  95. enum
  96. {
  97. COMBO_MINUTES,
  98. COMBO_HOURS,
  99. COMBO_DAYS,
  100. };
  101. //{{AFX_DATA(CW3HTTPPage)
  102. enum { IDD = IDD_DIRECTORY_HTTP };
  103. int m_nTimeSelector;
  104. int m_nImmediateTemporary;
  105. BOOL m_fEnableExpiration;
  106. CEdit m_edit_Expire;
  107. CButton m_radio_Immediately;
  108. CButton m_button_Delete;
  109. CButton m_button_Edit;
  110. CButton m_button_PickDate;
  111. CButton m_button_FileTypes;
  112. CStatic m_static_Contents;
  113. CComboBox m_combo_Time;
  114. //}}AFX_DATA
  115. DWORD m_dwRelTime;
  116. CILong m_nExpiration;
  117. CTime m_tm;
  118. CTime m_tmNow;
  119. CRat m_ocx_Ratings;
  120. CButton m_radio_Time;
  121. CButton m_radio_AbsTime;
  122. CDateTimeCtrl m_dtpDate;
  123. CDateTimeCtrl m_dtpTime;
  124. CRMCListBox m_list_Headers;
  125. CStringListEx m_strlCustomHeaders;
  126. //
  127. // Overrides
  128. //
  129. protected:
  130. virtual HRESULT FetchLoadedValues();
  131. virtual HRESULT SaveInfo();
  132. // ClassWizard generate virtual function overrides
  133. //{{AFX_VIRTUAL(CW3HTTPPage)
  134. protected:
  135. virtual void DoDataExchange(CDataExchange * pDX);
  136. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  137. //}}AFX_VIRTUAL
  138. //
  139. // Implementation
  140. //
  141. protected:
  142. // Generated message map functions
  143. //{{AFX_MSG(CW3HTTPPage)
  144. afx_msg void OnButtonAdd();
  145. afx_msg void OnButtonDelete();
  146. afx_msg void OnButtonEdit();
  147. afx_msg void OnButtonFileTypes();
  148. afx_msg void OnButtonRatingsTemplate();
  149. afx_msg void OnCheckExpiration();
  150. afx_msg void OnSelchangeComboTime();
  151. afx_msg void OnSelchangeListHeaders();
  152. afx_msg void OnDblclkListHeaders();
  153. afx_msg void OnRadioImmediately();
  154. afx_msg void OnRadioTime();
  155. afx_msg void OnRadioAbsTime();
  156. afx_msg void OnDestroy();
  157. virtual BOOL OnInitDialog();
  158. //}}AFX_MSG
  159. afx_msg void OnItemChanged();
  160. DECLARE_MESSAGE_MAP()
  161. void SetTimeFields();
  162. void FillListBox();
  163. void FetchHeaders();
  164. void StoreTime();
  165. void StoreHeaders();
  166. void MakeExpirationString(CString & strExpiration);
  167. BOOL SetControlStates();
  168. BOOL CrackExpirationString(CString & strExpiration);
  169. BOOL HeaderExists(LPCTSTR lpHeader);
  170. INT_PTR ShowPropertiesDialog(BOOL fAdd = FALSE);
  171. LPCTSTR QueryMetaPath();
  172. private:
  173. BOOL m_fValuesAdjusted;
  174. CStringListEx m_strlMimeTypes;
  175. CObListPlus m_oblHeaders;
  176. CMimeTypes * m_ppropMimeTypes;
  177. };
  178. //
  179. // Inline Expansion
  180. //
  181. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  182. inline CHeader::CHeader(
  183. IN LPCTSTR lpstrHeader,
  184. IN LPCTSTR lpstrValue
  185. )
  186. : m_strHeader(lpstrHeader),
  187. m_strValue(lpstrValue)
  188. {
  189. }
  190. inline CHeader::CHeader(
  191. IN LPCTSTR lpstrDisplayString
  192. )
  193. {
  194. CrackDisplayString(lpstrDisplayString, m_strHeader, m_strValue);
  195. }
  196. inline LPCTSTR CHeader::DisplayString(
  197. OUT CString & str
  198. )
  199. {
  200. str.Format(_T("%s: %s"), (LPCTSTR)m_strHeader, (LPCTSTR)m_strValue);
  201. return str;
  202. }
  203. inline void CHeader::SetHeader(
  204. IN LPCTSTR lpszHeader
  205. )
  206. {
  207. m_strHeader = lpszHeader;
  208. }
  209. inline void CHeader::SetValue(
  210. IN LPCTSTR lpszValue
  211. )
  212. {
  213. m_strValue = lpszValue;
  214. }
  215. inline LPCTSTR CW3HTTPPage::QueryMetaPath()
  216. {
  217. return ((CW3Sheet *)GetSheet())->GetDirectoryProperties().QueryMetaRoot();
  218. }
  219. #endif // __HTTPPAGE_H__