Feb 2, 2012 6:38 AM
66 Posts

xPages and Dojo 1.7.x

  • Category: Dojo and Client Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 5
Based on this article http://heidloff.net/home.nsf/dx/09272011023837AMNHE9T8.htm there should be some easy way how to replace Dojo toolkit version to the newer one. Domino 8.5.3 provides Dojo 1.6..x  but we would like to use the latest ono, that emans 1.7.x . How can we accomplish this?
 
David 
Feb 2, 2012 7:21 AM
2 Posts
Re: xPages and Dojo 1.7.x
Yea I'd like to know as well.
 I loved the Dojo debug kit for Domino 8.5.3
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=Dojo%20debug%20kit%20for%20Domino%208.5.3
 
the same for Dojo 1.7 I'm sure is on many peoples wishlist.
Feb 6, 2012 10:18 AM
1 Posts
Re: xPages and Dojo 1.7.x
*** N.B. Caveat: The XPages 8.5.3 release is only compatible with the version of Dojo which ships with XPages (i.e. 1.6.1).
There are known issues regarding compatibility with 1.7.

In the XPages 8.5.3 release, a new extension mechanism was introduced to allow for the dynamic contribution of Dojo resources via a plugin.

In order to take advantage of this new behaviour, create a plugin to contribute a class which extends "com.ibm.xsp.context.DojoLibraryFactory". The DojoLibraryFactory is the new extension mechanism introduced to provide dynamic Dojo contribution. This is the "plugin.xml" file for the new plugin just created.

<plugin>
   <extension point="com.ibm.commons.Extension">
      <service
            class="xsp.dojo.dev.MyDojoLibraryFactory"
            type="com.ibm.xsp.context.DojoLibraryFactory">
      </service>
   </extension>
</plugin>

Given this new class created called "MyDojoLibraryFactory", this class is responsible for specifying properties of the Dojo resources which this plugin provides. It does so by returning a Collection of one or more classes which extend from "com.ibm.xsp.context.BundleDojoLibrary". Each BundleDojoLibrary is passed three parameters. First, a reference to this bundle (or plugin), second is the version string of the Dojo being provided and last is the directory path under the plugin where the Dojo resources can be found.

import java.util.Collection;
import java.util.Collections;
import org.osgi.framework.Bundle;
import com.ibm.xsp.context.DojoLibrary;
import com.ibm.xsp.context.DojoLibraryFactory;

public class MyDojoLibraryFactory extends DojoLibraryFactory {
    public Collection<DojoLibrary> getLibraries() {
        Bundle bundle = MyActivator.instance.getBundle();
        String versionString = "x.y.z.qualifier";
        String bundleLocationPrefix = "/resources/dojo-version";

        DojoLibrary lib = new MyBundleDojoLibrary(bundle, versionString, bundleLocationPrefix);
        return Collections.singletonList(lib);
    }
}

The version string is declared using the format "x.y.z.qualifier". This same format is used to explicitly specify which version of Dojo to use via an xsp.properties declaration either at an application or server-wide level.

xsp.client.script.dojo.version=x.y.z.qualifier

That is the infrastructure of the plugin taken care of so last requirement is to declare the DojoLibrary which specifies the behaviour that this plugin provides.

import org.osgi.framework.Bundle;
import com.ibm.xsp.context.BundleDojoLibrary;

public class MyBundleDojoLibrary extends BundleDojoLibrary {
    public MyBundleDojoLibrary(Bundle bundle, String versionString, String bundleLocationPrefix) {
        super(bundle, versionString, bundleLocationPrefix);
    }

    public boolean hasIbmModules() {
        return false;
    }

    public boolean isDefaultIbmLibrary() {
        return false;
    }

    public boolean isDefaultLibrary() {
        return false;
    }
}

This class which extends from "com.ibm.xsp.context.BundleDojoLibrary" declares functions altering the behaviour of how this DojoLibrary is registered with the runtime. In order for your plugin to be considered as the default library which will automatically be used by the runtime you must return true for the last function "isDefaultLibrary", then depending on whether it provides a later version computed based on the "versionString" parameter. If the library does not declare itself as a candidate for the default library then in order to use the particular version provided by the plugin, this must be explicitly specified using the xsp.properties option.

When completed, the new plugin providing the desired version of Dojo can be exported as a JAR to the location "domino\workspace\applications\eclipse\plugins" under the Domino Data directory path.

To verify whether your new plugin has been successfully registered with the runtime, issue the following command to the Domino console.

tell http osgi ss <my-dojo-plugin-name>

Furthermore, this can also be confirmed via the browser by hitting the following address.

http://<your-domino-server>/xsp/.ibmxspres/dojoroot-<versionString>/dojo/dojo.js

I hope this is of some help to everybody.

Feb 6, 2012 1:28 PM
66 Posts
Re: xPages and Dojo 1.7.x
 Does it mean, that there is a way, but cannot be used because of current incompatibility?
Feb 7, 2012 5:24 AM
272 Posts
Re: xPages and Dojo 1.7.x
I have made some quick tests by running Dojo 1.7.1 on Domino 8.5.2, and the XSP object is working as designed (partial refreshes etc.).
But the Date Picker is not working anymore, maybe other widgets are not working anymore too.
 
Sven
 
 
Feb 8, 2012 7:51 AM
2 Posts
Re: xPages and Dojo 1.7.x
There is a way to plug in a new version of Dojo but we usually have some integration issues with partial refresh and date/time picker.
 
Our plan is to provide Dojo 1.7 as part of Notes/Domino Upgrade Pack 2.