Customization Files
Properties Files
Web Center Properties
The Web Center properties file
WEB-INF/config/webCenter.properties
contains configuration properties to adapt the overall layout of Web Center pages and to adjust some features.To override a default property value, add a property with identical name and the new value to file
WEB-INF/config/webCenterCustom.properties.
You can also add new properties to the custom file. The custom file properties take precedence over the default ones.
The properties are made available to the application as an application-scoped variable of type java.util.Map with name “webCenter”. In a JSP, for example, the expression “${webCenter.initialSearch}” is resolved to the value of the property with name “initialSearch”. Its default value is “false”. In order to change it to “true”, add the following line to the custom properties file:
initialSearch = true
The custom property file is not delivered with Web Center, so create it if needed.
Paths
The path configuration file
WEB-INF/config/paths.properties
contains a couple of action and JSP lists.The lists were defined in checkSession.jsp in previous versions but have been moved to a separate configuration file for easier adaptation.
To override a default path, add a property with identical name and the new value to file
WEB-INF/config/pathsCustom.properties.
The custom paths override the default ones.
Message Texts
The default message texts are defined in
WEB-INF/classes/resources/languages/<language>/text.properties.
In order to customize a default message, add a message with the same key and the customized text to file
WEB-INF/classes/resources/languages/<language>/
text_<language>.properties
for each language your application supports.
For example, the custom message file for the English language is
WEB-INF/classes/resources/languages/en/text_en.properties.
You can, of course, also add additional messages to the custom files.
The custom message files are not delivered with Web Center, so create them if needed.
Customization Sample
Default Message File: text.properties
application.logonStatus.loggedOn = Logged on as application.shortTitle = User Management with DirX
Custom Message File: text_en.properties
application.logonStatus.loggedOn = You are logged on as application.shortTitle = custom.companyName = Your-Company
The custom file
-
Redefines the text of the 1st message.
-
Removes the text of the 2nd message, which means no short title will be displayed.
-
Defines a new custom message with key “custom.companyName”.
Objects Configuration
The standard Web Center objects and object relations are configured in file
WEB-INF/config/objects-config.xml.
The location of the file can be changed in the context descriptor file
webCenter-<domain>.xml:
<Parameter override="false" name="ObjectConfig.Path" value="/WEB-INF/config/objects-config.xml"/>
Do not change the standard definition file or location. Instead, place your custom object definitions in a new file and append its path name to ObjectConfig.Path, for example
<Parameter override="false" name="ObjectConfig.Path"
value="/WEB-INF/config/objects-config.xml,
/WEB-INF/custom/config/objects-config.xml"/>
| A custom definition will overwrite any default definition with the same object id or relation name. |
Customization Sample
Default File: WEB-INF/config/objects-config.xml
<objects>
…
<object id="project"
nodeClass="siemens.dxr.organization.nodes.SvcProject"
set="Projects"
dirClass="dxrProject"/>
…
</objects>
Custom File: WEB-INF/custom/config/objects-config.xml
<objects>
<object id="project"
nodeClass="custom.customObject"
set="Projects"
dirClass="dxrProject"/>
</objects>
<relations>
<relation name="customAssigned" value=".assigned"/>
<relations>
The custom file
-
Redefines the default definition of object “project”.
-
Defines a new relation with id “customAssigned”.
Renderers
Renderer Definitions
The definitions of the standard Web Center renderers are configured in file
WEB-INF/config/renderers-config.xml.
The location of the file can be changed in the context descriptor file
webCenter-<domain>.xml:
<Parameter override="false" name="RendererConfig.Path" value="/WEB-INF/config/renderers-config.xml"/>
Do not change the standard definition file or location. Instead, place your custom renderers in a new file and append its path name to RendererConfig.Path, for example
<Parameter override="false" name="RendererConfig.Path"
value="/WEB-INF/config/renderers-config.xml,
/WEB-INF/custom/config/renderers-config.xml"/>
| A custom renderer will overwrite any default renderer with the same id. |
Customization Sample
Default File: WEB-INF/config/renderers-config.xml
<renderer id="text"
defURL="/WEB-INF/snippets/textField/roTextField.htm"
altURL="/WEB-INF/snippets/textField/rwTextField.htm"
jsURL="/WEB-INF/snippets/textField/textField.js"
roJsURL="/WEB-INF/snippets/textField/roTextField.js/>
Custom File: WEB-INF/custom/config/renderers-config.xml
<renderer id="text"
defURL="/WEB-INF/custom/snippets/textField/roTextField.htm"
altURL="/WEB-INF/custom/snippets/textField/rwTextField.htm"
jsURL="/WEB-INF/snippets/textField/textField.js"
roJsURL="/WEB-INF/snippets/textField/roTextField.js/>
<renderer id="customText" extends="text"
roJsURL="/WEB-INF/snippets/textField/roTextField.js/>
The custom file
-
Redefines the default definition of renderer “text”.
-
Defines a new renderer with id “customText”.
Default Renderer Assignments
Default assignments of renderers to form properties are configured in file:
WEB-INF/config/defaultRenderer.properties.
The location of the file is configured in the properties file
WEB-INF/config/webCenter.properties
config.defaultRenderers = /WEB-INF/config/defaultRenderer.properties
Do not change the standard definition file or location. Instead, place your custom assigments in a new file and append its path name to config.defaultRenderers in file
WEB-INF/config/webCenterCustom.properties
For example:
config.defaultRenderers =
/WEB-INF/config/defaultRenderer.properties,
/WEB-INF/custom/config/defaultRenderer.properties
| A custom assignment will overwrite any default assignment with the same key. |
Customization Sample
Default File: WEB-INF/config/defaultRenderer.properties
java.lang.String = text manager = userSearch
Custom File: WEB-INF/custom/config/defaultRenderer.properties
java.lang.String = customText custommember = userLinks
The custom file
-
Redefines the default renderer for properties of type “java.lang.String”.
-
Adds a new assignment for property “customMember”.
Including Custom Javascript Files and Stylesheets
The main Web Center layout page adds the content of a custom JSP to the header of each HTML page.The JSP is intended to contain <script> and <style> tags to include custom Javascript files and stylesheets for the page.
The name of the file must be configured as Web Center property with name “customScriptsAndStyles”, e.g.
customScriptsAndStyles = /WEB-INF/custom/jsp/ScriptsAndStyles.jsp
Specify the file name as an absolute path from the Web Center root folder.We recommend putting the file somewhere below the WEB-INF folder since this prevents the file from being downloaded to clients.
The following sample file includes a script and a stylesheet:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<script src="resources/custom/scripts/custom.js"></script>
<script src="resources/custom/messages/
<c:out value="${sessionScope['com.siemens.webMgr.language']}"/>/
messages.js">
</script>
<link rel="StyleSheet" type="text/css"
href="resources/custom/styles/styles.css">
| Including files in an HTML page has an impact on performance.It’s not advisable to include too many files. |
Javascript
Custom Code
Do not change any of the Javascript files supplied with Web Center in order to add custom script code.Keep all your code in a separate custom file.
Custom Renderers
Custom renderers for table cells must be registered with the renderers object defined in Javascript file documentFuncs.js.
As of DirX Identity 8.2, the renderers object provides some methods to register custom renderers.So there is no more need to change the file documentFuncs.js.
For details on custom renderers, see chapter “Renderers.”
Custom Validators
Custom validators must be registered with the validators object defined in Javascript file validation.js.
The validators object provides a method to register custom validators. So there is no need to change the file validation.js.
For details on custom validators, see chapter “Validation.”
Custom Messages
Each Web Center page loads a language dependent Javascript message file resources/build/messages/<language>/messages.js.
The default messages are defined in object messages.texts. At the end of each file, the object messages.custom.texts is defined.
Now, in order to overwrite a default message text messages.texts, create your own language-specific message file and add a property with the name to messages.custom.texts. You can also add additional messages to the messages.custom.texts.
Then include the custom message file in each Web Center page as described in section “Including Custom Javascript Files and Stylesheets” above.
Customization Sample
Default Message File
messages.texts = {
...
attributes: {
cn: "Name",
description: "Description",
$displayname: "Name",
dxmactive: "Active",
ou: "Department",
telephonenumber: "Phone"
}
};
Custom Message File
messages.custom.texts = {
...
attributes: {
cn: "Common Name",
$displayname: "Displayname",
ou: "Organizational Unit",
telephonenumber: "Phone Number"
},
colors: {
red: "Red",
blue: "Blue",
green: "Green"
}
};
The custom file overrides some of the default texts in the “attributes” section, and defines a new section “colors”.
When editing a message file take care of correct syntax, esp. of properly separating two adjacent definitions with a comma.There mustn’t be a comma after the last definition with each section, e.g. at the end of the “telephonenumber” line, or after the closing curly brace of the “colors” section in the above sample.
Custom File Overview
Custom files might be located below an application’s root folder in the following way:
resources custom messages de messages.js en messages.js scripts custom.js styles small styles.css medium styles.css large styles.css WEB-INF classes resources languages de text_de.properties en text_en.properties config webCenterCustom.properties custom config converters.properties defaultRenderers.properties messages.properties objects-config.xml renderers-config.xml jsp scriptsAndStyles.jsp
You may choose different folders and names for your custom files.Files with fixed names and locations are printed in bold font.
Configuring Customization File Names
The following table summarizes where to configure the names of customization files.
Configuration Files with Fixed Names
| File Name | Customization File |
|---|---|
WEB-INF/config/webCenter.properties |
WEB-INF/config/ webCenterCustom.properties |
WEB-INF/classes/resources/ languages/<language>/text.properties |
WEB-INF/classes/resources/ languages/ <language>/ text_<language>.properties |
Configuration Files with Variable Names
| File Name | Configuration File | Parameter |
|---|---|---|
WEB-INF/config/../ struts-config.xml |
webCenter-<domain>.xml |
Struts.DefaultFiles Struts.Path |
WEB-INF/config/../ forms-config.xml |
webCenter-<domain>.xml |
Struts.DefaultFiles Struts.Path |
WEB-INF/config/../ tiles-defs.xml |
webCenter-<domain>.xml |
Struts.DefaultFiles Struts.Path |
WEB-INF/config/../ menu-defs.xml |
webCenter-<domain>.xml |
Struts.DefaultFiles Struts.Path |
WEB-INF/config/ converters.properties |
WEB-INF/config/ webCenterCustom.properties |
config.converters |
WEB-INF/config/ defaultRenderers.properties |
WEB-INF/config/ webCenterCustom.properties |
config.defaultRenderers |
WEB-INF/config/ messages.properties |
WEB-INF/config/ webCenterCustom.properties |
config.messages |
WEB-INF/config/ objects-config.xml |
webCenter-<domain>.xml |
ObjectConfig.Path |
WEB-INF/config/ renderers-config.xml |
webCenter-<domain>.xml |
RendererConfig.Path |
WEB-INF/config/ validation.xml |
WEB-INF/config/identity/ struts-config.xml |
ValidatorPlugIn: pathnames |
WEB-INF/config/ validator-rules.xml |
WEB-INF/config/identity/ struts-config.xml |
ValidatorPlugIn: pathnames |
Custom Javascript files |
Custom include file |
script tags |
Custom CSS stylesheets |
Custom include file |
link tags |
Custom include file |
WEB-INF/config/ webCenterCustom.properties |
customScriptsAndStyles |
The table lists the configuration files for the WebCenter application.
The corresponding files for the Self-Service application are
selfService-domain.xml and
WEB-INF/config/identitySelf/struts-config.xml.