5 Replies Latest reply on Oct 17, 2012 6:49 AM by infoni

    Portlet headers are not included just after adding a portlet to a page

    infoni

      Hi,

       

      I work on a portlet project, with Gatein it makes use of the "doHeaders" method to include javascript and css files. All works perfectly with Gatein 3.3 final: when i add this portlet to a page i can access its edit mode in the page editor:

      gatein-headers-addportlet.png

      But with 3.4 M01 and 3.4 final when i add a portlet to a page, its javascript and css are not included, and then the edit mode does not work. Though if i save the page the "view mode" is correctly displayed. And then by switching back to the page editor, this time the "edit mode" will work: this issue only happens just after adding the portlet to a page (and if there was not already another portlet instance on the same page).

       

      Is it a known issue? Is there a workaround? Any help will be much appreciated!

      Thanks

        • 1. Re: Portlet headers are not included just after adding a portlet to a page
          vstorm83

          What do you mean by "its javascript and css are not included" can you take a look at your browser's dev tool (firebug or whatever..) and see if the script or link tag for portlet is there on the header ?

          The portlet's script tag has "src" attribute or just the content ? The issue about script tag the "src" attribute was known issue and has been fixed by GTNPORTAL-2582

          Can you attach a simple test portlet ?

          • 2. Re: Portlet headers are not included just after adding a portlet to a page
            infoni

            Thank you for your response.

             

            You are right, i did not correctly qualify this issue. Both portlet javascript and css are  included in the page header. I believe this issue has something to do with inline javascript: it seems it is invoked before the portlet javascript headers.

             

            I was able to reproduce this problem with a simple "helloworld" portlet. In its JSP edit page, an inline javascript makes use of a javascript function, located in a file included in the doHeaders method:

            <b>

                Hello world portlet javascript - EDIT MODE

                <button type="button" onClick="HelloWorldTestJavascript()">Click me!</button>

            </b>

            <script type="text/javascript">

                   HelloWorldTestInlineJavascript();

            </script>

            When this helloworld portlet is added to a page, the Edit mode does not work: it says the function HelloWorldTestInlineJavascript() does not exist, and the page is broken: even the "Abort" gatein ajax function can't be used. Once the page is saved, and we come back in the page editor, all works correctly.

             

            I join in the initial post the portlet .war and  the small java code .

             

            thanks

            • 3. Re: Portlet headers are not included just after adding a portlet to a page
              infoni

              The "helloWorld" portlet attached in the first post works in 3.3 GA1: we can access the edit mode just after adding it to a page, in the page editor. But it fails with 3.4 M01 and 3.4 final as described, to make it work we need to save the page first. Should we log a JIRA issue?

               

              Thanks

              • 4. Re: Portlet headers are not included just after adding a portlet to a page
                vstorm83

                No, I think it was fixed by GTNPORTAL-2582 (the fix version is 3.5.0.Beta01) Can you test it with the lastest gatein snapshot ?

                1 of 1 people found this helpful
                • 5. Re: Portlet headers are not included just after adding a portlet to a page
                  infoni

                  Thank you! In my first answer i missed it was fixed in 3.5beta01. I will try to build this version with tomcat 7 and post here the result of my test.