* @link http://www.nonumber.nl * @copyright Copyright (C) 2010 NoNumber! All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ // Ensure this file is being included by a parent file defined( '_JEXEC' ) or die( 'Restricted access' ); /** * Editor Element * * Available extra parameters: * width Width of the editor (default = 100%) * height Width of the editor (default = 400) * newline Show editor on a new line (under the other blocks) */ class JElementEditor extends JElement { /** * Element name * * @access protected * @var string */ var $_name = 'Editor'; function fetchTooltip( $label, $description, &$node, $control_name, $name ) { return; } function fetchElement( $name, $value, &$node, $control_name ) { $label = $node->attributes( 'label' ); $description = $node->attributes( 'description' ); $width = $this->def( $node->attributes( 'width' ), '100%' ); $height = $this->def( $node->attributes( 'height' ), 400 ); $newline = $node->attributes( 'newline' ); $value = htmlspecialchars( $value, ENT_QUOTES, 'UTF-8' ); $option = JRequest::getVar( 'option', '' ); if ( $option == 'com_modules' ) { $name = $control_name.'['.$name.']'; } $html = ''; if ( $newline ) { $html .= JText::_( $description ); $html .= ''; $html .= ''; $html .= '
'; if( $label != '' ) { $html .= ''.JText::_( $label ).''; } $html .= '
'; } else { if( $label != '' ) { $html .= ''.JText::_( $label ).'
'; } if( $description != '' ) { $html .= JText::_( $description ).'
'; } } $editor =& JFactory::getEditor(); $html .= $editor->display( $name, $value, $width, $height, '60', '20', true ); $html .= '
'; return $html; } function def( $val, $default ) { return ( $val == '' ) ? $default : $val; } }