Version 8.5.0
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Contents
1 Introduction 2 JSP basics 2.1.1 JSP features 2.1.2 How to continue from here? The JSP cms-taglib 2.1.3 How to insert the "taglib" directive? 2.1.4 Available tags 2.1.5 Available EL functions 3 Page editor 3.1 Toolbar 3.1.1 Controls 3.2 Edit points 3.3 The Add Content 3.3.1 Creating new content 3.3.2 Searching for content 3.3.2.1 Results 3.4 Clipboard 3.4.1 Recent list 3.4.2 Favorites 3.4.2.1 Add to favorites 3.4.2.2 Favorites list 3.5 Context 3.5.1 Availability 3.5.2 Show workplace 3.5.3 Properties 3.6 Publish 3.6.1 Publish dialog 4 Sitemap Editor 4.1 Introduction 4.2 Open the Sitemap Editor 4.3 Sitemap toolbar 4.3.1 Controls 4.4 Create page 4.4.1 Container Pages 4.4.1.1 Edit Model Page 4.4.2 Type pages 1 2 2 2 2 2 3 3 5 5 5 5 6 6 6 6 6 7 7 8 8 8 8 9 9 9 9 10 10 10 11 11 11 12 13 13
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
4.4.2.1 Detail pages 4.4.3 Function pages 4.4.3.1 HTML Redirect 4.4.3.2 Navigation Level 4.4.3.3 Function detail pages 4.5 Clipboard 4.5.1 Modified 4.5.2 Deleted 4.6 Display all Resources 4.7 Context menu 4.8 Edit point 5 Inline Editing 5.1 Demo 5.2 XmlContent fields with inline editing option 5.3 Configuration 5.3.1 Formatters 5.3.2 Nested contents 5.3.3 Details 6 Content editor widgets 6.1 Widgets 6.2 Widget description 6.2.1 BooleanWidget 6.2.2 DisplayWidget 6.2.3 StringWidget 6.2.4 TextareaWidget 6.2.5 HtmlWidget 6.2.6 RadioSelectWidget 6.2.7 SelectorWidget 6.2.8 MultiSelectWidget 6.2.9 ComboWidget 6.2.10 TypeComboWidget 6.2.11 LocalizationWidget 6.2.12 ColorpickerWidget 6.2.13 DateTimeWidget 6.2.14 CategoryWidget 6.2.15 GroupWidget 6.2.16 GroupMultiSelectorWidget 6.2.17 VfsFileWidget
13 13 14 14 14 14 15 15 15 15 15 16 16 17 17 17 18 18 19 19 19 19 19 19 20 20 21 22 22 23 23 24 25 25 26 27 27 28
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.18 VfsImageWidget 6.2.19 DownloadGalleryWidget 6.2.20 ImageGalleryWidget 6.2.21 HtmlGalleryWidget 6.2.22 TableGalleryWidget 6.2.23 LinkGalleryWidget 7 Model Page 7.1 Creation 7.2 Configuration 7.3 Extended feature 8 Element Group 8.1 Description 8.2 Combination with model page 8.3 How to use the element group 8.3.1 Editing 9 Inheritance Group 10 Description 11 Basic definitions 12 Usage 12.1 Creating new inheritance groups 12.2 Using existing inheritance groups 12.3 Changing inheritance groups 12.3.1 Changing the title and description 12.3.2 Adding content elements 12.3.3 Removing content elements 12.3.4 Reordering content elements 12.3.5 Inheritance status 12.3.6 Showing previously hidden elements 12.3.7 Save 12.3.8 Break up 12.3.9 Edit settings 13 Internals 13.1 Resource types 14 Detail Page 14.1 Use Case 14.2 Configuration 14.2.1 Module adjustments 14.2.2 Add detail page to the sitemap
28 30 30 31 32 32 33 33 33 34 34 34 34 35 35 36 36 36 37 37 37 37 37 38 39 39 40 40 41 41 41 41 42 42 42 42 43 43
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
15 Function Detail Page 15.1 Use Case 15.2 General steps 15.3 Creating dynamic function 15.4 Create and configure function detail page 15.5 Usage 16 Simple Collector 16.1 Demo 16.2 Implementation 16.3 Configuration 16.4 How to use collector in a jsp 16.5 How to drop the list into a container page 16.6 How to use detail pages for lists 16.7 Code examples 17 XSD Choice Element 17.1 Definition 17.2 Single and multiple choice 17.3 Content editor 17.4 Accessing values in JSP 17.5 Examples 17.5.1 v8 InfoBox 17.5.2 Development Demo 18 Navigation Level 18.1 Use Case 18.2 How to use the "Navigation Level" 18.3 Implementation details 18.3.1 Navigation tag 18.3.2 Styling 18.4 Examples 19 Hidden Entries 19.1 Description 19.2 Usage 20 Search with Apache Solr 21 Abstract 22 Searching for Content in OpenCms 22.1 DEMO 22.2 Quick Start Example 22.2.1 Send a REST-like query
44 44 44 44 44 45 46 46 46 46 47 47 48 48 49 49 50 50 50 52 52 52 53 53 53 53 53 53 54 54 54 54 56 56 56 56 56 57
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
22.2.2 Retrieve the response 22.2.3 Send a Java-API query 22.2.4 Use CmsSolrQuery class for querying Solr 22.3 Advanced Search Feature Examples 22.3.1 Auto suggestion/completion/correction 22.3.2 Excerpt 22.3.3 Facteted search 22.3.4 Grouping 22.3.5 Highlighting 22.3.6 Range queries 22.3.7 Sorting 22.3.8 Spellchecking 22.3.9 Thesaurus/Synomys 22.3.10 Querying multiple cores (indexes) 22.4 Using the standard OpenCms Solr collector 23 Indexing Content of OpenCms 23.1 Search Configuration 23.1.1 Embedded/HTTP Solr Server 23.1.2 Search index(es) 23.1.3 Index sources 23.1.4 A new document type 23.1.5 The Solr default field configuration 23.1.6 Migrating a Lucene index to a Solr index 23.2 Indexed data 23.2.1 The Solr index schema (schema.xml) 23.2.2 Default index fields 23.2.3 Custom fields for XML contents 23.2.4 Dynamic field mappings 23.2.5 Custom field configuration 23.2.6 Extend the CmsSolrFieldConfiguration 24 Behind the walls 24.1 The request handler 24.2 Permission check 24.3 Configurable post processor 24.4 Multilingual support 24.5 Multilingual dependency resolving 24.6 Extraction result cache 25 SEO
57 59 60 60 60 60 60 60 60 60 60 60 61 61 61 62 62 62 63 63 64 64 64 66 66 68 69 70 70 70 70 70 70 70 71 71 71 72
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
26 CMIS
72
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
1 Introduction
This documentation has been developed by Alkacon Software - the OpenCms experts [1]. We offer standard service and support packages for OpenCms, providing an optional layer of security and convenience often required for mission critical OpenCms projects. For more information about our services, please contact us at info@alkacon.com [2]. It aims to help developers from getting started with OpenCms up to getting familiar with advanced development topics regarding OpenCms. It uses links referring a locally installed OpenCms verion >= 8.5 including the OpenCms v8 Modules ('modules-v8 [3]') together with the OpenCms Developer Modules ('dev-demo'). In order to use the interactive development demo from OpenCms 8 together with this documentation we assume you have a running OpenCms on localhost:8080 and the OpenCmsServlet is reachable under http://localhost:8080/ opencms/opencms [4]. If so, you are able use the links inside this documentation that will open the according DEMO pages inside the "Wonderful world of flowers". If you don't have a running OpenCms including the Alkacon OpenCms Demo Modules yet, please read OpenCms server installation and you will see how to setup and run OpenCms... This documentation is published under the GNU FDL Free Documentation License by Alkacon Software GmbH. We certainly welcome all contributions and feedback to this documentation.
Developer Documentation Version OpenCms Document 8.5.0 1.0 Date 2012-09-24 2012-09-24
References
[1] [2] [3] [4] http:/ / www. alkacon. com mailto:info@alkacon. com https:/ / github. com/ alkacon/ modules-v8 http:/ / localhost:8080/ opencms/ opencms
Page 1
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
2 JSP basics
This part of the documentation describes the basics of JSP application development with OpenCms. It provides an overview and some background information about the technology used for the OpenCms JSP integration. Other sections available in the Alkacon OpenCms documentation accompany this introduction and serve as further reference material. Please note that this is not an introduction to JSP developing, there are certainly many good tutorials or books for that around. The JSP integration part in OpenCms is called Flex. So if we talk about an OpenCms/Flex or just a Flex application, we actually mean a JSP application built with OpenCms. The name Flex was chosen because the ultimate goal of the JSP integration was to make OpenCms more flexible to use. We think that we have achieved that goal. But judge for yourself...
Page 2
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 3
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 4
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
3.1.1 Controls
The edit toolbar appears on top of the page and shows the available options:
Available options are: Publish: This icon opens the publish dialog. Clipboard: Opens the clipboard, where a content editor can access favorites and recently changed files. Add content: The "Add content" allows to add content to a container page by drag & drop. Edit point: Clicking the "Edit point" icon switches on / off the edit points for the editable elements on the website. Context: Opens the context menu of the current container page Sitemap: Opens the Sitemap Editor The following section explains all Controls in detail. The order of the described controls differs.
Page 5
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
3.3.2.1 Results
You can combine all of the given search refinements by Types, Galleries, Categories and Advanced if you like. Click the Results button to generate an overview according to your search settings to display content of the given criteria. Thus it is possible to see a result list of all existing contents of these types in the OpenCms repository.
Page 6
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
3.4 Clipboard
3.4.1 Recent list
You can access the Clipboard and Recent list from the page you are editing by clicking on the Clipboard icon in the toolbar. The clipboard holds a list of all elements that have recently been edited or modified. You can directly add content from the clipboard to your page by drag & drop.
Page 7
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
3.4.2 Favorites
3.4.2.1 Add to favorites
Editing your page you can add any element to user individual favorites list using the favorites option on the element. Add to
3.5 Context
You can access the page's context menu by selecting the Available options are: from the toolbar.
Properties: Display and edit the OpenCms properties of current container page. Attributes: container page attributes, like date created, date last modified, etc. Availability: the availability options Lock report: lock state report of current container page Assign categories: dialog to assign categories to current container page SEO options: Search engine optimazation Undo changes Show workplace: open the OpenCmsworkplace Logout
Page 8
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
3.5.1 Availability
By selecting the Availability option from the page's context menu you can access and set different properties concerning the resource's online visibility. Available options in the Availability / Publish Scheduled dialog are: Publish scheduled Publish scheduled date: Using the Publish scheduled date, this page will be published automatically on the set date / time. Availability Date released: By setting the release date, this page will be visible online from the chosen date / time on (if published). Date expired: By setting the expiry date, this page will be online (if published) until this date / time and the will disappear but still remain in the OpenCms VFS You can set the dates by keyboard input or by using the simple calendar widget that will appear, when the mouse is clicked in the according field.
3.5.3 Properties
To edit the page properties, select the Properties option from the page's context menu. The newly designed property dialog allows changing of all properties of the resource in the OpenCms VFS. In the Properties dialog, there are 3 different subsets of properties available: Basic, Individual and Shared Properties.
3.6 Publish
After you made one or many changes in the page editor or in the sitemap editor, you still need to publish those changes to be visible in the OpenCms "Online" project. The Publish option allows you to publish all changes you recently made directly from page editor. To publish the edited page and its contents select the publish dialog opens in an overlaying window. Publish option from the toolbar. The
Page 9
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
On mouse-over there appears the option to remove a single resource from the user's personal publish list. In case the deselected resource has siblings or related resources, these will also be removed from the list provided these options have been chosen by the user (see below: "Include related resources"). If an item was removed from the publish list, it will re-appear if the dialog is opened again. With the two checkboxes below the publish list it is possible to extend the publish list. Include related resources will publish all new / changed resources that are related to the original resource (e.g. images or linked resources). Include siblings will publish resources that are directly link to the original resource and that get changed when the original resource gets changed. Resources can also be published from the Sitemap Editor.
Page 10
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
4.3.1 Controls
The following options are available: Publish: opens the publish dialog Clipboard: shows deleted or recently modified pages Create page: opens the dialog from which model pages can be dropped to the sitemap Display all Resources: opens an extended sitemap view, which corresponds to the VFS explorer view in the workplace. Context: opens the context menu for the sitemap Edit point: returns to the page editor
Page 11
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 12
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Hint: to add a sub-page to an existing leaf, drag the container page on the move symbol and place it over the container page icon.
If the displayed page contains sub-pages itself that are currently not displayed (you might want to unfold them by clicking the (+) more symbol) you can insert the new page after the existing page at the same navigation level. The folder structure can be unfold while drag & drop by moving the mouse over a folder icon.
Page 13
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 14
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
4.5 Clipboard
When selecting the Clipboard option from the sitemap toolbar the clipboard opens in an overlay window. It features two lists of pages recently edited in the sitemap editor.
4.5.1 Modified
The Modified list will be displayed as default and contains pages that have recently been modified in the Sitemap Editor. When you move the mouse over a list entry, to the right side of the bar there appears an option to show the page in the Sitemap Editor. If clicked the overlay window is closed and the selected page will show up blinking in the Sitemap Editor.
4.5.2 Deleted
This list holds all pages that had been deleted from the sitemap editor without publishing the deletion. Moving the mouse over a list entry will show up an Undelete option to the right side of the bar, restoring the original state of the resource before it was deleted.
Page 15
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
5 Inline Editing
Inline editing is a new feature introduced with OpenCms 8, which improves user experience during editing of page contents. The Inline Editing enables the editor to change the contents directly on the preview page. The content editor can still be used as usual for editing the complete content of the resource. Click here to open the corresponding Inline Editing Demo of Development Demo Module [1]
5.1 Demo
Inline editing is enabled by clicking on the Edit point in the toolbar. An edit cursor appears, when the cursor is hovering text, which can be edited inline.
By cliking the inline editable field, the text is highlighted and optionally a format toolbar is switched on.
Page 16
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
5.3 Configuration
Inline Editing is configured inside a formatter jsp. Each formatter of a resource type defines its own inline edit behavior. E.g. an article can be dropped to the center column as well as to the side column, but the editor should only be able to edit the article in the center column. To achieve this only the formatter used to render the article in the center column container should enable the inline editing.
Page 17
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
5.3.1 Formatters
There is an xmlcontent with a field Title. The inline editig feature for this xmlcontent field can be configured in the formatter jsp in only two steps: 1. To enable the inline editing add a new attribute rdfa="rdfa" to <cms:formatter> tag. 2. Add ${rdfa.fieldName} as attribute to the html element, which surrounds the field content. <cms:formatter var="content" val="value" rdfa="rdfa"> <span ${rdfa.Text}>${value.Text}</span>
5.3.3 Details
rdfa attribute of the <cms:formatter> tag is used in a similar manner to the val attribute. Assume the xmlcontent has a field with the name Title. In EL with ${rdfa.Title} you get the specific css attributes, which are required to enable the inline editing feature for this content field. These automatically generated attributes has to be set as attribute on the html element, which surrounds the field content. Note that the inline editing feature cannot be applied to field contents, that are manipulated in a jsp e.g. with cms:stripHtml() or cms:trimToSite().
Page 18
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
References
[1] http:/ / localhost:8080/ opencms/ opencms/ dev-demo/ inline-editing-demo/
This widget does not need any configuration and can be define in the xsd by this way: <xsd:sequence> <xsd:element name="Checkbox" type="OpenCmsBoolean" /> ... </xsd:sequence>
6.2.2 DisplayWidget
The DisplyWidget only shows a value. The value cannot be changed or edit by the user. It is set during configuration of this widget.
During the definition of this widget it could be set a configuration string. This string is displayed in the display widget. It can be define in the xsd by this way:
<xsd:sequence> <xsd:element name="Display" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="Display" widget="DisplayWidget" configuration="This is no default string." /> ... </layouts>
Page 19
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.3 StringWidget
The StringWidget provides an input field to write or edit the text.
This widget does not need any configuration and can be define in the xsd by this way: <xsd:sequence> <xsd:element name="Input" type="OpenCmsString" /> ... </xsd:sequence>
6.2.4 TextareaWidget
The TextareaWidget provides a text area field for input. It is like the StringWidget but can show more than one row at once and it supports to scroll if the text is too big to display all. The field can also be resized by using the mark at the right bottom corner.
This widget has only one parameter that can be set during the definition in xsd. This parameter sets the number of rows that should be shown. The default value, if no configuration is set, is to show fife rows of text. This value also sets the minimum height of the field. It cannot be resized smaller than the given row count. <xsd:sequence> <xsd:element name="Textarea" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="Textarea" widget="TextareaWidget" configuration="7" /> ... </layouts>
6.2.5 HtmlWidget
The HtmlWidget is like the text area but it allows formatting the text directly in the input field. Like a text editor it has some implemented functions to format the text left or right, to indent the text or to build a bulleted list. This formatted text will be saved with the entire html format.
Page 20
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Options can be defined for each element of the type OpenCmsHtml using the widget HtmlWidget. They have to be placed in the annotation section of a XSD describing XML content. The configuration attribute in the layout node for the element must contain the activated options as a comma separated String value:
<xsd:sequence> <xsd:element name="Text" type="OpenCmsHtml" /> ... </xsd:sequence> ... <layouts> <layout element="Text" widget="HtmlWidget" configuration="height:400px,link,anchor,imagegallery,downloadgallery,formatselect,source" /> ... </layouts>
Available options are: anchor: the anchor dialog button buttonbar:${button bar items, separated by ';'}: an individual button bar configuration. css:/vfs/path/to/cssfile.css: the absolute path in the OpenCms VFS to the CSS style sheet to use to render the contents in the editor (availability depends on the integrated editor) formatselect: the format selector for selecting text format like paragraph or headings formatselect.options:${list of options, separated by ';'}: the options that should be available in the format selector, e.g. formatselect.options:p;h1;h2 fullpage: the editor creates an entire HTML page code ${gallerytype}: Shows a gallery dialog button, e.g. imagegallery displays the image gallery button or downloadgallery displays the download gallery button height:${editorheight}: the editor height, where the height can be specified in px or %, e.g. 400px hidebuttons:${list of buttons to hide, separated by ';'}: the buttons to hide that usually appear in the default button bar, e.g. hidebuttons:bold;italic;underline;strikethrough hides some formatting buttons image: the image dialog button (availability depends on the integrated editor) link: the link dialog button source: shows the source code toggle button(s) stylesxml:/vfs/path/to/stylefile.xml: the absolute path in the OpenCms VFS to the user defined styles that should be displayed in the style selector (availability depends on the integrated editor) stylesformat:/vfs/path/to/stylefile.xml: the absolute path in the OpenCms VFS to the user defined styles format that should be displayed in the style selector (availability depends on the integrated editor) table: the table dialog button (availability depends on the integrated editor) Some configurations like the button bar items should be defined in the global widget configuration of the file opencms-vfs.xml.
Page 21
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.6 RadioSelectWidget
The RadioSelectWidget provides a group of radio buttons to select only one value.
For the configuration of this widget please read "SelectWidgetConfiguration". An example for an xsd definition is:
<xsd:sequence> <xsd:element name="Radiobutton" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="Radiobutton" widget="RadioSelectWidget" configuration="Radiobutton1*|Radiobutton2|Radiobutton3|Radiobutton4|Radiobutton5|Radiobutton6" /> ... </layouts>
6.2.7 SelectorWidget
The SelectorWidget provides a select box to select only one value.
For the configuration of this widget please read "SelectWidgetConfiguration". An example for an xsd definition is:
<xsd:sequence> <xsd:element name="Select" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="Select" widget="SelectorWidget" configuration="1*|2|3|4|5|6|7" /> ... </layouts>
Page 22
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.8 MultiSelectWidget
The RadioSelectWidget provides a group of check boxes to select one or more value.
For the configuration of this widget please read "SelectWidgetConfiguration". An example for an xsd definition is:
<xsd:sequence> <xsd:element name="Multiselect" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="Multiselect" widget="MultiSelectWidget" configuration="1*|2*|3*|4|5|6|7"/> ... </layouts>
6.2.9 ComboWidget
The ComboWidget is like the SelectorWidget with the different that it combines an input field and the select box. That means you can either select the value from the select box or type it yourself.
For the configuration of this widget please read "SelectWidgetConfiguration". An example for an xsd definition is:
<xsd:sequence> <xsd:element name="Combobox" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="Combobox" widget="ComboWidget" configuration="1|2|3|4|5|6|7" /> ... </layouts>
Page 23
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.10 TypeComboWidget
This like the ComboWidget, with the difference that it directly a list of all types provides. It has not to be configurated to show the selection.
This widget does not need any configuration and can be define in the xsd by this way: <xsd:sequence> <xsd:element name="TypeCombo" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="TypeCombo" widget="TypeComboWidget" /> ... </layouts>
6.2.11 LocalizationWidget
The LocalizationWidget provides a standard HTML form input field for overwriting localized values of a resource bundle. The resource bundle is configured with the widget configuration attribute. An optional key name to look up in the bundle can be given, too, in case it is different from the element name: key=mykey.
The locale to get the value for can be configured, too, by adding a configuration directive: locale=en. <xsd:sequence> <xsd:element name="Localization" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts>
Page 24
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<layout element="Localization" widget="LocalizationWidget" configuration="org.opencms.workplace.messages|key=mykey|locale=en" /> ... </layouts> To use the stored localization values and have the values of the resource bundles as fallback, use the CmsXmlMessages object.
6.2.12 ColorpickerWidget
The color picker widget provides an easy way to select a color. There are two ways to use this widget. The first way is to type the color value directly into the input field. The second is to open the popup and choose there a color, known by other color picker like Photoshop. If you use the popup, the value will automatically select by closing the popup.
This widget does not need any configuration and can be define in the xsd by this way: <xsd:sequence> <xsd:element name="Colorpicker" type="OpenCmsColor" /> ... </xsd:sequence>
6.2.13 DateTimeWidget
The date picker widget is an easy way to select a date. On the one hand you can select the date by selecting it in the popup; on the other you can type it directly into the input field.
This widget does not need any configuration and can be define in the xsd by this way:
Page 25
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.14 CategoryWidget
The CategoryWidget provides a category based selection. By clicking on the widget it open a category selection where the category can be selected. On depended of the configuration only one category is selectable (singe selection) or more categories are selectable at once.
This widget has some optional configuration parameters: category: Path to the folder of the categories that should be selectable onlyleafs: starts the selection in a list view parentSelection: add this parameter if the parent categories should be stored with the children by multiselecitoncategry This widget has two different schema types. As a function of this schema type the widget will be a single selection or a multi selection. For the single selection please use the OpenCmsVfsFile schema type in xsd, for the multi selection use OpenCmsCategory Single selection category widget can be decelerated this way: <xsd:sequence> <xsd:element name="Category" type="OpenCmsVfsFile" /> ... </xsd:sequence> ... <layouts> <layout element="Category" widget="CategoryWidget" configuration="category=/sites/default/_categories/|onlyleafs=false"/> ... </layouts> Multi selection category widget can be decelerated this way:
Page 26
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<xsd:sequence> <xsd:element name="Category" type="OpenCmsCategory" /> ... </xsd:sequence> ... <layouts> <layout element="Category" widget="CategoryWidget" configuration="category=/sites/default/_categories/|onlyleafs=false|parentSelection"/> ... </layouts>
6.2.15 GroupWidget
The GroupWidget is like the select widget. The different is that no configuration is needed because the selection is automatically built. This selection is a list of groups from the OpenCms.
This widget does not need any configuration and can be define in the xsd by this way: <xsd:sequence> <xsd:element name="Group" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="Group" widget="GroupWidget" /> ... </layouts>
6.2.16 GroupMultiSelectorWidget
The GroupMultiSelectorWidget is like the GroupWidget. The different is that more than one value can be selected.
This widget is configurable with the following options: groupfilter: regular expression to filter available groups groups: comma separated list of group names to show in the select box. Note: if this configuration option if used, groupfilter and includesubous are not considered anymore. includesubous: boolean flag to indicate if sub OUs should be scanned for groups to select oufqn: the fully qualified name of the OU to read the groups from To map the selected group to a permission to set, use the following mapping configuration:
<mapping element="..." mapto="permission:GROUP:+r+v|GROUP.ALL_OTHERS:|GROUP.Projectmanagers:+r+v+w+c" />
Page 27
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
This means that the +r+v permission is written for the principal GROUP on the resource. Additionally two permissions are written as default: for ALL_OTHERS, no allowed permission is set, for Projectmanagers, "+r+v+w+c" is set. This widget does not need any configuration and can be define in the xsd by this way: <xsd:sequence> <xsd:element name="GroupMulti" type="OpenCmsString" /> ... </xsd:sequence> ... <layouts> <layout element="GroupMulti" widget="GroupMultiSelectorWidget" /> ... </layouts>
6.2.17 VfsFileWidget
The VfsFileWidget provides a selection of a file in the vfs. It either can be typed in directly or be choosing with the gallery. This gallery will come up by pushing the button on the right side of the input field. A detail description of the popup can you find here: "GallerySelection"
This widget has this configuration options: hidesiteselector, showsiteselector: The site selector is hidden or shown (default) excludefiles, includefiles: Files are hidden in the popup tree or shown (default) notprojectaware, projectaware: Folders and files are shown according to the current project or not (default) startsite: The site the popup tree should be opened with And can be declared this way:
<xsd:sequence> <xsd:element name="VfsFile" type="OpenCmsVfsFile" /> ... </xsd:sequence> ... <layouts> <layout element="VfsFile" widget="VfsFileWidget" configuration="startsite=/sites/www.domain.org/repository|hidesiteselector" /> ... </layouts>
Page 28
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.18 VfsImageWidget
The VfsImageWidget provides a selection of a image in the vfs. It either can be typed in directly or be choosing with the gallery. This gallery will come up by pushing the button on the right side of the input field. A detail description of the popup can you find here: "GallerySelection"
Configuration options for the VFS image widget. The configuration options are read from the configuration String of the widget. The configuration String has to be formatted as JSON object, with the following possible keys: class: optional class implementing to dynamically configure startup parameters and format values formatnames: list of format names to select, with pairs of selectable value and selectable text, e.g. value1:optiontext1|value2:optiontext2 formatvalues: corresponding format values to the format names list, can be dynamically generated by the dynamic configuration class. The list of values should contain width and height information, with a '?' as sign for dynamic size and with an 'x' as separator for width and height. Example: ['200x?', '800x600'] scaleparams: default scale parameters (no width, height or crop information should be provided!) startup: the startup folder, can be dynamically generated by the provided class, in that case, use 'dynamic' as value type: the startup folder type, can be 'gallery' or 'category'. Can be dynamically generated by the provided class, in that case, use 'dynamic' as value usedescription: indicates if the description input field for the image should be shown or not useformat: indicates if the format select box for the image should be shown or not An example configuration can look like this: {scaleparams: 'q:70,r:2,c:CCCC00', type: 'gallery', startup: '/demo_en/images/',usedescription: true, useformat: true, formatnames: 'imageleft:Image left|imageright:Image right|imagetop:Image top', formatvalues: ['150x?', '250x300', '?x250']} An example for the xsd declaration: <xsd:sequence> <xsd:element name="VfsImage" type="OpenCmsVfsImage" minOccurs="1"/> ... </xsd:sequence> ... <layouts> <layout element="Widget" widget="VfsImageWidget" configuration="{useformat:true, usedescription: true, formatnames:'left:%(key.v8.news.image.left)| right:%(key.v8.news.image.right)| top:%(key.v8.news.image.top)',
Page 29
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.19 DownloadGalleryWidget
The DownloadGalleryWidget provides a selection of a file in the download gallery. This gallery will come up by pushing the button on the right side of the input field.
The configuration options are read from the configuration String of the widget. For nested XML schemas the configuration String must be defined inside the nested content. The configuration String has to be formatted as JSON object, with the following possible keys: class: optional class implementing to dynamically configure startup parameters and format values startup: the startup folder, can be dynamically generated by the provided class, in that case, use 'dynamic' as value. type: the startup folder type, can be 'gallery' or 'category'. Can be dynamically generated by the provided class, in that case, use 'dynamic' as value Example configurations can look like this: {type: 'gallery', startup: '/demo_en/images/'} Example of the xsd declaration:
<xsd:sequence> <xsd:element name="DownloadGallery" type="OpenCmsString" minOccurs="1"/> ... </xsd:sequence> ... <layouts> <layout element="DownloadGallery" widget="LegacyDownloadGalleryWidget" configuration="{type: 'gallery', startup: '/demo_en/images/'}"/> ... </layouts>
6.2.20 ImageGalleryWidget
The ImageGalleryWidget provides a selection of a file in the image gallery. This gallery will come up by pushing the button on the right side of the input field.
The configuration options are read from the configuration String of the widget. For nested XML schemas the configuration String must be defined inside the nested content. The configuration String has to be formatted as JSON object, with the following possible keys: class: optional class implementing to dynamically configure startup parameters and format values
Page 30
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
startup: the startup folder, can be dynamically generated by the provided class, in that case, use 'dynamic' as value. type: the startup folder type, can be 'gallery' or 'category'. Can be dynamically generated by the provided class, in that case, use 'dynamic' as value Example configurations can look like this: {type: 'gallery', startup: '/demo_en/images/'} Example of the xsd declaration: <xsd:sequence> <xsd:element name="ImageGallery" type="OpenCmsVfsFile" minOccurs="1"/> ... </xsd:sequence> ... <layouts> <layout element="ImageGallery" widget="ImageGalleryWidget" configuration="{type: 'gallery', startup: '/demo_en/images/'}"/> ... </layouts>
6.2.21 HtmlGalleryWidget
The HtmlGalleryWidget provides a selection of a file in the html gallery. This gallery will come up by pushing the button on the right side of the input field.
The configuration options are read from the configuration String of the widget. For nested XML schemas the configuration String must be defined inside the nested content. The configuration String has to be formatted as JSON object, with the following possible keys: class: optional class implementing to dynamically configure startup parameters and format values startup: the startup folder, can be dynamically generated by the provided class, in that case, use 'dynamic' as value. type: the startup folder type, can be 'gallery' or 'category'. Can be dynamically generated by the provided class, in that case, use 'dynamic' as value Example configurations can look like this: {type: 'gallery', startup: '/demo_en/html/'} Example of the xsd declaration: <xsd:sequence> <xsd:element name="HtmlGallery" type="OpenCmsString" minOccurs="1"/> ... </xsd:sequence> ... <layouts> <layout element="HtmlGallery" widget="HtmlGalleryWidget"
Page 31
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
6.2.22 TableGalleryWidget
The TableGalleryWidget provides a selection of a file in the table gallery. This gallery will come up by pushing the button on the right side of the input field.
The configuration options are read from the configuration String of the widget. For nested XML schemas the configuration String must be defined inside the nested content. The configuration String has to be formatted as JSON object, with the following possible keys: class: optional class implementing to dynamically configure startup parameters and format values startup: the startup folder, can be dynamically generated by the provided class, in that case, use 'dynamic' as value. type: the startup folder type, can be 'gallery' or 'category'. Can be dynamically generated by the provided class, in that case, use 'dynamic' as value Example configurations can look like this: {type: 'gallery', startup: '/demo_en/table/'} Example of the xsd declaration: <xsd:sequence> <xsd:element name="TableGallery" type="OpenCmsString" minOccurs="1"/> ... </xsd:sequence> ... <layouts> <layout element="TableGallery" widget="TableGalleryWidget" configuration="{type: 'gallery', startup: '/demo_en/table/'}"/> ... </layouts>
6.2.23 LinkGalleryWidget
The LinkGalleryWidget provides a selection of a file in the link gallery. This gallery will come up by pushing the button on the right side of the input field.
The configuration options are read from the configuration String of the widget. For nested XML schemas the configuration String must be defined inside the nested content. The configuration String has to be formatted as JSON object, with the following possible keys: class: optional class implementing to dynamically configure startup parameters and format values
Page 32
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
startup: the startup folder, can be dynamically generated by the provided class, in that case, use 'dynamic' as value. type: the startup folder type, can be 'gallery' or 'category'. Can be dynamically generated by the provided class, in that case, use 'dynamic' as value Example configurations can look like this: {type: 'gallery', startup: '/demo_en/link/'} Example of the xsd declaration: <xsd:sequence> <xsd:element name="LinkGallery" type="OpenCmsString" minOccurs="1"/> ... </xsd:sequence> ... <layouts> <layout element="LinkGallery" widget="LinkGalleryWidget" configuration="{type: 'gallery', startup: '/demo_en/link/'}"/> ... </layouts>
7 Model Page
A model page is a default copy model for the container page, where common contents, which should appear on a new created container page, are defined. This documentation part describes how model pages can be used to simplify the creation of new pages in the site. It uses links referring a locally installed OpenCms verion >= 8.5. Assuming you run OpenCms on localhost:8080 and the OpenCmsServlet is reachable under http://localhost:8080/opencms/ opencms you can click the links and will show the examples inside the Development Demo. Click here to open the corresponding Model Page use case in Development Demo [1] Click here to open Element Group use case in Development Demo [2]
7.1 Creation
For a OpenCms 8 template you have to create and configure a model page in order to enable the "Create page" Dialog in the sitemap editor. Usually the template developer should create and configure one or more model pages after the template and resource type creation, before the editor starts writing contents for the website. The model page is used as a copy to create a new page. The contents dropped to the selected model page automatically appears on all new pages. Create a new container page in the explorer view. If the template property is not set on the site folder, edit the template property. Create several model pages, if the site has pages with different template configuration. Place the model pages in the following folder of the sub sitemap: /{sitefolder}/{sub sitemap path}/.content/.new/ Open the preview by clicking the model page and drop some elements, which will appear on a new created page.
Page 33
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
7.2 Configuration
Configure the model page in the sitemap configuration file: /{sitefolder}/{sub sitemap path}/.content/.config In tab "Model pages" add a new node for each model page and select its path. Now the configured model pages appear in the list of container pages of the "Create page" in the sitemap editor. In order to have a nice name for the page model, edit additionally its title property. If set as default this page is also used to create the new page, when it is added over the context menu in the sitemap editor. Further use the check box of the page model configuration to control the visibility of the inherited page models from the upper sitemaps.
References
[1] http:/ / localhost:8080/ opencms/ opencms/ dev-demo/ model-containerpage/ [2] http:/ / localhost:8080/ opencms/ opencms/ dev-demo/ model-containerpage-group/
8 Element Group
An Element Group is a new content element in OpenCms 8, which references a group of other content elements. This documentation uses links referring a locally installed OpenCms verion >= 8.5. Assuming you run OpenCms on localhost:8080 and the OpenCmsServlet is reachable under http://localhost:8080/opencms/opencms you can click the links and will show the examples inside the Development Demo. Click here to open the corresponding model page use case of the Development Module [2]
8.1 Description
An element group is a content element similar to inheritance group, which allow the user to drop other elements in it. The user can edit, delete or replace the elements inside the group as well as changing their order. All changes on the element group affects all container pages to which the element group is dropped. So the element group allows to maintain the referenced elements in one place to take effect on many pages.
Page 34
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Drag and drop new elements from the "Add content" dialog to the element group.
Page 35
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Edit or delete the existing elements of the element group. Reorder the elements inside the group. Save all changes by clicking the ok-button of the element group editor.
All changes on the elements inside of the element group like editing, removing elements, moving elements insider the group as well as changing settings of the element are populated to all pages using this page model.
9 Inheritance Group
Inheritance groups are a new content type in OpenCms 8.5 for use in container pages. This documentation uses links referring a locally installed OpenCms verion >= 8.5. Assuming you run OpenCms on localhost:8080 and the OpenCmsServlet is reachable under http://localhost:8080/ opencms/opencms you can click the links and will show the examples inside the Development Demo. Click here to open the inheritance-group page use case of the Development Module [1]
10 Description
A Inheritance group is similar to an Element Group in that they allow you to drop a set of content elements into your page as a single object. But Element Groups don't allow you to change the set of elements only for a specific subset of pages; when you make a change to an element group, this change is visible across all pages using that element group. This is the problem that Inheritance Groups are meant to solve: When changing an inheritance group on a page, the content of the same group will only be changed on the page and any pages which are descendants of the page's parent folder; In other words, changes will be "inherited" by the group in child pages, but nowhere else. For example, you may want to define an inheritance group for the right column of your template, define some common content which you want to be visible everywhere on your site, and then add more specific contents for each subsection of your site.
Page 36
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
11 Basic definitions
We will call a container page a.html a descendant page of another container page b.html if the parent folder of a.html is a direct or indirect subfolder of the parent folder of b.html. Conversely, we call b.html an ancestor page of a.html. When editing a container page, we call the parent folder of that page the current folder. This is important because inheritance group data is attached to folders, not to individual container pages. So container pages in the same folder can't have different content for the same inheritance group.
12 Usage
12.1 Creating new inheritance groups
You can create a new inheritance group in the container page editor by opening the galleries menu and dragging the item "Inheritance group" from the "Types" tab onto your page. As with other resources, the inheritance group will only be created in the VFS once you edit it.
Page 37
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 38
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Note that when adding new elements to inheritance groups on a page, those elements will inherited by the same inheritance group on any descendant page. By default, new elements will appear on the bottom of the inheritance group on descendant pages.
Page 39
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 40
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
12.3.7 Save
All changes to an inheritance group will only take effect if you click on the "Save" button. The inheritance group editor will then be closed.
12.3.8 Break up
When using this button, the inheritance group will be replaced by its current, individual content elements in the container page, just as with group containers. Note that this action takes effect immediately, not just after pressing the "Save" button.
Page 41
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
13 Internals
13.1 Resource types
There are two resource types used for the implementation of inheritance groups: inheritance_group and inheritance_config. inheritance_group is the type of the contents which are actually inserted into the container page when creating new inheritance groups or dragging existing inheritance groups from the galleries into a page. They only contain the internal id of the inheritance group they represent. The resources of type inheritance_config contain the actual contents of the inheritance groups. The inheritance group changes for a folder will be stored in a file (of type inheritance_config) named .inherited which is contained in the same folder. Since only one file per folder is used, data for multiple inheritance groups will be stored in the same file. The content of this config file should not be edited manually.
References
[1] http:/ / localhost:8080/ opencms/ opencms/ dev-demo/ / inheritance-group/
14 Detail Page
Detail page is an OpenCms 8 technique to create nice url for a resource which is not dropped to a container page but automatically created in the /.content/ directory, e.g. by a collector. This documentation part uses links referring a locally installed OpenCms version >= 8.5. Assuming you run OpenCms on localhost:8080 and the OpenCmsServlet is reachable under http://localhost:8080/opencms/opencms you can click the links and will show the examples inside the Development Demo. Click here to open corresponding use case in Development Demo [1]
Page 42
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
14.2 Configuration
Following steps are necessary to use a detail page for a resource type. The configuration is related to the module containing the template and the resource type as well as the website content.
When using collector to list the resources, surround the resource path ${content.filename} with <cms:link>. The <cms:link> takes care of generating the proper url.
<%@page buffer="none" session="false" taglibs="c,cms" %> <div> <cms:contentload collector="myCollector" param="..." editable="true"> <%-- Access the content --%> <cms:contentaccess var="content" /> <a href="<cms:link>${content.filename}</cms:link>">${content.value.Title}</a> </cms:contentload> </div>
References
[1] http:/ / localhost:8080/ opencms/ opencms/ dev-demo/ collector-with-detail-page/
Page 43
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
The Drag&Drop functionality is enabled for user with the role WORKPLACE_USERS.
Page 44
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Implement another jsp, which evaluates the form data and generates the html output for the detail view. In explorer view create two dynamic function elements in folder /system/modules/[module name]/functions/ of the module. One of the dynamic functions should point to the form jsp and another to the detail page jsp. Edit the module configuration file /system/modules/[module name]/.config and configure the function detail page in the tab "Functions". Add new field "Named function". Define a unique name for the function detail. This should be the same name, which is used in the form jsp as action parameter. After this configuration the function detail page appears in the tab "Function pages" of the "Create page" dialog in the sitemap editor. Edit property container.info on the template jsp. Set the property value functionDetail=[container name attribute]. Use as the value the name attribute of the container, in which the function results should be displayed.
15.5 Usage
Drop the dynamic function element with the form into container pages. Open the "Create page" dialog of the sitemap editor. Use the configured function detail page from tab "Function pages" as page model to add new page to the navigation.
References
[1] http:/ / localhost:8080/ opencms/ opencms| [2] http:/ / dev-opencms-v8:8080/ opencms/ opencms/ dev-demo/ dynamic-function/ [3] http:/ / dev-opencms-v8:8080/ opencms/ opencms/ dev-demo/ dynamic-function-detail/
Page 45
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
16.2 Implementation
In order to develop a collector, which can be used with <cms:collector> tag, the new collector should implement org.opencms.file.collectors.I_CmsResourceCollector interface. The package org.opencms.file.collectors already provides a standard implementation for this interface with org.opencms.org.opencms.file.collectors.A_CmsResourceCollector. Extend this class, if you develop your own collector. Following methods has to be implemented: List<String> getCollectorNames(); getCollectorNames() return one or more collector names as list of strings. String getCreateLink(CmsObject cms, String collectorName, String param) throws CmsException, CmsDataAccessException; getCreateLink(CmsObject, String, String) returns the link that must be executed when a user clicks on the direct edit "new" button on a list created by the named collector. If this method returns null, it indicated that the selected collector implementation does not support a "create link", and so no "new" button will not be shown on lists generated with this collector. String getCreateParam(CmsObject cms, String collectorName, String param) throws CmsDataAccessException; The method getCreateParam(CmsObject, String, String) returns the parameter that must be passed to the getCreateLink(CmsObject, String, String). If this method returns null, it indicates that the selected collector implementation does not support a "create link", and so no "new" button will be should shown on lists generated with this collector.
List<CmsResource> getResults(CmsObject cms, String collectorName, String param) throws CmsDataAccessException, CmsException;
getResults(CmsObject, String, String) returns a list of org.opencms.file.CmsResource Objects that are gathered in the VFS using the named collector.
Page 46
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
16.3 Configuration
Edit opencms-vfs.xml and add following line to <collectors> node:
<collectors> <collector class="org.opencms.dev.demo.CmsSimpleResourceCollector" order="180" /> </collectors>
<%-- The jsp html should be surround by block element --%> <div> <%-- Read collector paramter, e.g. from request --%> <c:set var="folder" value="${param.folder}"/> <c:set var="type" value="${param.type}"/> <c:set var="count" value="${param.count}"/>
<ul> <%-- Use <cms:contentload> with new collector--%> <cms:contentload collector="myCollector" param="${folder}|${type}|${count}" editable="true"> <%-- Access the content --%> <cms:contentaccess var="content" /> <%-- Set the link to the content in the list and do not forgat to use <cms:link> tag --%> <li><a href="<cms:link>${content.filename}</cms:link>">${content.value.Title}</a></li>
Page 47
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 48
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
17.1 Definition
The <xsd:choice> node can be used in the same way as a <xsd:sequnce> to describe an OpenCms type. It has to be defined in XML schema definition of a nested xmlcontent. The element in the root schema has to be optional. Add attribute minOccurs="0" on the element to make it optional. Root XML Schema Dfinition:
<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd" /> <xsd:include schemaLocation="opencms://system/modules/org.opencms.dev.demo/ schemas/nested/options.xsd" /> ... <xsd:complexType name="OpenCmsDevDemoSettingsArticle"> <xsd:sequence> ... <xsd:element name="Options" type="OpenCmsDevDemoTextOption" minOccurs="0" /> ... </xsd:sequence> <xsd:attribute name="language" type="OpenCmsLocale" use="optional" /> </xsd:complexType> ... </xsd:schema>
Use the <xsd:choice> node to define the element of the selection. Nested XML schema defenition with <xsd:choice>:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/> ... <xsd:complexType name="OpenCmsDevDemoTextOption"> <xsd:choice minOccurs="0" maxOccurs="3"> <xsd:element name="Text" type="OpenCmsString" minOccurs="0" /> <xsd:element name="Html" type="OpenCmsHtml" minOccurs="0" /> <xsd:element name="Link" type="OpenCmsVarLink" minOccurs="0" />
Page 49
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012 </xsd:choice> <xsd:attribute name="language" type="OpenCmsLocale" use="optional"/> </xsd:complexType> ... </xsd:schema>
The elements, which define the selection options of the <xsd:choice> have to be optional, too.
Multiple choice:
<xsd:choice minOccurs="0" maxOccurs="5"> <xsd:element name="VariableLink" type="OpenCmsVarLink" minOccurs="0" /> <xsd:element name="LinkGallery" type="OpenCmsVfsFile" minOccurs="0" /> <xsd:element name="DownloadGallery" type="OpenCmsVfsFile" minOccurs="0" /> </xsd:choice>
Page 50
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 51
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
${value.FurtherInfo.value.Link.exists} checks the existence of the choice element. ${value.FurtherInfo.value.Link.value.VariableLink.isSet} checks the value of a choice element.
17.5 Examples
The full examples for the usage of the choice element can be find in the Development Demo as well as in Template III.
17.5.1 v8 InfoBox
The root xsd of the infobox [1] The nested xsd containing further info [2] The nested xsd containing choice element [3] The formatter Jsp [4]
References
[1] https:/ / github. com/ alkacon/ modules-v8/ blob/ master/ modules/ com. alkacon. opencms. v8. infobox/ resources/ system/ modules/ com. alkacon. opencms. v8. infobox/ schemas/ infobox. xsd [2] https:/ / github. com/ alkacon/ modules-v8/ blob/ master/ modules/ com. alkacon. opencms. v8. infobox/ resources/ system/ modules/ com. alkacon. opencms. v8. infobox/ schemas/ nested/ furtherinfo. xsd [3] https:/ / github. com/ alkacon/ modules-v8/ blob/ master/ modules/ com. alkacon. opencms. v8. infobox/ resources/ system/ modules/ com. alkacon. opencms. v8. infobox/ schemas/ nested/ furtherinfolink. xsd [4] https:/ / github. com/ alkacon/ modules-v8/ blob/ master/ modules/ com. alkacon. opencms. v8. infobox/ resources/ system/ modules/ com. alkacon. opencms. v8. infobox/ formatters/ side. jsp [5] https:/ / github. com/ alkacon/ modules-v8/ blob/ master/ modules/ org. opencms. dev. demo/ resources/ system/ modules/ org. opencms. dev. demo/ schemas/ settings_article. xsd [6] https:/ / github. com/ alkacon/ modules-v8/ blob/ master/ modules/ org. opencms. dev. demo/ resources/ system/ modules/ org. opencms. dev. demo/ schemas/ nested/ options. xsd
Page 52
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
18 Navigation Level
Navigation level is a special navigation folder, which redirects to the first container page inside this folder. This documentation uses links referring a locally installed OpenCms verion >= 8.5. Assuming you run OpenCms on localhost:8080 and the OpenCmsServlet is reachable under http://localhost:8080/opencms/opencms you can click the links and will show the examples inside the Development Demo. Click here to open the corresponding Navigation Level use case of the Development Module [1]
18.3.2 Styling
The class CmsJspNavElement provides a new method to recognize the Navigation Level in the navigation. This information can be useful e.g. for styling.
Page 53
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
In following example the css class current is used to mark the selected item in navigation. The navigation level element is not marked:
<cms:navigation type="treeForFolder" startLevel="1" endLevel="4" var="nav"/> <c:forEach items="${nav.items}" var="elem"> ... <a href="<cms:link>${elem.resourceName}</cms:link>" <c:if test="${nav.isActive[elem.resourceName] and !elem.navigationLevel }">class="current"</c:if>> ${elem.navText} </a> ... </c:forEach>
18.4 Examples
Please check following jsp for the complete navigation example: https://github.com/alkacon/modules-v8/blob/master/modules/org.opencms.dev.demo/ resources/system/modules/org.opencms.dev.demo/elements/site-elements/nav_side.jsp
References
[1] http:/ / localhost:8080/ opencms/ opencms/ dev-demo/ navigation-level/
19 Hidden Entries
Hidden Entries are container pages or other pages which are not visible in navigation menu build with CmsJspNavBuilder.
19.1 Description
Since OpenCms 8.5 resources, which should not be included in the navigation menu on the website, can be directly hidden in the sitemap editor. The hidden pages are still visible in the sitemap editor and can be edited.
This new feature is supposed to be useful for pages, which are hidden in navigation but appear directly under predefined url like error, contacts, search, location pages etc. under domain url detail pages for the resources
Page 54
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
19.2 Usage
Open the sitemap Open the context menu of the container page and select "Hide in navigation". The page item is displayed light colored. Use again context menu "Show in navigation" to enable the navigation properties for the page.
Page 55
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
caption
21 Abstract
After searching with Apache's Lucene for years Apache Solr has grown and grown and can now be called an enterprise search platform that is based on Lucene. It is a standalone enterprise search server with a REST-like API. You put documents in it (called "indexing") via XML, JSON or binary over HTTP. You query it via HTTP GET and receive XML, JSON, or binary results. To get a more detailed knowledge what Solr exactly is and how it works, please visit the Apache Solr [1] project website. Searching with the powerful and flexible Apache Solr's REST-like interface will drill down the development complexity. More over you can rely on existing graphical interfaces that provide comfortable AJAX based search functionality to the end user of your internet/intranet application. OpenCms 8.5 integrates Apache Solr. This document will give you a brief introduction on the Solr/OpenCms integration details. It uses links referring a locally installed OpenCms verion >= 8.5. Assuming you run OpenCms on localhost:8080 and the OpenCmsServlet is reachable under http://localhost:8080/opencms/opencms you can click the links and will show the examples inside the "Wonderful world of flowers".
22.1 DEMO
The OpenCms v8 modules are covering a Solr based OpenCms Search Demonstration using the Open Source UI Ajax Solr: Click here to run the OpenCms Solr Search DEMO [2] Ajax Solr Project on github.com [3]
Page 56
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
// Filter query on the field type with the value 'v8article' // Filter query on the field lastmodified with a range query from 'NOW-1DAY TO NOW' // Filter query on the field Title_prop with the value 'v8article'
NOTE: Solr query Syntax If you want to get familiar with the Solr query syntax you will get a general overview at Solr query syntax [4]. For advanced features Searching - Solr Reference Guide - Lucid Imagination [5] will lend a hand. Please note that many characters in the Solr Query Syntax (most notable the plus sign: "+") are special characters in URLs, so when constructing request URLs manually, you must properly URL-Encode these characters.
q= +popularity:[10 TO *] +section:0 http://localhost:8983/solr/select?q=%2Bpopularity:[10%20TO%20*]%20%2Bsection:0
For more information, see Yonik Seeley's blog on Nested Queries in Solr [6]. As parameter of the new OpenCms Solr request handler (handleSolrSelect) you can pass any "Solr valid" input parameters. To get familiar with the Solr query syntax the Solr Wiki page lends itself: Search and Indexing [7]
Page 57
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<str>contentdate:[NOW-1DAY TO NOW]</str> <str>Title_prop:Flower</str> </arr> <long name="start">0</long> </lst> </lst> <result name="response" numFound="2" start="0"> <doc> <str name="id">51041618-77f5-11e0-be13-000c2972a6a4</str> <str name="contentblob">[B:[B@6c1cb5</str> <str name="path">/sites/default/.content/article/a_00003.html</str> <str name="type">v8article</str> <str name="suffix">.html</str> <date name="created">2011-05-06T15:27:13Z</date> <date name="lastmodified">2011-08-17T13:58:29Z</date> <date name="contentdate">2012-09-03T10:41:13.56Z</date> <date name="relased">1970-01-01T00:00:00Z</date> <date name="expired">292278994-08-17T07:12:55.807Z</date> <arr name="res_locales"> <str>en</str> <str>de</str> </arr> <arr name="con_locales"> <str>en</str> <str>de</str> </arr> <str name="template_prop">/system/modules/com.alkacon.opencms.v8.template3/ templates/main.jsp</str> <str name="style.layout_prop">/.content/style</str> <str name="NavText_prop">OpenCms 8 Demo</str> <str name="Title_prop">Flower Today</str> <str name="ahtml_de_t">Nachfolgend finden Sie aktuelle Meldungen und Veranstaltungen rund um die Blume.</str> <str name="ahtml_en_t">In this section, you find current flower related news and events.</str> <arr name="content_en"> <str>News from the world of flowers Flower Today In this section, you find current flower related news and events.</str> </arr> <arr name="content_de"> <str>Neuigkeiten aus der Welt der Blumen Blume aktuell Nachfolgend finden Sie aktuelle Meldungen[...]</str> </arr> <date name="timestamp">2012-09-03T10:45:47.055Z</date> <float name="score">1.0</float> </doc> <doc> <str name="id">ac56418f-77fd-11e0-be13-000c2972a6a4</str> <str name="contentblob">[B:[B@1d0e4a2</str>
Page 58
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<str name="path">/sites/default/.content/article/a_00030.html</str> <str name="type">v8article</str> <str name="suffix">.html</str> <date name="created">2011-05-06T16:27:02Z</date> <date name="lastmodified">2011-08-17T14:03:27Z</date> <date name="contentdate">2012-09-03T10:41:18.155Z</date> <date name="relased">1970-01-01T00:00:00Z</date> <date name="expired">292278994-08-17T07:12:55.807Z</date> <arr name="res_locales"> <str>en</str> <str>de</str> </arr> <arr name="con_locales"> <str>en</str> <str>de</str> </arr> <str name="template_prop">/system/modules/com.alkacon.opencms.v8.template3/ templates/main.jsp</str> <str name="style.layout_prop">/.content/style</str> <str name="NavText_prop">OpenCms 8 Demo</str> <str name="Title_prop">Flower Dictionary</str> <str name="ahtml_de_t">In der Botanik existieren zahlreiche Gewchsfamilien die uns durch Ihre dekorativen Blten [...]</str> <str name="ahtml_en_t">There are many different types of plants and flowers existing. To give a short overview, [...]</str> <arr name="content_en"> <str>The different types of flowers Flower Dictionary There are many different types of plants and flowers [...]</str> </arr> <arr name="content_de"> <str>Die verschiedenen Gewchsfamilien Blumen Lexikon In der Botanik existieren zahlreiche Gewchsfamilien die uns durch [...]</str> </arr> <date name="timestamp">2012-09-03T10:45:49.265Z</date> <float name="score">1.0</float> </doc> </result> </response>
Page 59
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Date date = sResource.getMultivaluedField(I_CmsSearchField.FIELD_DATE_LASTMODIFIED); List<String> cats = sResource.getMultivaluedField(I_CmsSearchField.FIELD_CATEGORY); } The class org.opencms.search.solr.CmsSolrResultList encapsulates a list of 'OpenCms resource documents' ({@link CmsSearchResource}). This list can be accessed exactly like an {@link ArrayList} which entries are {@link CmsSearchResource} that extend {@link CmsResource} and holds the Solr implementation of {@link I_CmsSearchDocument} as member. This enables you to deal with the resulting list as you do with well known {@link List} and work on it's entries like you do on {@link CmsResource}.
22.3.2 Excerpt
The documentation will follow soon.
22.3.4 Grouping
The documentation will follow soon.
22.3.5 Highlighting
The documentation will follow soon.
22.3.7 Sorting
The documentation will follow soon.
Page 60
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
22.3.8 Spellchecking
The documentation will follow soon.
22.3.9 Thesaurus/Synomys
The documentation will follow soon.
Page 61
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<cms:img src="${content.value.Image}" width="${imgwidth}" scaleColor="transparent" scaleType="0" cssclass="left" alt="${content.value.Image}" title="${content.value.Image}" /> </c:if>
Optionally you can configure the Solr home directory and the main Solr configuration file name solr.xml. OpenCms then concats those two paths to <solr_home><configfile> an example for such a configuration would look like: <solr enabled="true"> <home>/my/solr/home/folder</home>
Page 62
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<configfile>rabbit.xml</configfile> </solr> In order to disable Solr system wide remove the <solr/>-node or set the enabled attribute to 'false' like: <solr enabled="false"/> It is also possible to connect with an external HTTP Solr server, to do so replace the line <solr enabled="true"/> with the following: <solr enabled="true" serverUrl="http://mySolrServer" /> The OpenCms SolrSelect request handler does not support the external HTTP Solr Server. So if your HTTP Solr Server is directly reachable by http://<your_server> there will no permission check performed and indexed data that is secret will be accessible. What means that you are self-responsible for resources that have permission restrictions set on the VFS of OpenCms. But of course you can use the method org.opencms.search.solr.CmsSolrIndex.search(CmsObject, SolrQuery) or org.opencms.search.solr.CmsSolrIndex.search(CmsObject, String) and be sure permissions are checked also for HTTP Solr Servers. Maybe a future version of OpenCms will feature a secure access on HTTP Solr server.
Page 63
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<name>containerpage</name> <name>xmlpage</name> <name>text</name> <name>pdf</name> <name>image</name> <name>msoffice-ole2</name> <name>msoffice-ooxml</name> <name>openoffice</name> </documenttypes-indexed> </indexsource>
Page 64
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
Page 65
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<fields> <field name="content" display="%(key.field.content)" store="compress" index="true" excerpt="true"> <mapping type="content"/> </field> <field name="title-key" display="-" store="true" index="untokenized" boost="0.0" type="s"> <mapping type="property">Title</mapping> </field> <field name="title" display="%(key.field.title)" store="false" index="true" type="prop"> <mapping type="property">Title</mapping> </field> <field name="keywords" display="%(key.field.keywords)" store="true" index="true" type="prop"> <mapping type="property">Keywords</mapping> </field> <field name="description" display="%(key.field.description)" store="true" index="true" type="prop"> <mapping type="property">Description</mapping> </field> <field name="meta" display="%(key.field.meta)" store="false" index="true" type="en"> <mapping type="property">Title</mapping> <mapping type="property">Keywords</mapping> <mapping type="property">Description</mapping> </field> </fields> </fieldconfiguration>
stored="true" /> stored="true" stored="true" stored="true" stored="true" stored="true" stored="true" stored="true" required="true" multiValued="true" /> required="true" multiValued="true" /> required="true" /> required="true" /> required="true" /> /> />
Page 66
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<field name="content" <field name="contentblob" <field name="category" <!-- is copied --> <field name="category_exact" <field name="dependencyType" type="string" type="string" indexed="true" indexed="true" stored="false" multiValued="true" termVectors="true" /> stored="true" /> type="text_general" indexed="true" type="binary" stored="false" multiValued="true" compressed="true" /> compressed="true" /> multiValued="true" />
type="text_general" indexed="true"
<!-- Catchall for general text fields --> <field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
<!-- Catchall for English text fields --> <field name="text_en" <!-- Catchall for German <field name="text_de" <!-- Catchall for German <field name="text_el" <!-- Catchall for German <field name="text_es" <!-- Catchall for German <field name="text_fr" <!-- Catchall for German <field name="text_hu" <!-- Catchall for German <field name="text_it" type="text_en" text fields --> type="text_de" text fields --> type="text_el" text fields --> type="text_es" text fields --> type="text_fr" text fields --> type="text_hu" text fields --> type="text_it" indexed="true" stored="false" multiValued="true"/> indexed="true" stored="false" multiValued="true"/> indexed="true" stored="false" multiValued="true"/> indexed="true" stored="false" multiValued="true"/> indexed="true" stored="false" multiValued="true"/> indexed="true" stored="false" multiValued="true"/> indexed="true" stored="false" multiValued="true"/>
<dynamicField name="*_exact" <dynamicField name="*_prop" <dynamicField name="*_i" <dynamicField name="*_s" <dynamicField name="*_l" <dynamicField name="*_t" <dynamicField name="*_txt" <dynamicField name="*_en" <dynamicField name="*_de" <dynamicField name="*_el" <dynamicField name="*_es" <dynamicField name="*_fi" <dynamicField name="*_fr" <dynamicField name="*_hu" <dynamicField name="*_it" <dynamicField name="*_b" <dynamicField name="*_f" <dynamicField name="*_d"
type="string"
indexed="true"
stored="false"/> stored="true"/> stored="true"/> stored="true"/> stored="true"/> stored="true"/> stored="true" multiValued="true"/> stored="true" multiValued="true" /> stored="true" multiValued="true" /> stored="true" multiValued="true" /> stored="true" multiValued="true" /> stored="true" multiValued="true" /> stored="true" multiValued="true" /> stored="true" multiValued="true" /> stored="true" multiValued="true" /> stored="true"/> stored="true"/> stored="true"/> stored="false"/> stored="true"/> stored="true"/> stored="true"/> stored="true"/> stored="true"/> stored="true"/> stored="true"/>
type="text_general" indexed="true" type="text_general" indexed="true" type="text_en" type="text_de" type="text_el" type="text_es" type="text_fi" type="text_fr" type="text_hu" type="text_it" type="boolean" type="float" type="double" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true" indexed="true"
<dynamicField name="*_coordinate" type="tdouble" <dynamicField name="*_ti" <dynamicField name="*_tl" <dynamicField name="*_tf" <dynamicField name="*_td" <dynamicField name="*_tdt" <dynamicField name="*_dt" <dynamicField name="*_pi" type="tint" type="tlong" type="tfloat" type="tdouble" type="tdate" type="date" type="pint"
Page 67
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<dynamicField name="attr_*" <dynamicField name="random_*" <dynamicField name="text_*" type="text_general" indexed="true" type="random" /> type="text_general" indexed="true" stored="true" termVectors="true" stored="true" multiValued="true"/>
<uniqueKey>id</uniqueKey>
<copyField source="*_en" <copyField source="*_de" <copyField source="*_el" <copyField source="*_es" <copyField source="*_fi" <copyField source="*_fr" <copyField source="*_hu" <copyField source="*_it" <copyField source="text_*" <copyField source="*_prop" <copyField source="content" <copyField source="category"
dest="text_en"/> dest="text_de"/> dest="text_el"/> dest="text_es"/> dest="text_fi"/> dest="text_fr"/> dest="text_hu"/> dest="text_it"/> dest="text"/> dest="text" /> dest="text" /> dest="text" />
Page 68
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
*_prop - All properties of a resource as searchable and stored text (field name: <Property_Definition_Name>_prop as text_general) *_exact - All properties of a resource as exact not stored string (field name: <Property_Definition_Name>_exact as string)
<xsd:complexType name="OpenCmsDefaultAppinfoSolrField"> <xsd:sequence> <xsd:element name="mapping" type="OpenCmsDefaultAppinfoSolrFieldMapping" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="targetfield" type="xsd:string" use="required" /> <xsd:attribute name="sourcefield" type="xsd:string" use="optional" /> <xsd:attribute name="copyfields" type="xsd:string" use="optional" /> <xsd:attribute name="locale" type="xsd:string" use="optional" /> <xsd:attribute name="default" type="xsd:string" use="optional" /> <xsd:attribute name="boost" type="xsd:string" use="optional" /> </xsd:complexType>
You are able to declare search field mappings for XML content elements directly in the XSD Content Definition. A XSD using this feature can then look like:
<searchsettings> <searchsetting element="Title" searchcontent="true"> <solrfield targetfield="atitle"> <mapping type="property">Author</mapping> </solrfield> </searchsetting> <searchsetting element="Teaser"> <solrfield targetfield="ateaser"> <mapping type="item" default="Homepage n.a.">Homepage</mapping> <mapping type="content"/> <mapping type="property-search">search.special</mapping> <mapping type="attribute">dateReleased</mapping> <mapping type="dynamic" class="org.opencms.search.solr.CmsDynamicDummyField">special</mapping> </solrfield> </searchsetting> <searchsetting element="Text" searchcontent="true"> <solrfield targetfield="ahtml" boost="2.0"/> </searchsetting>
Page 69
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
<searchsetting element="Release" searchcontent="false"> <solrfield targetfield="arelease" sourcefield="*_dt" /> </searchsetting> <searchsetting element="Author" searchcontent="true"> <solrfield targetfield="aauthor" locale="de" copyfields="test_text_de,test_text_en" /> </searchsetting> <searchsetting element="Homepage" searchcontent="true"> <solrfield targetfield="ahomepage" default="Homepage n.a." /> </searchsetting> </searchsettings>
Page 70
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
OpenCms offers the capability for post search processing Solr documents after the document has been checked for permissions. This capability allows you to add fields to the found document before the search result is returned. In order to make use of the post processor you have to add an optional parameter for the search index as follows:
<index class="org.opencms.search.solr.CmsSolrIndex"> <name>Solr Offline</name> <rebuild>offline</rebuild> <project>Offline</project> <locale>all</locale> <configuration>solr_fields</configuration> <sources> [...] </sources> <param name="org.opencms.search.solr.CmsSolrIndex.postProcessor">my.package.MyPostProcessor</param> </index>
The specified class for the parameter org.opencms.search.solr.CmsSolrIndex.postProcessor must be an implementation of org.opencms.search.solr.I_CmsSolrPostSearchProcessor.
References
[1] [2] [3] [4] [5] [6] [7] [8] [9] http:/ / lucene. apache. org/ solr/ http:/ / localhost:8080/ opencms/ opencms/ flower_en/ Search/ index. html https:/ / github. com/ evolvingweb/ ajax-solr http:/ / wiki. apache. org/ solr/ SolrQuerySyntax http:/ / lucidworks. lucidimagination. com/ display/ solr/ Searching http:/ / www. lucidimagination. com/ blog/ 2009/ 03/ 31/ nested-queries-in-solr/ http:/ / wiki. apache. org/ solr/ FrontPage#Search_and_Indexing http:/ / wiki. apache. org/ solr/ QueryResponseWriter http:/ / wiki. apache. org/ solr/ CoreAdmin
Page 71
OpenCms Documentation
Version 8.5.0 Date: September 21, 2012
25 SEO
The documentation for the SEO feature will follow soon.
26 CMIS
The documentation for the CMIS integration will follow soon.
Page 72