ICEfaces
  1. ICEfaces
  2. ICE-6164

Conflicting versions of YUI 3 between ACE components and Liferay 6

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-Beta1
    • Fix Version/s: 2.1-Beta2, 3.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces 2 ACE Liferay portlet 6
    • Affects:
      Compatibility/Configuration

      Description

      The new ACE components rely on YUI (both 2.8 and 3.1 currently). Liferay 6 has a UI layer called Alloy that is based on YUI 3.2. While it appears that YUI 2 and 3 can co-exist on a page, there currently appears to be a collision between the 2 different versions of YUI 3 when they are both loaded into the portal page. The initial rendering of the page dumps out an error to the JavaScript console of Firebug that says:

      f.applyConfig is not a function

      The Chrome JavaScript console supplies a stack trace:

      Loading modules
      barebone.jsp:1Uncaught TypeError: Object [object Object] has no method 'applyConfig'
      YUI [barebone.jsp:1]
      YUI [barebone.jsp:1]
      ice.yui3.use [icefaces-2-ace:55]
      (anonymous function) [icefaces-2-ace:83]

        Issue Links

          Activity

          Hide
          Mircea Toma added a comment -

          After analyzing what is going on when 3.2.* and 3.1.* libraries are mixed I can tell now that is not quite possible to use them together. In the Liferay case the 3.2.0pr2 library is loaded first thus defining YUI variable and YUI.prototype methods. When 3.1.1 library is loaded later on the YUI variable is not redefined (see comment: "If YUI is already defined, the existing YUI object will not be overwritten so that defined namespaces are preserved."). But, the YUI.prototype is redefined when 3.1.1 library is loaded. So when you invoke YUI function the 3.2.0pr2 function code tries to invoke a method defined on the YUI.prototype: YUI.prototype.applyConfig. Unfortunately the 'applyConfig' function does not exists anymore because 3.1.1 library replaced the YUI prototype.

          Show
          Mircea Toma added a comment - After analyzing what is going on when 3.2.* and 3.1.* libraries are mixed I can tell now that is not quite possible to use them together. In the Liferay case the 3.2.0pr2 library is loaded first thus defining YUI variable and YUI.prototype methods. When 3.1.1 library is loaded later on the YUI variable is not redefined (see comment: "If YUI is already defined, the existing YUI object will not be overwritten so that defined namespaces are preserved."). But, the YUI.prototype is redefined when 3.1.1 library is loaded. So when you invoke YUI function the 3.2.0pr2 function code tries to invoke a method defined on the YUI.prototype: YUI.prototype.applyConfig. Unfortunately the 'applyConfig' function does not exists anymore because 3.1.1 library replaced the YUI prototype.
          Hide
          Ken Fyten added a comment -

          We'll need to revisit this issue for 2.1, including consulting with Liferay and possibly Yahoo YUI to determine a workable solution.

          Show
          Ken Fyten added a comment - We'll need to revisit this issue for 2.1, including consulting with Liferay and possibly Yahoo YUI to determine a workable solution.
          Hide
          Bob Dietrich added a comment -

          Does this mean Liferay 6 cannot use ICEface portlets? (I realize there is another issue regarding JavaScript libraries)

          Show
          Bob Dietrich added a comment - Does this mean Liferay 6 cannot use ICEface portlets? (I realize there is another issue regarding JavaScript libraries)
          Hide
          Deryk Sinotte added a comment -

          The new ACE components are not going to be supported with Liferay 6 in this release. We will continue to work with Liferay (and Yahoo) on getting YUI to peacefully co-exist on the page. The "classic" components are supported in the 2.0 release with ICEfaces 2.0 running on Liferay 5 and 6.

          Show
          Deryk Sinotte added a comment - The new ACE components are not going to be supported with Liferay 6 in this release. We will continue to work with Liferay (and Yahoo) on getting YUI to peacefully co-exist on the page. The "classic" components are supported in the 2.0 release with ICEfaces 2.0 running on Liferay 5 and 6.
          Hide
          Bob Dietrich added a comment -

          Thanks for the quick reply. Although it would be nice to have access to the ACE components from Liferay 6, I guess we will have to wait. I'm still a little confused, however. According to the Beta 2 wiki, the inputFile component from 1.8 is not supported. Without ACE and the fileButton component, does this mean there is no file upload solution for Liferay 6 portlets?

          Show
          Bob Dietrich added a comment - Thanks for the quick reply. Although it would be nice to have access to the ACE components from Liferay 6, I guess we will have to wait. I'm still a little confused, however. According to the Beta 2 wiki, the inputFile component from 1.8 is not supported. Without ACE and the fileButton component, does this mean there is no file upload solution for Liferay 6 portlets?
          Hide
          Ken Fyten added a comment -

          Bob, it is possible to use the fileEntry component with Liferay 6. From the ICEfaces 2.0.0 Release Notes:

          The Advanced Components are not currently supported for portlet development on Liferay 6, with the exception of the fileEntry component. Using the fileEntry component on Liferay 6 requires that the mandatoryResourceConfiguration configuration parameter be set in the web.xml as follows:

          <context-param>
          <param-name>org.icefaces.mandatoryResourceConfiguration</param-name>
          <param-value></param-value>
          </context-param

          See the Configuration topic for more information on mandatoryResourceConfiguration.

          Show
          Ken Fyten added a comment - Bob, it is possible to use the fileEntry component with Liferay 6. From the ICEfaces 2.0.0 Release Notes: The Advanced Components are not currently supported for portlet development on Liferay 6, with the exception of the fileEntry component. Using the fileEntry component on Liferay 6 requires that the mandatoryResourceConfiguration configuration parameter be set in the web.xml as follows: <context-param> <param-name>org.icefaces.mandatoryResourceConfiguration</param-name> <param-value></param-value> </context-param See the Configuration topic for more information on mandatoryResourceConfiguration.
          Hide
          Mircea Toma added a comment -

          It seems that YUI code can be sandboxed by using an iframe. The iframe would need to reference internally the required library version and then the parent window can access the 'YUI' namespace and the rest of the API.
          The only drawback is that you can use the YUI instance but when using its API you always need to pass element references instead of using IDs otherwise YUI will lookup by ID in the iframe owned document.

          Show
          Mircea Toma added a comment - It seems that YUI code can be sandboxed by using an iframe. The iframe would need to reference internally the required library version and then the parent window can access the 'YUI' namespace and the rest of the API. The only drawback is that you can use the YUI instance but when using its API you always need to pass element references instead of using IDs otherwise YUI will lookup by ID in the iframe owned document.
          Hide
          Mircea Toma added a comment -

          The main drawback of using an iframe to sandbox code is that the referenced code is not loaded before the body of the iframe containing page is parsed. This in effect bans the use of inline JS code in the markup, but unfortunately the inlining is required to initialize the different YUI components.

          Show
          Mircea Toma added a comment - The main drawback of using an iframe to sandbox code is that the referenced code is not loaded before the body of the iframe containing page is parsed. This in effect bans the use of inline JS code in the markup, but unfortunately the inlining is required to initialize the different YUI components.
          Hide
          Mircea Toma added a comment -

          Modified the component renderer to render JS code to be executed only after the document would load, in effect delaying the YUI component initialization until the iframe referenced code would load. Doing this for Slider component resulted in a correct rendering and initialization of the component but interacting with the slider was not possible, grabbing the cursor to slide it would not work.

          Show
          Mircea Toma added a comment - Modified the component renderer to render JS code to be executed only after the document would load, in effect delaying the YUI component initialization until the iframe referenced code would load. Doing this for Slider component resulted in a correct rendering and initialization of the component but interacting with the slider was not possible, grabbing the cursor to slide it would not work.
          Hide
          Navin Agarwal added a comment - - edited

          Hi can any one tell when we will be able to get the Advanced Components support for portlet development on Liferay 6. I need these feature in my Project

          Show
          Navin Agarwal added a comment - - edited Hi can any one tell when we will be able to get the Advanced Components support for portlet development on Liferay 6. I need these feature in my Project
          Hide
          Ken Fyten added a comment -

          Note that support for using ACE components with Liferay 5 was added in ICEfaces 2.0.2. This issue pertains only to using Liferay 6 with ACE components.

          This is scheduled for resolution with ICEfaces 2.1.

          Show
          Ken Fyten added a comment - Note that support for using ACE components with Liferay 5 was added in ICEfaces 2.0.2. This issue pertains only to using Liferay 6 with ACE components. This is scheduled for resolution with ICEfaces 2.1.

            People

            • Assignee:
              Ken Fyten
              Reporter:
              Deryk Sinotte
            • Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: