Differences
This shows you the differences between two versions of the page.
Last revisionBoth sides next revision | |||
en:entwickler:javascript-editor_integrieren [2015/11/04 21:38] – created thomas-rcv | en:entwickler:javascript-editor_integrieren [2016/12/03 15:09] – codestyle and typos ximex | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Integrate | + | ====== Integrate |
With Admidio 2.3 the CKEditor is included as the standard. This can now be installed with simple methods in a script. | With Admidio 2.3 the CKEditor is included as the standard. This can now be installed with simple methods in a script. | ||
Line 5: | Line 5: | ||
===== Install editor in a form ===== | ===== Install editor in a form ===== | ||
The installation into a form has become very easy since version 3.0. | The installation into a form has become very easy since version 3.0. | ||
- | Normally it should have been created with a form of class [[http:// | + | Normally it should have been created with a form of class [[https:// |
<code php> | <code php> | ||
- | Now you can at call the matheod | + | Now you can at call the method |
<code php> | <code php> | ||
===== Storing the contents ===== | ===== Storing the contents ===== | ||
- | If the contents of the editor shall be saved about an object or derived object of **Table Access** - class, it must be deposited an exception in the methods **getValue** and **setValue** for the editor field. This prevents the HTML content is removed from the editor again. <code php> public function getValue($field_name, | + | If the contents of the editor shall be saved about an object or derived object of **Table Access** - class, it must be deposited an exception in the methods **getValue** and **setValue** for the editor field. This prevents the HTML content is removed from the editor again. <code php> public function getValue($field_name, |
{ | { | ||
- | if($field_name | + | if ($fieldName === ' |
{ | { | ||
$value = $this-> | $value = $this-> | ||
Line 19: | Line 19: | ||
else | else | ||
{ | { | ||
- | $value = parent:: | + | $value = parent:: |
} | } | ||
Line 25: | Line 25: | ||
} | } | ||
| | ||
- | public function setValue($field_name, $field_value, $check_value | + | public function setValue($fieldName, $fieldValue, $checkValue |
{ | { | ||
- | if($field_name | + | if ($fieldName === ' |
{ | { | ||
- | return parent:: | + | return parent:: |
} | } | ||
- | return parent:: | + | return parent:: |
}</ | }</ | ||
| | ||
===== Validation of the HTML content ===== | ===== Validation of the HTML content ===== | ||
- | Because only HTML code is passed using the editor, this has yet to be validated before being stored in the database. For this purpose Admidio uses the script htmLawed. This must be integrated into the script that processes the inputs of the editor: <code php> require_once (' | + | Because only HTML code is passed using the editor, this has yet to be validated before being stored in the database. For this purpose Admidio uses the script htmLawed. This must be integrated into the script that processes the inputs of the editor: <code php> |
===== Enable image upload ===== | ===== Enable image upload ===== | ||
- | If the editor instance shall allow the upload of images, so it must be specified in the upload script | + | If the editor instance shall allow the upload of images, so it must be specified in the upload script a folder name for a folder within **adm_my_files**. Proceed this by calling the script **adm_program/ |
{ | { | ||
$folderName = ' | $folderName = ' | ||
Line 44: | Line 44: | ||
===== Skip the HTML code-Check ===== | ===== Skip the HTML code-Check ===== | ||
- | The final step in the integration of the editor, the system-wide check of all passed variables for Html code must be deactivated for the id of the editor-field. For this purpose, the function **admStrStripTagsSpecial** must be supplemented. <code php> if($key != ' | + | The final step in the integration of the editor, the system-wide check of all passed variables for Html code must be deactivated for the id of the editor-field. For this purpose, the function **admStrStripTagsSpecial** must be supplemented. <code php>if ($key !== ' |
{ | { | ||
$srcArray[$key] = strStripTags($value); | $srcArray[$key] = strStripTags($value); |