The Corinis TagLib
How to Include
If you want to use the corinis taglibs just put:
<%@ taglib uri="/corinisTags" prefix="corinis" %>
on top of your jsps.
Tags available
corinis:core
This is the core taglib. It allows you to include basic information like username or the current date.
Usage
<corinis:core name="date"/>
Following values for "name" are available:
- name - current username
- id - current id
- ip - current ip
- email - current email
- profile-fieldname - the value of the given profile field (change fieldname with the name of the profile field you want to get)
- session - session string
- date - formatted date/time
- app - application name
- usersonline - number of current online users
- users - number of all users
corinis:cms
This is a helper taglib to the cms module. You can use corinis:module to accomplish the same tasks (but slightly more difficult)
Usage
<corinis:cms function="getEntry" xsl="show.xsl"/>
If you do not pass any function, the cms will be printed:
<corinis:cms />
Functions
Following optional functions (function="") are available:
- getFileManagerComplete - retrieve the complete site tree (use parentFolder="-3" to get a flat tree with all documents)
- getEntries - retrieve only elements in this level (use parentFolder="-3" to get a flat tree with all documents)
- getEntry - retrieve the complete document information
- name - get the name of the current document
- changed - get the date when this document was last changed
- created - get the date when this document was created
- editor - get the name of the editor
- editorid - get the user id of the editor
- version - the version of this document
- get - get a named field out of the document (use name="fieldname" )
top
Set the site-root for this call (if not set here it is taken out of the session)
parentfolder
set the id of the parent folder
docid
set the id of the document
htmlout
Set this to true to render all tags as tags (should be set if you try to display richedit fields).
name
This attribute (name="") is available for following functions
- getFileManagerComplete
- getEntries
- getEntry
The value is a list of , separated string representing data-fields from the document that should be included in the resulting xml:
Example: get="header,subheader,content_1_text"
dateformat
This attribute is used when you want a different datetime format for your output.
<corinis:cms name="header,abstract" dateFormat="EEE, d MMM yyyy HH:mm:ss z" function="getFileManager" parentFolder="-2" xsl="inline">
xsl
This attribute may either have the value "inline" or a path to an xsl. If used with "inline" the content of the tag is the xml.
Example:
<corinis:cms name="header,abstract" dateFormat="EEE, d MMM yyyy HH:mm:ss z" function="getFileManager" parentFolder="-2" xsl="inline"> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:for-each select="/CMSFILEMANAGER/ENTRY[not(ID=0)]"> <xsl:sort select="LDATECHANGED" order="descending"/> <item> <xsl:if test="position() < 5"> <title><xsl:value-of select="CONTENT/header"/></title> <description><xsl:value-of select="CONTENT/abstract"/></description> <link>http://localhost:8080/test/observers/index.jsp?Document_id=<xsl:value-of select="ID"/></link> <pubDate><xsl:value-of select="DATECHANGED"/></pubDate> </xsl:if> </item> </xsl:for-each> </xsl:template> </xsl:stylesheet> </corinis:cms>
corinis:module
Using this tag you can call almost ANY function available in corinis. This includes all view/modify and create functions. Since the corinis module functions use the request parameter to act, you normally do not need much more than a form, the corinis:module tag and a an xsl (may be inline)
Example
<corinis:module app="corinis" name="CmsLifeFileManager" xsl="show.xsl" function="getEntry"> <cms> <id>0</id> </cms> </corinis:module>
name
The name is the name of the module (if without classpath, the path corinis.modules is assumed).
function
The function can be any function that is defined in the module.
predefined parameters (like id...)
All predefined parameters are inside the tag body.
xsl
the xsl to use for parsing the result
htmlout
DESCRIBEME
corinis:function
Provides tagfunctions like: if/for/... in combination with some corinis internals.
Example:
<corinis:function name="if" field="online" value="true"> <a title="logout" href="?Login_deleteEntry=true"><corinis:core name="name"/></a> </corinis:function>
Following attributes are available:
- name
- field
- value
name
- if: everything in the tag will only be evaluated/shown if the result of field and value result in a true
field/value
The field defines a special internal function (like online to check if the current user is online or not), which returns a value (true/false, a number or any string). The return value can then be checked against the value-parameter.
The value can contain a regular expression that is used to check against the return of the function defined in field.
- online: true if the user is online, false otherwise
- request-parameter:NAME: checks against any request parameter (NAME)
- authority:NAME: true if the current logged on user (or guest) has the named authority (NAME)
