Galleries can make editing pages for your users a lot easier. These can include important images or commonly used HTML snippets, and are much easier to sort through than just looking through the file system. Plus, image galleries will show previews of the image.
Adding an HTML Gallery
- Navigate to the folder where you want the gallery
- Select New->Extended Folder
- Select HTML Gallery
- Once the folder is created, add a plain text file to the folder, and put some HTML into it
- Create one file for each HTML snippet
Now, when you go to the editor, and choose HTML Galleries from the toolbar buttons, you can browse through your HTML snippets, and select one to get added to your page.
You can even put JSP files into the HTML Gallery, and include dynamically generated HTML.
NOTE: There's an issue sometimes with FCKEditor that causes your newly inserted HTML snippet to disappear. A work around is to insert a carriage return at the top of the file. You can alternatively edit the default body to have it in place too.
If the HTML snippet uses some CSS from an external CSS stylesheet, you need to add the CSS stylesheet to the FCKEditor editor. Locate the JSP page which is the template, and set its template property to the path of your CSS styleheet. Yes, the template property of the template specifies the location of CSS stylesheet for the FCKEditor.
There is an issue with FCKEditor and image galleries where if you place an image gallery somewhere on your OpenCms install other than /system/galleries/ none of the images are displayed in the editor. They will display in the site fine, but when editing content you will get a broken image. The first time you insert the image it will display fine, however when editing the page in the future the broken image appears. The solution is as follows:
Edit the file /system/workplace/editors/fckeditor/customconfig.js
- Add the import: org.opencms.site.CmsSiteManager
- Change the line: String site = OpenCms.getSiteManager().getWorkplaceServer(); to:
String site = CmsSiteManager.getCurrentSite(cms.getCmsObject()).getUrl();
Table galleries are like HTML galleries, so just create a text file with an HTML code for the table. The difference from HTML galleries is that the editor knows that it is a table, and right-clicking a table shows a pop-up menu, where the user can add and remove cells, columns and rows.