Recent Topics

WYSIWYG/File manager - possible solution

Started by on Oct 06, 2003 – Contents updated: Oct 06, 2003

Oct 06, 2003 10:59    

Hi there, I've already posted a request for filemanager before, so this topic might seem to be obsolette. But, wait for a moment, and I'll tell you why it is not.

The [url=www.solmetra.com/spaw]SPAW Editor [/url]from solmetra has built-in image manager, so we can say that we have 2 solutions in one - WYSIWYG editor and simple file manager. (you can find demo here: http://www.solmetra.com/spaw/demo/demo.php ).

What do you think?

Oct 13, 2003 11:46

I've almost integrated SPAW WYSIWYG editor into b2evolution. The only thing, I can't figure out is how to pass a $content parameter to editor.

If anyone interested, here it is:
1. Download spaw editro from www.solmetra.com and extract it.
2. Put all files under admin/spaw (or wherever you like)
3. adjust admin/spaw/config/spaw_control.config.php
--------------------------------------------------------
[code]"// directory where spaw files are located
$spaw_dir = '/admin/spaw/';

// base url for images
$spaw_base_url = 'http://yourhost.com/';
.....[/code]
if you want image upload feature, scroll down and look for (if you already have a folder for uploads specified in _advanced.php, you can use the same here)

[code]" // image libraries
$spaw_imglibs = array(
array(
'value' => 'images/', //this value reffers to the folder "images" located on the docroot.
'text' => 'Images root',
),
array(
'value' => 'you/need/to/change/this/too/', // this might be adjusted too, if you want...
'text' => 'Not configured',
),
);[/code]
-----------------------------------------
4. Open "admin/_header.php" and paste the following code after the copyright notice
---------------------------------------------------------------------
[code]require_once(dirname(__FILE__).'/../conf/_config.php');
require_once(dirname(__FILE__).'/../conf/_admin.php');
if (!ereg('/$', $HTTP_SERVER_VARS['DOCUMENT_ROOT']))
$_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'].'/';
else
$_root = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];

define('DR', $_root);
unset($_root);

// set $spaw_root variable to the physical path were control resides
// don't forget to modify other settings in config/spaw_control.config.php
// namely $spaw_dir and $spaw_base_url most likely require your modification
$spaw_root = DR.'admin/spaw/';

// include the control file
include $spaw_root.'spaw_control.class.php';

// here we add some styles to styles dropdown
$spaw_dropdown_data['style']['default'] = 'No styles';
$spaw_dropdown_data['style']['style1'] = 'Style no. 1';
$spaw_dropdown_data['style']['style2'] = 'Style no. 2';[/code]
-------------------------------------------------

This will load spaw config.
5. Open "conf/_admin.php and place the following lines after the copyright notice
[code]//Load the SPAW WYSIWYG editor
$use_spaw = 1;[/code]
6. Open "admin/_edit_form.php and scroll down 'till you find

---- QUICK TAGS ----

and replace all the code between <?php ?> with the following

[code]<?php // --------------------------- QUICK TAGS ------------------------------------
if ($use_spaw=0)
require( dirname(__FILE__).'/_quicktags.php');
?>
[/code]
This will disable quicktags (smilies) feature if we are using WYSIWYG editor. If not, it simply returns a javascript error.

7. Below you'll see a ---- TEXTAREA ---- field. Cut out the code below that line, and replace with the following code (this will load SPAW with the full toolbar set):
[code]
<?php $sw = new SPAW_Wysiwyg('spaw1',stripslashes($HTTP_POST_VARS['spaw1']));
$sw->show();
?>[/code]
FULL STOP HERE UNTILL WE FIND OUT HOW TO PASS A &content PARAMETER TO THE EDITOR.

Thats it, folks.

Oct 14, 2003 14:11

*g* :-/ Anyone can help?

Oct 14, 2003 15:45

I'll try to a look when I get home from work today.

It's sounds really kewl.

Oct 15, 2003 08:57

basstech wrote:

I'll try to a look when I get home from work today.

It's sounds really kewl.

:D Cheers!

Nov 13, 2003 10:47

the problem of those WYSIWYG editors is that they are based on IE only. But there are a couple of other initiatives to be more cross-browser and I believe b2evolution should look at something like that. Here are my very perso list:

- Midas demo http://www.mozilla.org/editor/midasdemo/ works both IE and Mozilla-based browsers out-of-the-box.
- http://mozile.mozdev.org/ an xhtml online editor for Mozilla only.
- http://www.hexidec.com/ekit.php a Java solution for "all" browsers.

