_loadBehavior($params); $loaded = true; } } /** * Creates a pane and creates the javascript object for it * * @param string The pane identifier */ function startPane( $id ) { return '
'; } /** * Ends the pane */ function endPane() { return "
"; } /** * Creates a tab panel with title text and starts that panel * * @param string $text The name of the tab * @param string $id The tab identifier */ function startPanel( $text, $id ) { return '
'.$text.'
'; } /** * Ends a tab page */ function endPanel() { return "
"; } /** * Load the javascript behavior and attach it to the document * * @param array $params Associative array of values */ function _loadBehavior($params = array()) { // Include mootools framework JHTML::_('behavior.mootools'); $document =& JFactory::getDocument(); $options = '{'; $opt['onActive'] = (isset($params['onActive'])) ? $params['onActive'] : null ; $opt['onBackground'] = (isset($params['onBackground'])) ? $params['onBackground'] : null ; $opt['display'] = (isset($params['startOffset'])) ? (int)$params['startOffset'] : null ; foreach ($opt as $k => $v) { if ($v) { $options .= $k.': '.$v.','; } } if (substr($options, -1) == ',') { $options = substr($options, 0, -1); } $options .= '}'; $js = ' window.addEvent(\'domready\', function(){ $$(\'dl.tabs\').each(function(tabs){ new JTabs(tabs, '.$options.'); }); });'; $document->addScriptDeclaration( $js ); $document->addScript( JURI::root(true). '/media/system/js/tabs.js' ); } } /** * JPanelSliders class to to draw parameter panes * * @package Joomla.Framework * @subpackage HTML * @since 1.5 */ class JPaneSliders extends JPane { /** * Constructor * * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes */ function __construct( $params = array() ) { static $loaded = false; parent::__construct($params); if(!$loaded) { $this->_loadBehavior($params); $loaded = true; } } /** * Creates a pane and creates the javascript object for it * * @param string The pane identifier */ function startPane( $id ) { return '
'; } /** * Ends the pane */ function endPane() { return '
'; } /** * Creates a tab panel with title text and starts that panel * * @param string $text - The name of the tab * @param string $id - The tab identifier */ function startPanel( $text, $id ) { return '
' .'

'.$text.'

' .'
'; } /** * Ends a tab page */ function endPanel() { return '
'; } /** * Load the javascript behavior and attach it to the document * * @param array $params Associative array of values */ function _loadBehavior($params = array()) { // Include mootools framework JHTML::_('behavior.mootools'); $document =& JFactory::getDocument(); $options = '{'; $opt['onActive'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler-down\'); toggler.removeClass(\'jpane-toggler\'); }'; $opt['onBackground'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler\'); toggler.removeClass(\'jpane-toggler-down\'); }'; $opt['duration'] = (isset($params['duration'])) ? (int)$params['duration'] : 300; $opt['display'] = (isset($params['startOffset']) && ($params['startTransition'])) ? (int)$params['startOffset'] : null ; $opt['show'] = (isset($params['startOffset']) && (!$params['startTransition'])) ? (int)$params['startOffset'] : null ; $opt['opacity'] = (isset($params['opacityTransition']) && ($params['opacityTransition'])) ? 'true' : 'false' ; $opt['alwaysHide'] = (isset($params['allowAllClose']) && ($params['allowAllClose'])) ? 'true' : null ; foreach ($opt as $k => $v) { if ($v) { $options .= $k.': '.$v.','; } } if (substr($options, -1) == ',') { $options = substr($options, 0, -1); } $options .= '}'; $js = ' window.addEvent(\'domready\', function(){ new Accordion($$(\'.panel h3.jpane-toggler\'), $$(\'.panel div.jpane-slider\'), '.$options.'); });'; $document->addScriptDeclaration( $js ); } }