Getting the URI to a image or file component with the IBM WCM APIs

In order to create a link to a file or image component in the WCM repository, there is a 4 step process.

  1. Create a renderer
  2. Set the default context on the renderer to a site area.
  3. Render out a link tag that references the component.
  4. Get the actual desired url using a regex

The code which you can use as a starting point for doing this is included below:

//create a renderer
workspace.createRenderingContext(
    portletRequest, portletResponse, Collections.EMPTY_MAP);
//set the rendered content to a site area
renderingContext.setRenderedContent(siteArea);

//render the component (which will create an a tag)
String linkToComponent = workspace.render(
    renderingContext, fileOrImageComponent);

//get the url for the component (using the below code)
result = getUrl(linkToComponent));

//regular expression that can be used to refer to the rendered link
public static final Pattern IMG_SRC_PATTERN =
        Pattern.compile(
        "<\\s*img\\s[^>]*src\\s*=\\s*\"([^\\\"]*)(\")[^>]*>");

//used a regex to get the url for the component
String getUrl(String url) {
	String result = "";
	Matcher matcher = IMG_SRC_PATTERN.matcher(url);
	boolean found = matcher.find();

	if (found) {
		result = matcher.group(1);
	}
	return result;
}

 

Ensuring IWWCM Inline Editing Uses EditLive!

Symptom

After installing EditLive! for IBM WCM, the default editor is still used when using inline editing. When using the standard WCM interface, EditLive! is correctly used to edit rich text sections.

Cause

The WCM rendering portlet which provides the inline editing has a separate configuration option for which rich text editor to use. In most cases, this setting is correctly changed to use EditLive! when installing but in certain environments the setting may revert to the default editor.

Solution

  1. Log in as the portal administrator.
  2. Go to Portal Administration –> Portlet management –> Portlets.
  3. Search for portlets starting with Web.
  4. Click on the “Configure Portlet” button (displayed as a spanner icon) for the “Web Content Viewer” portlet.
  5. Set the value of the WCM_RICH_TEXT_EDITOR field to “EditLiveJavaEditor.jsp” (without the quotes). If the field is not present, add it.
  6. Save the changes.

EditLive! should now correctly load in both the standard editing form and in the inline editing view.

Uninstalling EditLive! for IBM Web Content Management

While we hope you never need or want to, if you ever decide to uninstall EditLive! and go back to using the default editor within IBM’s Web Content Management system (IWWCM), simply follow the steps below. If you’ve decided not to use EditLive! anymore we’d appreciate it if you could drop us a note to let us know why as it will help us to improve our products in the future.

  1. In the IWWCM Authoring interface, click the Configure link.
  2. Expand the Rich Text section. Remove the reference to EditLiveJavaEditor.jsp in the provided text field (so that it is blank). Click OK. The ODC Editor is now the default editor for new rich text fields.
  3. Select your desired Authoring template. Once open, click the Edit button.
  4. Click the Default Content Settings link. Notice that EditLive! will still appear for each registered rich text field in the Authoring template.
  5. For each rich text field element open the properties of the rich text field.
  6. Where the EditLiveJavaEditor.jsp file is referenced, remove the reference to EditLiveJavaEditor.jsp so that the text field is blank.
  7. Save the Authoring template. Each content item which uses this Authoring template will represent Rich Text fields using the IBM editor.
  8. Perform steps 3 to 8 for all the authoring templates where you no longer wish to use EditLive! for IWWCM.

 

Using EditLive! 6.4 (beta) in IWWCM 6.0

Several of our EditLive! for IWWCM clients have asked me recently how they can get hold of EditLive! 6.4 so they can try out the new styling capabilities in the release.  This article will give you the information that you need to install EditLive! 6.4 in IWWCM.

The steps in this article require you to customize an EditLive! for IWWCM installer.  Before making changes to your IWWCM installer I'd recommend that you check out the series of articles I wrote previously on Custom IWWCM installers.  

  1. Get a copy of the EditLive! for IWWCM installer - You can obtain a copy from either the Ephox website, or you can use a copy of an existing EditLive! for IWWCM 6.0 installer that you have.  
    • The advantage of using your own installer is that you will be able to install any customizations you've done along with EditLive! 6.4.
    • If you're downloading a new copy of the installer, unzip it to a location on your server so it's ready to be installed.
  2. Backup - If you're using an existing installer that you've customized then you'll want to back it up before working with EditLive! 6.4.  EditLive! 6.4 is currently a beta and there are bugs, so you will want to make sure you back up your EditLive! for IWWCM installer with EditLive! 6.3 before starting this process.  If you need to go back to using EditLive! 6.3 then having that backup will be important.
  3. Get a copy of EditLive! 6.4 - EditLive! 6.4 beta is available right now from the LiveWorks! web site in the Early Access section, you'll find a link to the EditLive! 6.4 downloads there.  In order to update EditLive! for IWWCM all you will need to download is the update package (the third download link in the list for EditLive! 6.4).  Unzip this package to a separate location on the machine with the EditLive! for IWWCM installer.
  4. Add EditLive! 6.4 to the IWWCM installer
    1. Open the EditLive! update package you downloaded and select all the files except the sample_eljconfig.xml file (we don't want to overwrite this in case you've made customizations).  
    2. Copy these files into the EDITLILVE_IWWCM/web/res/editlivejava folder and overwrite the existing files when prompted, where EDITLIVE_IWWCM folder is the root directory of your IWWCM installer.
  5. Run the installer - The installer is now ready to run.  Set the IBM Portal directory in the build.properties file in the installer's root directory if necessary and then run the install script.

You can find more information about what's in EditLive! 6.4 in the changelog.

If you have any questions or issues with the EditLive! 6.4 beta please let us know.  You can get in contact with us and the EditLive! community via the LiveWorks! mailing list.

 

IWWCM Version 6 Search

Editor’s Note: From time to time while developing with IWWCM, we discover useful gems of knowledge that we think everyone working with IWWCM should know, even if they don’t relate directly to our products. This is one of those nuggets of wisdom that we’d like to share.

IBM Workplace Web Content Management (IWWCM) Version 6 provides a variety of different searching options. These are discussed in the Best practices for using IBM Workplace Web Content Management V6 document, and from a high level are: 

  • Workplace Web Content Management API
  • WebSphere Portal Search, and 
  • Third-party search product

Workplace Web Content Management API

The IWWCM APIs do provide a limited search API. Before investing time in building a search using the APIs, the following points should be considered:

  • there is some degree of reinventing the wheel, as the WebSphere Portal Search, and third party search products already provide search.
  • the APIs do not provide full content search, instead searches are performed using the Document Ids of meta data (siteAreaIds, categoryIds and keyword ids).

WebSphere Portal Search

Publishing IWWCM Content to the portal search system and integrating this with your WCM system is not immediately obvious, but is explained in the WCM Infocenter.

To make this work you will need to follow steps outlined in the infocenter. Your content will then be regularly crawled by the portal search service, and included in the collections that you have set up. This allows fine grained control on search, including web content in which ever search collections are relevant.

A potential advantage of using this approach is the availability of the content through the Search and Indexing API (SIAPI). This may not work in all portal configurations, and may require troubleshooting to enable.

Third Party Search

A number of third party search options are also available, including IBMs OmniFind, and LuciFind.  These will provide rich search functionality, but require additional purchases, and may have some integration overheads.

Conclusion

There are three main different search options available with IWWCM. The WCM API option is not recommended to be used as it provides limited search options, and requires development of a custom search engine.

The Portal search API will often provide enough search functionality, but it is somewhat limited in the options available, and so a third party search may be required (as noted on this Developer Works forum thread).  While the WCM API provides some search functionality it is not recommended.  The Portal search API is worth considering as a starting point, as it is straight forward to integrate and deploy.  If it does not produce the desired results, a third party search should be used.

IWWCM Best Practices

Editor's Note: From time to time while developing with IWWCM, we discover useful gems of knowledge that we think everyone working with IWWCM should know, even if they don't relate directly to our products. This is one of those nuggets of wisdom that we'd like to share.

IBM Workplace Web Content Management (IWWCM) Version 6 is a true enterprise content management system. It integrates with WebSphere Portal 6, leveraging many of the features provided by portal, providing a huge number of configuration options, and different ways to set up your system.

IBM has produced the useful document Best practices for using IBM Workplace Web Content Management V6. This document has provided useful guidance when working through the next generation of Ephox software that will interact with IWWCM. We have found it to be a useful resource that provides helpful information for working with IWWCM (not just because they recommend using EditLive! for IWWCM).

Updating Your Custom EditLive! for IWWCM Installer

So now you have your custom EditLive! for IWWCM installer and re-installing EditLive! for IWWCM after an iFix is a breeze, but what happens when Ephox releases an update?  The answer is simple - copy your customizations into the new installer.

