Clarity

Expand all | Collapse all

Custom HTML portlets not working in 15.2

  • 1.  Custom HTML portlets not working in 15.2

    Posted Nov 24, 2017 02:18 AM

    Hi All,

     

    We have recently upgraded to 15.2 and our custom html portlets not working in any browser content.Can you please suggest me whether we have some checks on it.

     

    thanks in advance

     

    regards

    sasikala



  • 2.  Re: Custom HTML portlets not working in 15.2

    Broadcom Employee
    Posted Nov 24, 2017 02:25 AM

    Can you give more context on what is not working and moreover with HTML portlet there are certain changes. Have a look at this guide 

     

    https://docops.ca.com/ca-ppm/15-2/en/reference/ca-ppm-studio-development/ca-ppm-studio-portlets#CAPPMStudioPortlets-html… 

     

     

    Looking forward to hear more from you on this 

     

    Regards

    Suman Pramanik 



  • 3.  Re: Custom HTML portlets not working in 15.2

    Posted Nov 24, 2017 04:49 AM

    Hi Suman,

     

    thanks for the update.

    To give you  more on the context.

    I have couple of custom html portlets created. When i click on a link these portlets should open. In these portlets i have some static data showing up

    ideally it should take the below code  and show me the portlet configured.

     

    var currentURL = window.location.toString();
                        var endpoint = currentURL.substr(0, currentURL.indexOf("/niku")) + "/niku/xog";
                        var sessionCookie = getCookie('sessionId');
                        //alert("sessionCookie" + sessionCookie);
                        
                        // XML to fetch the token for The loggedIN User and for Project
                        var xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:quer="http://www.niku.com/xog/Query">'+
                                    '<soapenv:Header>'+
                                    '<quer:Auth>'+
                                    '<quer:SessionID>'+sessionCookie+'</quer:SessionID>'+
                                    '</quer:Auth>'+
                                    '</soapenv:Header>'+
                                    '<soapenv:Body>'+
                                    '<quer:Query>'+
                                    '<quer:Code>charter_fancy_portlet_query</quer:Code>'+
                                    '<quer:Filter>'+
                                    //'<quer:param_token>'+sessionCookie+'</quer:param_token>'+
                                    '<quer:param_code>'+project+'</quer:param_code>'+
                                    '</quer:Filter>'+                                               
                                    '</quer:Query>'+
                                    '</soapenv:Body>'+
                                    '</soapenv:Envelope>';
                        xmlhttp.open("POST", endpoint, true);
                            //alert('InputXML'+xml);
                        xmlhttp.send(xml);

     

    .But in my scenario in 15.2 when i click on the links it is checking for this portlet in the local /temp/location for the  where it is not able to find it and not opening the portlet.

     

    Ideally with the above code it should pick up as below. But something is missing. I tested it in Firefox these are the screenshots.

     

     

    with IE i am getting the download page for the portlets. some different behavior with browsers



  • 4.  Re: Custom HTML portlets not working in 15.2

    Broadcom Employee
    Posted Nov 24, 2017 04:55 AM

    You wont be able to use Windows.location and that cookie is not a static data, its dynamic and changes with each login. The documentation i provided states that.



  • 5.  Re: Custom HTML portlets not working in 15.2

    Posted Nov 27, 2017 03:37 AM

    hello Suman,

     

    So any alternate method to try upon.

     

    thanks

    sasikala.



  • 6.  Re: Custom HTML portlets not working in 15.2

    Posted Nov 24, 2017 01:06 PM

    I still have custom portlets working on 15.3 which use the sessionId with a couple of web service calls to render a user specific UI.

     

    I would expect that you are not getting the sessionId via your getCookie function.  

     

    Somewhere after 13.3,  I ran into this where the OnDemand PPM environment protected the sessionID cookie from JavaScript access.

     

    I switched methods of getting the sessionId based on Chris Wuenstel reply in:

     

    https://communities.ca.com/thread/241749057

     

    V/r,
    Gene



  • 7.  Re: Custom HTML portlets not working in 15.2

    Broadcom Employee
    Posted Nov 25, 2017 12:05 PM

    You may run into risk of vulnerability if you disable HTTPONLY session cookie 



  • 8.  Re: Custom HTML portlets not working in 15.2

    Posted Nov 25, 2017 12:35 PM

    We are OnDemand and have no access to the CSA to change the session cookie protection.  I also agree that is would be a bad idea to disable HTTPONLY session cookie.

     

    I was referring to not using cookies to get the session as it is available on the window global object which was pointed out by Chris Wuenstel.

     

    V/r,

    Gene



  • 9.  Re: Custom HTML portlets not working in 15.2

    Posted Nov 28, 2017 04:01 AM

    Hi Gene,

    thank you for the update.

    var preUrl="http://"+window.location.hostname+"/niku/nu#";
    var preUrl1="http://"+window.location.hostname+"/niku/app?";

     

    This no longer supported. What could be the alternate solution for getting the current URL.

     

    regards

    sasikala



  • 10.  Re: Custom HTML portlets not working in 15.2

    Posted Nov 28, 2017 11:02 AM

    This still works for me.

     

    <br>
    <div id='host'/>
    <br>
    <div id='sessionId'/>
    <br>
    <script type="text/javascript">
              var currentSession = window.clarity.session.sessionId;
              var host = window.location.host;
              var hostDiv = document.getElementById("host");
              hostDiv.innerHTML = host.toString();
              var sessionDiv = document.getElementById("sessionId");
              sessionDiv.innerHTML = currentSession.toString();
    </script>

     

     

    V/r,

    Gene



  • 11.  Re: Custom HTML portlets not working in 15.2

    Posted Nov 29, 2017 04:47 PM