I have managed to get basic forms generated from xqueries in eXist to
load with Ubiquity although I still have a few issues. Here are the
steps to get it working:
1. Build a copy of the Ubiquity release from svn and load into eXist
as a resource
2. Create an xquery that generates an html document with xforms
elements embeded within it. Remember that the xforms model must go
inside the html body element rather than the head element.
3. Insert the following element at the top of the html head section in
your html output (adjusting for the appropriate path): <script src="/
exist/rest//dbs/some/path/ubiquity-xforms/src/ubiquity-loader.js"
type="text/javascript">/**/</script>
4. At the top of the xquery document, after any namespace declarations
and import statements, insert the following declaration to ensure that
the output is serialized as html: declare option exist:serialize
"method=xhtml media-type=text/html indent=yes";
One of the issues I had is that I have designed my application so far
using the mozilla plugin. In order for the mozilla plugin to work,
the output must be serialized as xml. In order to handle both html
and xml output, I had to have two index pages that call the main
html / xforms xquery: index.xq and index-xml.xq. In the head of the
html output I put the following javascript to redirect if the browser
is firefox and has the xforms plugin installed:
<script language="JavaScript" type="text/JavaScript">
<!--
if(location.pathname.match('index.xq'))
{
if (isFirefox())
{
if (hasMozXForms())
{
var url=location.href;
var redirect=url.replace(/index.xq/,"index-xml.xq")
window.location = redirect;
}
}
}
else if (!hasMozXForms())
{
var url=location.href;
var redirect=url.replace(/index-xml.xq/,"index.xq")
window.location = redirect;
}
function isFirefox() {return (navigator.appName ==
'Netscape' && !navigator.appVersion.match('AppleWebKit')); }
function hasMozXForms() {return
(document.implementation.hasFeature("org.w3c.xforms.dom", "1.0"));}
-->
</script>
This isn't really a great solution but I haven't been able to come up
with anything else. Once Ubiquity is performing as well as the
mozilla plugin I could skip this redirect and have only one index.xq
file.
When loading the more complex xforms required for my application,
unfortunately most of the functionality that is working using the
mozilla plugin is not working using the Ubiquity processor. Here are
some of the issues I have identified:
1. IE seems to have problems completing the load of the ubquiquity
javascript as the "loading...." message stays visible and the form
controls don't render. Even an html login form won't submit.
2. Webkit browsers render the form controls ok but none of the
submissions work. In the process of debugging I once saw a message
able an issue with parsing UTF-8 but I can't seem to replicate that
message at the moment.
3. Webkit browsers break a lot of the css that is working in the
mozilla plugin
4. Webkit browsers don't seem to be able to handle a switch/case
inside of a repeat.
5. While the page is loading, the xforms model shows in the browser.
It creates a disturbing affect when navigating from page to page.
Despite these issues I'm very excited about the progress of the
Ubiquity project and appreciate very much the hard work of the
developers. I agree completely with Mark's advocacy for declarative
web development tools like xforms and progressive browser enhancement
using javascript to bridge between the advent of new declarative
approaches and the native capabilities of browsers. My application
currently only works in Firefox using the plugin so getting it to work
with Ubiquity would be really critical.
I hope this feedback helps the progress of Ubiquity.
Cheers,
Fraser