3 * GForge Plugin FCKeditor Plugin Class
5 * Copyright 2005 (c) Daniel A. PĂ©rez <daniel@gforgegroup.com> , <danielperez.arg@gmail.com>
7 * This file is part of GForge-plugin-fckeditor
9 * GForge-plugin-fckeditor is free software; you can redistribute it
10 * and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * GForge-plugin-fckeditor is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 * See the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GForge-plugin-fckeditor; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
26 * The fckeditorPlugin class. It implements the Hooks for the presentation
27 * of the text editor whenever needed
31 require_once($GLOBALS['sys_plugins_path']."fckeditor/www/fckeditor.php");
33 class fckeditorPlugin extends Plugin {
34 function fckeditorPlugin () {
36 $this->name = "fckeditor" ;
37 $this->text = "FCKeditor";
38 $this->hooks[] = "groupisactivecheckbox";
39 $this->hooks[] = "groupisactivecheckboxpost";
40 $this->hooks[] = "text_editor"; // shows the editor
44 * The function to be called for a Hook
46 * @param String $hookname The name of the hookname that has been happened
47 * @param String $params The params of the Hook
50 function CallHook ($hookname, $params) {
51 global $group_id,$Language, $G_SESSION, $HTML,$sys_default_domain ;
52 if ($hookname == "groupisactivecheckbox") {
53 //Check if the group is active
54 $group = &group_get_object($group_id);
57 echo ' <input type="CHECKBOX" name="use_fckeditorplugin" value="1" ';
58 // Checked or Unchecked?
59 if ( $group->usesPlugin ( $this->name ) ) {
65 echo "<strong>".$this->text." Plugin</strong>";
68 } elseif ($hookname == "groupisactivecheckboxpost") {
69 $group = &group_get_object($group_id);
70 if ( getStringFromRequest('use_fckeditorplugin') == 1 ) {
71 $group->setPluginUse ( $this->name );
73 $group->setPluginUse ( $this->name, false );
75 } elseif ($hookname == "text_editor") {
76 $group_id=$params['group']; // get the project id
77 $project = &group_get_object($group_id);
78 if ( (!$project) || (!is_object($project)) || ($project->isError()) || (!$project->isProject()) ) {
81 if ( $project->usesPlugin ( $this->name ) ) { // only if the plugin is activated for the project show the fckeditor box
82 if (strtoupper(getStringFromServer('HTTPS')) == 'ON') {
87 if ($params['name']) {
88 $oFCKeditor = new FCKeditor($params['name']) ;
90 $oFCKeditor = new FCKeditor('body') ;
92 $oFCKeditor->BasePath = $http . $sys_default_domain . '/plugins/' . $this->name . '/';
93 $oFCKeditor->Value = $params['body']; // this is the initial text that will be displayed (if any)
94 $oFCKeditor->Width = $params['width'];
95 $oFCKeditor->Height = $params['height'];
96 $oFCKeditor->ToolbarSet = "GForge";
97 $oFCKeditor->Create() ;
98 $GLOBALS['editor_was_set_up'] = true;
108 // c-file-style: "bsd"