Create Module HowTo

(Difference between revisions)
Jump to: navigation, search
(Create and Install Message Bundle)
(Create action class and initiate the message bundle as part of the action class)
Line 19: Line 19:
 
Action class is used to register the message bundle with OpenCms at start up. Again this is just a simple class this time implementing org.opencms.module.I_CmsModuleAction. The important thing here is to call the message bundle as part of the action class initialize method, so the message bundle gets loaded. Sample class below should demonstrate how to achieve this.  
 
Action class is used to register the message bundle with OpenCms at start up. Again this is just a simple class this time implementing org.opencms.module.I_CmsModuleAction. The important thing here is to call the message bundle as part of the action class initialize method, so the message bundle gets loaded. Sample class below should demonstrate how to achieve this.  
  
After  you have created and uploaded the action class in module /classes/ directory you also need to register the action class with your module. This can be done in the module management  by editing the "Action class" value.  
+
After  you have created and uploaded the action class in module /classes/ directory you also need to register the action class with your module. This can be done in the module management  by editing the "Action class" value.
 +
 
 +
[[Image:Actionclass.jpg|Module action class configuration]]
  
 
=== Create your module specific workplace.properties file ===
 
=== Create your module specific workplace.properties file ===
 
text
 
text

Revision as of 12:27, 13 March 2007

Contents

Introduction

this HowTo will take you through a process of creating your own module extension to OpenCms administration view.

Create Module

First you must create module container for your extension. Creation of a new module is described in detail at Defining_OpenCMS_structured_XML_content#Step_1_.E2.80.93_Create_the_module_and_configure_it. Make sure that you select all module folders to be created.

Create and Install Message Bundle

Next we need to create and install message bundle for our new module, so will be able to customise all workplace labels based on user's selected language. This requires the following steps:-

  1. Create messages class.
  2. Create action class and initiate the message bundle as part of the action class.
  3. Create your module specific workplace.properties file.

All these files must be published as part of your module /classes/ directory.

Create messages class

Message class is used to reference your module specific workplace.properties file at part of OpenCms. This is just a simple class extending org.opencms.i18n.A_CmsMessageBundle and the bundle name variable pointing to the module specific workplace.properties file location. Below is a sample Messages class in order to illustrate this.

Create action class and initiate the message bundle as part of the action class

Action class is used to register the message bundle with OpenCms at start up. Again this is just a simple class this time implementing org.opencms.module.I_CmsModuleAction. The important thing here is to call the message bundle as part of the action class initialize method, so the message bundle gets loaded. Sample class below should demonstrate how to achieve this.

After you have created and uploaded the action class in module /classes/ directory you also need to register the action class with your module. This can be done in the module management by editing the "Action class" value.

Module action class configuration

Create your module specific workplace.properties file

text

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox