...
2) After unpacking, I have done some modifications to IFramePortlet
a) iframe.jsp -
- added javascripts for dynamic adjustment of the frame height. The scripts and the HowTo is located here: http://www.codeproject.com/KB/script...me_Height.aspx
The part of code added is:
Code Block | ||||
---|---|---|---|---|
| ||||
<script type="text/javascript"> function getElement(aID) { return (document.getElementById) ? document.getElementById(aID) : document.all[aID]; } function getIFrameDocument(aID){ var rv = null; var frame=getElement(aID); // if contentDocument exists, W3C compliant (e.g. Mozilla) if (frame.contentDocument) rv = frame.contentDocument; else // bad IE rv = document.frames[aID].document; return rv; } function adjustMyFrameHeight() { var frame = getElement("myFrame"); var frameDoc = getIFrameDocument("myFrame"); frame.height = frameDoc.body.offsetHeight; } </script> |
- I have modified the "<iframe>" part by adding id and onloada function. Like this:
Code Block | ||||
---|---|---|---|---|
| ||||
<iframe id="myFrame" src="<%= request.getAttribute("iframeurl") %>" width="<%= request.getAttribute("iframewidth") %>" onload="adjustMyFrameHeight()" frameborder="0"> Your browser does not support iframes </iframe> |
- I have also removed the part that enables opening the iframe in a new window, I don't need it
b) iFramePortlet.java
- I have modified the defaultURL and set:
private static final String defaultURL = "http://localhost:8080/pentaho/Dashboards"; (you can replace localhost with another URL if needed)
- I have also done some modifications to enable setting height in percentage, but it is not needed for this solution to work
c) portlet.xml - I have modified this file to disable Porlet EDIT mode because I don't need it to be editable. I have just removed the line:
...