FCKeditor

Uit DeVliegendeWiki

Ga naar: navigatie, zoeken

FCKeditor is een WYSYWIG-editor voor oa. Drupal. Het lijkt de meestgebruikte UZWUK-editor te zijn voor Drupal, te oordelen aan de hoge positie op drupalmodules. Het is vervangen door de CKeditor-module.

Inhoud

$cookie_domain

FCKeditor is los van Drupal ontwikkeld, en integreert daardoor beperkt. Een voorbeeld daarvan is sessiebeheer. Op het moment dat je Quick uploads enabled, heeft de FCKeditor cookies nodig om state te behouden. In settings.php staat ergens:

/**
 * Drupal automatically generates a unique session cookie name for each site
 * based on on its full domain name. If you have multiple domains pointing at
 * the same Drupal site, you can either redirect them all to a single domain
 * (see comment in .htaccess), or uncomment the line below and specify their
 * shared base domain. Doing so assures that users remain logged in as they
 * cross between your various domains.
 */
# $cookie_domain = 'example.com';

Van deze laatste regel moet je het commentaar-teken weglaten, en het domein invullen waar de site draait. Overigens: Ik betwijfel of de actuele domeinnaam echt belangrijk is. Oftewel: Als je op een ontwikkelserver al de domeinnaam van de productieserver invult, is er waarschijnlijk niets aan de hand.

Ik heb ervaren dat de admin-login niet meer herkend werd na deze aanpassing. De mogelijkheid om per e-mail een nieuw wachtwoord aan te vragen, loste dit probleem op.

Bronnen

Code die automatisch toegevoegd wordt

Zucht: http://groups.drupal.org/node/94044

Installatie

  1. Download vanaf drupal.org bestanden en plaats die op de gebruikelijke locatie (sites/default/modules/fckeditor);
  2. Download vanaf ckeditor.com de FCKeditor-plugin (niet de ckeditor-plugin), en plaats die binnen de fckeditor-map, dus sites/default/modules/fckeditor/fckeditor);

Vervolgens werkt de FCKEditor meestal direct. Overigens: Er bestaan uitgebreide configuratiemogelijkheden, onder andere indien je gebruik wilt maken van de Built-in Browser of Quick Uploads. Zie elders op deze pagina voor details hieromtrent.

Uiteindelijk moet je de volgende bestandsstructuur hebben:

/sites/all/modules/fckeditor:

fckeditor/
   _samples/
   editor/
   _documentation.html
   _upgrade.html
   _whatsnew_history.html
   COPY_HERE.txt
   fckeditor.js
   fckeditor.asp
   fckeditor.cfc
   fckeditor.cfm
   fckeditor.js
   fckeditor.lasso
   fckeditor.php
   fckeditor.pl
   fckeditor.py
   fckeditor_php4.php
   fckeditor_php5.php
   fckpackager.xml
   fckstyles.xml
   fcktemplates.xml
   fckutils.cfm
   licence.txt
plugins/
  drupalbreak/
  drupalpagebreak/
  imgassist/
  linktomenu/
  linktonode/
translations/
  cs.po
  de.po
  fckeditor.pot
  fi.po
  hu.po
  sv.po
.cdsignore
CHANGELOG.txt
fckeditor.config.js
fckeditor.css
fckeditor.info
fckeditor.install
fckeditor.module
fckeditor.popup.html
fckeditor.popup.js
fckeditor.utils.js
filemanager.config.php
img_assist_fckeditor.js
LICENCE.txt
README.txt
TROUBLESHOOTING.txt

Aanvullende gegevens:

  • FCKEditor vs. TinyMCE vs. Yahoo (YUI): FCKEditor lijkt net iets beter en veelzijdiger te zijn
  • Zie ook de Wysiwyg module
  • Op Drupalmodules.com/top-favorites staat FCKEditor in de top-10 terwijl TinyMCE ergens rond de zestigste plaats staat (september 2009)
  • FCKeditor formatteert altijd de input, oa. door
    <p></p>
    -tags om de input te zetten. Op het moment dat je ergens editor-achtige input moet geven, zoals '*' voor een filter, moet je eerst overschakelen naar source

