Edit online

Creating an Options Page for a Plugin

Every Oxygen XML Web Author plugin can contribute an options page that can be accessed from the Administration Page. These options will be persistent in the global options file and can be accessed programmatically either from server-side or client-side code.

Implementing an Options Page

First off, you have to add a Java class to your plugin that will be responsible for the options page. The class should extend ro.sync.ecss.extensions.api.webapp.plugin.PluginConfigExtension. An example of such class can be found in the following WebDAV plugin located on GitHub: WebdavPluginConfigExtension.java.

This class needs to be registered in the plugin.xml file as in the following code snippet:

<extension type="WebappServlet" role="config" class="com.company.package.ServletClass"/>

Using the Options

The following code snippet reads an option from server-side Java code:
PluginWorkspaceProvider.getPluginWorkspace().getOptionsStorage().getOption
("option_name", "default_value");
The following code snippet reads an option from client-side JavaScript code:
sync.options.PluginsOptions.getClientOption('option_name');
Note: The options returned by this JavaScript method are those returned by the

PluginConfigExtension.getOptionsJson method on the server.