Source for file LCssDropDownMenu.php
Documentation is available at LCssDropDownMenu.php
* LCssDropDownMenu class file
* This program is free software; you can redistribute it and/or modify
* it under the terms of the BSD License.
* Copyright(c) 2004 by Scott Fuelberth.
* Copyright(c) 2006 by Tobias Munk.
* The latest version of PRADO can be obtained from:
* {@link http://prado.sourceforge.net/}
* =================================================
* NOTICE: This works now with assets, working with
* custom files, like in v2 need to be reimplemented.
* =================================================
* Changes: Ported to v3, this component can hook up to LVirtualNodes and
* LPageService for a changeable custom, non-nardcoded navigation.
* @author Scott Fuelberth <skot@bastardcat.org>, Tobias Munk <webmaster@lithron.de>
* @version $Revision: 633 $ $Date: 2007-02-25 02:10:18 +0100 (Sun, 25 Feb 2007) $
* @package Phundament.Components
* @subpackage WebControls
* LCssDropDownMenu class file class
* LCssDropDownMenu class file displays a css driven menu on a Web page. You can set the alignment of the menu
* through the <b>Horizontal</b> property.
* If you do not have your own menu styling with themes, you may setUseStylingAsset to true.
* Example: <code><com:TCssDropDownMenu Horizontal="false" /></code>
* Namespace: Lithron.Web.UI.WebControls
* - <b>Horizontal</b>, boolean, kept in viewstate
* <br>Sets the alignment of the menu, true = horizontal and false = vertical.
* - <b>CssHorizontalFile</b>, string, kept in view state
* <br>Sets the css file to be used for horizontal menus
* - <b>CssVerticalFile</b>, string, kept in view state
* <br>Sets the css file to be used for vertical menus
* - <b>CssDirectory</b>, string, kept in view state
* <br>Sets the css file directory
* - <b>JsDirectory</b>, string, kept in view state
* <br>Set the javascript directory
* - <b>JsFile</b>, string, kept in view state
* <br>Set the javascript filename
* - <b>TopParentNodeCssClass</b>, string, kept in view state
* <br>Set the css class name of the top most TCssDropDownMenuNode
* - <b>ParentNodeCssClass<b>, string, kept in view state
* <br>Set the css class name of parent (nodes with children nodes) TCssDropDownMenuNodes
* - <b>NodeCssClass</b>, string, kept in view state
* <br>Set the node css class name of ending TCssDropDownMenuNodes
* - <b>DisabledCssClass</b>, string kept in view state
* <br>Set the node css class name of disabled TCssDropDownMenuNodes
* Note, that the default css files need to be located under the root of your site unders js/cssdropdownmenu/css with
* cssdropdownmenu-horizontal.css and cssdropdownmenu-vertical.css controlling the aligments. There is also a small
* javascript file for IE non-support of the virtual tage hover. Based off the work of Son of Suckerfish by
* Patrick Griffiths and Dan Webb, see http://www.htmldog.com/articles/suckerfish/dropdowns/
* @package System.Web.UI.WebControls
* Adds attributes related to a hyperlink element to renderer.
* @param THtmlWriter the writer used for the rendering purpose
parent::addAttributesToRender($writer);
//$writer->addAttribute('style',"width:100%;clear:both;background-color:red;margin-right:0px");
$isEnabled=$this->getEnabled(true);
if($this->getEnabled() && !$isEnabled)
$writer->addAttribute('disabled','disabled');
parent::addAttributesToRender($writer);
if(($url=$this->getNavigateUrl())!=='' && $isEnabled)
$writer->addAttribute('href',$url);
if(($target=$this->getTarget())!=='')
$writer->addAttribute('target',$target);
* Renders the menu, and itinitialize top parent nodes css.
#Prado :: trace("Begin Menu render", 'System.Lithron.LPageService');
$body = $this->getControls();
//$this->setCssClass(" parent");
$item->setTopParent(true);
#Prado :: trace("End Menu render", 'System.Lithron.LPageService');
parent :: render($writer);
* @return string the disabled menu node css class
return $this->getViewState('DisabledCssClass', '');
* @param string the menu alignment
$this->setViewState('DisabledCssClass', $value, '');
* @return boolean the menu alignment
* true means a horizontal menu, false means a vertical menu
return $this->getViewState('Horizontal', '');
* @param boolean the menu alignment
* true means a horizontal menu, false means a vertical menu
$this->setViewState('Horizontal', TPropertyValue::ensureBoolean($value));
* @return string the name of the css horizontal file
return $this->getViewState('CssHorizontalFile');
* @param boolean the name of the css horizontal file
$this->setViewState('CssHorizontalFile', $value);
* @return string the name of the css vertical file
return $this->getViewState('CssVerticalFile');
* @param boolean the name of the css vertical file
$this->setViewState('CssVerticalFile', $value, '');
* @return string the name of the css directory
return $this->getViewState('CssDirectory', 'js/cssdropdownmenu/css');
* @param boolean the name of the css directory
$this->setViewState('CssDirectory', $value, 'js/cssdropdownmenu/css');
* @return string the name of the js directory
return $this->getViewState('JsDirectory', 'js/cssdropdownmenu');
* @param boolean the name of the js directory
$this->setViewState('JsDirectory', $value, 'js/cssdropdownmenu');
* @return string the name of the js file
return $this->getViewState('JsFile', 'cssdropdownmenu.js');
* @param boolean the name of the js file
$this->setViewState('JsFile', $value, 'cssdropdownmenu.js');
* @return string the top level parent node css class name
return $this->getViewState('TopParentNodeCssClass', '');
* @param string the top level parent node css class name
$this->setViewState('TopParentNodeCssClass', $value, '');
* @return string the parent node css class name
return $this->getViewState('ParentNodeCssClass', '');
* @param string the parent node css class name
$this->setViewState('ParentNodeCssClass', $value, '');
* @return string the node css class name
return $this->getViewState('NodeCssClass', '');
* @param string the node css class name
$this->setViewState('NodeCssClass', $value, '');
* @param boolean the name of the css horizontal asset
$this->setViewState('CssHorizontalAsset', $value);
* @return string the name of the css horizontal asset
$asset = $this->getViewState('CssHorizontalAsset', 'LCssDropDownMenu/horizontal.css');
return $this->publishAsset($asset);
#$this->setViewState('JsAsset',$value);
* @param boolean the name of the css vertical asset
$this->setViewState('CssVerticalAsset', $value);
* @return string the name of the css vertical asset
$asset = $this->getViewState('CssVerticalAsset', 'LCssDropDownMenu/vertical.css');
return $this->publishAsset($asset);
#$this->setViewState('JsAsset',$value);
* @param boolean the name of the js asset
$this->setViewState('JsAsset', $value);
* @return string the name of the js asset
$asset = $this->getViewState('JsAsset', 'LCssDropDownMenu/script.js');
return $this->publishAsset($asset);
#$this->setViewState('JsAsset',$value);
* @param boolean the name of the js asset
$this->setViewState('UseStylingAsset', TPropertyValue::ensureBoolean($value));
* @return string the name of the js asset
return $this->getViewState('UseStylingAsset', false);
#Prado :: trace("Initializing TCssDropDownMenu ...", 'Lithron.LCssDrownDownMenu');
parent :: onLoad($param);
$this->publishAsset('LCssDropDownMenu/rightarrow.gif'); // TODO
$scriptMgr = $this->getPage()->getClientScript();
if ($this->getUseStylingAsset() === true) $scriptMgr->registerStyleSheetFile('LCssDropDownMenu:Styling', $this->publishAsset("assets/LCssDropDownMenu.css"));
$scriptMgr->registerStyleSheetFile('LCssDropDownMenu:Shared', $this->publishAsset("LCssDropDownMenu/shared.css"));
#Prado :: trace("Registering menu CSS file", 'Lithron.LCssDrownDownMenu');
$scriptMgr->registerScriptFile('LCssDropDownMenu:Js', $this->getJsAsset());
#Prado :: trace("Registering menu JS file", 'Lithron.LCssDrownDownMenu');
$this->setCssClass("menuS menuH");
$scriptMgr->registerStyleSheetFile('LCssDropDownMenu:Horizontal', $cssFile);
$this->setCssClass("menuS menuV");
$scriptMgr->registerStyleSheetFile('LCssDropDownMenu:Vertical', $cssFile);
#Prado :: trace("TCssDropDownMenu onLoad finished", 'Lithron.LCssDrownDownMenu');
|