Source for file DobomodeTheme.class.php

Documentation is available at DobomodeTheme.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/MenuTheme.abstract.php");
  4.  
  5. require_once(HARMONI."GUIManager/Container.class.php");
  6.  
  7. require_once(HARMONI."GUIManager/StyleCollection.class.php");
  8.  
  9. require_once(HARMONI."GUIManager/StyleProperty.class.php");
  10.  
  11. require_once(HARMONI."GUIManager/StyleProperties/FontFamilySP.class.php");
  12. require_once(HARMONI."GUIManager/StyleProperties/FontWeightSP.class.php");
  13. require_once(HARMONI."GUIManager/StyleProperties/FontSizeSP.class.php");
  14. require_once(HARMONI."GUIManager/StyleProperties/BackgroundColorSP.class.php");
  15. require_once(HARMONI."GUIManager/StyleProperties/ColorSP.class.php");
  16. require_once(HARMONI."GUIManager/StyleProperties/TextAlignSP.class.php");
  17. require_once(HARMONI."GUIManager/StyleProperties/OverflowSP.class.php");
  18. require_once(HARMONI."GUIManager/StyleProperties/MarginSP.class.php");
  19. require_once(HARMONI."GUIManager/StyleProperties/MarginTopSP.class.php");
  20. require_once(HARMONI."GUIManager/StyleProperties/MarginLeftSP.class.php");
  21. require_once(HARMONI."GUIManager/StyleProperties/MarginRightSP.class.php");
  22. require_once(HARMONI."GUIManager/StyleProperties/TextDecorationSP.class.php");
  23. require_once(HARMONI."GUIManager/StyleProperties/WidthSP.class.php");
  24. require_once(HARMONI."GUIManager/StyleProperties/HeightSP.class.php");
  25. require_once(HARMONI."GUIManager/StyleProperties/BorderSP.class.php");
  26. require_once(HARMONI."GUIManager/StyleProperties/BorderTopSP.class.php");
  27. require_once(HARMONI."GUIManager/StyleProperties/FloatSP.class.php");
  28. require_once(HARMONI."GUIManager/StyleProperties/PaddingSP.class.php");
  29. require_once(HARMONI."GUIManager/StyleProperties/PaddingTopSP.class.php");
  30. require_once(HARMONI."GUIManager/StyleProperties/PaddingBottomSP.class.php");
  31. require_once(HARMONI."GUIManager/StyleProperties/PaddingLeftSP.class.php");
  32. require_once(HARMONI."GUIManager/StyleProperties/PaddingRightSP.class.php");
  33. require_once(HARMONI."GUIManager/StyleProperties/DisplaySP.class.php");
  34.  
  35. require_once(HARMONI."GUIManager/StyleComponents/ColorSC.class.php");
  36.  
  37. require_once(HARMONI."GUIManager/Components/Menu.class.php");
  38. require_once(HARMONI."GUIManager/Components/MenuItemLink.class.php");
  39.  
  40. require_once(HARMONI."GUIManager/Layouts/FlowLayout.class.php");
  41.  
  42. /**
  43. * An implementation of a Dobomode theme (as seen on www.dobomode.com)
  44. *
  45. * @package harmoni.gui
  46. *
  47. * @copyright Copyright &copy; 2005, Middlebury College
  48. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  49. *
  50. * @version $Id: DobomodeTheme.class.php,v 1.2 2007/09/04 20:25:23 adamfranco Exp $
  51. ***/
  52. class DobomodeTheme extends MenuThemeAbstract {
  53.  
  54. /**
  55. * This is a wrapper component that is used to center and resize the
  56. * contents of the page.
  57. * @attribute private object _wrapper
  58. */
  59. var $_wrapper;
  60. /**
  61. * This is the main container into which all non-menu content will go.
  62. * @attribute private object _main
  63. */
  64. var $_main;
  65.  
  66. /**
  67. * The constructor. All initialization and Theme customization is performed
  68. * here.
  69. * @access public
  70. ***/
  71. function DobomodeTheme() {
  72. $this->Theme("Dobomode Theme", "The Dobomode Theme by Dobo Radichkov. Visit <a href=\"http://www.dobomode.com\">www.dobomode.com</a> for more information.");
  73.  
  74. // Add some global styles
  75.  
  76. // =====================================================================
  77. // body
  78. $style = new StyleCollection("body", null, "Global Style", "Style settings affecting the overall look and feel.");
  79. $style->addSP(new FontFamilySP("'Arial', 'Helvetica', 'Verdana'"));
  80. $style->addSP(new FontSizeSP("10pt"));
  81. $style->addSP(new ColorSP("#262D34"));
  82. $style->addSP(new BackgroundColorSP("#5D7D9C"));
  83. $style->addSP(new TextAlignSP("center"));
  84. $style->addSP(new OverflowSP("auto"));
  85. $style->addSP(new MarginSP("0px"));
  86. // the following scrollbar style properties are not part of GUIManager
  87. // create them manually
  88. $sp = new StyleProperty("scrollbar-face-color","Scrollbar Face Color","Scrollbar Face Color");
  89. $sp->addSC(new ColorSC("#A4B9CD")); $style->addSP($sp);
  90. $sp = new StyleProperty("scrollbar-shadow-color","Scrollbar Shadow Color","Scrollbar Shadow Color");
  91. $sp->addSC(new ColorSC("#A4B9CD")); $style->addSP($sp);
  92. $sp = new StyleProperty("scrollbar-highlight-color","Scrollbar Highlight Color","Scrollbar Highlight Color");
  93. $sp->addSC(new ColorSC("#FFFFFF")); $style->addSP($sp);
  94. $sp = new StyleProperty("scrollbar-darkshadow-color","Scrollbar Darkshadow Color","Scrollbar Darkshadow Color");
  95. $sp->addSC(new ColorSC("#262D34")); $style->addSP($sp);
  96. $sp = new StyleProperty("scrollbar-3dlight-color","Scrollbar 3D Light Color","Scrollbar 3D Light Color");
  97. $sp->addSC(new ColorSC("#262D34")); $style->addSP($sp);
  98. $sp = new StyleProperty("scrollbar-track-color","Scrollbar Track Track","Scrollbar Track Color");
  99. $sp->addSC(new ColorSC("#4C5A68")); $style->addSP($sp);
  100. $sp = new StyleProperty("scrollbar-arrow-color","Scrollbar Arrow Color","Scrollbar Arrow Color");
  101. $sp->addSC(new ColorSC("#262D34")); $style->addSP($sp);
  102. $this->addGlobalStyle($style);
  103. // =====================================================================
  104. // anchors
  105. $style = new StyleCollection("a", null, "Link Style", "Style settings affecting the look and feel of links.");
  106. $style->addSP(new TextDecorationSP("none"));
  107. $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
  108. $style->addSP(new ColorSP("#323B44"));
  109. $this->addGlobalStyle($style);
  110. $style = new StyleCollection("a:hover", null, "Link Hover Style", "Style settings affecting the look and feel of links when the mouse pointer is over them.");
  111. $style->addSP(new ColorSP("#FFFFFF"));
  112. $this->addGlobalStyle($style);
  113. // =====================================================================
  114. // initialize wrapper object
  115. $style = new StyleCollection("*.wrapper", "wrapper", "Wrapper Style", "Style settings for wrapper component.");
  116. $style->addSP(new WidthSP("700px"));
  117. $style->addSP(new MarginSP("auto"));
  118. $style->addSP(new TextAlignSP("left"));
  119. $this->_wrapper = new Container(new FlowLayout(), BLOCK, 0, $style);
  120. // =====================================================================
  121. // initialize main container object
  122. $style = new StyleCollection("*.main", "main", "Main Box Style", "Style settings for main content box.");
  123. $style->addSP(new FloatSP("right"));
  124. // total width with borders and padding = 500
  125. $style->addSP(new WidthSP("468px"));
  126. // total height with borders and padding = 400
  127. $style->addSP(new HeightSP("356px"));
  128. $style->addSP(new OverflowSP("auto"));
  129. $style->addSP(new BackgroundColorSP("#CFDBE6"));
  130. $style->addSP(new BorderSP("1px", "solid", "#262D34"));
  131. $style->addSP(new BorderTopSP("3px", "solid", "#262D34"));
  132. $style->addSP(new MarginTopSP("20px"));
  133. $style->addSP(new MarginLeftSP("10px"));
  134. $style->addSP(new PaddingTopSP("20px"));
  135. $style->addSP(new PaddingBottomSP("20px"));
  136. $style->addSP(new PaddingLeftSP("15px"));
  137. $style->addSP(new PaddingRightSP("15px"));
  138. $this->_main = new Container(new FlowLayout(), BLOCK, 0, $style);
  139. $this->_wrapper->add($this->_main);
  140. // =====================================================================
  141. // initialize main menu
  142. // styles for level 1 menu
  143. $style = new StyleCollection("*.menu_1", "menu_1", "Level 1 Menu Style", "Style settings for level 1 menus.");
  144. $style->addSP(new FloatSP("left"));
  145. // total width with borders and padding = 160
  146. $style->addSP(new WidthSP("138px"));
  147. $style->addSP(new OverflowSP("hidden"));
  148. $style->addSP(new BackgroundColorSP("#CFDBE6"));
  149. $style->addSP(new BorderSP("1px", "solid", "#262D34"));
  150. $style->addSP(new BorderTopSP("3px", "solid", "#262D34"));
  151. $style->addSP(new MarginTopSP("20px"));
  152. $style->addSP(new MarginRightSP("10px"));
  153. $style->addSP(new PaddingBottomSP("10px"));
  154. $style->addSP(new PaddingLeftSP("10px"));
  155. $style->addSP(new PaddingRightSP("10px"));
  156. $this->addStyleForComponentType($style, MENU, 1);
  157. // styles for level 1 menu item links
  158. $style = new StyleCollection("*.menu_item_link_1 a", "menu_item_link_1", "Level 1 Menu Link Style", "Style settings for level 1 menu links.");
  159. $style->addSP(new BackgroundColorSP("#A4B9CD"));
  160. $style->addSP(new ColorSP("#262D34"));
  161. $style->addSP(new BorderSP("1px", "solid", "#262D34"));
  162. $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
  163. $style->addSP(new FontWeightSP("bold"));
  164. $style->addSP(new TextAlignSP("center"));
  165. $style->addSP(new MarginSP("8px"));
  166. $style->addSP(new MarginTopSP("15px"));
  167. $style->addSP(new PaddingSP("3px"));
  168. $style->addSP(new DisplaySP("block"));
  169. $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 1);
  170. $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 1);
  171. $style = new StyleCollection("*.menu_item_link_1 a:hover", "menu_item_link_1", "Level 1 Menu Link Hover Style", "Hover style settings for level 1 menu links.");
  172. $style->addSP(new BackgroundColorSP("#4C5A68"));
  173. $style->addSP(new ColorSP("#FFFFFF"));
  174. $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 1);
  175. $style = new StyleCollection("*.menu_item_link_selected_1 a", "menu_item_link_selected_1", "Level 1 Selected Menu Link Style", "Style settings for level 1 selected menu links.");
  176. $style->addSP(new BorderSP("2px", "solid", "#262D34"));
  177. $style->addSP(new BackgroundColorSP("#4C5A68"));
  178. $style->addSP(new ColorSP("#FFFFFF"));
  179. $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 1);
  180. // styles for level 1 menu item headings
  181. $style = new StyleCollection("*.menu_item_heading_1", "menu_item_heading_1", "Level 1 Menu Heading", "Style settings for level 1 menu heading.");
  182. $style->addSP(new ColorSP("#000000"));
  183. $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
  184. $style->addSP(new FontWeightSP("bold"));
  185. $style->addSP(new TextAlignSP("center"));
  186. $style->addSP(new MarginTopSP("10px"));
  187. $style->addSP(new DisplaySP("block"));
  188. $this->addStyleForComponentType($style, MENU_ITEM_HEADING, 1);
  189. // styles for level 2 menu
  190. $style = new StyleCollection("*.menu_2", "menu_2", "Level 2 Menu Style", "Style settings for level 2 menus.");
  191. $style->addSP(new FloatSP("left"));
  192. $style->addSP(new FontSizeSP("8pt"));
  193. // total width with borders and padding = 120
  194. $style->addSP(new WidthSP("108px"));
  195. $style->addSP(new OverflowSP("hidden"));
  196. $style->addSP(new BackgroundColorSP("#CFDBE6"));
  197. $style->addSP(new BorderSP("1px", "solid", "#262D34"));
  198. $style->addSP(new BorderTopSP("3px", "solid", "#262D34"));
  199. $style->addSP(new MarginTopSP("20px"));
  200. $style->addSP(new MarginLeftSP("20px"));
  201. $style->addSP(new MarginRightSP("20px"));
  202. $style->addSP(new PaddingBottomSP("5px"));
  203. $style->addSP(new PaddingLeftSP("5px"));
  204. $style->addSP(new PaddingRightSP("5px"));
  205. $this->addStyleForComponentType($style, MENU, 2);
  206. // styles for level 2 menu item links
  207. $style = new StyleCollection("*.menu_item_link_2 a", "menu_item_link_2", "Level 2 Menu Link Style", "Style settings for level 2 menu links.");
  208. $style->addSP(new BackgroundColorSP("#A4B9CD"));
  209. $style->addSP(new ColorSP("#262D34"));
  210. $style->addSP(new BorderSP("1px", "solid", "#262D34"));
  211. $style->addSP(new FontFamilySP("'Verdana', 'Arial', 'Helvetica'"));
  212. $style->addSP(new FontWeightSP("bold"));
  213. $style->addSP(new TextAlignSP("center"));
  214. $style->addSP(new MarginSP("5px"));
  215. $style->addSP(new MarginTopSP("5px"));
  216. $style->addSP(new PaddingSP("1px"));
  217. $style->addSP(new DisplaySP("block"));
  218. $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 2);
  219. $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 2);
  220. $style = new StyleCollection("*.menu_item_link_2 a:hover", "menu_item_link_2", "Level 2 Menu Link Hover Style", "Hover style settings for level 2 menu links.");
  221. $style->addSP(new BackgroundColorSP("#4C5A68"));
  222. $style->addSP(new ColorSP("#FFFFFF"));
  223. $this->addStyleForComponentType($style, MENU_ITEM_LINK_UNSELECTED, 2);
  224. $style = new StyleCollection("*.menu_item_link_selected_2 a", "menu_item_link_selected_2", "Level 2 Selected Menu Link Style", "Style settings for level 2 selected menu links.");
  225. $style->addSP(new BorderSP("2px", "solid", "#262D34"));
  226. $style->addSP(new BackgroundColorSP("#4C5A68"));
  227. $style->addSP(new ColorSP("#FFFFFF"));
  228. $this->addStyleForComponentType($style, MENU_ITEM_LINK_SELECTED, 2);
  229. }
  230. /**
  231. * Overloads the normal <code>setComponent</code> method - sets the Theme
  232. * component to the wrapper component and adds the argument to the latter.
  233. * @access public
  234. * @param ref object A component.
  235. ***/
  236. function setComponent($component) {
  237. parent::setComponent($this->_wrapper);
  238. $this->_main->removeAll();
  239. $this->_main->add($component);
  240. }
  241.  
  242. /**
  243. * Prints the HTML page.
  244. * @access public
  245. ***/
  246. function printPage() {
  247. // before printing, add menus to Theme component
  248. foreach (array_keys($this->_menus) as $i => $level)
  249. $this->_wrapper->add($this->_menus[$level]);
  250. parent::printPage();
  251. }
  252. }
  253.  
  254.  
  255. //
  256. //ul {
  257. // margin-left: 65px;
  258. //}
  259. //
  260. //ul.sub {
  261. // list-style: circle;
  262. //}
  263. //
  264. //div.text {
  265. // text-align: justify;
  266. ///* text-indent: 3em; */
  267. // cursor: default;
  268. //}
  269. //
  270. //div.text:first-letter {
  271. ///* font-weight: bold; */
  272. // text-transform: capitalize;
  273. //}
  274. //
  275. //div.title1 {
  276. // text-align: center;
  277. // font-size: small;
  278. // cursor: default;
  279. // font-family: "Arial Black", sans-serif;
  280. //}
  281. //
  282. //span {
  283. // text-align: justify;
  284. //}
  285. //
  286. //
  287. //
  288. //
  289. //form {
  290. // text-align: center;
  291. //}
  292. //
  293. //input, textarea {
  294. // margin-bottom: 5px;
  295. // border: 1px solid #262D34;
  296. // font-size: xx-small;
  297. // font-family: 'Verdana','Helvetica';
  298. //}
  299. //
  300. //input:focus, textarea:focus {
  301. // border-color: #036;
  302. //}
  303. //
  304. //input.textfield, textarea {
  305. // width: 300px;
  306. //}
  307. //
  308. //textarea {
  309. // overflow: auto;
  310. // height: 140px;
  311. //}
  312. //
  313. //input.button {
  314. // cursor: hand;
  315. //}
  316. //
  317. //span.label {
  318. // cursor: default;
  319. // width: 65px;
  320. // text-align: right;
  321. // font-size: xx-small;
  322. // font-weight: bolder;
  323. // vertical-align: top;
  324. // color: #036;
  325. //}
  326. //
  327. //hr {
  328. // color: #262D34;
  329. // height: 1px;
  330. //}
  331. //
  332. //div.col1 {
  333. // padding: 10px;
  334. // background-color: #A4B9CD;
  335. // text-align: left;
  336. //}
  337. //
  338. //div.col2 {
  339. // padding: 10px;
  340. // background-color: #CFDBE6;
  341. // text-align: left;
  342. //}
  343. //
  344. //div.cnt {
  345. // background-color: #CFDBE6;
  346. // width: 500px;
  347. // float: right;
  348. // border-top: 0px solid #262D34;
  349. // border-right: 1px solid #262D34;
  350. // border-bottom: 1px solid #262D34;
  351. // border-left: 1px solid #262D34;
  352. // text-align: right;
  353. // font-size: xx-small;
  354. // padding: 2px 5px 1px 5px;
  355. //}
  356. //
  357. //img {
  358. // border: #262D34 solid 1px;
  359. //}
  360. //
  361.  
  362. ?>

Documentation generated on Wed, 19 Sep 2007 10:22:48 -0400 by phpDocumentor 1.3.0RC3