/** * Return the htmlarea in HTML * * @access public * @return string */ function toHtml() { $html = null; // return frozen state if ($this->_flagFrozen) { return $this->getFrozenHtml(); // return textarea if incompatible } elseif (!$this->IsCompatible()) { return parent::toHtml(); // return textarea } else { //FIX for multiple editors in a form, initialize once (CRM-3559) if (!defined('HTML_QUICKFORM_TINYMCEEDITOR_LOADED')) { // load tinyMCEeditor $config = CRM_Core_Config::singleton(); // tinymce is wierd, it needs to be loaded initially along with jquery $html = null; $html .= sprintf('<script type="text/javascript"> cj( function( ) { cj("textarea.tinymce").tinymce({ theme : "advanced", editor_selector : "form-TinyMCE", plugins : "safari,spellchecker,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak", theme_advanced_buttons1 : "separator,bold,italic,underline,|,fontselect,fontsizeselect", theme_advanced_buttons1_add: "separator,forecolor,backcolor,separator,link,unlink,separator,image,hr,emotions", theme_advanced_buttons2 : "separator,numlist,bullist,|,outdent,indent,cite,separator,justifyleft,justifycenter,justifyright", theme_advanced_buttons2_add: "justifyfull,separator,pastetext,pasteword,|,spellchecker,separator,removeformat,separator,code,|,fullscreen,help", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resize_horizontal : false, theme_advanced_resizing : true, apply_source_formatting : true, spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv", convert_urls : false, remove_script_host : false, width : "' . $this->Width . '%", setup : function(ed) { ed.onInit.addToTop( function(){ var height = cj("#" + ed.editorId).attr("height"); cj("#" + ed.editorId + "_tbl").css("height", height); cj("#" + ed.editorId + "_ifr").css("height", height); }); ed.onChange.add(function(ed, l) { global_formNavigate = false; }); } }); }); </script>'); define('HTML_QUICKFORM_TINYMCEEDITOR_LOADED', true); } // include textarea as well (TinyMCE transforms it) $html .= parent::toHTML(); $html .= sprintf('<script type="text/javascript"> cj("#' . $this->_attributes['id'] . '").attr( "height","' . $this->Height . 'px"); </script>'); return $html; } }
/** * Build this element using FCKeditor */ function build_FCKeditor() { if (!FCKeditor::IsCompatible()) { return parent::toHTML(); } $this->fck_editor->Value = $this->getValue(); $result = $this->fck_editor->CreateHtml(); if (isset($this->fck_editor->Config['LoadAsciiMath'])) { if (isset($_SESSION['ascii_math_loaded']) && $_SESSION['ascii_math_loaded'] == false) { $result .= $this->fck_editor->Config['LoadAsciiMath']; $_SESSION['ascii_math_loaded'] = true; } } //Add a link to open the allowed html tags window //$result .= '<small><a href="#" onclick="MyWindow=window.open('."'".api_get_path(WEB_CODE_PATH)."help/allowed_html_tags.php?fullpage=". ($this->fullPage ? '1' : '0')."','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600,left=200,top=20'".'); return false;">'.get_lang('AllowedHTMLTags').'</a></small>'; return $result; }
/** * Return the htmlarea in HTML * * @access public * @return string */ function toHtml() { $html = null; // return frozen state if ($this->_flagFrozen) { return $this->getFrozenHtml(); // return textarea if incompatible } elseif (!$this->IsCompatible()) { return parent::toHtml(); // return textarea } else { // load tinyMCEeditor $config = CRM_Core_Config::singleton(); $browseUrl = $config->userFrameworkResourceURL . 'packages/kcfinder/browse.php?opener=tinymce&cms=civicrm&type='; // tinymce is wierd, it needs to be loaded initially along with jquery $html = null; $html .= sprintf('<script type="text/javascript"> var configArray = [{ theme : "advanced", editor_selector : "form-TinyMCE", plugins : "safari,spellchecker,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak", theme_advanced_buttons1 : "separator,bold,italic,underline,|,fontselect,fontsizeselect", theme_advanced_buttons1_add: "separator,forecolor,backcolor,separator,link,unlink,separator,image,hr,emotions", theme_advanced_buttons2 : "separator,numlist,bullist,|,outdent,indent,cite,separator,justifyleft,justifycenter,justifyright", theme_advanced_buttons2_add: "justifyfull,separator,pastetext,pasteword,|,spellchecker,separator,removeformat,separator,|,undo,redo,|,code,|,fullscreen,help", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resize_horizontal : false, theme_advanced_resizing : true, apply_source_formatting : true, spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv", convert_urls : false, remove_script_host : false, width : "' . $this->Width . '%", file_browser_callback: "openKCFinder", setup : function(ed) { ed.onInit.addToTop( function(){ var height = cj("#" + ed.editorId).attr("height"); cj("#" + ed.editorId + "_tbl").css("height", height); cj("#" + ed.editorId + "_ifr").css("height", height); }); ed.onKeyUp.add(function(ed, l) { global_formNavigate = false; }); }' . $this->getConfigString() . ' }]; tinyMCE.settings = configArray[0]; //remove the control if element is already having tinyMCE.execCommand("mceRemoveControl", false,"' . $this->_attributes['id'] . '"); tinyMCE.execCommand("mceAddControl" , true, "' . $this->_attributes['id'] . '"); function openKCFinder(field_name, url, type, win) { tinyMCE.activeEditor.windowManager.open({ file: "' . $browseUrl . '" + type, title: "KCFinder", width: 700, height: 500, resizable: "yes", inline: true, close_previous: "no", popup_css: false }, { window: win, input: field_name }); return false; } </script>'); // include textarea as well (TinyMCE transforms it) $html .= parent::toHTML(); $html .= sprintf('<script type="text/javascript"> cj("#' . $this->_attributes['id'] . '").attr( "height","' . $this->Height . 'px"); </script>'); return $html; } }