Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

OpenCms Days 2015 Hidden features of OpenCms

OpenCms 9.5 (and soon version 10) has a great number of features that are included in the core distribution but are not well known and therefore often remain unused. These include:

- Many EL functions available for JSP templates
- XML schema based configuration of the content editor
- Individual content settings for sitemaps
- Advanced logging options in the workplace Administration
… and much more.

In this session, some of these valuable hidden features are presented.

  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

OpenCms Days 2015 Hidden features of OpenCms

  1. 1. Michael Emmerich, Alkacon Software Hidden features of OpenCms 30.09.2015
  2. 2. ● EL functions available for JSP templates ● Individual content settings for sitemaps 2 Agenda – Good to know…
  3. 3. ● Logging in OpenCms ● Extending the XML Sitemap ● <cms:parse> Tag 3 Agenda – Did you know…
  4. 4. ● Linkexclude ● Using the Workflow 4 Agenda – The hidden features
  5. 5. A short overview of useful EL functions EL functions5
  6. 6. ● 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
  7. 7. ● 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
  8. 8. ● 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
  9. 9. ● 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
  10. 10. How to configure content locations and content types Individual content settings for sitemaps 10
  11. 11. ● „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
  12. 12. ● Disable individual content types (useful in a multi-site enviroment) 12 Individual content settings for sitemaps
  13. 13. ● Disable all content types and set them individually 13 Individual content settings for sitemaps
  14. 14. Adding individual logfiles Logging in OpenCms14
  15. 15. ● 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
  16. 16. 16 Logging Tool in Workplace Channel Logfile
  17. 17. ● 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
  18. 18. Additional output in XML-Sitemaps Extending the XML-Sitemap18
  19. 19. ● 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. 20. 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
  21. 21. ● 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
  22. 22. 22 Extending the XML-Sitemap Example XML-sitemap output:
  23. 23. Modification of HTML output The <cms:parse> tag23
  24. 24. ● <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
  25. 25. ● Usage in formatter: ● Important: Inline editing is not possible/useful when using the <cms:parse> tag! 25 The <cms:parse> tag
  26. 26. ● 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
  27. 27. ● The Parser example: 27 The <cms:parse> tag
  28. 28. ● The Visitor example: 28 The <cms:parse> tag
  29. 29. 29 The <cms:parse> tag Demo Demo Demo Demo デモ
  30. 30. Linkexcludes – what is this? Linkexcludes30
  31. 31. ● 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
  32. 32. ● The Solution: Linkexcludes! ● Defined in /system/shared/linkexcludes ● All paths entered are not processed by the internal link check 32 Linkexcludes
  33. 33. ● 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
  34. 34. 34 The <cms:parse> tag Demo Demo Demo Demo デモ
  35. 35. OpenCms has a workflow? Using the OpenCms Workflow35
  36. 36. ● 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
  37. 37. ● Configuration: Add the follwoing to the opencms-system.xml ● All users of the defined „workflowProjectManagerGroup“ will notified by email 37 Using the OpenCms Workflow
  38. 38. ● Step 1: ● User tries to publish, but has not enough permissions to do so 38 Using the OpenCms Workflow
  39. 39. ● Step 2: ● User switches to „release“, the publish dialog behaves like during a „normal“ publication 39 Using the OpenCms Workflow
  40. 40. ● Step 3: ● Adminstrator receives email 40 Using the OpenCms Workflow
  41. 41. ● Step 4: ● By clicking on email or accessing the publish dialog directly, the requested content can be published 41 Using the OpenCms Workflow
  42. 42. 42 Any questions? Fragen? Questions ? ¿Preguntas?質問 Questiones?
  43. 43. Michael Emmerich Alkacon Software GmbH http://www.alkacon.com http://www.opencms.org Thank you very much for your attention! 43

×