Community
Participate
Working Groups
Build Identifier: Helios Hi, Print Selected Topic and All Subtopics option seems not to work properly when using anchors (example: DITA-based document with enabled chunking, produced by DITA OT). Sample document's TOC structure: <?xml version="1.0" encoding="UTF-8"?> <?NLS TYPE="org.eclipse.help.toc"?> <toc label="Test doc" topic="chunk_test.html"> <topic label="Test title 1" href="chunk_test.html#chunk_test"> <topic label="Test title 2" href="chunk_test.html#DN0948387_SNMP"/> <topic label="Test title 3" href="chunk_test.html#chunk_test3"/> </topic> </toc> More info will be provided as an attachment. Reproducible: Always Steps to Reproduce: 1. Open attached sample_doc.jar in Infocenter 2. Expand Test doc book 3. Click on Test title 1 4. Select Print selected topic and all subtopics
Created attachment 196739 [details] Sample document with anchor-based TOC
Created attachment 196740 [details] Error report
Created attachment 196741 [details] Infocenter's plugin list
I was able to trace the problem using firebug. Infocenter adds to the href a "path" field, like this: href="chunk_test.html?path=1_0_0#chunk_test" But the printToc(errorMsg) function under navActions.js doesn't remove this and generates a print error trying to print the href with the additional field. As it is possible to change the href directly using firebug, I removed the "?path=1_0_0" and everything started to work properly. My guess is that the "path" field in the Contents was added as a sorting method recently and the PrintToc code stayed the same not taking this additional situation into account.
Changed version into 3.7 as this is also valid for Indigo.
Hi, In case there's someone else looking for a solution to this problem, here's how we managed to fix it: 1. Copy plugins/org.eclipse.help.webapp_3.5.0.v20100507.jar elsewhere. 2. Unpack elsewhere/org.eclipse.help.webapp_3.5.0.v20100507.jar: cd elsewhere jar xf org.eclipse.help.webapp_3.5.0.v20100507.jar rm org.eclipse.help.webapp_3.5.0.v20100507.jar 3. In advanced/navActions.js, change this: if (indexAnchor!=-1) { var anchor=topic.substr(indexAnchor+1); topic=topic.substr(0,indexAnchor); parameters = "?topic="+topic+"&anchor="+anchor; } else { parameters = "?topic="+topic; } To something like this: if (indexAnchor != -1) { var anchor = topic.substr(indexAnchor+1); var indexPath = topic.indexOf("?path="); topic = topic.substr(0, indexAnchor).substr(0, indexPath); parameters = "?topic=" + topic + "&anchor=" + anchor; } else { parameters = "?topic=" + topic; } 4. Repack org.eclipse.help.webapp_3.5.0.v20100507.jar: jar cmf META-INF/MANIFEST.MF org.eclipse.help.webapp_3.5.0.v20100507.jar * 5. Move it back into your plugins folder: mv org.eclipse.help.webapp_3.5.0.v20100507.jar <plugins_dir> 6. Restart Eclipse help system. It's a bit of a hacky solution, maybe, and we're not 100% sure whether it compromises any other functionality, but we didn't find any problems in our preliminary testing, at least.
Thanks for filing this, targeting Eclipse 3.8.
This problem will occur when print selected topic and all subtopics is performed on a page which is referenced more than one time from the same Toc ( and therefore gets a path parameter which in turn is required for show in contents to work correctly ). This can be reproduced in an instance of Eclipse with the User Assistance test suite installed as follows: Open the help system Navigate to User Assistance Tests/manual.anchors one and two/anchor one Select the page "anchor one" in the contents pane. Print selected topics and all subtopics
Created attachment 202100 [details] Updated navActions.js comment #6 looks to be on the right lines. I've recoded it a little differently, here is the updated version of navActions.js. I will get the fix into Eclipse 3.8, it may be too late for 3.7.1 and will have to wait for 3.7.2.
Created attachment 202101 [details] Patch
The patch has been committed to the master branch. I have created Bug 355760 to track applying the fix to the 3.7 maintenance stream.
Created attachment 202354 [details] Fix version 2 I modified the patch so it would handle any parameters, not just ?path. The previous patch has been reverted and this patch committed.
Created attachment 202355 [details] navActions.js corresponding to Fix version 2
This fix has been in the 3.8 builds for a while now and is in 3.8M2. Can someone ( Lucasz, Natario or Eero ) verify that it fixes the problem you saw.
Tested in RCP mode using: Eclipse SDK Version: 3.8.0 Build id: I20110915-1308 I can confim that it works fine.
(In reply to comment #15) > Tested in RCP mode using: > > Eclipse SDK > > Version: 3.8.0 > Build id: I20110915-1308 > > I can confim that it works fine. Setting status to VERIFIED I will open another bug to track backporting this fix to 3.7.2