7 Replies Latest reply on Jul 21, 2010 10:13 PM by trong.tran

    GateIn with JQuery

    funkybreizh

      Hello,

       

      I want to use JQuery widget in many portlet, and the problem is that I want to import one time (in my header page) the JQuery librairy. Is the a convenient way to do this. I have already read the "Creating a jQuery portlet" in the wiki, but I 'm not satisfied.

       

      Regards,

       

      DERUERE Julien

        • 1. Re: GateIn with JQuery
          trong.tran

          You could be able to configure it by XML in the gatein-resources.xml file in your war, for an example ( http://anonsvn.jboss.org/repos/gatein/portal/tags/3.1.0-GA/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml ) :

           

              <javascript>
                  <param>
                      <js-module>moduleName</js-module>
                      <js-path>/path/to/file.js</js-path>
                      <js-priority>10</js-priority>
                  </param>
              </javascript>
          

           

          with that, GateIn will imports your js library by default in page's header

           

          Ensure your {WAR}/WEB-INF/web.xml file includes following filter

           

            <filter>
              <filter-name>ResourceRequestFilter</filter-name>
              <filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class>
            </filter>
          
            <filter-mapping>
              <filter-name>ResourceRequestFilter</filter-name>
              <url-pattern>/*</url-pattern>
            </filter-mapping>
          
          1 of 1 people found this helpful
          • 2. Re: GateIn with JQuery
            funkybreizh

            Yes, it's work, but what about the css theme of JQuery. I try something like this :

             

            Write my own skin, for my portal, based on the SimpleSkin :

             

             

             

            And in Stylesheet.css, I have :

             

             

            @import url(CustomSkin/UIPortalApplicationSkin.css); @import url(PortletThemes/Stylesheet.css); @import url(Portlet/Stylesheet.css); @import url(JQuery/ui-lightness/jquery-ui-1.8.2.custom.css);

             

             

            My custom theme css is well load, but the jquery theme is not.

             

            any idea?

             

            [Edit] The css is load, but not the images, for example in my css it's :

             

            background-image: url(images/ui-icons_222222_256x240.png);

             

            But in my navigator, it's :

             

            background-image: none;

             

            Is it the filter, or something like that?

            • 3. Re: GateIn with JQuery
              trong.tran

              the WEB-INF/gatein-resources.xml file is a registration for Javascript and CSS in a WAR to GateIn portal ( refers http://docs.jboss.com/gatein/portal/3.1.0-FINAL/reference-guide/en-US/html_single/index.html#sect-Reference_Guid-Skin_Configuration-Skin_Service )

               

              So you could do  same way with CSS by something like this :

               

                 <portal-skin>
                    <skin-module>JQuery</skin-module>
                    <skin-name>Default</skin-name>
                    <css-path>/JQuery/ui-lightness/jquery-ui-1.8.2.custom.css</css-path>
                    <overwrite>false</overwrite>
                 </portal-skin>
              
              • 4. Re: GateIn with JQuery
                funkybreizh

                <skin-module> doesn't exist in the gatein-ressource dtd !

                 

                And it doesn't work

                • 5. Re: GateIn with JQuery
                  trong.tran

                  <skin-module> doesn't exist in the gatein-ressource dtd !

                   

                  Yes, it was missing in the gatein_resources_1_0 dtd and updated in gatein_resources_1_1 ( Look at JIRA issue https://jira.jboss.org/browse/GTNPORTAL-1316 )

                  And it doesn't work

                  What happened ?

                  1 of 1 people found this helpful
                  • 6. Re: GateIn with JQuery
                    funkybreizh

                    Thanks, the css is well load in my head's page, but images aren't display even if urls define in the css are good, they aren't load in the page.

                    • 7. Re: GateIn with JQuery
                      trong.tran

                      Could you show us the file structure in your war and the content of gatein-resources.xml file ?