jck has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,

I have several perl-driven pages that generate forms that interact with several databases, and, to allow our less-techsavvy users to modify text in several textareas on our forms, i am implementing the TinyMCE javascript.

i see from this tinymce and perl node that this is possible, and i've gotten it to work OK, BUT - i have one problem (ergo, this query for wisdom from the monks)...

i'm trying to get the link/unlink buttons to work.

this page - http://tikvatisrael.org/cgi-bin/tinymcefull.html - is rendered in straight html

this page - http://tikvatisrael.org/cgi-bin/tinymcefull.pl - is rendered using perl and cgi

the link dialog box comes up in the html version, but not in the perl version. they are both calling the tinyMCE code using the same external js script, and both files are located in the same parent file.

i am not even sure what to do next to figure this out (i'm not that strong on javascripting) the TinyMCE initiation code is as follows:

tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,iespell,emotions,template", // relative_urls : false, // Theme options theme_advanced_buttons1 : "bold,italic,underline,strikethrough +,|,bullist,numlist,|,hr,|,justifyleft,justifycenter,justifyright,just +ifyfull,|,outdent,indent,blockquote", theme_advanced_buttons2 : "undo,redo,|,link,unlink,|,f +orecolor,backcolor,|,charmap,,sub,sup,emotions,iespell,|,code", theme_advanced_buttons3 : "", theme_advanced_buttons4 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", // theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "http://tikvatisrael/js/tinymce/css/content.css" +, // Drop list for link dialogs template_external_list_url : "lists/template_list.js", external_link_list_url : "lists/link_list.js", // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } });

i got to this by taking the "full" example from the TinyMCE download, and stripping it down sequentially to get the editor bar to load on my textarea elements. for reasons that i don't understand, and i'm frustratingly unable to get any help from the TinyMCE forum (not nearly so kind and gentle as you monks have always been), deleting the last few lines, headed with the comment "// Replace values for the template plugin" makes the javascript non-functional (or at least, it doesn't load the editor bar)

Replies are listed 'Best First'.
Re: implementing TinyMCE in a perl script
by Crackers2 (Parson) on Jul 31, 2009 at 19:32 UTC

    One obvious difference I see is that the HTML version loads http://tikvatisrael.org/js/tiny_mce/themes/advanced/link.htm in the popup, while the perl version loads http://www.tikvatisrael.org/js/tiny_mce/themes/advanced/link.htm. (note the leading www)

    Update: And to confirm that this is indeed the problem, load the perl version by going to http://www.tikvatisrael.org/cgi-bin/tinymcefull.pl instead of the www-less version and you'll see that everything works now.

    I'm guessing it's some cross-domain protection code kicking in.

      thanks so much! that was it. the perl had absolute paths for the js src urls, and the html had relative paths...changing the perl to match the html did the trick. i didn't even notice that i'd typed in www.tikvatisrael.org...etc in (odd, since i don't normally do that with our root path - usually it's without the "www")

      anyway, thanks for the fresh eyes on the problem!!