38 require_once realpath(dirname(__FILE__)).
"/../field_renderers.inc";
66 $this->hideStyleBar =
$parent->HTMLEditorHideStyleBar;
67 $this->width =
$parent->HTMLEditorDefaultWidth;
68 $this->height =
$parent->HTMLEditorDefaultHeight;
69 $this->annotateBefore =
true;
74 $this->rteParams[$key] = $value;
79 return $this->rteParams[$key];
86 if ($this->parent->readOnlyForm || $this->parent->isReadOnly($field)
87 || array_key_exists($field, $this->parent->hidden))
return "";
89 global $tiny_mce_application_plugins;
90 global $tiny_mce_application_toolbar_section;
91 global $tiny_mce_application_context_menu_section;
92 global $tiny_mce_content_css;
93 global $tiny_mce_body_class;
95 $plugins =
"advlist,lists,code,visualblocks,table,charmap,paste,contextmenu,searchreplace,fullscreen";
96 if ($tiny_mce_application_plugins) $plugins .=
",".$tiny_mce_application_plugins;
97 $contextMenu =
"cut copy paste pastetext searchreplace removeformat | {$tiny_mce_application_context_menu_section} inserttable cell row column deletetable";
98 $toolbar =
"undo redo | cut copy paste pastetext searchreplace | styleselect | bold italic removeformat | bullist numlist outdent indent | table charmap | {$tiny_mce_application_toolbar_section} code visualblocks fullscreen";
106 $https = Fakoli::checkSSL();
108 $protocol = $https ?
"https" :
"http";
112 if ($this->rootBlock !=
"p")
114 if (!$this->rootBlock)
120 $this->
setRTEParam(
"forced_root_block", $this->rootBlock);
124 $baseURL = ($this->baseURL !==
null) ? $this->baseURL :
"{$protocol}://{$config['http_host']}";
125 if (isset($config[
"convertURLs"]))
138 <script type=
'text/javascript'>
139 tinymce.baseURL =
"<?echo $protocol?>://<?echo $config['http_host']?>/fakoli/tinymce/";
145 $cssFiles = explode(
"\n", str_replace(
"\r",
"", $tiny_mce_content_css));
146 if (count($cssFiles) > 0)
157 $w = substr($this->width, 0, -2);
164 $h = substr($this->height, 0, -2);
169 $this->
setRTEParam(
"selector",
"#{$this->parent->id}_{$field}");
173 $this->
setRTEParam(
"body_class", $tiny_mce_body_class);
181 if ($this->customConfig) call_user_func($this->customConfig, $this);
183 <script type=
'text/javascript'>
187 echo $this->renderParameters();
194 private function renderParameters()
197 foreach($this->rteParams as $key => $value)
199 if (is_array($value))
201 $v =
"['".implode(
"','", $value).
"']";
202 $params[] =
"\t\t\t$key: $v";
204 else if (is_bool($value))
206 $v = $value ?
"true" :
"false";
207 $params[] =
"\t\t\t$key: $v";
209 else if (is_numeric($value))
211 $params[] =
"\t\t\t$key: $value";
215 $params[] =
"\t\t\t$key: '$value'";
219 return implode(
",\n", $params);
226 echo
"theEditors.$editor.addToolbarButton('{$button['name']}', '{$button['image']}', '{$button['tooltip']}', '{$button['url']}', '{$button['width']}', '{$button['height']}');\n";
230 echo
"theEditors.$editor.addToolbarButton('{$button['name']}', '{$button['image']}', '{$button['tooltip']}', {$button['handler']});\n";
236 echo
"theEditors.$editor.overrideToolbarButton('{$button['name']}', {$button['handler']});\n";
241 if ($this->parent->readOnlyForm || $this->parent->isReadOnly($field) || array_key_exists($field, $this->parent->hidden))
return "";
242 echo
"<div id='{$field}_container'></div>";
246 echo
"<textarea id='{$this->parent->id}_{$field}' name='{$field}' style='width: {$this->width}; height: {$this->height}' class='richtext'>".htmlSafe($this->parent->data->get($field)).
"</textarea>\n";
255 echo $this->parent->data->get($field);
265 if ($mode ==
"range")
267 $from = $this->parent->params->get($field,
"from");
268 $to = $this->parent->params->get($field,
"to");
272 echo
"<td>From <input type='text' name='$field:from' value='{$from}' size='25'> to <input type='text' name='$field:to' value='{$to}' size='25'></td>\n";
277 $value = $this->parent->params->get($field, $mode);
280 echo
"<td><input type='text' name='$field:$mode' value='{$value}' size='50'></td>\n";
288 if ($this->parent->isReadOnly($field))
return "";
290 $editor = $field.
"_editor";
FieldRenderer is the abstract base class for all FieldRenderers.
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
_printLabel($field, $colspan=1, $styles="", $annotation="")
Internal method to generate the HTML for the field label.
FieldRenderer($parent)
Constructor.
Field renderer for HTML data fields.
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
HTMLFieldRenderer(&$parent)
addEditorButton($editor, $button)
renderSearchField($field, $mode="equal")
FieldRenderers must override this method to provide the HTML implementation of the control displayed ...
static $_includedRTEScript
renderOnSubmitHandler($field)
FieldRenderers can override this method to provide any Javascript that must be executed when the form...
renderScript($field)
FieldRenderers can override this method to provide any Javascript that their control requires for an ...
setRTEParam($key, $value)
overrideEditorButton($editor, $button)
endsWith($text, $end)
Tests whether a string ends with the given sub-string.