"REST" connection to l10n_server
| Project: | Localization client |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
We struggled today with this issue at the code sprint, and this part does not behave as we'd like to. The server code at http://drupal.org/node/231435 does work nicely, but this does not. The idea here is that we need to have a session to the remote server and the local server as well. So we need to do that on the browser side, where we have both sessions. The local session works with the AJAX, but the remote session would only work with a hidden POST form (cross domain AJAX with session sharing not being possible).
Our issue was that we did not get to the form to submit it. Whatever we tried, we did not get to the form submit. We tried to unleash some jQuery experts as well, but we did not reach the goal.
So basically, this one should work with http://drupal.org/node/231435 to connect the client to the server, and we are blocker at browser issues, that we cannot submit the form in the hidden iframe.
| Attachment | Size |
|---|---|
| remote-connection.patch | 5.79 KB |

#1
Note also that the urlencoding of the strings does not make sense in the HTML form generation code, it should escape the code, not urlencode. This should not affect its working (and did not affect its working) in our testing, as far as short string saves went, without multiple words :)
#2
Huh, just arrived back at the hotel, sat down and realized how bad the approach was. We should basically have an iframe to submit forms to, not create iframes with forms which we cannot access. I also realized quite a few other shortcomings which are addressed now, so the list of changes:
- largely cleaned up code!
- only one extra iframe ever, forms submit to that
- create the forms dynamically as a DOM element, so we can call submit() on them (no need for special ID)
- do not even add the form to the document :) (avoid leaving off temporary forms in the document)
- escape with checkPlain() instead of urlencoding
- use a textarea instead of a text input field, so multiline input is well respected, and works
- fixed up some typos
We could use more jQuery in the form builder now that we need to use less tags, but it might look better as it is.
All-in-all, since this works just pretty nice for me, I committed this version to the client.
#3
Automatically closed -- issue fixed for two weeks with no activity.