Create Module HowTo

(Difference between revisions)
Jump to: navigation, search
(Create messages class)
(Create messages class)
Line 13: Line 13:
 
=== Create messages class ===
 
=== Create messages class ===
 
Message class is used to reference your module specific workplace.properties file at part of OpenCms.
 
Message class is used to reference your module specific workplace.properties file at part of OpenCms.
 +
 +
<math>package com.clicksandlinks.opencms.groupmail;
 +
 +
import org.opencms.i18n.A_CmsMessageBundle;
 +
import org.opencms.i18n.I_CmsMessageBundle;
 +
 +
/**
 +
* This class serves the module captions.<p>
 +
*
 +
* @author Olli Aro, Clicks and Links Ltd
 +
* @version Revision: 0.1 Date: 2007/02/21
 +
*
 +
*/
 +
 +
public class Messages extends A_CmsMessageBundle {
 +
 +
/** Global message captions. */
 +
public static final String GUI_NEWSLETTER_MASSMAIL_TOOL_NAME_0 = "GUI_NEWSLETTER_MASSMAIL_TOOL_NAME_0";
 +
public static final String ERR_PROBLEM_SENDING_EMAIL_0 = "ERR_PROBLEM_SENDING_EMAIL_0";
 +
public static final String ERR_BAD_SENDER_ADDRESS_0 = "ERR_BAD_SENDER_ADDRESS_0";
 +
public static final String ERR_BAD_SUBJECT_FIELD_0 = "ERR_BAD_SUBJECT_FIELD_0";
 +
public static final String ERR_BAD_SUBJECT_MESSAGE_0 = "ERR_BAD_SUBJECT_MESSAGE_0";
 +
public static final String ERR_BAD_TO_GROUP_0 = "ERR_BAD_TO_GROUP_0";
 +
public static final String GUI_USER_EDITOR_LABEL_IDENTIFICATION_BLOCK_COMPOSE_EMAIL_0 = "GUI_USER_EDITOR_LABEL_IDENTIFICATION_BLOCK_COMPOSE_EMAIL_0";
 +
public static final String MODULE_DATE_FORMAT = "MODULE_DATE_FORMAT";
 +
public static final String MODULE_EMAIL_SUBJECT_PREFIX = "MODULE_EMAIL_SUBJECT_PREFIX";
 +
 +
/** Name of the used resource bundle. */
 +
    private static final String BUNDLE_NAME = "com.clicksandlinks.opencms.groupmail.workplace";
 +
 +
    /** Static instance member. */
 +
    private static final I_CmsMessageBundle INSTANCE = new Messages();
 +
   
 +
    /*
 +
    *
 +
    * Hides the public constructor for this utility class.<p>
 +
    *
 +
    */
 +
  private Messages() {
 +
 +
      // hide the constructor
 +
  }
 +
 +
  /**
 +
    * Returns an instance of this localized message accessor.<p>
 +
    *
 +
    * @return an instance of this localized message accessor
 +
    */
 +
  public static I_CmsMessageBundle get() {
 +
 +
      return INSTANCE;
 +
  }
 +
 +
  /**
 +
    * Returns the bundle name for this OpenCms package.<p>
 +
    *
 +
    * @return the bundle name for this OpenCms package
 +
    */
 +
  public String getBundleName() {
 +
 +
      return BUNDLE_NAME;
 +
  }
 +
}
 +
</math>
  
 
=== Create action class and initiate the message bundle as part of the action class ===
 
=== Create action class and initiate the message bundle as part of the action class ===

Revision as of 11: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.

Create messages class

Message class is used to reference your module specific workplace.properties file at part of OpenCms.

<math>package com.clicksandlinks.opencms.groupmail;

import org.opencms.i18n.A_CmsMessageBundle; import org.opencms.i18n.I_CmsMessageBundle;

/**

* This class serves the module captions.

* * @author Olli Aro, Clicks and Links Ltd * @version Revision: 0.1 Date: 2007/02/21 * */ public class Messages extends A_CmsMessageBundle { /** Global message captions. */ public static final String GUI_NEWSLETTER_MASSMAIL_TOOL_NAME_0 = "GUI_NEWSLETTER_MASSMAIL_TOOL_NAME_0"; public static final String ERR_PROBLEM_SENDING_EMAIL_0 = "ERR_PROBLEM_SENDING_EMAIL_0"; public static final String ERR_BAD_SENDER_ADDRESS_0 = "ERR_BAD_SENDER_ADDRESS_0"; public static final String ERR_BAD_SUBJECT_FIELD_0 = "ERR_BAD_SUBJECT_FIELD_0"; public static final String ERR_BAD_SUBJECT_MESSAGE_0 = "ERR_BAD_SUBJECT_MESSAGE_0"; public static final String ERR_BAD_TO_GROUP_0 = "ERR_BAD_TO_GROUP_0"; public static final String GUI_USER_EDITOR_LABEL_IDENTIFICATION_BLOCK_COMPOSE_EMAIL_0 = "GUI_USER_EDITOR_LABEL_IDENTIFICATION_BLOCK_COMPOSE_EMAIL_0"; public static final String MODULE_DATE_FORMAT = "MODULE_DATE_FORMAT"; public static final String MODULE_EMAIL_SUBJECT_PREFIX = "MODULE_EMAIL_SUBJECT_PREFIX"; /** Name of the used resource bundle. */ private static final String BUNDLE_NAME = "com.clicksandlinks.opencms.groupmail.workplace"; /** Static instance member. */ private static final I_CmsMessageBundle INSTANCE = new Messages(); /* * * Hides the public constructor for this utility class.<p> * */ private Messages() { // hide the constructor } /** * Returns an instance of this localized message accessor.<p> * * @return an instance of this localized message accessor */ public static I_CmsMessageBundle get() { return INSTANCE; } /** * Returns the bundle name for this OpenCms package.<p> * * @return the bundle name for this OpenCms package */ public String getBundleName() { return BUNDLE_NAME; } } </math>

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

text

Create your module specific workplace.properties file

text

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox