We use TWiki and
PublishContrib to manage our public website (see
http://www.lepp.cornell.edu
). We are attempting to upgrade from TWiki 4.0.5 and
PublishContrib 10413 to TWiki 4.3.1 and
PublishContrib 17710. However, with this upgrade, our one piece of javascript is no longer rendered properly.
On our home page, we use the following javascript to rotate through images:
<script language="Javascript">
<!--
image = new Array(4);
link = new Array(4);
image[0] = "cms.jpg";
link[0] = "./Research/EPP/CMS/";
image[1] = "control.jpg";
link[1] = "./Research/AP/CESR/";
image[2] = "ilc.jpg";
link[2] = "./Research/AP/ILC/";
image[3] = "erl.jpg";
link[3] = "./Research/AP/ERL/";
image[4] = "edu_outreach.jpg";
link[4] = "./Education/";
image[5] = "CLEO_Exp.jpg";
link[5] = "./Research/EPP/CLEO/";
index = Math.floor(Math.random() * image.length);
document.write("<p><a href='" + link[index] + "'><img border='0' src='%ATTACHURLPATH%/" + image[index] + "' width='365' height='168' /></a></p>");
//-->
</script>
After upgrading TWiki and
PublishContrib, we see the following errors when trying to publish this page:
ERROR: /mnt/wiki/web/pub/LEPP/WebHome/" + image[index] + " is not readable
ERROR: MISSING RESOURCE LEPP/WebHome/" + image[index] + "
And the javascript in the published page becomes:
<script language="Javascript"> <!-- image = new Array(4); link = new Array(4); image[0] = "cms.jpg"; link[0] = "./Research/EPP/CMS/"; image[1] = "control.jpg"; link[1] = "./Research/AP/CESR/"; image[2] = "ilc.jpg"; link[2] = "./Research/AP/ILC/"; image[3] = "erl.jpg"; link[3] = "./Research/AP/ERL/"; image[4] = "edu_outreach.jpg"; link[4] = "./Education/"; image[5] = "CLEO_Exp.jpg"; link[5] = "./Research/EPP/CLEO/"; index = Math.floor(Math.random() * image.length); document.write("<p><a href='" + link[index] + "'><img border='0' src='MISSING RESOURCE LEPP/WebHome/" + image[index] + "' width='365' height='168' /></a></p>"); //--> </script>
Any suggestions or help would be greatly appreciated.
Many thanks.
--
TWiki:Main/DevinBougie
- 30 Jun 2009
The issue seems to be with the base URL for images, should be
"/pub/Bugs/Item6284"
, but is
"MISSING RESOURCE LEPP/WebHome/"
in your published page. You need to read the code of the
PublishContrib to understand why this happens.
As a workaround you could hardcode the
"/pub/Bugs/Item6284"
, in your case may be
"/rsrc"
.
Look into the
PublishWebPlugin, which is actually designed for website publishing. Publishing happens transparently when saving a page, so your website is always in sync with your TWiki. See example site
http://www.twiki.net
- its content is entirely published out of the intranet TWiki.
--
TWiki:Main.PeterThoeny
- 06 Jul 2009
Many thanks for looking into this Peter. Yes, the published page looks correct if I change the code from: src='/pub/Bugs/Item6284/" + image[index] + "' to: src='rsrc/LEPP/WebHome/" + image[index] + "'
However, now the wiki version does not render the images. Is there any chance of getting this behavior changed in the
PublishContrib code (we don't see the "problem" with version 17710)?
We did look at the
PublishWebPlugin when we started using TWiki to maintain our public website back in 2005, but chose to just use
PublishContrib as it met our needs quite well. We actually wanted the ability to develop the website "off line" and publish a page only when it was ready (and not every time the wiki version is saved). I believe there was also some issue with our use of hierarchical webs or the desire to maintain multiple separate websites with a single TWiki installation, but that would have to be evaluated against the current
PublishWebPlugin.
Thanks again!
--
TWiki:Main.DevinBougie
- 08 Jul 2009