widgEditor WYSIWYG module
Posted: Thu May 19, 2005 4:46 pm
Just created a moule using widgEditor ... if anybody is interested in testing it, just follow these steps:
1. download a copy of Cameron Adams 'widgEditor' at http://www.themaninblue.com/experiment/ ... Editor.zip
2. unzip the package
3. create a file called 'widgEditor.module.php' inside the new folder 'widgEditor'
4. copy the following code and paste it to the newly created file and you are almost done
All you have to do now is to upload the files to your server, install them via module/plugins-dialogue in admin panel and set the preferences to use this WYSIWYG editor. Should work, but I am not really a good coder so there might be some glitches ... comments are welcome, improvements as well.
I should probably mention that I am NOT the author of this pretty cool WYSIWYG editor ... I just adopted it for CMSMS.
Regards,
Nils
1. download a copy of Cameron Adams 'widgEditor' at http://www.themaninblue.com/experiment/ ... Editor.zip
2. unzip the package
3. create a file called 'widgEditor.module.php' inside the new folder 'widgEditor'
4. copy the following code and paste it to the newly created file and you are almost done
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Simon Brown (simon@uptoeleven.ws)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#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
#
#$Id$
#
#TODO - install and uninstall, activate and deactivate, choose non-wysiwyg to actually work
class widgEditor extends CMSModule
{
function GetName()
{
return 'widgEditor';
}
function IsPluginModule()
{
return true;
}
function HasAdmin()
{
return false;
}
function GetVersion()
{
return '1.0';
}
function IsWYSIWYG() {
return true;
}
function WYSIWYGTextarea($name='textarea',$columns='80',$rows='15',$encoding='',$content='',$stylesheet='/modules/widgEditor/basic.css')
{
global $gCms;
$rows = $rows + 10;
if ($stylesheet != '')
{
$gCms->variables['widgeditor_stylesheet'] = $stylesheet;
}
if (!array_key_exists('widgeditor_textareas', $gCms->variables))
{
$gCms->variables['widgeditor_textareas'] = array();
}
array_push($gCms->variables['widgeditor_textareas'], $name);
return '<textarea id="'.$name.'" name="'.$name.'" columns="'.$columns.'" rows="'.$rows.'" class="widgEditor nothing">'.cms_htmlentities($content,ENT_NOQUOTES,get_encoding($encoding)).'</textarea>';
}
function WYSIWYGGenerateHeader()
{
global $gCms;
if (array_key_exists('widgeditor_textareas', $gCms->variables))
{
?>
<style type="text/css" media="all">
@import "<?php echo $gCms->config["root_url"]?>/modules/widgEditor/css/info.css";
@import "<?php echo $gCms->config["root_url"]?>/modules/widgEditor/css/main.css";
@import "<?php echo $gCms->config["root_url"]?>/modules/widgEditor/css/widgEditor.css";
</style>
<__script__ type="text/javascript" src="<?php echo $gCms->config["root_url"]?>/modules/widgEditor/scripts/widgEditor.js"></__script>
<?php
}
}
function GetHelp($lang='en_US')
{
return "
<h3>What does this do?</h3>
<p>This is a very handy WYSIWYG editor with only little features for authors that should not mess with the layout and/or source code.</p>
<h3>How do I use it?</h3>
<p>Install it, then go to User Preferences and select widgEditor as your WYSIWYG editor. Now go back to your content and edit it using widgEditor.</p>
<p>With widgEditor you can:</p>
<ul>
<li>create headlines & paragraphs</li>
<li>make text bold or italic</li>
<li>create links</li>
<li>insert images</li>
<li>edit the source-code</li>
</ul>
<p>If you are using stylsheets to design your website, those relevant for links, headings and paragraphs will automatically applied.</p>
";
}
function GetAuthor()
{
return 'Cameron Adams';
}
function GetAuthorEmail()
{
return '2005@themaninblue.com';
}
function GetChangeLog()
{
?>
<ul>
<li>
<p>Version: 1.0</p>
<p>widgEditor WYSIWYG textarea replacement tool</p>
</li>
<li>
<p>Author: Cameron Adams aka themaninblue.com</p>
</li>
</ul>
<?php
}
}
# vim:ts=4 sw=4 noet
?>
I should probably mention that I am NOT the author of this pretty cool WYSIWYG editor ... I just adopted it for CMSMS.
Regards,
Nils