00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Varien_Data_Form_Element_Editor extends Varien_Data_Form_Element_Textarea
00035 {
00036 public function __construct($attributes=array())
00037 {
00038 parent::__construct($attributes);
00039 if( $this->getWysiwyg() === true )
00040 {
00041 $this->setType('wysiwyg');
00042 $this->setExtType('wysiwyg');
00043 }
00044 else
00045 {
00046 $this->setType('textarea');
00047 $this->setExtType('textarea');
00048 }
00049 }
00050
00051 public function getElementHtml()
00052 {
00053 if( $this->getWysiwyg() === true )
00054 {
00055 $element = ($this->getState() == 'html') ? '' : $this->getHtmlId();
00056
00057 $html = '
00058 <textarea name="'.$this->getName().'" title="'.$this->getTitle().'" id="'.$this->getHtmlId().'" class="textarea '.$this->getClass().'" '.$this->serialize($this->getHtmlAttributes()).' >'.$this->getEscapedValue().'</textarea>
00059 <script type="text/javascript">
00060 //<![CDATA[
00061 /* tinyMCE.init({
00062 mode : "exact",
00063 theme : "'.$this->getTheme().'",
00064 elements : "' . $element . '",
00065 theme_advanced_toolbar_location : "top",
00066 theme_advanced_toolbar_align : "left",
00067 theme_advanced_path_location : "bottom",
00068 extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
00069 theme_advanced_resize_horizontal : "false",
00070 theme_advanced_resizing : "false",
00071 apply_source_formatting : "true",
00072 convert_urls : "false",
00073 force_br_newlines : "true",
00074 doctype : \'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\'
00075 });*/
00076 //]]>
00077 </script>';
00078
00079
00080
00081
00082
00083
00084
00085 $html.= $this->getAfterElementHtml();
00086 return $html;
00087 }
00088 else
00089 {
00090 return parent::getElementHtml();
00091 }
00092 }
00093
00094 public function getTheme()
00095 {
00096 if(!$this->hasData('theme')) {
00097 return 'simple';
00098 }
00099
00100 return $this->getData('theme');
00101 }
00102 }