The Interview Portlet does not support commentary display in a popup window. Commentary only exists for question screens and can only be displayed in the screen's associated iframe.
There are three aspects to handling commentary:
Commentary URLs need to be modified so that they take into account that the interview portlet is displayed within a portal. The commentary is displayed as a static page and so it is necessary to encode the URLs as a reference to a static resource.
To display commentary as a static page use the CommentaryContentAction action in web-determinations.
When using the getStaticCommentaryURL method in LocalAbstractNativeScreen and LocalAbstractControl, the commentary target is returned as a ResourceURL with the action set to CommentaryContentAction.
The ResourceURL is created for the commentary target using the PortletRewriter and when clicked, it triggers the serveResource method in interview portlet.
It is necessary to modify the associated templates so that they call this method for loading HTML pages as a resource. This is managed by replacing the screen.getCommentaryURL() method with the getStaticCommentaryURL() method.
For screen commentary it is also necessary to handle the displaying of associated commentary on the same page. In web-determinations, this is done using frames. If a screen has commentary then the frameset.vm template is used in place of the question_screen.vm template, to display the investigation screen and commentary side by side. As framesets do not work in the interview portlet framework, it is necessary to use iframes to display the commentary on the same screen. To manage this, the question_screen.vm template has been modified to display the associated commentary in an iframe which is now the commentary-target. This is done by setting the value of commentary-target in appearance.properties to the name of the commentary iframe in question_screen.vm.
The isPortletURI() query is used to indicates that the URI was created in context of a portlet (if a value of "true" is used); otherwise the default value is false. The interview portlet uses setIsPortletURI(value) call to set the value to true. When a question screen is being rendered this value dictates whether framesets should be used or just the question screen which includes the iframe.
For control commentary, the control raw text itself may have embedded commentary links. For example, in the statement "Is the sun shining?", there may be commentary associated with the words "sun" and "shining"; note that embedded commentary links are not supported at this stage .
Commentary plugins work by re-mapping the commentary target to a new URL; when getStaticCommentaryURL() is invoked, it returns one of the following:
Portals do not generally have any problems displaying commentary in an iframe using the standard redirecting of url in an A tag by using the target attribute. In Webcenter however, the URL for an A tag is converted to a javascript call which only works for same-screen display. Redirecting to an iframe or setting the target to open the URL in either a new tab or a new window, does not work. Clicking on the link in the case of iframe and a new tab, results in no action. Using Firebug console, it is possible to see the error message being thrown. In the case of a new window, the result is a blank page.
Same screen display is not a good solution since the user will lose the interview page. Moreover on using the back button, the user will be redirected to the start screen in Webcenter portal.
In order to be able to display commentary in an iframe in Webcenter, a span tag must be used together with an onclick event to mimic a link. Clicking on the span tag will trigger an event that changes the source URL of the commentary iframe. This tag does not get changed by the ADF library and as such behaves as expected.
To deploy this in Webcenter, set the value of use-javascript-for-commentary-display in appearance.properties to true; for accessibility reasons, by default it is assumed to be false unless explicitly set to true since not all browsers may support Javascript.
Both screen commentary and control commentary have corresponding javascript template versions that are used instead of the normal ones when use of Javascript is enabled through appearance properties.
The display styles for screen commentary and question control commentary are set using javascript-link-question-style.
The Javascript versions of templates can be found in the templates/javascript_links/ directory.