Xopus 3
Introduction
This document describes various items re integration of Xopus 3
Loading/Opening data
Download Xopus from http://www.xopus.com/download/ and unzip and deploy it such that it can be accessed for example with the following URL http://127.0.0.1:8080/yanel/from-scratch-realm/Xopus-3.2.10/xopus/xopus.js
WARNING: It doesn't seem to be possible to make it accessible from within a resource, which means using a URL as for example http://127.0.0.1:8080/yanel/from-scratch-realm/yanel/resource-types/http%3a%2f%2fwww.wyona.org%2fyanel%2fresource%2f1.0%3a%3axopus3/Xopus-3.2.10/xopus/xopus.js
In order to load data for editing with Xopus 3 one needs to provide an XHTML page containing a link to the main Xopus javascript (xopus.js) and an XML configuration (<x:config>...</x:config>) containing pointers to the actual XML data, its schema and some XSLT for the WYSIWYG transformation of the XML.
This page can be provided at any URL as for example http://127.0.0.1:8080/yanel/from-scratch-realm/xopus-example.html and served with the mime type text/html, whereas please make sure to resolve the Xopus javascript path relative to the page's URL:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Starting Xopus ...</title> <script src="./Xopus-3.2.10/xopus/xopus.js" type="text/javascript"></script> </head> <body bgcolor="#ffffff"> <div autostart="true" xopus="true"> <xml> <x:config version="1.0" xmlns:x="http://www.xopus.com/xmlns/config"> <x:pipeline xml="sample.xml" xsd="sample.xsd"> <x:view name="WYSIWYG View"> <x:transform xsl="sample.xsl"/> </x:view> <x:view name="XML View"> <x:treeTransform/> </x:view> </x:pipeline> </x:config> </xml> </div> </body> </html>
The actual content and it's related schema and XSLT are resolved then by Xopus relative to the location of the above page, for example http://127.0.0.1:8080/yanel/from-scratch-realm/sample.xml
NOTE: After loading this page and in particular loading the Xopus javascript, one will be redirected to Xopus-3.xx/xopus/xopus.html, whereas this page will be kept as reference within the URL. (The page Xopus-3.x.x/xopus/xopus.html is referencing a favicon.ico, but which doesn't exist within the Xopus-3.x.x/xopus/media folder! One might want to add one in order to avoid 404 messages within the log-file.)
Saving data
In order to save data from Xopus to the server one needs to implement a custom javascript save function (and also an exit function):
// This function is called when the save button is pressed, or when the save function is called on an XMLDocument. function mySaveFunction(uri, xmlDocument) { // HTTP POST the XML document var result = HTTPTools.postXML(uri, xmlDocument,"UTF-8"); // Show a dialog with the result. //return confirm("Called save\n" + "Result: " + result + "\n"); } // Register the save function. IO.setSaveXMLFunction(mySaveFunction); // Set exit URL: var exitURL = unescape(window.location.href).split('#')[0].split('?')[0] + '?yanel.resource.usecase=checkin'; //alert(exitURL); Editor.setExitURL(exitURL);
The file containing the javascript code above needs to be referenced from within the x:config
<!-- .. --> </x:pipeline> <x:javascript src="./Xopus-3.2.10/custom/save.js"/> </x:config> </xml>
Lookup
The "Lookups" need to be configured within x:config
<!-- .. --> </x:pipeline> <x:lookupConfig> <!-- Image Lookup --> <x:lookup xmlns:yanel="http://wyona.org/yanel/1.0" parentPattern="self::yanel:image" name="src" url="SOME_URL?yanel.resource.usecase=xopus-imagelookup" forceLookup="true" autoOpen="true"/> <!-- Link Lookup --> <x:lookup xmlns:xhtml="http://www.w3.org/1999/xhtml" parentPattern="self::xhtml:a" name="href" url="SOME_URL?yanel.resource.usecase=xopus-linklookup" forceLookup="true" autoOpen="true"/> </x:lookupConfig> </x:config> </xml>
Sometimes Xopus hangs after closing a lookup. This can be 'fixed' by adding a sleep() to Xopus-3.2.10/xopus/media/lookup.html
funtion doUnload() { sleep(500);
In order to transfer the values from the custom Lookup-Dialog into Xopus one needs to use top.dialogArguments (instead window.dialogArguments as used by Xopus 2)
Misc
Xopus depends on the MSXML Parser, whereas depending on the version of the MSXML Parser one needs to adapt the schemas and XSLTs. In order to test what version you have installed, please browse to the following URL http://xopus.com/files/msxmltester/
Depending on the schemas and XSLTs provided by the server you might have to upgrade your locally installed MSXML Parser.
Your comments are much appreciated
Is the content of this page unclear or you think it could be improved? Please add a comment and we will try to improve it accordingly.