The WCM deployment of EditLive! provides a framework for developers to specify which EditLive! configuration file is loaded into the editor depending on the current Web Content Management user's access privileges. This article describes how to create EditLive! configuration files and how to specify which files are loaded for which users.
Custom JavaScript Integration Code
Tiny has provided a JSP file for developers where custom JavaScript methods can be specified - for example, a custom dialog called via a RaiseEvent custom toolbar button in EditLive!.
The file is customFunctionality.jsp and is located in the web/jsp/html directory of the installation package. Note that this file is updated on the server every time the integration is installed, so when upgrading the integration please ensure you keep your copy of this file.
Creating EditLive! Configuration Files
EditLive! configuration files are XML documents which specify the appearance and functionality of an instance of the EditLive! editor. This EditLive deployment contains the default configuration file of sample_eljconfig.xml. You can modify this file and save your changes under a different file name to create your own configuration files.
Using a text editor, you can create or edit an EditLive! configuration file. The EditLive! Developer Guide packaged with this integration contains information on XML elements and attributes required in a configuration file.
The following <menuItem> and <toolbarButton> configuration file elements have been created specifically for the Tiny deployment into the Web Content Management portlet. These configuration file elements are:
- <menuItem name="iwwcmlink"/> - A menu item allowing the user to launch the IBM dialog for creating a hyperlink to Content/Components.
- <menuItem name="iwwcmimage"/> - A menu item allowing the user to launch the IBM dialog for inserting images from either the user's local machine or the Component Library.
- <menuItem name="iwwcmecmlink" action="raiseEvent" value="Ephox.EditLive.WCM.insertEcmLink"/> - A menu item allowing the user to launch the IBM dialog for inserting content from an ECM repository.
- <toolbarButton name="iwwcmlink"/> - A toolbar button allowing the user to launch the IBM dialog for creating a hyperlink to Content/Components.
- <toolbarButton name="iwwcmimage"/> - A toolbar button allowing the user to launch the IBM dialog for inserting images from either the user's local machine or the Component Library.
These configuration file elements are defined in the default configuration file (sample_eljconfig.xml) packaged with this integration.
Specifying Configuration File for EditLive! to Use (Role-based Config)
This EditLive! deployment comes packaged with an example properties file that depicts how to load a specific configuration file based on the current user's name or user group. This example properties file is called ephox.config.properties.sample and is located in the res/configs directory for your installation. The installation will be located in the folder installedApps/EphoxEditLiveJEE.ear/EphoxEditLiveJEE.war.
If you would like to use a configuration properties file to specify which configuration file should be used with EditLive!, change the name of this file to ephox.config.properties.
Each line of the configuration properties file is treated as a rule specifying which configuration file to use. EditLive! checks these rules in the following order of priority:
- User rules (config.user.username)
- Group rules (config.group.groupname)
- Default rules (config.default)
If none of these match, then the "global" default, sample_eljconfig.xml, will be used. Within each of these priorities, rules are resolved in the order they appear in the config file.
The current user's name (the combination of their first and last name for their Websphere profile) will be matched against the config.user.FIRSTNAME LASTNAME properties found in the file. If a match is found between the user's name and one of these properties, the corresponding configuration file is loaded into EditLive!.
There are three different ways for specifying rules: config.user rules, config.group rules, and config.default rules. Examples of each of these follow.
Example - User Name:
If the current user's first name is John, second name Citizen, and ephox.config.properties file contains the following line:
config.user.John Citizen=john_config.xml
Then the configuration file john_config.xml, located in the res/configs directory, will be loaded into EditLive! for this user.
The user name can contain spaces. Do not convert these spaces to underscores (this was required in previous versions).
Example - User Name:
If the current user's second name is admin, no first name has been specified, and ephox.config.properties file contains the following line:
config.user.admin=admin_config.xml
Then the configuration file admin_config.xml, located in the res/configs directory, will be loaded into EditLive! for this user.
For a config.group rule, the integration looks for a match between all the current user's Websphere group memberships and the config.group.X permissions.
Example - User Role:
If the current user belongs to the group named lwcm_reviewer and ephox.config.properties file contains the following line:
config.group.lwcm_reviewer=reviewer_config.xml
Then the configuration file reviewer_config.xml, located in the res/configs directory, will be loaded into EditLive! for this user.
A default configuration file can be specified in the config.default property.
Example - Default:
If the ephox.config.properties file only contains the following line
config.default=eljconfig.xml
Then the configuration file eljconfig.xml, located in the res/configs directory, will be loaded into for every user.
If the ephox.config.properties file does not contain a config.default property, and no config.user or config.group matches return any results, then the sample_eljconfig.xml configuration file is loaded for the user.
If you don't create your own ephox.config.properties file, the sample_eljconfig.xml configuration file will be loaded into EditLive! for any user.
If you wish to specify a different default configuration for EditLive!, Tiny encourages creating a uniquely named configuration file and specifying this under the config.default property in the ephox.config.properties file. If you simply make changes to the sample_eljconfig.xml configuration file, when you upgrade the Tiny integration in the future this file will be overwritten and your changes will be lost.