phpCollab Community
Discuss everything phpCollab!

The forums are currently in READ-ONLY mode while we upgrade the forums.
Home » Development » Modifications » [MOD] fckeditor html editor integration
[MOD] fckeditor html editor integration [message #7143] Tue, 24 May 2005 13:30 Go to next message
dracono is currently offline  dracono
Messages: 55
Registered: April 2005
Location: Gdynia
phpCollab lover
hello

I have done fckeditor (2.0 Beta 3 verion taken from OpenIT project) html editor integration.
Editor is in the attachment. Unpack it in ../javascript/ directory, edit
fckeditor.js and fckconfig.js if you need and:

1. add new function to ../includes/library.php


# ../includes/library.php
function turnHtmleditorOn($name,$width,$height,$skin,$value) {
$headBonus = '
<script type="text/javascript" src="../javascript/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function() {
var oFCKeditor = new FCKeditor("'.$name.'", "'.$width.'", "'.$height.'", "'.$skin.'", "'.$value.'");
oFCKeditor.ReplaceTextarea() ;
}
</script>';

return $headBonus;
}

[/php:1]

2. add default setting to the ../includes/settings.php


# ../includes/settings.php, anywhere
$enableHtmleditor = "true";
$editorWidth = "700"; # deafault values
$editorHeight = "400";
$editorSkin = "Default";
[/php:1]

3. change convertData function to unparse the html code (is it safe to phpC?)


# ../includes/library.php, inside convertData function, (is it safe for phpC?)
# $data = str_replace('"','&quot;',$data);
# $data = str_replace("'",''',$data);
# $data = str_replace('<','&lt;',$data);
# $data = str_replace('>','&gt;',$data);
[/php:1]
4. Add to every file/form where you want to have fckeditor window


#$bodyCommand = "onLoad=\"document.ptTForm.tpm.focus();\""; # changed

# MOD, use htmleditor, added
if ($enableHtmleditor == "true")
$headBonus=turnHtmleditorOn("TEXT_AREA_NAME",$editorWidth,$editorHeight,$editorSkin,"");
# ---
include('../themes/'.THEME.'/header.php'); # already there

[/php:1]

where TEXT_AREA_NAME is the id of the textarea object.

5. Add to the textrea proper id tag, for example


# ../topics/addpost.php
$block1->contentRow($strings["message"],"<textarea id=\"tpm\" rows=\"10\" style=\"width: 700px; height: 320px;\" name=\"tpm\" cols=\"47\"></textarea>");
[/php:1]