All you need to do is download the update from Ephox and unzip it.  In it you will find the same file structure as listed in the article on Understanding the EditLive! for IWWCM Installer.  Now just copy the relevant customizations you made to your EditLive! for IWWCM installer over to their matching locations in the new installer you've just downloaded.

It's important that you only copy the files that you've customized - i.e. the properties files and configuration files - otherwise you may overwrite one of the new files from the latest version.

Once you've copied over the files you're ready to go, simply run the newly downloaded and customized installer and you will be immediately up and running with the latest version of EditLive! for IWWCM.  EditLive! will automatically detect that it's been updated and the updated authoring environment will be automatically deployed to each author as they access it.

Next week will be the final article in this series.  I'm going to run through some information about EditLive!'s configuration, focusing on common customization options that I've seen people find very useful.

Customizing the EditLive! for IWWCM Installer

In this article we'll explore how to create the must-have Ephox accessory of the year, your own personal EditLive! for IWWCM installer.  As discussed in the previous article the EditLive! for IWWCM installer's main function is to perform some copy and paste operations.  By having and maintaining your own, customized version of the EditLive! for IWWCM installer it will make the job of maintaining your IWWCM instance much easier.

What I'm Not Going to Explain

In this article I'm not going to go into the details of each of the configuration settings for either the installer or EditLive!'s interface.  The best place to go for that information is the documentation packaged with the product.  If, you're still not sure about any of the settings after giving the documentation a glance I'd encourage you to get in touch with us here at Ephox via our support system.

Why Create a Custom Installer?

Put simply a custom installer is a backup of your EditLive! for IWWCM install.  

The main reason to create and maintain a custom EditLive! for IWWCM installer is to make the job of re-installing EditLive! for IWWCM much, much easier.  This will be helpful when either upgrading your EditLive! for IWWCM version or, more often, after you've installed certain IBM iFixes or patch releases.  For those of you who've been working with IWWCM and any IWWCM customizations, EditLive! included, you've probably noticed that certain packages from IBM will remove EditLive! for IWWCM's install files.   The usual clue that this will happen is when the iFix's or patch's release notes state that you need to backup any custom JSPs before the install.

If you have maintained your customized version of the installer for EditLive! for IWWCM then re-installing EditLive! for IWWCM after installing such a fix or patch into your Portal will be a breeze.  All you will need to do is run the installer and you'll be back up and running again with EditLive! in less than 5 minutes.  Equally upgrading your EditLive! install becomes a breeze - I'll go through how to upgrade your EditLive! version a little later.

What Can Be Customized?

I can tell I've got you interested now because you're still reading, so I will cut to the good bits.

For those of you who've spoken with our technical specialists or taken a glance at our documentation you'll know that EditLive! for IWWCM is extremely customizable.  However, for most people, customizing the installer's properties and EditLive!'s configuration is usually sufficient so that's what I will go through here.  If you've built extra functionality on top of the integration and have questions about how to best maintain that please get in touch with us via our support system or your system integrator who did the work originally.

There are two basic aspects of configuring EditLive!.  Firstly, the installer parameters that will set how EditLive! will interact with IWWCM behind the scenes.  This includes settings such as the install directory for Portal and what's visible on the dialogs that browse the repository (e.g. insert hyperlinks and images).

The second type of configuration is that for EditLive!'s interface.  Typically this involves things like what appears on the toolbar or menu, or how EditLive! cleans content copied from external applications (e.g. Word or the browser).

IWWCM 5.1.0.x

The files you are likely to customize for this installation are as follows (refer to Understanding the EditLive! for IWWCM Installer for information on where to find these files):

  • The build.properties file to set the parameters on how EditLive! will interact with your repository
  • The sites.properties file if you've enabled some of the advanced styles functionality
  • The standard_eljconfigxml.jsp if you've built role or user-based EditLive! configurations

IWWCM version 6.0 and Above

The files you are likely to customize for this installation are as follows (refer to Understanding the EditLive! for IWWCM Installer for information on where to find these files):

  • The build.properties file to set the install location of your Portal environment.
  • The configuration files for EditLive!
    • sample_eljconfig.xml if you've only got a single configuration for EditLive!
    • ephox.config.properties and any configuration files it lists if you're using role-based configurations or a configuration file other than sample_eljconfig.xml.

How to Create and Maintain Your Installer

By now you should know what advantages there are in maintaining a customized installer and which files are important to be able to maintain that custom installer.  So now it's time to go through the process of creating and maintaining that installer.

Creating the Installer

