2006-07-22 18:09:48 +02:00
|
|
|
|
<?php
|
2008-03-21 01:27:37 +01:00
|
|
|
|
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
2006-07-22 18:09:48 +02:00
|
|
|
|
*
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
* or see http://www.gnu.org/
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-08-07 08:33:35 +02:00
|
|
|
|
* \file htdocs/lib/doleditor.class.php
|
2009-10-13 23:46:09 +02:00
|
|
|
|
* \brief Classe permettant de g<EFBFBD>rer FCKEditor
|
2008-08-07 08:33:35 +02:00
|
|
|
|
* \version $Id$
|
2006-07-22 18:09:48 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-10-13 23:46:09 +02:00
|
|
|
|
* \class DolEditor
|
|
|
|
|
|
* \brief Classe de gestion de FCKEditor
|
|
|
|
|
|
* \remarks Usage:
|
2008-08-07 08:33:35 +02:00
|
|
|
|
* \remarks $doleditor=new DolEditor('body',$message,320,'toolbar_mailing');
|
|
|
|
|
|
* \remarks $doleditor->Create();
|
|
|
|
|
|
*/
|
2006-07-22 18:09:48 +02:00
|
|
|
|
class DolEditor
|
|
|
|
|
|
{
|
|
|
|
|
|
var $editor;
|
2009-01-31 03:55:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
2006-07-22 18:09:48 +02:00
|
|
|
|
/**
|
|
|
|
|
|
\brief DolEditor
|
2006-08-07 04:20:57 +02:00
|
|
|
|
\param htmlname Nom formulaire html WYSIWIG
|
2009-10-13 23:46:09 +02:00
|
|
|
|
\param content Contenu <EFBFBD>dition WYSIWIG
|
|
|
|
|
|
\param height Hauteur en pixel de la zone <EFBFBD>dition
|
|
|
|
|
|
\param toolbarname Nom barre de menu <EFBFBD>diteur
|
2009-01-31 03:55:32 +01:00
|
|
|
|
\param toolbarlocation Emplacement de la barre de menu :
|
2009-10-13 23:46:09 +02:00
|
|
|
|
'In' chaque fen<EFBFBD>tre d'<27>dition a <20>a propre barre d'outils
|
|
|
|
|
|
'Out:nom' partage de la barre d'outils o<> 'nom' est le nom du DIV qui affiche la barre
|
|
|
|
|
|
\param toolbarstartexpanded visible ou non au d<EFBFBD>marrage
|
2007-05-21 01:25:50 +02:00
|
|
|
|
\param modulepart modulepart pour protection wrapper download viewimage
|
|
|
|
|
|
*/
|
2007-05-21 01:53:09 +02:00
|
|
|
|
function DolEditor($htmlname,$content,$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true)
|
2006-07-22 18:09:48 +02:00
|
|
|
|
{
|
2007-03-18 00:27:09 +01:00
|
|
|
|
global $conf,$langs;
|
2009-01-31 03:55:32 +01:00
|
|
|
|
|
2009-02-20 23:53:15 +01:00
|
|
|
|
dol_syslog("DolEditor::DolEditor modulepart=".$modulepart);
|
2009-01-31 03:55:32 +01:00
|
|
|
|
|
2006-07-22 18:09:48 +02:00
|
|
|
|
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
|
2008-03-21 01:27:37 +01:00
|
|
|
|
|
2009-01-31 03:55:32 +01:00
|
|
|
|
|
2008-03-31 05:31:08 +02:00
|
|
|
|
$content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
|
2009-01-31 03:55:32 +01:00
|
|
|
|
|
2006-07-22 18:09:48 +02:00
|
|
|
|
$this->editor = new FCKeditor($htmlname);
|
2007-03-18 00:27:09 +01:00
|
|
|
|
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
|
2006-07-22 18:09:48 +02:00
|
|
|
|
$this->editor->Value = $content;
|
2007-03-18 00:27:09 +01:00
|
|
|
|
$this->editor->Height = $height;
|
|
|
|
|
|
$this->editor->ToolbarSet = $toolbarname;
|
|
|
|
|
|
$this->editor->Config['AutoDetectLanguage'] = 'true';
|
|
|
|
|
|
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
|
|
|
|
|
|
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
|
2009-01-31 03:55:32 +01:00
|
|
|
|
|
2007-05-21 01:52:04 +02:00
|
|
|
|
// Rem: Le forcage de ces 2 parametres ne semble pas fonctionner.
|
2007-05-21 01:25:50 +02:00
|
|
|
|
// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
|
|
|
|
|
|
// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
|
2007-05-21 01:52:04 +02:00
|
|
|
|
$modulepart='fckeditor';
|
|
|
|
|
|
$this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&file=';
|
2008-05-02 11:23:36 +02:00
|
|
|
|
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ;
|
2007-05-21 01:52:04 +02:00
|
|
|
|
|
|
|
|
|
|
$this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false');
|
|
|
|
|
|
$this->editor->Config['ImageBrowser']=($uselocalbrowser?'true':'false');
|
|
|
|
|
|
|
2007-03-18 00:27:09 +01:00
|
|
|
|
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'))
|
|
|
|
|
|
{
|
|
|
|
|
|
$this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js';
|
|
|
|
|
|
$this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/';
|
2008-08-07 08:33:35 +02:00
|
|
|
|
}
|
2006-07-22 18:09:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2008-08-07 08:33:35 +02:00
|
|
|
|
* \brief Show edit area
|
|
|
|
|
|
*/
|
2006-07-22 18:09:48 +02:00
|
|
|
|
function Create()
|
|
|
|
|
|
{
|
|
|
|
|
|
$this->editor->Create();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|