Search This Blog

Wednesday, November 10, 2010

WCM Tag List and it's detailed description

A wiki version of the information found here in the IBM Infocenter

    Element's are fields (and there corresponding values) that you created when you defined an authoring template or added an element to a site or site area. The Element tag is reference an element within a presentation template or element design.
     
    <Element type=" " context=" " name=" " key=" " format=" " link=" " separator=" " htmlencode=" " awareness=" " start=" " end=" " />

    <Element
    Opens the tag.

    type=" "

    This determines where the element is being referenced from. Either "content", "sitearea" or "site".
    context=" " This determines which content item or site area is being referenced.
    • Selected Refers to a particular item as specified in the name attribute below.
    • Current This will reference the element from the current site, site area or content item that is being browsed by the user.
    • AutoFill The element being referenced will be determined by the search parameters of a menu, navigator or taxonomy component.
    name=" " Enter the name and library of the item the element is being referenced from. For example, name="library/item". To use the library specified in the URL of the current page, use name="./item".
    Note:
    • If a content item with the same name is used in more than one site, you can also specify name="library/site/sitearea/item" to select the appropriate content item.
    • If you specify name="./item", the library name will not appear in your presentation template or element design. The actual path will not be resolved until the item is rendered.The "name" parameter is not used if context=current or context=autofill.
    key=" " This is the name of this element being referenced.
    format=" " This parameter is optional and can only be used with some component types:

    When referencing an image component:
    • Use format="url" to only render the URL of an image component.
    • Use format="alt" to only render the contents of the alt tag of an image component.
    • Use format="tag" to render a complete image tag. The image will be displayed on the rendered page. This is used by default if no format is specified.
      When referencing a file resource component:
    • Use format="HTML" If your file resource is a file type that can be converted to HTML you can instead convert the file to HTML and render the converted HTML directly. Examples of supported file types include: word processing documents (.doc, *.odt) spreadsheets (.xls) HTML files (.htm, .html) Text files (.txt) Other file types may also work but you will need to test them first.
      Note: Maximum Cache SizeIf the converted HTML is larger than the default cache size defined by the resourceserver.maxCacheObjectSizeproperty in the WCM ConfigService.properties file, each request that contains this file will be converted dynamically instead of using the cached copy. This will impact performance. You may need to increase the size of the resourceserver.maxCacheObjectSizeproperty to support large file conversions. Before doing this your should ensure that your system has enough memory installed to cope with the increase in cache size. You could also break up the file into separate files that can be converted separately instead of increasing the cache size.

       When referencing file resource and image components:
    • Use format="mimetype" to render the mime type of a file or image. If no valid mime type can be determined then "www/unknown" will be rendered.
    • Use format="filename" to render the name of a file or image.
    • Use format="size" to render the size of a file or image using the most appropriate unit. If the resource is smaller then 1K then the size in bytes will be rendered. If the size of the resource is less then 1MB then the size in kilobytes will be rendered. If the size is greater than or equal to 1MB then the size will be rendered in megabytes.
    • Use format="size_bytes" to render the size of a file or image in bytes. Only the numeric value is displayed.
    • Use format="size_KB" to render the size of a file or image in kilobytes. Only the numeric value is displayed.
    • Use format="size_MB" to render the size of a file or image in megabytes. Only the numeric value is displayed.
      When referencing a link component:
    • Use format="url" to render the full URL of a link component. For example:/wps/wcm/myconnect/Library/Site/SiteArea/Content
    • Use format="path" to only render the site path of a link component. For example:/Library/Site/SiteArea/Content
    • Use format="tag" to render a complete link tag. This is used by default if no format is specified. For example:<a href="/wps/wcm/myconnect/Library/Site/SiteArea/Content"></a>
      Note: The URL generated by the link component will be fully qualified when viewed through a portal. If you want to generate a URL that isn't fully qualified use the "noprefix" option instead:
    • format="noprefixurl"
    • format="noprefixpath"
    • format="noprefixtag"
      When referencing number or date elements:In this case, the format is used to specify the display format of dates and numbers. The following formats can be defined when displaying dates:
    • format="DATE_SHORT"
    • format="DATE_MEDIUM"
    • format="DATE_LONG"
    • format="DATE_FULL"
    • format="DATE_TIME_SHORT"
    • format="DATE_TIME_MEDIUM"
    • format="DATE_TIME_LONG"
    • format="DATE_TIME_FULL"
    • format="TIME_SHORT"
    • format="TIME_MEDIUM"
    • format="TIME_LONG"
    • format="TIME_FULL"
    • format="relative" (The relative date will be displayed as either "today", "yesterday" or the number of days ago.)

      You can also set user-defined formats for both dates and numbers.
      When referencing user details:
      When formatting user details, the format parameter is used to define which LDAP parameter to use when displaying user details. For example:
    • format="cn" is used to display the common name.
    • format="dn" is used to display the distinguished name.
      Maximum character length:
      You can also specify a maximum number of characters to display by using this format:
    • format="length:number_of_characters" For example, to display a maximum of ten characters you would specify the following parameter: format="length:10"
    link=" " The link parameter is used to define the type of link created by the element tag:link="default"A standard link to an element is created. link="path"Contextual path linking will be used when rendering this element. link="contextual"Contextual content linking will be used when rendering this element. If not applicable, then contextual path linking is used.
    Note: Contextual linking:*Contextual linking is used so that when content is linked from another site, the link will be rendered relative to the current site if possible. It can only be used if *context=current or context=autofill.
    separator=" " This only used when referencing an option selection or user selection element. It is used to define what text or code will be rendered between each selection displayed in an option selection or user selection element. For example, to add a line break between each selection, you would use separator="<br>" . If not defined, a comma will be placed between each selection when rendered.
    htmlencode=" " If htmlencode="true" the reserved HTML characters in text, short text and option selection elements will be converted into character entities. For example, '<' will be converted to '<'. This is useful if you would like to prevent users adding malicious code, or if you want to prevent users changing the look and feel of their text using HTML.If not specified, the default setting specified in the WCMConfigService.properties file located in the was_profile_root/PortalServer/wcm/config/ directory is used. By default, this is set to "true":cmpnt.htmlEncodeDefault=true
    awareness=" " If awareness="true" then user names are displayed using the people awareness features. These features displays user names as hyperlinks that allow users to contact people with whom they might want to work. Wherever person links appear, users can click the link to display a menu of actions for collaborating (contacting and working) with the person named by the link. If you, as administrator, have also configured an IBM® Lotus® Sametime® server to work with WebSphere Portal, person links indicate whether a person is active, away, offline, or in a Do Not Disturb state.People awareness will only work in content rendered using either a local or remote rendering portlet.
    If not specified, then awareness="false" and people awareness is not used.
    start=" "end=" " The start and end attributes are used to wrap the data returned by a tag within other tags, such as HTML. These attributes are not mandatory.
    /> This closes the tag.

    WCM Component Tags

    The Component tag is used to reference the content of a component within a presentation template or element design.
    <Component name=" " context="autofill" format=" " separator=" " compute=" " htmlencode=" " awareness=" " start=" " end=" " />
    <Component Opens a library component tag.
    name=" " Enter the name and library of the component being referenced. For example, name="library/item". To use the library specified in the URL of the current page, use name="./item".Note: If you specify name="./item", the library name will not appear in your presentation template or element design. The actual path will not be resolved until the item is rendered.The "name" parameter is not used if context="autofill".
    context="autofill" This parameter is only used when referencing a Component tag within a Personalization element design to display the results of a Personalization rule that searches for components.
    start=" "end=" " The start and end attributes are used to wrap the data returned by a tag within other tags, such as HTML. These attributes are not mandatory.
    format=" " This parameter is optional and can only be used with some component types:

    When referencing an image component:
    • Use format="url" to only render the URL of an image component.
    • Use format="tag" to render a complete image tag. The image will be displayed on the rendered page. This is used by default if no format is specified.
      When referencing a file resource component:
    • Use format="HTML" If your file resource is a file type that can be converted to HTML you can instead convert the file to HTML and render the converted HTML directly. Examples of supported file types include: word processing documents (.doc, *.odt) spreadsheets (.xls) HTML files (.htm, .html) Text files (.txt) Other file types may also work but you will need to test them first.
      Note: Maximum Cache SizeIf the converted HTML is larger than the default cache size defined by the resourceserver.maxCacheObjectSizeproperty in the WCM ConfigService.properties file, each request that contains this file will be converted dynamically instead of using the cached copy. This will impact performance. You may need to increase the size of the resourceserver.maxCacheObjectSizeproperty to support large file conversions. Before doing this your should ensure that your system has enough memory installed to cope with the increase in cache size. You could also break up the file into separate files that can be converted separately instead of increasing the cache size.

       When referencing file resource and image components:
    • Use format="mimetype" to render the mime type of a file or image. If no valid mime type can be determined then "www/unknown" will be rendered.
    • Use format="filename" to render the name of a file or image.
    • Use format="size" to render the size of a file or image using the most appropriate unit. If the resource is smaller then 1K then the size in bytes will be rendered. If the size of the resource is less then 1MB then the size in kilobytes will be rendered. If the size is greater than or equal to 1MB then the size will be rendered in megabytes.
    • Use format="size_bytes" to render the size of a file or image in bytes. Only the numeric value is displayed.
    • Use format="size_KB" to render the size of a file or image in kilobytes. Only the numeric value is displayed.
    • Use format="size_MB" to render the size of a file or image in megabytes. Only the numeric value is displayed.
      When referencing a link component:
    • Use format="url" to render the full URL of a link component. For example:/wps/wcm/myconnect/Library/Site/SiteArea/Content
    • Use format="path" to only render the site path of a link component. For example:/Library/Site/SiteArea/Content
    • Use format="tag" to render a complete link tag. This is used by default if no format is specified. For example:<a href="/wps/wcm/myconnect/Library/Site/SiteArea/Content"></a>
      Note: The URL generated by the link component will be fully qualified when viewed through a portal. If you want to generate a URL that isn't fully qualified use the "noprefix" option instead:
    • format="noprefixurl"
    • format="noprefixpath"
    • format="noprefixtag"
      When referencing number or date elements:In this case, the format is used to specify the display format of dates and numbers. The following formats can be defined when displaying dates:
    • format="DATE_SHORT"
    • format="DATE_MEDIUM"
    • format="DATE_LONG"
    • format="DATE_FULL"
    • format="DATE_TIME_SHORT"
    • format="DATE_TIME_MEDIUM"
    • format="DATE_TIME_LONG"
    • format="DATE_TIME_FULL"
    • format="TIME_SHORT"
    • format="TIME_MEDIUM"
    • format="TIME_LONG"
    • format="TIME_FULL"
    • format="relative" (The relative date will be displayed as either "today", "yesterday" or the number of days ago.)

      You can also set user-defined formats for both dates and numbers.
      When referencing user details:
      When formatting user details, the format parameter is used to define which LDAP parameter to use when displaying user details. For example:
    • format="cn" is used to display the common name.
    • format="dn" is used to display the distinguished name.
      Maximum character length:
      You can also specify a maximum number of characters to display by using this format:
    • format="length:number_of_characters" For example, to display a maximum of ten characters you would specify the following parameter: format="length:10"
    compute=" " This is only applicable to menu, navigator and taxonomy components. You specify compute="always" when you reference some JSP code within a component design, and you want that code to be run separately on each result returned by a menu, navigator and taxonomy component.For example, if a menu referenced JSP code that used the public DocumentId getCurrentResultId(); method, you would use compute="always" to make the JSP code run separately in every result returned by the menu.
    If not specified, then compute="once" is used which is the default method for delivering the results of menu, navigator and taxonomy components.
    htmlencode=" " If htmlencode="true" the reserved HTML characters in text and short text components will be converted into character entities. For example, '<' will be converted to '<'. This is useful if you would like to prevent users adding malicious code, or if you want to prevent users changing the look and feel of their text using HTML.If not specified, the default setting specified in the WCMConfigService.properties file. By default, this is set to "true":cmpnt.htmlEncodeDefault=true
    awareness=" " If awareness="true" then user names are displayed using the people awareness features. These features displays user names as hyperlinks that allow users to contact people with whom they might want to work. Wherever person links appear, users can click the link to display a menu of actions for collaborating (contacting and working) with the person named by the link. If you, as administrator, have also configured an IBM® Lotus® Sametime® server to work with WebSphere Portal, person links indicate whether a person is active, away, offline, or in a Do Not Disturb state.People awareness will only work in content rendered using either a local or remote rendering portlet.
    If not specified, then awareness="false" and people awareness is not used.
    separator=" " This only used when referencing a user selection component. It is used to define what text or code will be rendered between each selection. For example, to add a line break between each selection, you would use separator="<br>" . If not defined, a comma will be placed between each selection when rendered.
    /> This closes the tag.

    WCM Placeholder tags

    You use a placeholder tag to display metadata of an item. This is different from the
     
    <placeholder tag=" " htmlencode=" " start=" " end=" " />
     

    <placeholder
    Opens a Placeholder Tag.
    tag=" " Determines which placeholder is being referenced:
    • Name
    • Title
    • dn
    • Href
    • noprefixhref
    • Namelink
    • noprefixnamelink
    • Titlelink
    • noprefixtitlelink
    • Sitepath
    • Idnum
    • Listnum
    • Treenum
    • Paddedtreenum
    • Depth
    htmlencode=" " If htmlencode="true" the reserved HTML characters in the source will be converted into character entities. For example, '<' will be converted to '<'. This is useful if you would like to prevent users adding malicious code, or if you want to prevent users changing the look and feel of their text using HTML.If not specified, the default setting specified in the WCMConfigService.properties file located in the was_profile_root/PortalServer/wcm/config/ directory is used. By default, this is set to "true":cmpnt.htmlEncodeDefault=true
    start=" "end=" " The start and end attributes are used to wrap the data returned by a tag within other tags, such as HTML. These attributes are not mandatory.
    /> This closes the tag.

    Placeholder types

    Name This is used to display the name of the site area or content being retrieved in a menu or navigator. This can also be used when you create a user name component, where you can add a placeholder tag in the design and specify tag="name" to render the name of the user.
    Title This is used to display the title of the site area or content being retrieved in a menu or navigator.
    dn This is for when you create a user name component. You can add a placeholder tag in the design and specify tag="dn" to render the distinguished name of the user.
    HREF This inserts a link to the page of the site area or content being retrieved in a menu or navigator.
    noprefixhref The URLs generated by "HREF" parameter will be fully qualified when viewed through a portal. To generate URLs with no prefix, use the "noprefixhref" parameter instead of the "HREF" parameter.
    NameLink This is a combination of the name and HREF tags. It assembles a complete link based on the name of the item being returned.
    noprefixnameLink The URLs generated by "nameLink" parameter will be fully qualified when viewed through a portal. To generate URLs with no prefix, use the "noprefixnameLink" parameter instead of the "nameLink" parameter.
    TitleLink This is a combination of the title and HREF tags. It assembles a complete link based on the title of the item being returned.
    noprefixtitleLink The URLs generated by "titleLink" parameter will be fully qualified when viewed through a portal. To generate URLs with no prefix, use the "noprefixtitleLink" parameter instead of the "titleLink" parameter.
    Note: Using a URLCmpnt tag.*The *URLCmpnt tag is used to generate a URL to a site, site area or content item and can be used as an alternative to a placeholder when generating a URL. This is particularly useful when creating links to Web content displayed within rendering portlets.
    sitepath This is similar to the HREF placeholder except that it only display the site path of an items URL.For example, an HREF placeholder tag displaying a content item may give you:
    • /ILWWCM/connect/metaorg/intranet/press+releasesWhereas the site path will give you:
    • /metaorg/intranet/press+releasesFor example, an HREF placeholder tag displaying a site area may give you:
    • /ILWWCM/connect/metaorg/intranet/Whereas the site path will give you:
    • /metaorg/intranet
      Note that the final / slash is not included when the site path is displayed for sites and site areas.
    Idnum This returns the hexadecimal id value of an item. This can be used when creating static URLs in menus and navigators. You could hard-code the site/site area path in a menu or navigator element design and use the Idnum for each content item being displayed. This would allow you to display content with a different presentation template (for example, a printer friendly presentation template) or use different security settings.
    Listnum Displays a single column list of numbered links:
    1. First
    2. Second
    3. Third
    Treenum Displays a hierarchical numbered list:1.0
    1.1
    1.2
    2.0
    2.1
    2.2
    Paddedtreenum Similar to Treenum, but the numbers are padded:0001
    00010001
    00010002
    000100020001
    000100020002
    Depth Displays the depth of the currently processed node (in a navigator or menu) as a number. A top-level node has a depth of 1.

    Steps required to export WCM Library

    IBM Workplace Web Content Management (WCM) 6 provides a way that you can export and import data from libraries. This can be useful as a way to backup data for safety - especially in the early days of development.
    For example, before more robust data backup and restore procedures can be trusted, you might leverage this mechanism. It is also a way that you can get data from one server to another such as from a team DEV server to your local DEV server.

    (Note that Syndication, not data export/import is the proper way to keep WCM content synchronized between servers on a regular basis. This describes a backup or data move procedure, not syndication for data synchronization.)

    This procedure assumes that you have already configured the data export options in the WCM data export configuration file. This is intended to simply document a quick checklist style procedure for executing new data exports on a regular basis.
    • Use PuTTY to login to the server (on SSH connection if necessary)
    • Change directory: cd /usr/IBM/WebSphere/wp_profile/PortalServer/wcm/config
      • If you list the contents of this directory (ls -la), you should see a file called wcm60_conf.xml. This is the file where the WCM data export options are configured. We will need to modify this file, so let's make a backup for safety first.
    • Backup the config file by making a dated copy. For example:
      • cp wcm60_conf.xml wcm60_conf_2009_09_24.xml
    • Use VI to open the file:
      • vi wcm60_conf.xml
    • The first thing we want to do is change the date in the name of the export directory (first config line in the file). We will change the following line, for example from:
      • <property name="ExportDir" value="/usr/IBM/WebSphere/wp_profile/PortalServer/wcm/config/22Sept2009export"/>
      • to...
      • <property name="ExportDir" value="/usr/IBM/WebSphere/wp_profile/PortalServer/wcm/config/24Sept2009export"/>
    • Note that there is also a line in the file that defines the libary to export. It looks like this:
      • <property name="WebLib" value="Content"/>
    • We can leave that alone for now and export the Content library first. But to export other libraries, we will need to change the library name and run the export command again.
    • In VI, use [ESCAPE] to exit edit mode, then :wq (write, quit). If necessary, you can skip making changes to the file with :q! (quit, but ignore changes).
    • Now that we've saved the file, we can execute the export command.
    • cd /usr/IBM/WebSphere/wp_profile/ConfigEngine
    • ./ConfigEngine.sh export-wcm-data
    • The data will begin to export and you will get a lot of information on the console. Hopefully, the console messages will end with a BUILD SUCCESSFUL message. You will then have all the data exported from the library in the directory you specified and you can later import that data if necessary.
    • Now you can cd back to the directory containing the config file, use VI to change the library name to export, and repeat the process for each library you wish to export.

    Some Quick Tips for using the VI editor:
    k = up
    j = down
    w = right or forward one word
    b = left or back one word
    l = right 1 char
    h = left 1 char
    x = delete 1 char
    u = undo
    i = insert
    [ESCAPE] = get out of edit mode
    :wq = write and quit
    :q! = quite ignoring changes (do not write).

    Hope this article will be useful...

    List of Useful Blogs on WCM and Portal

    IBM Forums
    1. IBM WCM Forum
    2. IBM Portal Forum


    External Forum
    1. WCM Blog
    2. Extreme Portal
    3. Sunil Patil Blog
    4. http://vivekagarwal.wordpress.com/

    Monday, November 8, 2010

    Extending Portal Personlaization to external data source

    This article to explain how to create a simple Plain Old Java Object (POJO) to use external data source in implementing your custom pzn rule in WebSphere Portal 6.x/7.x.

    Steps to be followed.
    1. Create simple Java project in RAD 7.x

    2. Configure the build path to include the following jar file which are required to buld.
    - pznauthor.jar
    - pzncommon.jar
    - pznquery.jar
    - pznresources.jar
    - pznruntime.jar

    Note: the jar files can be found in in the location
    v6.x - [portal-root-dir]/pzn/v6.0/lib and
    v7.x - [portal-root-dir]/pzn/prereq.pzn/lib

    3. Your POJO class should implement the following interface
    - com.ibm.websphere.personalization.applicationObjects. SelfInitializingApplicationObject
    & Serializable.

    Example :

    package com.ibm.websphere.personalization.examples;

    import java.util.Date;

    import com.ibm.websphere.personalization.RequestContext;
    import com.ibm.websphere.personalization.applicationObjects.SelfInitializingApplicationObject;
    import java.io.Serializable;

    public class MySampleObject implements SelfInitializingApplicationObject,
    Serializable {

    private String userName;
    public void init(RequestContext context) {
    userName = context.getRequestUsername();
    context.setSessionAttribute("mysampleobject", this);
    }

    public String getMySampleString() {
    return "Hello " + userName;
    }

    public int getMySampleInt() {
    return 1;
    }

    public Date getMySampleDate() {
    return new Date();
    }
    }

    4. Export this java project as jar file and copy into the following locations

    v6.x - [portal-root-dir]/pzn/v6.0/collections
    v7.x - [portal-root-dir]/pzn/prereq.pzn/collections

    5. Please don't forget to restart your portal server to take effect.

    Configure the application object in Portal Personalization

    1. Login to the portal server.

    2. Navigate to the Personalization Business Rules page. With the default theme, this page is accessible by clicking Launch => Personalization => Business Rules.

    3. Create a folder to contain your work by choosing New => Folder from the menu; name the folder Application Objects and click Save. Using a folder here is optional. Because export, import, access control, and versioning operate on folders, it is a good idea to give some thought to the folder structure you use. Moving some objects in Personalization after their creation will break references to those objects.

    4. With the Application Object folder open in the Personalization Navigator, choose New => Application Object from the menu.

    5. Enter My First Application Object in the name field. This name will display in the rule editor; it can be anything you choose.

    6. Enter mysampleobject for the Session Key. This name should match the key you used in the code in step 5c. Keeping these values the same insures that the rules engine will pick up the object from the session.

    7. Complete the Class Name field with the name of our Application Object Java class, com.ibm.websphere.personalization.examples.MySampleObject.

    If you have not put the MySampleObject class in the classpath by copying the JAR into the collections folder, or if you have not restarted the server, you might see a message: The application object class 'com.ibm.websphere.personalization.examples.MySampleObject' could not be located. Specify a valid class for this application object.

    If you see this message, check the location of the JAR, and restart the portal server.

    8. Click Save to store the definition of the application object in Personalization.

    Finally you can add this rule to any portlet/page/label to suit your own needs with business logic implemented in POJO class.

    Please do remember you can use DB layer approach fetch any data from the external data source to wrap your business rule.

    Hope this tutorial will be useful to everyone.

    Detailed Information on modifying Config parameters for WebSphere Portal Sevrer 7

    All Techies,

    The following link will be useful when you are configuring WebSphere Portal 7 and it explains you that various config. parameters which are required during running configuration task.

    Hope you will find it very useful :-)

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Configuration_properties_reference_wp7

    Thursday, November 4, 2010

    Clustering WebSphere Portal 7 with Process Server 7

    All techies,

    I came across one of the good article about clustering of WebSphere Portal 7 with Process Server 7 at IBM developerworks site.

    Please take a look at this at http://www.ibm.com/developerworks/websphere/zones/portal/proddoc/dw-w-integratewps/index.html

    Parsing & using XML in AJAX method by XML DOM Parser

    Agenda:

    How to parse and use XML data using XML DOM parser using AJAX in your enterprise application.

    XML :

    AJAX Code snippet (which will be inside the onreadystatechange block):

    var xmlDoc;
    if (window.DOMParser) { //for Firefox
    parser=new DOMParser();
    xmlDoc=parser.parseFromString(xmlHttp.responseXML,"text/xml");
    } else { //for IE 6+
    xmlDoc = xmlHttp.responseXML;
    }

    var tagValue = xmlDoc.getElementsByTagName("[XML-TAG-NAME]")[(POSITION)];
    var attrValue = xmlDoc.getElementsByTagName("[XML-TAG-NAME]")[(POSITION)].getAttribute("[ATTRIBUTE-NAME]");