--- /dev/null
+Name: ckeditor
+Version: 3.5.3
+Release: 0
+Summary: WYSIWYG Text and HTML Editor for the Web
+License: GPL
+Group: Development/Tools
+URL: http://ckeditor.com/
+Packager: Alain Peyrat <alain.peyrat@alcatel-lucent.com>
+Source0: %{name}_%{version}.tar.gz
+BuildRoot: /var/tmp/%{name}-buildroot
+BuildArch: noarch
+AutoReqProv: no
+
+%define debug_package %{nil}
+
+%description
+CKEditor is a text editor to be used inside web pages. It's a WYSIWYG
+editor, which means that the text being edited on it looks as similar
+as possible to the results users have when publishing it. It brings
+to the web common editing features found on desktop editing applications
+like Microsoft Word and OpenOffice.
+
+%prep
+
+%setup -c -n %{name}-%{version}
+
+cat > ckeditor.conf <<'EOF'
+Alias /%{name}/ %{_datadir}/%{name}/
+<Directory %{_datadir}/%{name}/>
+ Allow from all
+</Directory>
+EOF
+
+%build
+
+%install
+%{__rm} -rf %{buildroot}
+%{__install} -d -m0755 %{buildroot}%{_datadir}/
+%{__cp} -ar * %{buildroot}%{_datadir}/
+%{__install} -d %{buildroot}%{_sysconfdir}/httpd/conf.d/
+%{__mv} %{buildroot}%{_datadir}/ckeditor.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%files
+%defattr(-, root, root, 0755)
+%{_datadir}/%{name}
+%{_sysconfdir}/httpd/conf.d/ckeditor.conf
+
+%changelog
+* Mon Apr 18 2011 Alain PEYRAT <alain.peyrat@alcatel-lucent.com> - 3.5.3-0
+- Updated for 3.5.3
+
+* Mon Apr 04 2011 Alain PEYRAT <alain.peyrat@alcatel-lucent.com> - 3.5.2-0
+- Initial package.
--- /dev/null
+<?php
+/**
+ * FusionForge Plugin CKeditor Plugin Class
+ *
+ * Copyright 2011 (c) Alcatel-Lucent
+ *
+ * This file is part of FusionForge-plugin-ckeditor
+ *
+ * FusionForge-plugin-ckeditor 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.
+ *
+ * FusionForge-plugin-ckeditor 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 FusionForge-plugin-ckeditor; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
+ *
+ */
+
+/**
+ * The ckeditorPlugin class. It implements the Hooks for the presentation
+ * of the text editor whenever needed
+ *
+ */
+
+class ckeditorPlugin extends Plugin {
+
+ var $toolBar = array();
+
+ function ckeditorPlugin () {
+ $this->Plugin() ;
+ $this->name = "ckeditor" ;
+ $this->text = _("HTML editor (ckeditor)");
+ $this->hooks[] = "user_create";
+ $this->hooks[] = "userisactivecheckbox";
+ $this->hooks[] = "userisactivecheckboxpost";
+ $this->hooks[] = "text_editor";
+
+ // Toolbar
+ $this->toolBar['complete'] = array(
+ array('Source','-','Cut','Copy','Paste','-','SpellChecker','Scayt'),
+ array('Undo','Redo','-','Find','Replace'),
+ array('JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'),
+ array('Outdent','Indent'),
+ array('Maximize','-','About'),
+ '/',
+ array('Bold','Italic','Underline','Strike','-','Subscript','Superscript'),
+ array('Format','FontSize'),
+ array('TextColor','BGColor'),
+ array('NumberedList','BulletedList'),
+ array('Link','Unlink','Anchor'),
+ array('Table','HorizontalRule','Smiley','SpecialChar','PageBreak')
+ );
+ $this->toolBar['fusionforge-basic'] = array(
+ array('Source'),
+ array('JustifyLeft','JustifyCenter'),
+ array('Bold','Italic','Underline','Strike'),
+ array('Format'),
+ array('TextColor','BGColor'),
+ array('NumberedList','BulletedList'),
+ array('Link','Unlink'),
+ array('Table','HorizontalRule')
+ );
+ }
+
+ /**
+ * The function to be called for a Hook
+ *
+ * @param String $hookname The name of the hookname that has been happened
+ * @param String $params The params of the Hook
+ *
+ */
+ function CallHook ($hookname, &$params) {
+ global $group_id;
+
+ if ($hookname == "user_create") {
+ // Activate the plugin by default for new user.
+ $params['user']->setPluginUse ( $this->name );
+ } elseif ($hookname == "text_editor") {
+ // Check if activated as user side.
+ if (session_loggedin()) {
+ $user = session_get_user();
+ if ($user->usesPlugin ( $this->name )) {
+ return $this->displayCKeditorArea($params);
+ }
+ }
+ }
+ }
+
+ private function displayCKeditorArea(&$params) {
+ $name = isset($params['name'])? $params['name'] : 'body';
+ if (file_exists ("/usr/share/ckeditor/ckeditor.php")) {
+ require_once("/usr/share/ckeditor/ckeditor.php");
+ $editor = new CKeditor($name) ;
+ $editor->basePath = util_make_uri('/ckeditor/');
+ } else {
+ include_once $GLOBALS['gfplugins'].'ckeditor/www/ckeditor.php';
+ if (class_exists('CKeditor')) {
+ $editor = new CKeditor($name) ;
+ $editor->basePath = util_make_uri('/plugins/' . $this->name . '/');
+ } else {
+ $this->setError("Unable to activate ckeditor plugin, package ckeditor not found.");
+ return false;
+ }
+ }
+ if (isset($params['width'])) $editor->config['width'] = $params['width'];
+ if (isset($params['height'])) $editor->config['height'] = $params['height'];
+ if (isset($params['toolbar']) && array_key_exists(strtolower($params['toolbar']), $this->toolBar)) {
+ $editor->config['toolbar'] = $this->toolBar[strtolower($params['toolbar'])];
+ } else {
+ $editor->config['toolbar'] = $this->toolBar['complete'];
+ }
+ $editor->returnOutput = true;
+ $h = '<input type="hidden" name="_'.$name.'_content_type" value="html" />'."\n";
+ $h .= $editor->editor($name, $params['body']) ;
+
+ // If content is present, return the html code in content.
+ if (isset($params['content'])) {
+ $params['content'] = $h;
+ } else {
+ $GLOBALS['editor_was_set_up'] = true;
+ echo $h ;
+ }
+ }
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>