PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/Web/Components/HtmlConfiguration.cs

http://mojoportal.codeplex.com
C# | 332 lines | 217 code | 103 blank | 12 comment | 6 complexity | d7cf083ac6b1afe63d417e2df0310346 MD5 | raw file
Possible License(s): CPL-1.0, CC-BY-SA-3.0, GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause, Apache-2.0
  1. // Author: Joe Audette
  2. // Created: 2010-06-01
  3. // Last Modified: 2012-11-04
  4. //
  5. // The use and distribution terms for this software are covered by the
  6. // Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
  7. // which can be found in the file CPL.TXT at the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by
  9. // the terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. // 2011-02-18 Joe Davis added settings for enabling the slide show pager
  13. using System;
  14. using System.Collections;
  15. using System.Configuration;
  16. using System.Globalization;
  17. using System.Web.UI.WebControls;
  18. using mojoPortal.Web.Framework;
  19. namespace mojoPortal.Web.ContentUI
  20. {
  21. public class HtmlConfiguration
  22. {
  23. public HtmlConfiguration()
  24. { }
  25. public HtmlConfiguration(Hashtable settings)
  26. {
  27. LoadSettings(settings);
  28. }
  29. private void LoadSettings(Hashtable settings)
  30. {
  31. if (settings == null) { throw new ArgumentException("must pass in a hashtable of settings"); }
  32. enableContentRatingSetting = WebUtils.ParseBoolFromHashtable(settings, "EnableContentRatingSetting", enableContentRatingSetting);
  33. enableRatingCommentsSetting = WebUtils.ParseBoolFromHashtable(settings, "EnableRatingCommentsSetting", enableRatingCommentsSetting);
  34. includeSwfObject = WebUtils.ParseBoolFromHashtable(settings, "IncludeSwfObjectSetting", includeSwfObject);
  35. enableSlideShow = WebUtils.ParseBoolFromHashtable(settings, "HtmlEnableSlideShow", enableSlideShow);
  36. slideContainerHeight = WebUtils.ParseInt32FromHashtable(settings, "HtmlSlideContainerHeight", slideContainerHeight);
  37. pauseSlideOnHover = WebUtils.ParseBoolFromHashtable(settings, "HtmlSlideShowPauseOnHover", pauseSlideOnHover);
  38. slideDuration = WebUtils.ParseInt32FromHashtable(settings, "HtmlSlideDuration", slideDuration);
  39. transitionSpeed = WebUtils.ParseInt32FromHashtable(settings, "HtmlTransitionSpeed", transitionSpeed);
  40. randomizeSlides = WebUtils.ParseBoolFromHashtable(settings, "HtmlSlideShowRandomizeSlides", randomizeSlides);
  41. enableSlideShowPager = WebUtils.ParseBoolFromHashtable(settings, "HtmlEnableSlideShowPager", enableSlideShowPager);
  42. slideShowPagerBefore = WebUtils.ParseBoolFromHashtable(settings, "HtmlSlideShowPagerBefore", slideShowPagerBefore);
  43. useSlideClearTypeCorrections = WebUtils.ParseBoolFromHashtable(settings, "HtmlSlideShowUseExtraClearTypeCorrections", useSlideClearTypeCorrections);
  44. if (settings.Contains("HtmlCustomCssClassSetting"))
  45. {
  46. instanceCssClass = settings["HtmlCustomCssClassSetting"].ToString();
  47. }
  48. if (settings.Contains("HtmlSlideTransitions"))
  49. {
  50. slideTransitions = settings["HtmlSlideTransitions"].ToString();
  51. }
  52. if (settings.Contains("HtmlSlideContainerClass"))
  53. {
  54. slideContainerClass = settings["HtmlSlideContainerClass"].ToString().Trim();
  55. }
  56. showFacebookLikeButton = WebUtils.ParseBoolFromHashtable(settings, "UseFacebookLikeButton", showFacebookLikeButton);
  57. if (settings.Contains("FacebookLikeButtonTheme"))
  58. {
  59. facebookLikeButtonTheme = settings["FacebookLikeButtonTheme"].ToString().Trim();
  60. }
  61. facebookLikeButtonShowFaces = WebUtils.ParseBoolFromHashtable(settings, "FacebookLikeButtonShowFaces", facebookLikeButtonShowFaces);
  62. facebookLikeButtonWidth = WebUtils.ParseInt32FromHashtable(settings, "FacebookLikeButtonWidth", facebookLikeButtonWidth);
  63. facebookLikeButtonHeight = WebUtils.ParseInt32FromHashtable(settings, "FacebookLikeButtonHeight", facebookLikeButtonHeight);
  64. enableContentVersioning = WebUtils.ParseBoolFromHashtable(settings, "HtmlEnableVersioningSetting", enableContentVersioning);
  65. versionPageSize = WebUtils.ParseInt32FromHashtable(settings, "HtmlVersionPageSizeSetting", versionPageSize);
  66. useWysiwygEditor = WebUtils.ParseBoolFromHashtable(settings, "UseWysiwygEditor", useWysiwygEditor);
  67. showCreatedBy = WebUtils.ParseBoolFromHashtable(settings, "ShowCreatedBy", showCreatedBy);
  68. showCreatedDate = WebUtils.ParseBoolFromHashtable(settings, "ShowCreatedDate", showCreatedDate);
  69. showModifiedBy = WebUtils.ParseBoolFromHashtable(settings, "ShowModifiedBy", showModifiedBy);
  70. showModifiedDate = WebUtils.ParseBoolFromHashtable(settings, "ShowModifiedDate", showModifiedDate);
  71. showAuthorAvatar = WebUtils.ParseBoolFromHashtable(settings, "ShowAuthorAvatar", showAuthorAvatar);
  72. showAuthorBio = WebUtils.ParseBoolFromHashtable(settings, "ShowAuthorBio", showAuthorBio);
  73. }
  74. private bool enableInlineEditing = true;
  75. public bool EnableInlineEditing
  76. {
  77. get { return enableInlineEditing; }
  78. }
  79. private bool showAuthorAvatar = false;
  80. public bool ShowAuthorAvatar
  81. {
  82. get { return showAuthorAvatar; }
  83. }
  84. private bool showAuthorBio = false;
  85. public bool ShowAuthorBio
  86. {
  87. get { return showAuthorBio; }
  88. }
  89. private bool showCreatedBy = false;
  90. public bool ShowCreatedBy
  91. {
  92. get { return showCreatedBy; }
  93. }
  94. private bool showCreatedDate = false;
  95. public bool ShowCreatedDate
  96. {
  97. get { return showCreatedDate; }
  98. }
  99. private bool showModifiedBy = false;
  100. public bool ShowModifiedBy
  101. {
  102. get { return showModifiedBy; }
  103. }
  104. private bool showModifiedDate = false;
  105. public bool ShowModifiedDate
  106. {
  107. get { return showModifiedDate; }
  108. }
  109. private bool useWysiwygEditor = true;
  110. public bool UseWysiwygEditor
  111. {
  112. get { return useWysiwygEditor; }
  113. }
  114. private int versionPageSize = 10;
  115. public int VersionPageSize
  116. {
  117. get { return versionPageSize; }
  118. }
  119. private bool enableContentVersioning = false;
  120. public bool EnableContentVersioning
  121. {
  122. get { return enableContentVersioning; }
  123. }
  124. private int facebookLikeButtonHeight = 35;
  125. public int FacebookLikeButtonHeight
  126. {
  127. get { return facebookLikeButtonHeight; }
  128. }
  129. private int facebookLikeButtonWidth = 450;
  130. public int FacebookLikeButtonWidth
  131. {
  132. get { return facebookLikeButtonWidth; }
  133. }
  134. private bool facebookLikeButtonShowFaces = false;
  135. public bool FacebookLikeButtonShowFaces
  136. {
  137. get { return facebookLikeButtonShowFaces; }
  138. }
  139. private string facebookLikeButtonTheme = "light";
  140. public string FacebookLikeButtonTheme
  141. {
  142. get { return facebookLikeButtonTheme; }
  143. }
  144. private bool enableContentRatingSetting = false;
  145. public bool EnableContentRatingSetting
  146. {
  147. get { return enableContentRatingSetting; }
  148. }
  149. private bool enableRatingCommentsSetting = false;
  150. public bool EnableRatingCommentsSetting
  151. {
  152. get { return enableRatingCommentsSetting; }
  153. }
  154. private bool includeSwfObject = false;
  155. public bool IncludeSwfObject
  156. {
  157. get { return includeSwfObject; }
  158. }
  159. private bool enableSlideShow = false;
  160. public bool EnableSlideShow
  161. {
  162. get { return enableSlideShow; }
  163. }
  164. private bool enableSlideShowPager = false;
  165. public bool EnableSlideShowPager
  166. {
  167. get { return enableSlideShowPager; }
  168. }
  169. private bool slideShowPagerBefore = false;
  170. public bool SlideShowPagerBefore
  171. {
  172. get { return slideShowPagerBefore; }
  173. }
  174. private int slideContainerHeight = 0;
  175. public int SlideContainerHeight
  176. {
  177. get { return slideContainerHeight; }
  178. }
  179. private string slideTransitions = "fade";
  180. public string SlideTransitions
  181. {
  182. get { return slideTransitions; }
  183. }
  184. private bool pauseSlideOnHover = true;
  185. public bool PauseSlideOnHover
  186. {
  187. get { return pauseSlideOnHover; }
  188. }
  189. private int slideDuration = 3000;
  190. public int SlideDuration
  191. {
  192. get { return slideDuration; }
  193. }
  194. private int transitionSpeed = 1000;
  195. public int TransitionSpeed
  196. {
  197. get { return transitionSpeed; }
  198. }
  199. private string slideContainerClass = string.Empty;
  200. public string SlideContainerClass
  201. {
  202. get { return slideContainerClass; }
  203. }
  204. private bool randomizeSlides = false;
  205. public bool RandomizeSlides
  206. {
  207. get { return randomizeSlides; }
  208. }
  209. private bool useSlideClearTypeCorrections = true;
  210. public bool UseSlideClearTypeCorrections
  211. {
  212. get { return useSlideClearTypeCorrections; }
  213. }
  214. private string instanceCssClass = string.Empty;
  215. public string InstanceCssClass
  216. {
  217. get { return instanceCssClass; }
  218. }
  219. private bool showFacebookLikeButton = false;
  220. public bool ShowFacebookLikeButton
  221. {
  222. get { return showFacebookLikeButton; }
  223. }
  224. public static bool UseHtmlDiff
  225. {
  226. get { return ConfigHelper.GetBoolProperty("HtmlContent:UseHtmlDiff", true); }
  227. }
  228. }
  229. }