Een enkele keer heb ik meegemaakt dat het aantal knoppen in de toolbar vermindert was. Dat heb ik kunnen oplossen door

Administer > Site configuration > FCKeditor setting > Profiles: Advanced > edit > Editor appearance > Toolbar: DrupalFull

te kiezen.

Daarnaast kan het voorkomen dat access fckeditor uitgeschakeld staat voor bv. authenticated users. Ga naar

Administer > User management: fckeditor module

om dit aan te passen.

Een probleem dat veelvuldig voorkomt: Bij gebruik van een aangepast theme wijkt de vormgeving van de FCKeditor nogal af. In het bijzonder: (1) Het lettertype is veel te groot en (2) de achtergrondkleur van het invoervak is niet handig.

Volgens http://drupal.fckeditor.net/tricks moet je daarvoor bestand

sites/default/modules/fckeditor/fckeditor.config.js

aanpassen en van drie extra regels voorzien. Als ik dat deed, was de tekst in het invoervak op een rare manier ingesprongen. Ik heb wel lettergrootte en achtergrondkleur kunnen aanpassen door alleen de laatste regel toe te voegen. De totale toevoeging werd daardoor:

/ Eigen toevoegingen
//
// Bron: http://drupal.fckeditor.net/tricks
//
// Strompf, dec. 2009
// FCKConfig.BodyId = "primary";
// FCKConfig.BodyClass = "singlepage";

FCKConfig.EditorAreaStyles = "body{background:#FFFFFF;text-align:left;font-size:0.8em}";

Quick Uploads

Standaard zijn uploads niet toegestaan. De FCKeditor biedt twee mogelijkheden: De Built-in Browser en Quick Uploads. Om Quick Uploads te activeren, ga naar:

Administer > Site configuration > FCKeditor > Advanced:edit > File browser settings > Allow quick uploads: Yes

Er zijn standaard twee profielen beschikbaar: Default en Advanced. Op dit moment weet ik niet wat daar het nut van is, maar om speciaal een profiel te verwijderen, lijkt me ook overkill. In de praktijk gebruik ik alleen het advanced-profiel.

Waarschijnlijk moet je daarna nog twee instellingen verzorgen, die elders op deze pagina behandeld worden:

  • $Cookie_domain instellen;
  • 'Require_once' instellingen.

Beide zaken worden je vanzelf duidelijk dankzij foutmeldingen op het Statusscherm.

README.txt

Het README.txt-bestand staat in de root van de FCKeditor-mappenstructuur.

$Id: README.txt,v 1.16.2.5.2.17 2010/01/30 18:33:28 jorrit Exp $

CONTENTS OF THIS FILE
---------------------

 * Overview
 * Required components
 * More information and licence
 * Requirements
 * Configuration
 * Installation troubleshooting
 * Plugins: Teaser break and Pagebreak
 * Uploading images and files
 * How to enable the built-in file browser
 * Modules: Image Assist
 * Modules: Link to content (EXPERIMENTAL)
 * Upgrading instructions
 * Help & Contribution
 * Credits

Overview
--------
This module allows Drupal to replace textarea fields with the
FCKeditor.
This HTML text editor brings many of the powerful functions of known
desktop editors like Word to the web. It's relatively lightweight and
doesn't require any kind of installation on the client computer.

Required components
-------------------
To use FCKeditor in Drupal, you will need to download the FCKeditor
http://ckeditor.com/download
Make sure you download FCKeditor, not CKEditor. If you would like to
use CKEditor with Drupal, please visit
http://drupal.org/project/ckeditor

More information and licence
----------------------------
FCKeditor - The text editor for internet
Copyright (C) 2003-2008 Frederico Caldeira Knabben

Licensed under the terms of the GNU Lesser General Public License:
    http://www.opensource.org/licenses/lgpl-license.php

For further information visit:
    http://ckeditor.com
    http://drupal.fckeditor.net

Requirements
------------
  - Drupal 6.x
  - PHP 4.3.0 or greater
  - FCKeditor 2.5.x or greater
    Download FCKeditor (not CKeditor) from http://ckeditor.com/download

