oxy_urlChooser Form Control Does Not Show the Browse Button
Problem
The oxy_urlChooser
form control in Oxygen XML Web Author does not show
the browse button near the text field. Other actions such as inserting an image or a link to
another file may not work or may show a text field instead of a file browser.
Cause
The oxy_urlChooser
form control uses the UrlChooser
(sync.api.UrlChooser) installed from a JavaScript
plugin. If no such UrlChooser
is installed, the browse button does not
appear in the UI.
Solution
You can install an UrlChooser
that allows for
choosing a resource in your CMS. The following code snippet implements a dummy
UrlChooser
that shows a prompt to the user that asks for the URL:
var DummyUrlChooser = function() {
sync.api.UrlChooser.call(this);
};
DummyUrlChooser.prototype = Object.create(sync.api.UrlChooser.prototype);
DummyUrlChooser.prototype.constructor = DummyUrlChooser;
// Only support image choosing
DummyUrlChooser.prototype.supports = function(type) {
return type == sync.api.UrlChooser.Type.IMAGE;
};
//
DummyUrlChooser.prototype.chooseUrl = function(context, chosen) {
if (context.getType() == sync.api.UrlChooser.Type.IMAGE) {
var result = prompt();
chosen(result);
}
return null;
};
Then, you can register it using the following API call:
workspace.setUrlChooser(new DummyUrlChooser());