OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Solution: TinyMCE buttons disappear under non-canonical URL

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Solution: TinyMCE buttons disappear under non-canonical URL

Postby Laird » Fri Mar 07, 2014 8:06 am

Hi,

I just helped a friend to resolve a problem he was having with his new OJS installation, and I wanted to document it here in case it helps anyone else.

The problem is that when he accessed his OJS installation under its non-canonical URL, the TinyMCE editing buttons wouldn't show. I understand that because there *is* a canonical URL setting in config.inc.php, accessing OJS under non-canonical URLs isn't necessarily supported, but in any case, here's the problem and the solution for anyone who wants to try it regardless.

The base script path for OJS was different under each of my friend's URL schemes; those two schemes being something like this:

http://canonical.domain/journal
http://non-canonical.domain

The problem then was that in lib/pkp/lib/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php, the cache hash generated on line 162 doesn't include the tinyMCEPreInit.base value (generated from dirname($_SERVER["SCRIPT_NAME"])) of line 194, so that only one cache file is generated for both values of tinyMCEPreInit.base - the actual cached value depending simply on whichever URL scheme is accessed first. When the wrong cached file is served up, TinyMCE tries to load its CSS and image files from the wrong URLs, and thus its editing buttons don't show up.

There seem to be (at least) two possible solutions:

1. Edit that file so that the impending value of tinyMCEPreInit.base is added to the cache hash.
2. Turn off TinyMCE caching.

I chose the second solution, because it seemed better to edit a file native to OJS rather than one from upstream (TinyMCE). This involved editing line 369 of /public_html/journal/plugins/generic/tinymce/TinyMCEPlugin.inc.php so that disk_cache is set to false rather than to true.

I hope this helps anyone experiencing a similar problem.
Laird
 
Posts: 1
Joined: Fri Mar 07, 2014 8:03 am

Re: Solution: TinyMCE buttons disappear under non-canonical

Postby asmecher » Fri Mar 07, 2014 10:57 am

Hi Laird,

Thanks for writing this up in clear detail.

Note that you may experience other problems as a result of having two URLs, particularly when it comes to statistics; the statistics framework uses logfile URLs to match requests, so you may find that your statistics miss the part of the traffic coming from the non-canonical URL. (External statistics tools such as those based on web bugs, like Google Analytics, will suffer the same problem OTOH.)

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: mbria and 2 guests

cron