Creating the installer is pretty easy, in fact, if you've installed EditLive! for IWWCM in the past you've already created your own custom installer by specifying your own settings when you installed.  So, now that you've gone to the effort of doing that for the initial install don't waste it.  Keep that installer in a safe place as it will form the basis for your custom installer.

Maintaining the Installer

Maintaining the installer is also easy, it simply comes down to how you edit the configuration for EditLive!.  The way I'd recommend making any customization is to make the changes in the relevant files in the installer first (see the What Can Be Customized section which lists these files).  If you follow this logic then the steps to make changes to your EditLive! for IWWCM install will be as follows:

  1. Make the change in the customized installer you've created (and maintained)
  2. Deploy the changes by running the installer

Because deploying EditLive! for IWWCM doesn't require any downtime or restart for Portal this process is quick, easy and painless.

On the other hand if, for some reason, you have to make changes to the EditLive! for IWWCM configuration in the live Portal environment then simply make sure you copy the changes back into the EditLive! for IWWCM installer you're maintaining.  In this way you will make sure that your customized installer always reflects the live environment - effectively maintaining a backup - so if you ever have to re-install you'll have all your customizations back up and running instantly.

Summary

By now you should understand how a custom installer can be used to make a very effective backup of your EditLive! for IWWCM environment.  You should know how this backup can be used to quickly and easily get your EditLive! for IWWCM install back up and running after patching your Portal environment and how to create and maintain your custom installer.

I hope you've found this information useful.  If you have any comments or suggestions on how we could make this article more useful please let us know via the comments field below, the LiveWorks! mailing list, or through our support system.

The next article in this series will go through how you can upgrade your EditLive! for IWWCM install while still maintaining your custom files.

Understanding the EditLive! for IWWCM Installer

I've been out and about recently talking to quite a few of our IBM WCM clients both in person and on the phone.  In talking to many of you I found that there were lots of you out there who are not sure of the easiest way for maintaining an EditLive! for IWWCM install.  Fortunately we've got a few simple hints and tips that will help make your work easier.

Throughout this set of articles I'll be explaining how to get the most out of EditLive!, it's installer and how to make the basic system admin related to EditLive! for IWWCM much simpler.

The EditLive! for IWWCM Installer

Before I get into any tips about how to tweak EditLive! for IWWCM, I'd like provide some background on EditLive! for IWWCM's installer.  When I say "installer" I really mean it in the loosest sense of the word.  For the most part the installer for EditLive! for IWWCM just runs a script that copies the files needed to run EditLive! into the relevant directories.  In fact, for Portal 6.0 and above that's all it does.  For those using an earlier version of Portal the installer does some very basic configuration settings and then performs the copy operations.

What this means is that the installer can be tweaked to your needs so that you've got your own personal EditLive! installer.  Why is this useful?  Because this will make system admin much easier when installing certain iFixes and migrating your EditLive! settings from one environment to another.  

The EditLive! for IWWCM Package

The installer package is slightly different for Portal 6.0 and Portal 5.1.0.x.  For those who have experienced both versions of IWWCM you would have noticed there were some significant changes between these versions and the editor APIs that we use didn't escape those changes.  While it's the same editor functionality for your users, under the hood the integrations are really quite separate and you can see that in the installers, so I'll go through them separately.  Here's a link for those who want to skip straight to the IWWCM 6.0 information.

The IWWCM 5.1.0.x Package

Once you extract the downloadable package you'll see three directories, the important directories for this installer at the root directory and the ephox/editlivejava folder.  I'd also recommend taking a look at the docs folder.  It's the documentation folder and, while it doesn't have any affect on the install process, it is full of useful info.

The Root Directory

There are two important files here.  

Firstly the build.properties file:

You will need to edit this file.  This file sets almost all the important properties for the installer, including where to install EditLive! for IWWCM.  You'll find a complete run down on what each property does in the PDF install guide documentation also contained in the root folder.  

The properties in this file must be set at install time.  If you want to change these properties at a later date you need to do a re-install.  While that might sound daunting now, after reading these articles you'll see how simple that actually is.

You'll also find the sites.properties file here:

This file enables you to create a mapping between a given CSS file and a site area so that the content in EditLive! can be styled accordingly.  Unless you have vastly different stylesheets for different site areas I'd not recommend taking advantage of this feature as it has some limitations that impact the saving of documents (you can read them in the documentation).  As an aside, the stylesheet and editor interaction are greatly improved in Portal 6.0 thanks to some extra APIs from the WCM team.

The sites.properties file can be changed at any time.

The ephox/editlivejava Directory