I have used the first one and I can tell you that it works fine on both IE and Mozilla without any addition.

a more comprehensive list can be found at http://www.bris.ac.uk/is/projects/cms/ttw/ttw.html#os

Nov 13, 2003 15:15

Well, partly agree with you. For SPAW and many others... But, the main problem is not the IE, but that most of these WYSIWYG are not outputing XHTML compliant content. This means, if your page is HTML compliant, after the posting in WYSIWYG editor, you'll screw your complancy.

That's my opinion.

Besides, I already integrated SPAW into b2evo. And it works 98%. But the rest 2% stops me from sharing this hack. The first one is mentioned above (it conflicts with b2evo internal XHTML checker). The last 1% is actual pain in the ass.. :-/ Post editing. I cannot force SPAW to fetch $content in "DESIGN" mode, i.e. it returns plain html.

Anyway, if you have any free time you can play with it. Here's the code I've used for textarea repalcement in _edit_form.php:



$sw = new SPAW_Wysiwyg('spaw1' /*name*/, stripslashes($HTTP_POST_VARS['$content']) /*value*/, 'en' /*language*/, 
'sidetable' /*toolbar mode*/, 'default' /*theme*/,
'500px' /*width*/, '320px' /*height*/, );
$sw->show();

And don't forget to include the spaw_control.class.php before you call the instance. :P

Cheers.

Nov 14, 2003 04:22

Agree, the main issue is XHTML. The only one I know that is XHTML compliant is http://mozile.mozdev.org/
I will try to look at it later and see how we could integrate it in b2evolution...I am just missing some time.

Nov 21, 2003 07:58

Ladies and Gentelmen :) ,

If anyone interested to have SPAW integrated into b2evolution, please spend a few minutes reading this small howto.

1. Ihope you've already downloaded the latest spaw version and extracted it. If not, [url=https://sourceforge.net/project/showfiles.php?group_id=77954&release_id=171887]do it[/url]
2. Create "spaw" dir under the "admin" folder in your b2evo instalation.
3. upload all "spaw" files to it.
4. Add this peace of code to the /admin/_edit_form.php below ----- TEXTAREA ---------

<?php
// include the control file
include ('spaw/spaw_control.class.php');

// here we add some styles to styles dropdown
$spaw_dropdown_data['style']['default'] = 'No styles';
$spaw_dropdown_data['style']['style1'] = 'Style no. 1';
$spaw_dropdown_data['style']['style2'] = 'Style no. 2';

$sw = new SPAW_Wysiwyg('content' /*name*/,$content /*value*/,
                       'en' /*language*/, 'sidetable' /*toolbar mode*/, 'default' /*theme*/,
                       '550px' /*width*/, '350px' /*height*/);
$sw->show();
?>


6. Remove the <textarea></textarea> below.
7. Open /conf/_formating.php and set $use_html_checker = 0;(because it is causing validation errors) $use_security_checker = 1;
8. Open /conf/_admin.php and set $use_quicktags = 0; (optional)
9. Open _b2evocore/_funtions.php and go to line 158 and look for the
$content = htmlspecialchars($content);
Comment it out. like //$content = htmlspecialchars($content);

That's it.

P.S. I made some tests and did not findd any misfunctioning neither in b2evo nor in SPAW, so if anyone find anything, please report it here on the forums, or via PM. Thank you for your time.

Nov 26, 2003 01:41

yeah, this is exactly what im looking for! c00l stuff mg!
...so i dug in and followed your instructions.... It integrates fine in backoffice, but trying to run a preview gives me this error:

Warning: preg_match() expects parameter 2 to be string, array given in /b2evocore/_functions.php on line 217

-And the same goes for line 218.

....something with the security checking??

Nov 26, 2003 08:10

Hi doodlebrain,

Do you set $use_html_checker = 0 ? Else, I can't find any other reason why this error happened.

Cheers.

Nov 26, 2003 23:27

yup, did that. :(

hmmmm.... Im still running v.8.6 though, could that be it?
Oh, btw, if i do the preview while in html mode the post will show ok but still displaying the error lines. (Previewing from design mode returns only the error)

Nov 27, 2003 10:54

I'm not sure is this about the version diference or something else, but I'll try to look at it closer.

Stand by.
P.S. By the way, try to upgrade to 8.6.1.


Form is loading...

b2evo – This forum is powered by b2evolution CMS, a complete engine for your website.