Configuration
-------------------
Note: this instruction assumes that you install FCKeditor in
      sites/all/modules directory (recommended).

   1. Unzip the files in the sites/all/modules directory. It should now
      contain a fckeditor directory.
   2. Download FCKeditor from http://ckeditor.com/download. Unzip the
      contents of the fckeditor directory in the
      sites/all/modules/fckeditor/fckeditor directory.
   3. Enable the module as usual from Drupal's admin pages.
   4. Grant permissions for use of FCKeditor in
      "Administer > User Management > Permissions"
      Note: to enable the file browser, read also the
            "How to enable the file browser" section.
   5. Under "Administer > Site configuration > FCKeditor", adjust
      the fckeditor profiles. In each profile you can choose which textareas
      will be replaced by FCKeditor, select default toolbar and configure
      some more advanced settings.
   6. For the Rich Text Editing to work you also need to configure your filters
      for the users that may access Rich Text Editing.
      Either grant those users Full HTML access or use the following tags:
      <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr>
      <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong>
      <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code>
      <cite> <embed> <object> <param> <strike> <caption>.
   7. To have a better control over line breaks, you may disable Line break converter
      in the chosen filter (recommended).
   8. Modify the fckeditor.config.js file to custom your needs (optional).
      You may copy the needed configuration lines from the default FCKeditor
      configuration settings (sites/all/modules/fckeditor/fckeditor/fckconfig.js),
      the lines in fckeditor.config.js will override most settings.
      In fckeditor.config.js you may define your own toolbars with selected buttons.
      WARNING: clear browser's cache after you modify any of the javascript files.
      If you don't do this, you may notice that browser is ignoring all your changes.


Installation troubleshooting
----------------------------
If your FCKeditor does not show you must check if all files are
extracted correctly.
The directory sites/all/modules/fckeditor/fckeditor/ should have the
following files:
   - fckeditor.js
   - fckconfig.js
   - fckstyles.xml
   - fcktemplates.xml
   - fckeditor.php
   - fckeditor_php4.php
   - fckeditor_php5.php
and a directory named editor.

The correct directory structure is as follows:
    modules
       fckeditor
          fckeditor.module
          fckeditor
             _samples
             editor
             COPY_HERE.txt
             fckconfig.js
             ...

If you're still having problems, scroll down to the "Help & Contribution" section.

Plugins: Teaser break and Pagebreak
-----------------------------------
By default, FCKeditor module comes with two plugins that can handle
teaser break (<!--break-->) and pagebreak (<!--pagebreak-->).
You can enable any (or even both) of them.

   1. Open sites/all/modules/fckeditor/fckeditor.config.js and
      uncomment these three lines:

            FCKConfig.PluginsPath = '../../plugins/' ;
            FCKConfig.Plugins.Add( 'drupalbreak' ) ;
            FCKConfig.Plugins.Add( 'drupalpagebreak' ) ;


   2. The second step is to add buttons to the toolbar (in the same file).
      The button names are: DrupalBreak, DrupalPageBreak.
      For example if you have a toolbar with an array of buttons defined
      as follows:

      ['Image','Flash','Table','Rule','SpecialChar']

      simply add those two buttons at the end of array:

      ['Image','Flash','Table','Rule','SpecialChar', 'DrupalBreak', 'DrupalPageBreak']

      (remember about single quotes).
      
    3. Note that the <!--pagebreak--> tag is not supported by default in Drupal.
       You should install the Paging module: http://drupal.org/project/paging
       to enable the <!--pagebreak--> tag support. Please refer to the Paging
       module documentation for detailed installation instructions.

Uploading images and files
--------------------------

There are three ways of uploading files: By using the built-in file browser, 
by using modules like IMCE, Image Browser or by using the core upload module.

