Upload
alkacon-software-gmbh-co-kg
View
485
Download
0
Embed Size (px)
Citation preview
● EL functions available for JSP templates
● Individual content settings for sitemaps
2
Agenda – Good to know…
● Access to OpenCms core beans in your JSP/Formaters
See the updated documentation and JavaDoc!
● Mostly used: ContentAccessBean, easy access to XML contents:
● <cms:formatter var="content"> ... </cms:formatter>
● <cms:contentload ...> ... <cms:contentaccess var="content" /> ... </cms:contentload>
6
EL functions
● CmsJspStandardContextBean cms
● Default entry point to EL functions, get access to other beans
● Some interesting properties of CmsJspStandardContextBean ● cms.locale
the locale for the current request
● cms.title the title property of currently requested page (containerpage)
● cms.uri Uri of the requested resource
● cms.isOnlineProject check if you are in the online project
● cms.isEditMode check if edit mode is enabled
● and much more…
7
EL functions
● Access to other useful beans:
● cms.requestContext returns a request context bean with properties ● uri
Uri of the requested resource
● currentUser Returns a bean with information about the current user
● and much more…
● cms.vfs Returns a VFS bean that allows to explore the VFS ● Some resource
cms.vfs.resource[<site relative path>]
● Currently requested resource cms.vfs.resource[cms.requestContext.uri]
8
EL functions
● Useful Beans for containers and elements
● cms.page (CmsContainerPageBean) currently rendered container page
● cms.container (CmsContainerBean) Get information on the container you are in
● cms.element (CmsContainerElementWrapper) Get information for the currently rendered container page element
● See the JavaDoc for all available methods
9
EL functions
● „Behaviour“ of content types is defined in
module config and can be overwritten in the
sitemap configuration
● Local content = store content in current
sitemap/.content folder
11
Individual content settings for
sitemaps
● Disable individual content types (useful in a
multi-site enviroment)
12
Individual content settings for
sitemaps
● OpenCms uses log4j for logging
● Default: opencms.log in /logs folder
● Tool for non persistant changes in Workplace Admin-View
● Only for Workplace Server!
● Customers called it: “Starship Enterprise”
15
Logging Tool in Workplace
● Logging configuration in /classes/log4j.properties
● Individual logfiles for special log channels:
log4j.logger.com.mypackage.myclass=DEBUG,mlg
log4j.additivity.com.mypackage.myclass=false
log4j.appender.mlg=org.apache.log4j.RollingFileAppender
log4j.appender.mlg.File=${opencms.logfolder}mylog.log
log4j.appender.mlg.MaxFileSize=2mb
log4j.appender.mlg.MaxBackupIndex=15
log4j.appender.mlg.layout=org.apache.log4j.PatternLayout
log4j.appender.mlg.layout.ConversionPattern=%d{DATE} %5p [%30.30C:%4L] %m%n
17
Logging Options
● Dynamic XML-Sitemap generation
● Uses all Containerpages which are part of the navigation
● Additionally, all permutations of Detailpages are added (eg. News)
19
The XML-Sitemap
20
Extending the XML-Sitemap
● Container page dates: Calculate last modification date based on elements used on the Containerpage (slower)
● Sitemap generator class: Custom additions to sitemap
● Extend the class org.opencms.site.xmlsitemap.CmsXmlSitemapGenerator
● Overwrite method getInnerXmlForEntry(CmsXmlSitemapUrlBean entry)
Create individual additional output for each entry of the Sitemap
● Example from real life project:
● Multiple Sites in OpenCms which show identical content in
different locales
Solution: Refer to same content in same or other locale XML-Sitemap with „alternate“ attribute
21
Extending the XML-Sitemap
● <cms:parse> allows to modify the HTML output of content elements during delivery
● No changes to the content itself is made!
● Typical examples: ● Modification of Links
● (mailto Link -> Link to webform)
● Addition/modification of class attributes ● (internal/external links)
● Adjustments in the Text ● (replacement of shortcuts)
24
The <cms:parse> tag
● Usage in formatter:
● Important: Inline editing is not possible/useful
when using the <cms:parse> tag!
25
The <cms:parse> tag
● Two classes are needed:
● Parser, extending the
A_CmsConfiguredHtmlParser
Parser defines the custom Html Visitor
● Html Visitor, extending the CmsHtmlParser for
manipulating the HTML Code
● Little example: Add class to all links to
OpenCms website
26
The <cms:parse> tag
● The Problem:
● Website is running at www.mysite.com
● OpenCms is configured that no
„/opencms/opencms/ is shown in URL
● Data stored at www.mysite.com/bigmedia should
not be stored in OpenCms
● BUT: OpenCms Linkmanager „grabs“
everything starting with www.mysite.com as
internal links
● LinkManager will show errors
31
Linkexcludes
● The Solution: Linkexcludes!
● Defined in /system/shared/linkexcludes
● All paths entered are not processed by the
internal link check
32
Linkexcludes
● A little configuration is required:
● In opencms-importexport.xml change
org.opencms.staticexport.CmsDefaultLinkSubstitutionHandler
to the advanced link substitution handler
org.opencms.staticexport.CmsAdvancedLinkSubstitutionHandler
33
Linkexcludes
● What - OpenCms has a Workflow?
● Yes – at least some kind of…..build after customer requirements four years ago
● What does it do?
● Editor users are not allowed to publish
● They can send publish requests for content to be published
● Adminstrators are notified of those requests and publish the content
● All is done via the publish dialog
36
Using the OpenCms Workflow
● Configuration: Add the follwoing to the opencms-system.xml
● All users of the defined „workflowProjectManagerGroup“ will notified by email
37
Using the OpenCms Workflow
● Step 1:
● User tries to publish, but has not enough
permissions to do so
38
Using the OpenCms Workflow
● Step 2:
● User switches to „release“, the publish dialog
behaves like during a „normal“ publication
39
Using the OpenCms Workflow
● Step 4:
● By clicking on email or accessing the publish
dialog directly, the requested content can be
published
41
Using the OpenCms Workflow