3 require_once'HTML/QuickForm/textarea.php';
6 * HTML Quickform element for Joomla Default Editor
8 * Joomla global configuration includes the selection of a default editor
9 * This class imports and translates the default editor into CiviCRM forms
11 * @author Brian Shaughnessy, based on other editor classes
14 class HTML_QuickForm_JoomlaEditor
extends HTML_QuickForm_textarea
17 * The width of the editor in pixels or percent
25 * The height of the editor in pixels or percent
35 * @param string Editor instance name
36 * @param string Editor instance label
37 * @param array Config settings for editor
38 * @param string Attributes for the textarea
42 function HTML_QuickForm_JoomlaEditor( $elementName=null, $elementLabel=null, $attributes=null, $options=array() )
45 HTML_QuickForm_element
::HTML_QuickForm_element( $elementName, $elementLabel, $attributes );
46 $this->_persistantFreeze
= true;
47 $this->_type
= 'JoomlaEditor';
48 // set editor height smaller if schema defines rows as 4 or less
49 if ( is_array( $attributes ) &&
50 array_key_exists( 'rows', $attributes ) &&
51 $attributes['rows'] <= 4
58 * Return the htmlarea in HTML
65 jimport( 'joomla.html.editor' );
66 $editor = JFactory
::getEditor();
68 if ( $this->_flagFrozen
) {
69 return $this->getFrozenHtml();
71 $name = $this->getAttribute( 'name' );
74 //tinymce and its relatives require 'double-loading' when inside jquery tab
75 $editorName = $editor->get( '_name' );
76 if ( $editorName == 'jce' ||
77 $editorName == 'tinymce'
79 $html .= sprintf( '<script type="text/javascript">
80 //reset the controls if called in jquery tab or via ajax
81 tinyMCE.execCommand( "mceRemoveControl", false,"' . $this->_attributes
['id'] .'" );
82 tinyMCE.execCommand( "mceAddControl" , true, "' . $this->_attributes
['id'] .'" );
85 $html .= sprintf( '<style type="text/css"> <!--
86 #crm-container table.mceLayout td { border: none; } .button2-left { display:none; }
90 $html .= $editor->display( $name, $this->getValue(), $this->width
, $this->height
, '94', '20', false );
96 * Returns the htmlarea content in HTML
101 function getFrozenHtml()
103 return $this->getValue();