[PATCH] correct position of help popup for tab styling
------------------------------------------------------

         Key: COCOON-1711
         URL: http://issues.apache.org/jira/browse/COCOON-1711
     Project: Cocoon
        Type: Bug
  Components: Blocks: Forms  
    Versions: 2.1.9-dev (current SVN)    
    Reporter: Werner Masik
    Priority: Minor
 Attachments: forms-advanced-field-styling.xsl.diff

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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to