How to enable the built-in file browser
------------------------------
The editor gives the end user the flexibility to create a custom file browser
that can be integrated on it.
The included file browser allows users to view the content of a specific
directory on the server and add new content to that directory
(create folders and upload files).

   1. To enable file browsing you need to edit the connector configuration file
      in your fckeditor module directory, the file should be in:

          sites/all/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php

      In this file(s) you will need to enable the file browser by adding one
      line that includes file with the special authentication function for
      Drupal (filemanager.config.php). Add this code:

          require_once '../../../../../filemanager.config.php';

      straight below this line:

          $Config['UserFilesAbsolutePath'] = '' ;

      The config.php file also holds some other important settings, please
      take a look at it and adjust it to your needs (optional).

   2. Locate file named settings.php inside your drupal directory
      (usually sites/default/settings.php) and set $cookie_domain variable to the
      appropriate domain (remember to uncomment that line). If you not do this,
      FCKeditor will claim that file browser is disabled

   3. Enabling file uploads is a security risk. That's why you have to grant a
      separate permission to enable the file browser to certain groups.
      In "Administer > User Management > Permissions" assign the
      "allow fckeditor file uploads" permissions.

   4. Lastly, adjust the File browser settings for each profile: set "File browser type" to "Built-in filebrowser".

Modules: Image Assist
---------------------
Image Assist version 1 and 2 can be integrated with FCKeditor. It is no longer necessary to copy a Javascript file.

Modules: Link to content (EXPERIMENTAL)
---------------------------------------
Link to content module can be integrated with FCKeditor.
ATTENTION: this module is not yet compatible with FCKeditor :(

The unofficial version of Link to content module compatible with FCKeditor can be downloaded here:
     http://drupal.fckeditor.net/download/linktocontent-fckeditor-6.x-2.x-dev.zip

Installation:
Follow the instruction from INSTALL.txt attached to the linktocontent module.
Then do the following steps to add Linktocontent button to the FCKeditor toolbar:

By default, FCKeditor module comes with two plugins that allows you to use linktocontent and linktonode features.
You can enable any (or even both) of them.

   1. Open /drupal/modules/fckeditor/fckeditor.config.js and uncomment these three lines:

            FCKConfig.PluginsPath = '../../plugins/' ;
            FCKConfig.Plugins.Add( 'linktonode', 'en,pl' ) ;
            FCKConfig.Plugins.Add( 'linktomenu', 'en,pl' ) ;

   2. The second step is to add buttons to the toolbar (in the same file).
      The button names are: LinkToNode, LinkToMenu. 
      For example if you have a toolbar with an array of buttons defined as follows:

      ['Link','Unlink','Anchor']

      simply add those two buttons at the end of array (or somewhere in the middle):

      ['Link','Unlink','LinkToNode','LinkToMenu','Anchor']

      (remember about single quotes).


Upgrading instructions
----------------------
This instruction assumes that you are upgrading FCKeditor module [M] and FCKeditor (the editor)[E] at the same time. 
Instructions specific for module upgrades are tagged with [M], steps that must be taken when upgrading FCKeditor (the editor) are marked 
with [E].

   1. [M] Download the latest version of FCKeditor module from http://drupal.org/project/fckeditor (it is advised to read release notes 
      before going further).
   2. [E] Download the latest version of FCKeditor from http://ckeditor.com/download (it is advised to read "what's new" before going 
      further: http://ckeditor.com/whatsnew).
   3. [M] Back up your database.
   4. [EM] Place the site in "Off-line" mode, to let the database updates run without interruption and avoid displaying errors to end 
      users of the site.
   5. [E] If you have used the FCKeditor built-in file browser, make a backup of sites/all/modules/fckeditor/fckeditor/editor/filemanager/
      connectors/php/config.php
   6. [E] If you have configured spellchecker, make a backup of sites/all/modules/fckeditor/fckeditor/editor/dialog/fck_spellerpages/
      spellerpages/server-scripts/spellchecker.php
   7. [E] If you have made any changes inside of sites/all/modules/fckeditor/fckeditor.config.js (or sites/all/modules/fckeditor/
      fckeditor/fckconfig.js), write down your changes and add them again after uploading new files (e.g. own toolbar definitions, re-
      enable a plugin etc.). Try to not make any changes to fckconfig.js and add everything to fckeditor.config.js.
   8. Delete old files:
      [EM]* Simply remove modules/fckeditor directory if upgrading both, the editor and the module. 
      [M] If you are upgrading module only, remember to leave the modules/fckeditor/fckeditor directory. 
      [E] When upgrading the editor, remove contents of modules/fckeditor/fckeditor directory only.
      WARNING: if you don't remove old files and just rename fckeditor directory instead e.g. to fckeditor_old, Drupal may use module from 
      the fckeditor_old directory.
   9. [M] Upload FCKeditor module (extracted files and folders) to sites/all/modules directory.
   10. [E] Upload FCKeditor (extracted files and folders from the fckeditor directory) to sites/modules/fckeditor/fckeditor (i.e. where COPY 
       HERE.txt file exists)
   11. [E] Replace the new config.php (see step 5) file with the old one (or RECOMMENDED way: perform again step with adding require_once 
       '../../../../../filemanager.config.php'; to config.php)
   12. [E] Replace the new spellchecker.php with the old one (see step 6) (or RECOMMENDED way: configure new spellchecker.php following the 
        settings from the old file).
   13. [E] Apply your modifications to default configuration in fckeditor.config.js file (see step 7).
   14. [M] If you're using Image Assist module, copy the new img_assist_fckeditor.js to modules/img_assist folder.
   15. [M] Run update.php.
   16. [EM] Put the site back online.
   
