Features of the octools moduleJstl adapters of OpenCms classesUsing a simple tag in your jsp, you can gain access to the CmsJspActionElement and CmsRequestContext classes. <%@ taglib prefix="oc" uri="http://dk.valtech.com/taglib/octools" %>
<oc:defineObjects />
The requested file is "${ cmsRequest.uri }"
The Title property is "${ cms.property[ 'Title' ] }"
This is a link to <a href="${ cms.link['index.html'] }">index.html</a>
The objects are also available in scriptlets, if you ever want to use that. Like this <%= cms.link("index.html") %>
(The name was inspired by the tag from the portlet specification: <portal:defineObjects />) The actual classes are not those from OpenCms, since they are not very Expression Language friendly. Instead they are wrapped in adapter classes from octools called CmsJstlActionElement and CmsJstlRequestContext. These classes provide map-style getters for properties, the link-method etc. The navigation tagsAre you tired of writing navigation code, using scriptlets? The solution is to use the octools navigation tags. Using jsp tags, you can generate a navigation simply like this: <%@ taglib prefix="oc" uri="http://dk.valtech.com/taglib/octools" %>
<%-- This snippet generates the navigation for the top-level of the site. Usually the language folders --%>
<oc:navigation var="nav" status="status" level="0" endLevel="0">
<a href="${ cms.link[nav.resourceName] }">${ nav.navText }</a>
<c:if test="${ not status.last }"> | </c:if>
</oc:navigation>
Read more about the navigation tag on the OctoolsNavigation page (that comes soon). The breadcrumb tagnew to version 1.1.3 Kind of the same as above. This is a tag to generate breadcrumbs, to avoid using scriptlets. <%@ taglib prefix="oc" uri="http://dk.valtech.com/taglib/octools" %>
<%-- This snippet generates the breadcrumb from level 1 of the site. Usually the selected language folder (e.g. /en/) --%>
<ul class="breadcrumb">
<oc:breadcrumb begin="1" var="nav" varStatus="status">
<li>
<a href="${ cms.link[nav.resourceName] }">${ nav.title }</a>
</li>
<c:if test="${ not status.last }"><li>></li></c:if>
</oc:breadcrumb>
</ul>
Friendly Property EditorIf you create a template that requires special properties to be set on the file that it renders, you can take advantage of the friendly property editor of octools. On the template, set the property template.properties to point to a xmlcontent file based on the schema in /system/modules/dk.valtech.octools/schema/TemplateProperties.xsd. Example setup: - A file called macro.html is based on the template photos.jsp
- The photos.jsp has a property template.properties with the value photos.xml
- The controlcode of photos.xml, which is just a Generic xml content file, looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<TemplatePropertiesCollections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="opencms://system/modules/dk.valtech.octools/schema/TemplateProperties.xsd">
<TemplateProperties language="en">
<Property>
<Name><![CDATA[Title]]></Name>
<TitleKey><![CDATA[Title]]></TitleKey>
<Type><![CDATA[Text]]></Type>
</Property>
<Property>
<Name><![CDATA[picasa.user]]></Name>
<TitleKey><![CDATA[Picasa username]]></TitleKey>
</Property>
<Property>
<Name><![CDATA[picasa.tag]]></Name>
<TitleKey><![CDATA[Photos with tag]]></TitleKey>
</Property>
<Property>
<Name><![CDATA[action]]></Name>
<TitleKey><![CDATA[Action name]]></TitleKey>
</Property>
<Property>
<Name><![CDATA[Navigation]]></Name>
<TitleKey><![CDATA[Navigation]]></TitleKey>
<Type><![CDATA[Navigation]]></Type>
</Property>
<Property>
<Name><![CDATA[NavImage]]></Name>
<TitleKey><![CDATA[Navigation Image]]></TitleKey>
</Property>
</TemplateProperties>
</TemplatePropertiesCollections>When you right click on macro.html and select properties, you will get a dialog like this:
|