Hitachi Vantara Pentaho Community Wiki

CDF Portlets

Skip to end of metadata
Go to start of metadata

CDF Portlet integration

Dejan Gambin provided a howto for portlet integration in CDF.

Here are the steps I have done in order to support CDF in portal environment using IFramePorlet (IFrame Portlet allows for a user-defined IFrame URL).

1) I started with downloading IFramePortlet from here:

http://anonsvn.jboss.org/repos/portl...amePortlet.zip

2) After unpacking, I have done some modifications to IFramePortlet

a) iframe.jsp -

The part of code added is:

<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:
<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:

<portlet-mode>EDIT</portlet-mode>

I think that's all. I built IFramePorlet.war using "ant deploy24" and put it in jboss/server/default/deploy folder.

After starting the server, there is IFramePortletInstance, IFrame page and IFramePortletWindow added.

If I missed something, please feel free to ask

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.