Help & Contribution
-------------------
If you are looking for more information, have any troubles in configuration or if
you found an issue, please visit the official project page:
  http://drupal.org/project/fckeditor

Having problems? Take a look at list of common problems when installing FCKeditor:
  http://drupal.fckeditor.net/troubleshooting

How to tune up FCKeditor to your theme and configure spell checker:
  http://drupal.fckeditor.net/tricks

We would like to encourage you to join our team if you can help in any way.
If you can translate FCKeditor module, please use fckeditor.pot file as a template
(located in "translations" directory) and send us the translated file so that we could attach it.
Any help is appreciated.

Credits
-------
 - FCKeditor for Drupal Core functionality originally written by:
     Frederico Caldeira Knabben
     Jorge Tite (LatPro Inc.)

 - FCKeditor for Drupal 5.x originally written by:
     Ontwerpwerk (www.ontwerpwerk.nl)

 - FCKeditor for Drupal 6.x is currently maintained by CKSource team and Jorrit Schippers.
     http://cksource.com

 - FCKeditor - The text editor for internet
     Copyright (C) 2003-2009 Frederico Caldeira Knabben
     http://ckeditor.com

'Require_once' invoegen

Indien je de Quick Upload-functionaliteit hebt aangezet (en wellicht ook in andere situaties), moet je in bestand

/sites/default/modules/fckeditor/fckeditor/editor/filemanager/connectors/php/config.php

onder de regel

$Config['UserFilesAbsolutePath'] =  ;

invoegen:

require_once '../../../../../filemanager.config.php';

Waarom weet ik ook niet. Zie de README.txt voor details.

Aangezien dit betekent dat je een bestand in een module gaat aanpassen, is het verstandig om naderhand een copie van dat bestand te maken, bv.

config.bk01_Actueel.php

zodat deze instelling niet verloren gaat wanneer je in een ambitieuze bui alle bestanden van de module overschrijft.

Warning file_exists open_basedir

Waarschuwing:

warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/fckstyles.xml) is not 
within the allowed path(s): (/var/www/vhosts/site.xyz/httpdocs:/tmp) in /var/www/vhosts/
site.xyz/httpdocs/domein/sites/default/modules/fckeditor/fckeditor.module on line 786. 

warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/style.css) is not 
within the allowed path(s): (/var/www/vhosts/site.xyz/httpdocs:/tmp) in /var/www/vhosts/site.xyz/httpdocs/
domein/sites/default/modules/fckeditor/fckeditor.module on line 862. 

Oplossing: Vervang de onderste functie in bestand fckeditor.module door de volgende aangepaste versie:

function fckeditor_path_to_theme() {
  global $theme_key;
  static $themepath;
 
  if(empty($themepath) && !empty($theme_key)) {
    $themepath = drupal_get_path('theme', $theme_key);
  }

  // fall back
  if(empty($themepath)) {
    return path_to_theme();
  }
 
  return $themepath;
}

Bron: http://drupal.org/node/701736

Persoonlijke instellingen