Uploaded image for project: 'Cocoon'
  1. Cocoon
  2. COCOON-1711

[PATCH] correct position of help popup for tab styling

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Continued
    • Minor
    • Resolution: Unresolved
    • 2.1.9
    • None
    • Blocks: Forms
    • None

    Description

      Help popups appear in the wrong position when the tab styling is used.
      Usually it pops up below the div that contains the tabbed form, which means
      that the popup is often outside of the visible viewing area.

      Looks like the bug exists since the stylesheets of 2.1.7 and dev branch were merged.
      The problem is that the function forms_createPopupWindow does not get called when
      the page is loaded into the browser. In current 2.1.X branch the function gets called
      directly from the <a href=" ...

      <a onclick="forms_createPopupWindow('email:help').showPopup('email:help:a');return false;" href="#" name="email:help:a" id="email:help:a"><img alt="helppopup" src="resources/forms/img/help.gif"></a>

      So the function is executed when then link to the popup is clicked.

      In 2.1.7 it was called like this:

      <script type="text/javascript">
           var helpWinN1003B = forms_createPopupWindow('helpN1003B');
      </script>
      <a onclick="helpWinN1003B.showPopup('N1003B');return false;" href="#" name="N1003B" id="N1003B"><img alt="helppopup" src="/images/help.gif"></a>

      Here the popup window was created at the first display of the browser page. Actually when in tab-styling the whole popup-tree was just copied right below the body-tag because of the positioning issues. This was done
      with the forms_moveInBody function which was called in the onload handler of the forms.

      Therefore 2 possible solutions exist:

      - revert the code to the old version, to register the handler before the onload is executed
      - alter forms-advanced-field-styling.xsl so the divs for the popups are all created as a child of the body tag

      The patch I'm submitting takes the second aproach. All it does is create the divs where they should be
      from the beginning (below body). This is done by introducing a mode called 'forms-help', to make the fi:help
      tags get processed twice. In the first run the divs are created and in the second run links for the popups
      are created just behind the field (as usual). Moving the divs with javascript therefore becomes obsolete. I think
      that registering the onloadHanlder to call forms_moveInBody can be removed. But I was not sure if
      it is needed for something else, so I kept it.

      I'm not a XSLT expert. There might be a better way to process the help popups. Feel free
      to make corrections. I also have no experience with ajax. I tested it with ajax activated
      and it worked. But I'm not sure if my test was using ajax the right way.

      Attachments

        1. testcase.zip
          2 kB
          Werner Masik
        2. testcase.tgz
          1 kB
          Werner Masik
        3. screenshot.png
          40 kB
          Werner Masik
        4. forms-advanced-field-styling.xsl.diff
          2 kB
          Werner Masik
        5. before.html
          4 kB
          Werner Masik
        6. ASF.LICENSE.NOT.GRANTED--forms-advanced-field-styling.xsl.diff
          2 kB
          Werner Masik
        7. after.html
          4 kB
          Werner Masik

        Activity

          People

            Unassigned Unassigned
            wernerm Werner Masik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: