[ 
https://issues.apache.org/jira/browse/OFBIZ-1648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Adrian Crum updated OFBIZ-1648:
-------------------------------

    Attachment: ofbiz_ajax.patch

ofbiz_ajax.patch is some work I did on the OFBiz-to-Ajax integration. Work had 
already been started in the screen widgets and the Example component - I 
expanded it a little.

The problem with the existing Ajax example in the Example component is that the 
screen is useless if the user has JavaScript disabled. I fixed that by putting 
JavaScript detection in the login screen, and then passing the setting around 
the framework. When a user first logs in the setting is stored in the 
UserPreferences entity, where it is retrieved by each webapp - making the 
setting span webapp sessions. I also put a "javaScriptEnabled" element in the 
screen context - it contains "true" or "false".

I modified the widget rendering code to output HTML according to the user's 
JavaScript setting. Some of it doesn't work. I wanted to get form widget 
pagination to use Ajax, but it isn't working. I gave up on it, but the code is 
still there. It would be great if a Prototype guru could take a look at it and 
figure what's wrong. I'll play with it some more later.

The Example component has been updated. One of the things I learned is that the 
request Maps for Ajax calls should have the auth attribute set to false, and 
have the widgets perform permission checking. With auth set to true, the HTML 
container being updated will have a login screen inside it if the user's 
session expires, or if they log out in another webapp. Set up the way I have 
it, the request is successful when the user is logged out, but it returns 
nothing - so the HTML container being updated goes blank.

This patch is intended for review and comment. It's not finished yet. If there 
are no objections, I will clean up the code and get it committed.

One thing I'm considering - that is not in this patch - is a JavaScript 
"connector" to bridge between the widgets and the Prototype library. Instead of 
widgets outputting code like

<script type="text/javascript">new 
Ajax.PeriodicalUpdater('ExampleAjaxMessages', 
'/example/control/ExampleAjaxMessages', {frequency: 10});</script>

it would output something like

<script type="text/javascript">OfbizPeriodicalUpdater('ExampleAjaxMessages', 
'/example/control/ExampleAjaxMessages', '10');</script>

where the OfbizPeriodicalUpdater JavaScript function is in the "connector" 
library, and it would create the corresponding Protoype Ajax object.

That way, if we want to switch to another Ajax library, or if the Prototype API 
changes, we only have to modify the connector JavaScript file, not all of the 
widget java code.


> Sandbox: Improved Screen Widgets, adding 3rd party rendering library support
> ----------------------------------------------------------------------------
>
>                 Key: OFBIZ-1648
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1648
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Adrian Crum
>            Priority: Minor
>         Attachments: ofbiz_ajax.patch, widget_improvements.patch
>
>
> Discuss screen widget modifications and enhancements that will make the 
> screen widgets more robust. Everyone is welcome to review and comment.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to