Skip to Content
So, how did we go about creating the type of functionality that you see here on SDN for the forums, weblogs and even the wiki or any other external web application. (although there are things we are still working on). First things first Before reading any further, the only way that this will work is to have the external web application in the same domain as the current portal. By default a domain for a web page is normally set to the full name of the server, in our case this would be www.sdn.sap.com. Now, as most, if not all, of you are aware, the portal will relax the domain of the portal server by default, or configurable so that we can relax it more than a single level. Therefore the domain of the SDN website is set to sdn.sap.com (notice the removal of the www). With the forums web application, we have had to put in the code ourselves that relaxes the domain: – // Domain relaxing if ( document.domain.indexOf(".") > 0 ) document.domain = document.domain.substr(document.domain.indexOf(".")+1); Otherwise the domain would be forums.sdn.sap.com instead of sdn.sap.com. Now, this would simply not do, thanks to the security restrictions of browser, which stops cross site scripting. The other thing to note is that access to the external system also need to be of the same protocol as the portal server, i.e. HTTP–>HTTP or HTTPS–>HTTPS. HTTP–>HTTPS will simply not work. Thas all been done, on SDN, using the EFP (Externally Facing Portal) funcionality, so has not been tested on the full portal desktop, although the same principals could be applied. Now to the nitty gritty There are several steps to follow, so please be patient. 1) New Content Area Component

  • We needed to create our own content area component. As many are aware ALL iviews are generally displayed using a content area iview is added to the innerpage page. The innerpage is added to the portal desktop.
    • LightWorkAreaiView
    • WorkAreaData
    • WorkAreaHelper

2) Changes to the LightWorkAreaiView class

  • The LightWorkAreaiView class is responsible for outputting the iframe tag, so all of our changes will be done there, other than the javascript (which will be detailed further down).
  • The main thing to do is to add an onload event to the iframe that is generated. To do this simply add the following code to the iframe tag, onload="workArea.resizeIframe()", so you iframe should look something like . This will mean that the workArea.resizeIframe() method will be called everytime the contents within the iframe is reloaded. This includes navigating around the site, as you do with the forums.

3) Changes to the javascript code

  • Copy the light_workArea.js file from the com.sap.portal.navigation.contentarea. This is found in the public area of the portal, root/portalapps/com.sap.portal.navigation.contentarea/scripts folder, into the dist/scripts folder of your NWDS project.
  • Find the workArea.resizeIframe javascript function in the javascript file and replace the code with this
  • workArea.resizeIframe = function(){ //Get the IFRAME object obj = document.getElementById("isolatedWorkArea"); DEFAULT_HEIGHT = '6000'; if (obj != null){ try{ reqsize = window.frames[obj.name].document.body.scrollHeight + 100 ; obj.style.height = reqsize + 'px'; obj.style.width = '100%'; var width; //This code is added because IE adds 16px for the scrollbar if(navigator.appName == "Microsoft Internet Explorer") width = parseInt(window.frames[obj.name].document.body.scrollWidth) + 16; else window.frames[obj.name].document.body.scrollWidth; obj.style.width = width + 'px'; }catch(e){ try{ obj.style.height = DEFAULT_HEIGHT + 'px'; }catch(e){} } } }
  • deploy the par file generated by this NWDS

4) Configuration required

  • Create an iview based on your par file
  • Create a copy of the standard desktop and of the innerpage and store these in some place of your choosing within the PCD.
  • Assign the copied desktop using the desktop rules.
  • Change the inner page so that it now has your custom content area iview instead of the standard one

Hey Presto The pages should now be resized not only in height, but in width also and that should be the end of those pesky scrollbar critters. Thanks Darrell

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Jürgen Bechtle
    I ve been trying to put up the project to do the modification you ve benn talking about.
    First of all there are a lot of dependencies which are not mentioned :

    com.sap.portal.navigation.api_service_api
    com.sap.portal.navigation.helperservice_api
    com.sap.portal.useragent_api
    com.sap.portals.common<== need OS xs.
    com.sap.portal.pagebuilder.utils_api
    potalLibs (DLable thru JavaDev Role.)
    servlet.jar (in eclipse plugin dir.)

    but in the end there is still s.th. missing :

    “com.sapportals.portal.prt.event.RedirectEvent cannot be resolved.”

    Am I missing s.th. ?

    J2EE Engine 6.40 PatchLevel 106831.313
    Portal 6.0.19.0.0
    KnowledgeManagementCollaboration 6.0.19.0.0 (NW04 SPS19)

    (0) 
  2. Jürgen Bechtle
    I ve been trying to put up the project to do the modification you ve benn talking about.
    First of all there are a lot of dependencies which are not mentioned :

    com.sap.portal.navigation.api_service_api
    com.sap.portal.navigation.helperservice_api
    com.sap.portal.useragent_api
    com.sap.portals.common<== need OS xs.
    com.sap.portal.pagebuilder.utils_api
    potalLibs (DLable thru JavaDev Role.)
    servlet.jar (in eclipse plugin dir.)

    but in the end there is still s.th. missing :

    “com.sapportals.portal.prt.event.RedirectEvent cannot be resolved.”

    Am I missing s.th. ?

    J2EE Engine 6.40 PatchLevel 106831.313
    Portal 6.0.19.0.0
    KnowledgeManagementCollaboration 6.0.19.0.0 (NW04 SPS19)

    (0) 
    1. Darrell Merryweather Post author
      Hi

      This class is in the prtcore jar file. You should be able to access this area by using the following in the portalapp.xml file: –

      I hope this helps

      Darrell

      (0) 

Leave a Reply