Dev 1.2.3 Spaw Editor errors

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
cchhita
Posts: 54
Joined: Sun 14. Nov 2004, 23:54

Dev 1.2.3 Spaw Editor errors

Post by cchhita »

Hi Everyone,
I have looked through the forums, but cant find an answer!
I am using Spaw editor in the new dev 1.2.3. My problem is that I am trying to add an image using the WYSIWYG spaw editor in a content part.

Uploading is fine, but when I go to preview the image in the popup window, its says the requested URL was not found on the server!

When I try to add the image to my page, it shows up with an X. And when I view its full path, this is what i get:
http://www.domain.com/root/root/content ... gename.gif

As you can see the root directory is called twice, hence the reason why the image does not display!
Does anyone know what is wrong here? This is using the default install, nothing has been changed, so I cant figure out why i get this error!

Thanks in advance
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

Hi cchhita,

I am quite familiar with this problem with Spaw....the dev 1.2.3 has a new version script.js.php that strips out the absolute URL. This was a bug of the system itself, whose fix was posted by original developer and incorporated by OliG ( I think in 1.2.2+). The lack of an absolute URL, makes Spaw useless for newsletter creation...so I have looked at different alternatives (more later). Obviously it is a path problem you are having. You might want to take a look at dialogs/img_library.php, plus the config/spaw_control.config.php file and considering hard coding them.....at least this is what I have done in the past. What is strange about spaw is that sometimes it works and sometimes not....which suggests there is a wee bug in it. As I mentioned the scriipt.js fix is a workaround in my opinion.

But my own personal preference is to no longer use Spaw and go with FCKeditor2 FC. It can be downloaded from sourceforge (different than wcms version)......Pico has offered a lot of insights to get it to work. Having said that I am going to post my own findings.... I spent nearly a whole day yesterday...tweaking FCK to suit my needs and I think I have something that works. It does require about 5 minutes of hard coding:

FCKeditor2 - Modifications

(1) FCKeditor2 ROOT: fckconfig.js

Import Wcms Sylesheets: This is Pico's idea - Allows using wcms stylesheets in FCKeditor!

Code: Select all

FCKConfig.EditorAreaCSS = FCKConfig.BasePath +'../../../../phpwcms_template/inc_css/frontend.css' ;
Enter your domain name:

Code: Select all

FCKConfig.BaseHref = 'http://www.myDomain.com' ;
Optional Skins settings: default | office 2003 | silver
(silver - my preference - similar look and feel to spaw editor)

Code: Select all

FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/silver/' ;
Declare PhpWcms version of toolbar set
Note: Only 3 drop downs Style, Fontname, Fontsize
This is because in summary section the toolbar gets truncated if there are 4
Also removed the 'save' (first line) since it creates a bug when working inside wcms:

Code: Select all

