* * @version 2.0 * @license LGPL 2.1 * * {@link http://www.gnu.org/licenses/lgpl-2.1.txt} */ /** * ETinyMce is an input widget based on TinyMCE and the jQuery TinyMCE plugin. * * Example: * * * widget('application.extensions.tinymce.ETinyMce', * array('name'=>'html')); ?> * * * This extension includes TinyMCE 3.4.3.2 Jquery, Compressor 2.0.4 PHP and the * full language sets. This is included under the LGPL 2.1 license: * * @license http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/license.txt * * @author Rodolfo Gonzalez */ class ETinyMce extends CInputWidget { /** * These are useful defaults in case you forget to set htmlOptions['cols'] * and htmlOptions['rows']. However, since width and heigth are defined * below, the cols and rows don't actually matter (they're here just for * XHTML compliance) */ const COLS = 40; const ROWS = 10; /** * Don't change these unless you're having name conflicts. They should be the * same as the used in the jquery.tinymce.js plugin file */ const COOKIE_SUFFIX = '_editorMode'; const SWITCH_SUFFIX = '_switch'; //************************************************************************** // Widget properties //************************************************************************** /** * The mode for this editor: html or text */ private $mode = 'html'; /** * The editor's language * * @var string */ private $language = 'en'; /** * You can use one of these predefined setups for the editor: * * - simple: This page shows you the simple theme and it's core functionality. * - full: This includes shows all available buttons and plugins that are * included in the TinyMCE core package. * * @var string */ private $editorTemplate = 'simple'; /** * The width of the editor. * This will be overriden if you set htmlOptions['style'] = 'width:...'; * * @var string */ private $width = '100%'; /** * The heigth of the editor. * This will be overriden if you set htmlOptions['style'] = 'heigth:...'; * * @var integer */ private $height = '400px'; /** * This option enables you to specify make editor instances in readonly mode. * When they are in readonly mode nothing can be changed and the contents is * just presented to the user. * * @var boolean */ private $readOnly = false; /** * The TinyMCE options. It is an associative array. Follow this example: * * $options['theme_advanced_toolbar_location'] = 'top'; * * The keys and the corresponding values are the configuration options from * this page: * * @link http://wiki.moxiecode.com/index.php/TinyMCE:Configuration * * You can control the toolbars following these instructions: * * @link http://wiki.moxiecode.com/index.php/TinyMCE:Control_reference * * @var array */ private $options = array(); /** * Plugins to load. The more you load the slower is the first load. * You may want to extend the class and redefine this property to your needs. * * For an almost full editor: * * array('spellchecker','table','save','emotions','insertdatetime','preview','searchreplace','print','contextmenu','paste','fullscreen','noneditable','layer','visualchars'); * * This variable is significative only if $this->options == array() * * @var array */ private $plugins = array(); /** * Font families to display on the font list. * You may want to redefine this property to your needs. * Notice that the only useful values are the most comon: Arial, Times New * Romn and Helvetica, since they have equivalents in most operating systems. * * This variable is significative only if $this->options == array() * * @var string */ private $fontFamilies = array( 'Andale Mono'=>'andale mono', 'Arial'=>'arial,helvetica,sans-serif', 'Arial Black'=>'arial black', 'Book Antiqua'=>'book antiqua', 'Comic Sans MS'=>'comic sans ms', 'Courier New'=>'courier new,courier,monospace', 'Georgia'=>'georgia', 'Helvetica'=>'helvetica', 'Impact'=>'impact', 'Symbol'=>'symbol', 'Tahoma'=>'tahoma', 'Terminal'=>'terminal', 'Times New Roman'=>'times new roman,roman,serif', 'Trebuchet MS'=>'trebuchet ms', 'Verdana'=>'verdana', 'Webdings'=>'webdings', 'Wingdings'=>'wingdings' ); /** * Font sizes to display in the font size list. This is a list of comma separated integers. * You may want to redefine this property to your needs. * * This variable is significative only if $this->options == array() * * @var string */ private $fontSizes = array('1','2','3','4','5','6','7'); /** * If you include an URL pointing to a CSS file, this will be used by the * editor to try to present the content as if it were on the target page. * * @var string */ private $contentCSS = ''; /** * The CSS style of the label tab * * @var string */ private $labelStyle = 'color:navy;font-family:sans-serif;font-size:8pt;background-color:#F0F0EE;border-style:solid;border-width:0px 1px 1px 1px;border-color:#CCCCCC;text-decoration:none;padding:1px 3px 3px 3px;margin:2px 0 0 0;'; /** * The CSS class of the label tab. A sample CSS file is provided inside the * css directory. Simple registerCssFile in your view and use mceSwitchLabel. * Or define your own. * * @var string */ private $labelClass = ''; /** * The labels for the HTML->plain text mode switch. The first element is the * "text to plain" label, and the second element is the "html to text" label * * @var array */ private $switchLabels = array(0=>'Text mode', 1=>'HTML mode'); /** * Wheter to use the HTML->plain text mode switch. * * Note: if useSwitch==true then the editor will be inside a
tag. Else * it will be a normal