Any comments or suggestions?
I took fckeditor (2.0 Beta 3 v.) from OpenIT because I had learn there how fck works. I tried with new 2.0FC version
and I got some js error... maybe some one found what is the difference.
[MOD] fckeditor html editor integration [message #7146] Tue, 24 May 2005 18:12 Go to previous messageGo to next message
fullo is currently offline  fullo
Messages: 390
Registered: January 2003
Location: faenza (ra)
phpCollab contributor
phpCollab Project Leader

I prefer to not use html inside the task/project textarea, for a single reason:

if you give to a user a editor wysiwyg he/she will use a lot of color, bold, underline, etc, etc, etc. and this is BAD (no more clear pages). Same problems for the clients.. they have not to modify in any way the data showned in the interface.

A good compromise should be enable only some tags, like anchor, strong and emphasis but no more than those.

Btw, I'll use fckeditor to the newsdesk instead the htmlarea
[MOD] fckeditor html editor integration [message #7147] Tue, 24 May 2005 18:28 Go to previous messageGo to next message
dracono is currently offline  dracono
Messages: 55
Registered: April 2005
Location: Gdynia
phpCollab lover
fullo

I prefer to not use html inside the task/project textarea, for a single reason:

if you give to a user a editor wysiwyg he/she will use a lot of color, bold, underline, etc, etc, etc. and this is BAD (no more clear pages). Same problems for the clients.. they have not to modify in any way the data showned in the interface.



Yes, I agree with that but I rather mean using html editor not to make eye-candy content but
to make more structural content (lists and outlines). It is very important thing which couse comunication clear and efficiency.

fullo


A good compromise should be enable only some tags, like anchor, strong and emphasis but no more than those.



Yes, It can be done very well with fck editor. I already done it partly, look at he fckconfig.js.
As I wrote above, I think that the most important are list (<ul> and <ol>) and indentations.

fullo

Btw, I'll use fckeditor to the newsdesk instead the htmlarea


In my opinion in topics it should be used too. Please consider my point of view.
[MOD] fckeditor html editor integration [message #7148] Tue, 24 May 2005 18:46 Go to previous messageGo to next message
fullo is currently offline  fullo
Messages: 390
Registered: January 2003
Location: faenza (ra)
phpCollab contributor
phpCollab Project Leader

for the list we should add a wiki like interpreter... this should also works for the other tags... it's better to not have html inside the data Wink
[MOD] fckeditor html editor integration [message #7149] Tue, 24 May 2005 19:10 Go to previous messageGo to next message
dracono is currently offline  dracono
Messages: 55
Registered: April 2005
Location: Gdynia
phpCollab lover
fullo

for the list we should add a wiki like interpreter... this should also works for the other tags... it's better to not have html inside the data Wink


I have to disagree with it Smile. Wiki like is good for us, computing specialists, but project management
gathers different people, for example specialists from branding and marketing department, few VIPs, engineeirs, and so on,
as in case of project in which I am involved in my company. There is no way to teach non technical oriented people (or even non computing oriented) to use
wiki syntax. But with editor they see icons like in theirs Words, and every body are happy Smile.

If you/we want to make phpC seriuos project management tool it should be intuitive and
efficient.

Good compromise it is to hack fckeditor to be wiki like syntax (non html) editor. But user
should know anything about it.
Re: [MOD] fckeditor html editor integration [message #7154] Wed, 25 May 2005 15:00 Go to previous messageGo to next message
dracono is currently offline  dracono
Messages: 55
Registered: April 2005
Location: Gdynia
phpCollab lover
dracono



4. Add to every file/form where you want to have fckeditor window



#$bodyCommand = "onLoad=\"document.ptTForm.tpm.focus();\""; # changed

# MOD, use htmleditor, added
if ($enableHtmleditor == "true")
$headBonus=turnHtmleditorOn("TEXT_AREA_NAME",$editorWidth,$editorHeight,$editorSkin,"");
# ---
include('../themes/'.THEME.'/header.php'); # already there
[/php:1]





It rather should looks like this:


# MOD, use htmleditor, added
if ($enableHtmleditor == "true")
$headBonus=turnHtmleditorOn("TEXT_AREA_NAME",$editorWidth,$editorHeight,$editorSkin,"");
else
$bodyCommand = "onLoad=\"document.ptTForm.tpm.focus();\"";
# ---
include('../themes/'.THEME.'/header.php'); # already there
[/php:1]
[MOD] fckeditor html editor integration [message #7160] Thu, 26 May 2005 19:47 Go to previous messageGo to next message
interfaSys
Messages: 4
Registered: February 2005
Location: Lausanne
phpCollab guest

I agree with dracono. Collaboration is about communication between different kind of people. Some just know how to use OpenOffice and thus won't bother to learn a tagging system.

Plain text is OK, but formmated text is much better.
It doesn't hurt to include the option everywhere. Just add some granularity in the settings, so that in can be turned off for tasks.
[MOD] fckeditor html editor integration [message #7244] Wed, 08 June 2005 09:16 Go to previous messageGo to next message
dracono is currently offline  dracono
Messages: 55
Registered: April 2005
Location: Gdynia
phpCollab lover
hello

fckeditor integration needs also some addons in the autoLinks function to
resolve urls properly. There is need to add "<" char to ftp/http/https:


#../includes/library.php
function autoLinks($data) {
global $newText;
$lines = explode("\n", $data);
while (list ($key, $line) = each ($lines)) {
$line = eregi_replace("([ \t]|^)www\.", " http://www.", $line);
$line = eregi_replace("([ \t]|^)ftp\.", " ftp://ftp.", $line);

# MOD, PS (dracono), added "<" char which mark end of link, needed by fckeditor integration
$line = eregi_replace("(http://[^ <)\r\n]+)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $line); # MOD
$line = eregi_replace("(https://[^ <)\r\n]+)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $line); # MOD
$line = eregi_replace("(ftp://[^ <)\r\n]+)", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $line); #MOD
$line = eregi_replace("([-a-z0-9_]+(\.[_a-z0-9-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)+))", "<a href=\"mailto:\\1\">\\1</a>", $line);
if (empty($newText)) {
$newText = $line;
} else {
$newText .= "\n$line";
}
}
}

[/php:1]
Where's the attachment? [message #8244 is a reply to message #7143] Fri, 26 October 2007 16:30 Go to previous message
lanlanb is currently offline  lanlanb
Messages: 1
Registered: October 2007
phpCollab guest
I'm not findind the attachment.
Where can I download it?

Thanks in advance.
Previous Topic: [MOD] Extra Save button
Next Topic: Page Customization
Goto Forum:
  


Current Time: Wed May 22 21:45:05 CEST 2013

Total time taken to generate the page: 0.27723 seconds