FCKConfig.ToolbarSets["phpwcms"] = [
	['Source','-','NewPage'],
   ['Cut','Copy','Paste','PasteText','PasteWord','-'],
	['Undo','Redo','-','Replace','-','SelectAll','RemoveFormat'],
	['Bold','Italic','Underline','-','Subscript','Superscript'],
	['OrderedList','UnorderedList','-','Outdent','Indent'],
	['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
	['Link','Unlink','Anchor'],['Templates'],
	['Image'],['Table'],['Rule','SpecialChar'],
	['TextColor','BGColor'],['About'],
	['Style','FontName','FontSize']
] ;
Get rid of pesky insertion <P> tags (this is my preference)

Code: Select all

FCKConfig.UseBROnCarriageReturn = true ;
Point FCKEditor to use mcpuk version file manager (IMAGE PREVIEWS):
(uncomment the following lines)

Code: Select all

FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/mcpuk/browser.html?
Connector=connectors/php/connector.php' ;

//Standardize browser window dialogue: (my preference for clients)
FCKConfig.LinkBrowserWindowWidth = 750 ;
FCKConfig.LinkBrowserWindowHeight = 540 ;

FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/mcpuk/browser.html?
Type=Image&Connector=connectors/php/connector.php' ;

//Standardize browser window dialogue: (my preference for clients)
FCKConfig.ImageBrowserWindowWidth  = 750 ;
FCKConfig.ImageBrowserWindowHeight = 540 ;

(2) FCKeditor2 ROOT: fckstyles.xml

Declare Wcms Stylesheets in FCK Styles dropdown, change to suit.
COOL

Code: Select all

<Styles>

	<Style name="Article Summary" element="span">
		<Attribute name="class" value="articleSummary" />
	</Style>
	<Style name="Article Heading" element="span">
		<Attribute name="class" value="articleHead" />
	</Style>
	<Style name="Article SubHeading" element="span">
		<Attribute name="class" value="articleSubHead" />
	</Style>
	<Style name="Content Heading" element="span">
		<Attribute name="class" value="contentHead" />
	</Style>
	<Style name="Content SubHeading" element="span">
		<Attribute name="class" value="contentSubHead" />
	</Style>
	<Style name="Small Body Text" element="span">
		<Attribute name="class" value="smallBodyText" />
	</Style>
	<Style name="Heading H1" element="h1" />
	<Style name="Heading H2" element="h2" />
	<Style name="Heading H3" element="h3" />
	<Style name="Heading H4" element="h4" />
	<Style name="Heading H5" element="h5" />
	<Style name="Custom Italic" element="em" />
	<Style name="Custom Ruler" element="hr">
		<Attribute name="size" value="1" />
		<Attribute name="color" value="#ff0000" />
	</Style>
</Styles>
(3) FCKeditor2 ROOT fckeditor.php

Instantiate Phpwcms version of toolbar:

Code: Select all

function FCKeditor( $instanceName )
	{
		$this->InstanceName	= $instanceName ;
		$this->BasePath		= '/FCKeditor2/' ;
		$this->Width		= '100%' ;
		$this->Height		= '400' ;
		$this->ToolbarSet	= 'phpwcms' ;
		$this->Value		= '' ;
		$this->Config		= array() ;
	}
(4) CREATE FOLDER @ SITE ROOT
(don't forget to chmod to 777 - read/write priviledges)

wysiwyg
then these subdirectories inside wysiwyg>>
Image
File
Flash
Media

(5) Define primary folder for FCK
(Pico had the idea to point to phpwcms_filestorage folder, but I encountered file permissions problems (600) in nix server setting, thus the strategy to create separate folder for FCK files. Edit this file:

\include\inc_ext\FCKEditor2\editor\filemanager\browser\mcpuk\connectors\php\config.php

//line 31 (uncomment)

Code: Select all

$fckphp_config['basedir']=$_SERVER['DOCUMENT_ROOT'];
//line 32 (comment out)

Code: Select all

//$fckphp_config['basedir'] = 'D:\Work\FCKEditor\www\FCKeditor.V2\editor\filemanager\browser\mcpuk' ;
//line 47: (add - no trailing /)

Code: Select all

$fckphp_config['UserFilesPath'] = "/wysiwyg" ;
(6) Hard code for absolute URL's (Useful if you are going to use to create newsletters) Edit this file:
\include\inc_ext\FCKEditor2\editor\filemanager\browser\mcpuk\frmresourceslist.html

Code: Select all

var sLink = '<a href="#" onclick="OpenFolder(\'http://www.myDomain.com' + escape(folderPath) + '\');return false;">' ;
var dLink = '<a href="#" onclick="DeleteFolder(\'http://www.myDomain.com' + escape(folderName) + '\');return false;">' ;
var rLink = '<a href="#" onclick="RenameFolder(\'http://www.myDomain.com' + escape(folderName) + '\');return false;">' ;
So that is the basic set of changes to get it to work. There are however other plugins if you wish to implement. They are pretty well documented. I did find the CSS Editor problematic, since I was unable to use it in a span setting....applied formatting globally... also no save funtionality. Pico has included another plugin Wei Zhuo's Image Manager in his zip, which is nice, but was unable to get the absolute URL to work....and did not spend time on trying to hard code...it is nice however.

Options:
FCKeditor2 ROOT: fcktemplates.xml
Nice feature that allows you to create templates for FCKeditor...
shows mini thumb, text description and 'onclick' inserts actual Html
(all Html markup is embedded in [CDATA[.....]] tag.)
(note: use absolute url path to images)

I hope this helps.....
Just posting this to add to other documentation of FCKeditor for wcms.
Cheers,
John :D
Last edited by jsw_nz on Thu 14. Jul 2005, 14:27, edited 13 times in total.
User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse »

Neat :!:

Very cool and clear explanation in ONE post, thanks John!
Congrats for the effort.

Cheers
andykromi
Posts: 32
Joined: Sun 6. Jun 2004, 10:53

Post by andykromi »

Very good explanation !!

It works now, but I see only the Source-Typ "Image"

is ths normal ?

in frmresourcetype.html I have this function
function SetResourceType( type )
{
window.parent.frames["frmFolders"].SetResourceType( type ) ;
}

var aTypes = [
['File','File'],
['Image','Image'],
['Flash','Flash'],
['Media','Media']
] ;

window.onload = function()
{
var bHasType = ( oConnector.ResourceType.length > 0 ) ;
cmbTypeObj=document.getElementById("cmbType");
for ( var i = 0 ; i < aTypes.length ; i++ )
{
if ( !bHasType || aTypes[0] ==
oConnector.ResourceType )
AddSelectOption( cmbTypeObj, aTypes[1],
aTypes[0] ) ;
}
}


regards

Andy
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post by jsw_nz »

Hi Andi,

yes its normal...and basically 'context sensitive'...

if uploading images...you will see images...
if uploading flash with flash plugin, you will see flash....etc

:D
...glad it worked for you...

FCK is really quite nice...now
I think its best strengths is the templates feature...allows you to 'pre-design' html templates for end-user/client, very elegant
Post Reply