Adding a universal dialog

The content page in the WebSphere Commerce Accelerator uses the Universal dialog. The examples below refer to this page.

Procedure

  1. Create a universal dialog definition XML file. This file defines all the sections in the universal dialog. This file should be stored in the following directory:
    • WC_installdir/xml/tools/componentname
    • WebSphere Commerce Developer workspace_dir/wc/xml/tools/componentname

    where componentname is the name of the component to which the new universal dialog belongs.

    For content, the universal dialog definition XML file is in the directory:

    • WC_installdir/xml/tools/campaigns/CollateralUniversalDialog.xml
    • WebSphere Commerce Developer workspace_dir/wc/xml/tools/campaigns/CollateralUniversalDialog.xml See Universal dialog definition for more information.

  2. Register the universal dialog definition XML file in the resources.xml file for the component that you are modifying. Multiple versions of this file exist, one for each component, in the following directory:

    • WC_installdir/xml/tools/component/resources.xml
    • WebSphere Commerce Developer workspace_dir/wc/xml/tools/componentname/resources.xml

    where componentname is the component to which you are adding the universal dialog.

    Make an entry similar to the following in resources.xml:

    <XML name=" myUniversalDialog" file="component/newUniversalDialog .xml" />

    The name attribute becomes a key which will be used in a later step.

    Since the WebSphere Commerce configuration file references the resources.xml files, you must also update the WebSphere Commerce configuration file to register any new resources.xml files.

    For content, the correct resources.xml file is in the following directory:

    • WC_installdir/xml/tools/campaigns
    • workspace_dir/wcworkspace_dir/wc

  3. Create a resource bundle adding text for the universal dialog. The resource bundle files are in the following directory:

    • WC_eardir/properties/com/ibm/commerce/tools/componentname/properties
    • WebSphere Commerce Developer workspace_dir/wc/properties/com/ibm/commerce/tools/componentname/properties

    where componentname is the component to which you are adding the universal dialog.

    
    # content panel
    collateralDialogTitle=content Properties
    collateralDialogSuccessConfirmation=The content was successfully saved.
    collateralGeneralPanelPrompt=content Properties
    collateralNamePrompt=Name (required)
    

    If national languages are supported, create the national language resource bundles with the appropriate language text. The national language file names must end with the locale supported. For example, for a French-language resource bundle, the file name should be filename_fr_FR.properties

    For content the resource bundle is in the following directory:

    • WC_eardir/properties/com/ibm/commerce/tools/campaigns/properties/campaignsRB_locale.properties
    • WebSphere Commerce Developer workspace_dir/wc/properties/com/ibm/commerce/tools/campaign/properties/campaignsRB_ locale.properties

    where locale is the local to which you are adding the universal dialog.

  4. Create any custom JavaScript or JSP files required. Although not necessary, you can define custom JavaScript functions and JSP files. For example, if an already existing JSP segment exists, you can include it as part of your universal dialog.
  5. Write a custom data bean to pre-populate fields. See Using data beans to populate values in a universal dialog and Example: Universal dialog data bean class for more information.
  6. Write custom controller commands for business logic. These controller commands update the database with the information entered, or perform some function when the user clicks on the Finish button. See Example: Wizard, dialog or notebook controller command for more information.
  7. Write custom validators, if necessary. WebSphere Commerce provides default Universal dialog JavaScript functions. However, if you require custom functions you can write them and include them in your universal dialog. To include them use the <jsfile/> tag for JavaScript or the <include> tag for JSP segments in the universal dialog definition XML file.
  8. Optional: Add context-sensitive help. Refer to Adding context-sensitive help into the tools user interface center
  9. (Panel mode only) Create a notebook definition XML file.

    This is almost identical to step 1 in Adding a notebook. The only difference is that each notebook panel is a section of the universal dialog. For example,

    <panel name="section1"
    url="UniversalDialogView?XMLFile=common.UDSample2&amp;section=section1"
    
    helpKey="" />
    
    <panel name="section2"
    url="UniversalDialogView?XMLFile=common.UDSample2&amp;section=section2"
    
    helpKey="" />
  10. Add your universal dialog to a Tools User Interface Center menu.

    For stand-alone mode, add your new universal dialog to a Tools User Interface Center menu system (for example, WebSphere Commerce Accelerator). Refer to Integrating tools into the Tools User Interface Center for more information.

    For panel mode, follow the same instructions, adding the notebook to a Tools User Interface Center.