This directory contains the actual rich text editor source files.  There's just one important file here and that's standard_eljconfigxml.jsp and it controls EditLive!'s toolbar, menu and other configuration properties.  It's also where you will need to install your EditLive! for IWWCM license.

If you've read the article about specifying different configuration files for different users in IWWCM 5.1.0.x you'll already be familiar with this file.  Basically, if you want to do any customization to how EditLive! looks or how it reacts to any non-IWWCM specific functionality then this is the place to change it.

The standard_eljconfigxml.jsp file can be changed at any time.

The IWWCM 6.0 (and above) Package

By the time IWWCM 6.0 was released IBM had been working with Ephox to improve the editing experience and APIs for integrating rich text editors.  As a result the IWWCM 6.0 integration is simpler in it's configuration and yet provides more functionality.  One really important distinction between the IWWCM 6.0 and the IWWCM 5.1.0.x integrations is that the properties (other than the install directory property) can be set at run time, so you don't need to reinstall the editor to make a change to the integration's behaviour.

The important directories for this integration are the root directory and the web/res/editlivejava directory.

The Root Directory

The build.properties file is the only important one here and inside you will find the one important setting - the Portal install directory.  Once you've set this you're ready to install EditLive! for IWWCM.

The web/res/editlivejava Directory 

This directory contains all the configuration information for EditLive! for IWWCM.

By default EditLive! for IWWCM will be configured according to the settings in the sample_eljconfig.xml.  

If you're using the default install of EditLive! for IWWCM then this is where you will need to install your license key as well as configure the menu, toolbar and other EditLive! settings.

You'll also find the ephox.config.properties.sample or ephox.config.properties file in this directory.  

Removing the "sample" from the file name (giving ephox.config.properties) will turn on EditLive! for IWWCM's role based customization linking the configuration of EditLive! to the roles of users within Portal/IWWCM. 

Once you've turned on this functionality this file provides the important mapping between roles and configuration files.  I'll provide more detail about how these configuration settings work in a future article.  For those who want to look into this now, you'll find more details in your install guide found in the docs folder (just open the index.html file).

Summary

Thanks for sticking with me through all that detail.  Hopefully by now you understand the structure of the installer for EditLive! for IWWCM and the operations it performs.  Most importantly, you now know which are the key files for your EditLive! for IWWCM install.  

I'd recommend that you bookmark this article as much of the information in this series of articles is going to relate to how we can work with these files and the installer to make the configuration and maintenance of your EditLive! for IWWCM install much easier.  So this is going to be a good article to refer back to.

Character Encoding and Special Characters

Have you ever put a piece of content through your system only to find that when you get it back some characters aren't quite right?  If this sounds like something you've seen recently chances are you are seeing a character encoding problem.

Unfortunately, characters aren't characters aren't characters when it comes to putting text through an application.  You need to make sure all the layers of your application from the database through to the text editing solution are all encoding using the same character set.  If this is not the case, you're likely to see character corruption, particularly for special characters i.e. characters from the extended character set.

Spotting the Issue

So how do you spot a character encoding problem?  It's usually pretty obvious but here are some key pointers:

  • The symbol ? appears on entering text. This means character encoding has been corrupted.
  • The curved quote characters “ and ” or apostrophe character ’ - typically present in content imported from Word - are corrupted
  • Special characters you insert using EditLive!'s symbol dialog insert correctly but are incorrect once the content has been submitted through the system.

This is not to be confused with situations where you get the character in the document.  If you see the box character this signals that the character cannot be displayed because the system doesn't have the required font installed (more info).  This is typically seen when trying to render Asian characters on an English system.

Fixing the Problem

The good news is that this problem is pretty easy to fix.  All you need to do is change the character encoding used in EditLive! to match that of your web application.  All you need to do is open up the configuration file for EditLive! and add a <meta> tag.  Your configuration file(s) can be found in:

  • IBM/PortalServer/installedApps/WCM_Authoring_UI__PA_XXXXXX.ear/PA_XXXXXX.war/ephox/editlivejava for ILWCM 5.1.0.x
  • IBM/PortalServer/installedApps/WCM_Authoring_UI__PA_XXXXXX.ear/res/editlivejava for ILWCM 6.0 or above

We've found that setting the character encoding to UTF-8 usually does the trick:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

However, if that still doesn't work you'll have to investigate your ILWCM settings to determine the character set correctly. Note that fixing the character set won't restore characters that have previously been corrupted.

If this doesn't solve your character encoding issue then chances are the issue is something else masquerading as a character encoding issue and you should get in touch with Ephox support