101 $hiddentext =
"xoopsHiddenText",
114 $this->hiddenText = $hiddentext;
127 if (!empty($this->htmlEditor) || !empty(
$options[
'editor'])) {
134 if (count($this->htmlEditor) == 1) {
136 $this->htmlEditor = $editor_handler->get($this->htmlEditor[0],
$options);
138 $this->htmlEditor = null;
142 include_once \XoopsBaseConfig::get(
'root-path') .
$path;
143 if (class_exists($class)) {
144 $this->htmlEditor =
new $class(
$options);
147 $this->htmlEditor = null;
162 if ($this->htmlEditor && is_object($this->htmlEditor)) {
163 if (!isset($this->htmlEditor->isEnabled) || $this->htmlEditor->isEnabled) {
164 return $this->htmlEditor->render();
177 $required = ($this->
isRequired() ?
' required' :
'');
180 $ret .= $this->
codeIcon() .
"<br />\n";
187 $ret .=
"<textarea" . $class .
" id='" . $this->
getName() .
"' name='" . $this->
getName() .
"' title='" . $this->
getTitle() .
"' onselect=\"xoopsSavePosition('" . $this->
getName() .
"');\" onclick=\"xoopsSavePosition('" . $this->
getName() .
"');\" onkeyup=\"xoopsSavePosition('" . $this->
getName() .
"');\" rows='" . $this->
getRows() .
"'" .
$extra . $required .
">" . $this->
getValue() .
"</textarea><br />\n";
189 if (empty($this->skipPreview)) {
191 $this->js .= implode(
"", file(\
XoopsBaseConfig::get(
'root-path') .
"/class/textsanitizer/image/image.js"));
193 $xoops->theme()->addScript(
'/class/textsanitizer/image/image.js', array(
'type' =>
'text/javascript'));
195 $button =
"<input id='" . $this->
getName() .
"_preview_button' " .
"type='button' " .
"class='btn' value='" .
\XoopsLocale::A_PREVIEW .
"' " .
"onclick=\"form_instantPreview('" . XOOPS_URL .
"', '" . $this->
getName() .
"','" . XOOPS_URL .
"/images', " . intval($this->doHtml) .
", '" .
$xoops->security()->createToken() .
"')\"" .
" />";
199 if (empty($js_loaded)) {
201 ?
'<script type="text/javascript">' . $this->js .
'</script>'
202 :
'') .
'<script type="text/javascript" src="' .
\XoopsBaseConfig::get(
'url') .
'/include/formdhtmltextarea.js"></script>';
216 $textarea_id = $this->
getName();
217 $code =
"<a name='moresmiley'></a>";
220 $code .=
"<img src='" .
\XoopsBaseConfig::get(
'url') .
"/images/imgsrc.gif' alt='" .
\XoopsLocale::IMAGES .
"' title='" .
\XoopsLocale::IMAGES .
"' onclick='xoopsCodeImg(\"{$textarea_id}\", \"" . htmlspecialchars(\
XoopsLocale::ENTER_IMAGE_URL, ENT_QUOTES) .
"\", \"" . htmlspecialchars(\
XoopsLocale::ENTER_IMAGE_POSITION, ENT_QUOTES) .
"\", \"" . htmlspecialchars(\
XoopsLocale::IMAGE_POSITION_DESCRIPTION, ENT_QUOTES) .
"\", \"" . htmlspecialchars(\
XoopsLocale::E_ENTER_IMAGE_POSITION, ENT_QUOTES) .
"\", \"" . htmlspecialchars(\
XoopsLocale::WIDTH, ENT_QUOTES) .
"\");' onmouseover='style.cursor=\"hand\"'/> ";
223 $extensions = array_filter(
$myts->config[
'extensions']);
224 foreach (array_keys($extensions) as $key) {
225 $extension =
$myts->loadExtension($key);
226 @list ($encode,
$js) = $extension->encode($textarea_id);
227 if (empty($encode)) {
238 \Xoops::getInstance()->events()->triggerEvent(
'core.class.xoopsform.formdhtmltextarea.codeicon', array(&
$code, $this));
249 $textarea_id = $this->
getName();
252 $fontStr =
"<script type=\"text/javascript\" language=\"JavaScript\">";
253 $fontStr .=
"var _editor_dialog = ''" .
"+ '<select class=\"span2\" id=\'{$textarea_id}Size\' onchange=\'xoopsSetElementAttribute(\"size\", this.options[this.selectedIndex].value, \"{$textarea_id}\", \"{$hiddentext}\");\'>'";
256 foreach ($localeFontSizes as $_val => $_name) {
257 $fontStr .=
" + '<option value=\'{$_val}\'>{$_name}</option>'";
259 $fontStr .=
" + '</select> '";
260 $fontStr .=
"+ '<select class=\"span2\" id=\'{$textarea_id}Font\' onchange=\'xoopsSetElementAttribute(\"font\", this.options[this.selectedIndex].value, \"{$textarea_id}\", \"{$hiddentext}\");\'>'";
263 $fontarray = !empty($localeFonts) ? $localeFonts :
264 array(
"Arial",
"Courier",
"Georgia",
"Helvetica",
"Impact",
"Verdana",
"Haettenschweiler");
265 foreach ($fontarray as $font) {
266 $fontStr .=
" + '<option value=\'{$font}\'>{$font}</option>'";
268 $fontStr .=
" + '</select> '";
269 $fontStr .=
"+ '<select class=\"span2\" id=\'{$textarea_id}Color\' onchange=\'xoopsSetElementAttribute(\"color\", this.options[this.selectedIndex].value, \"{$textarea_id}\", \"{$hiddentext}\");\'>'";
271 $fontStr .=
"var _color_array = new Array('00', '33', '66', '99', 'CC', 'FF');
272 for(var i = 0; i < _color_array.length; i ++) {
273 for(var j = 0; j < _color_array.length; j ++) {
274 for(var k = 0; k < _color_array.length; k ++) {
275 var _color_ele = _color_array[i] + _color_array[j] + _color_array[k];
276 _editor_dialog += '<option value=\''+_color_ele+'\' style=\'background-color:#'+_color_ele+';color:#'+_color_ele+';\'>#'+_color_ele+'</option>';
280 _editor_dialog += '</select>';";
282 $fontStr .=
"document.write(_editor_dialog); </script>";
292 $fontStr = $fontStr .
"<br />\n{$styleStr} {$alignStr} \n";
303 if ($this->htmlEditor && is_object($this->htmlEditor) && method_exists($this->htmlEditor,
'renderValidationJS')) {
304 if (!isset($this->htmlEditor->isEnabled) || $this->htmlEditor->isEnabled) {
305 return $this->htmlEditor->renderValidationJS();
308 return parent::renderValidationJS();
const F_CURRENT_TEXT_LENGTH
const ENTER_WEBSITE_TITLE
const E_ENTER_IMAGE_POSITION
__construct($caption, $name, $value="", $rows=5, $cols=50, $hiddentext="xoopsHiddenText", $options=array())
const ENTER_IMAGE_POSITION
const IMAGE_POSITION_DESCRIPTION
const CLICK_PREVIEW_TO_SEE_CONTENT