Sun Java System Communications Express 6 2005Q4 Customization Guide

Customizing New/Edit Contact Window

The files pertaining to the new contact or edit contact window are,

Common code shared among new and edit window can be accessed from contact - common-editcontact.xsl

Table 7–2 shows the templates that are defined for the sections in New Contact or Edit Contact Window

Table 7–2 Templates applicable for New/Edit Contact Window

Sections  

Template Name  

File  

Skip Links 

addcontact.xsl and editcontact.xsl

Name and Company 

nameAndCompany 

lcommon-editcontact.xs

Phone 

phone 

common-editcontact.xsl

Email 

email 

common-editcontact.xsl

Addresses 

address 

common-editcontact.xsl

IM Nicknames 

IM 

common-editcontact.xsl

Web Addresses 

onlineInfos 

common-editcontact.xsl

Notes 

notes 

common-editcontact.xsl

You can customize the window by changing labels or reordering the listed sections in any desired order.

In addcontact.xsl the 'edit-abperson' template calls the templates.

Example 7–12 shows the code that displays Address before Online information.


Example 7–12 Code that displays Address displayed before online information


<xsl:call-template name="address">
        <xsl:with-param name="abperson" select="$abperson"/>
      </xsl:call-template>
      <xsl:call-template name="onlineInfos">
        <xsl:with-param name="abperson" select="$abperson"/>
      </xsl:call-template>

            

Example 7–13 shows how to display Online information before Address.


Example 7–13 Code that displays Online information before Address


 <xsl:call-template name="onlineInfos">
        <xsl:with-param name="abperson" select="$abperson"/>
 </xsl:call-template>

 <xsl:call-template name="address">
        <xsl:with-param name="abperson" select="$abperson"/>
 </xsl:call-template>

            

Customizing Phone

Address Book allows you to set five types of phones which are defined in phoneEmailAndIM. The five definitions of 'phone' template are called and the priority value is passed to them when the values are displayed in the drop-down list. You can change their respective priority orders.

Figure 7–1 Customizing Phone

Figure showing the five types of phone entries along with a drop-down
list of the priority order.

Example 7–14 shows the default code where Work is displayed as priority 1 and home is displayed as priority 2.


Example 7–14 Default code wherein Work phone is displayed as priority 1 and home phone as priority 2


    <option value="work">
        <xsl:choose>
            <xsl:when test="$abperson">
              <xsl:choose>
                <xsl:when test=
				"$abperson/phone[@priority = $priority]">
                  <xsl:if test=
					"$abperson/phone[@priority = $priority]/@type = 'work'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:if test="$priority = '1'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority = '1'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
         <xsl:text>_Work</xsl:text>
       </option>
       <option value="home">
         <xsl:choose>
            <xsl:when test="$abperson">
              <xsl:choose>
                <xsl:when test=
				"$abperson/phone[@priority = $priority]">
                  <xsl:if test=
					"$abperson/phone[@priority = 
					$priority]/@type = 'home'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:if test="$priority = '2'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority = '2'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text>_Home</xsl:text>
        </option>

               

Example 7–15 shows how to change the code so that it displays Home phone as priority 1 and Work phone as priority 2.


Example 7–15 Code that displays Home as priority 1 and Work as priority 2


<option value="work">
        <xsl:choose>
            <xsl:when test="$abperson">
              <xsl:choose>
                <xsl:when 
						test="$abperson/phone[@priority = $priority]">
                  <xsl:if test=
		"$abperson/phone[@priority = $priority]/@type = 'work'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:if test="$priority = '2'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority = '2'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
         <xsl:text>_Work</xsl:text>
       </option>
       <option value="home">
         <xsl:choose>
            <xsl:when test="$abperson">
              <xsl:choose>
                <xsl:when test="$abperson/phone[@priority = $priority]">
                  <xsl:if 
	test="$abperson/phone[@priority = $priority]/@type = 'home'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:if test="$priority = '1'">
                   <xsl:attribute name="selected"/>
                  </xsl:if>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority = '1'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
      <xsl:text>_Home</xsl:text>
</option>


               

Customizing E-mail

Address Book allows to set three types of E-mail which are defined in phoneEmailAndIM. The three definitions of 'email' templates are called and the priority values are passed to them. You can change their priority orders.

Figure 7–2 Customizing E-mail

Figure showing the three types of E-mail entries along with a
drop-down list of their priority order.

Customizing Dates

Address Book allows you to set Birthday and Anniversary dates. These two dates are defined in the 'importantDates' template. This template passes all relevant information to the 'date' template.

You may customize the labels, change layout such as size of fields for the dates or their respective positions.


Example 7–16 Default code that shows horizontally aligned fields and displays Birthday as the first field and Anniversary as the second


<tr>
      <xsl:call-template name="date">
        <xsl:with-param name="abperson" select="$abperson"/>
        <xsl:with-param name="type" select="'birthday'"/>
        <xsl:with-param name="index" select="'1'"/>
        <xsl:with-param name="dateFormat" select="$dateFormat"/>
        <xsl:with-param name="width" select="40"/>
        <xsl:with-param name="fieldName" >
          <xsl:value-of select="$fieldPrefix" />
          <xsl:text>dateOfBirth</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="label">
          <xsl:text>_Birthday</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="tabindex" select="'52'"/>
      </xsl:call-template>

      <xsl:call-template name="date">
        <xsl:with-param name="abperson" select="$abperson"/>
        <xsl:with-param name="type" select="'anniversary'"/>
        <xsl:with-param name="index" select="'2'"/>
        <xsl:with-param name="dateFormat" select="$dateFormat"/>
        <xsl:with-param name="width" select="65"/>
        <xsl:with-param name="fieldName" >
          <xsl:value-of select="$fieldPrefix" />
          <xsl:text>anniversary</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="label">
          <xsl:text>_Anniversary</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="tabindex" select="'55'"/>
      </xsl:call-template>
    </tr>

               

Example 7–17 shows how to display the fields in a vertical layout and also rearranges Anniversary as the first date and Birthday as second


Example 7–17 Code that displays the field in a vertical layout and also rearranges Anniversary as the first date and Birthday as second


 <tr>
      <xsl:call-template name="date">
        <xsl:with-param name="abperson" select="$abperson"/>
        <xsl:with-param name="type" select="'anniversary'"/>
        <xsl:with-param name="index" select="'1'"/>
        <xsl:with-param name="dateFormat" select="$dateFormat"/>
        <xsl:with-param name="width" select="65"/>
        <xsl:with-param name="fieldName" >
          <xsl:value-of select="$fieldPrefix" />
          <xsl:text>anniversary</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="label">
          <xsl:text>_Anniversary</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="tabindex" select="'52'"/>
      </xsl:call-template>
    </tr>
    <tr>
      <xsl:call-template name="date">
        <xsl:with-param name="abperson" select="$abperson"/>
        <xsl:with-param name="type" select="'birthday'"/>
        <xsl:with-param name="index" select="'2'"/>
        <xsl:with-param name="dateFormat" select="$dateFormat"/>
        <xsl:with-param name="width" select="40"/>
        <xsl:with-param name="fieldName" >
          <xsl:value-of select="$fieldPrefix" />
          <xsl:text>dateOfBirth</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="label">
          <xsl:text>_Birthday</xsl:text>
        </xsl:with-param>
        <xsl:with-param name="tabindex" select="'55'"/>
      </xsl:call-template>

               

Customizing Web Addresses

Address Book allows you to set four web addresses for work, home, calendar and freebusy. These addresses are defined in the 'onlineInfos ' template. The 'onlineInfos' template calls the following:

You may change the order in which these addresses similar to the examples illustrated above.

Customizing IM Nicknames

Address Book allows you to set two IM nicknames. The list of IM services that is supported by Address Book are listed in the drop-down menus. These two IM options are defined in 'phoneEmailAndIM' template which calls the 'im' template passing the relevant information.

Example 7–18 shows the default code that displays SunONE as the default selected service


Example 7–18 Default code that displays SunONE as the default service


<option value="SunONE">
          <xsl:choose>
            <xsl:when test=
		"$abperson and $abperson/im[@priority=$priority]">
              <xsl:if test=
			"$abperson/im[@priority=$priority]/@service = 'SunONE'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority= '1'">
---- This value is passed by 'phoneEmailAndIM' 
---template to have this option default selected
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text>iPlanet</xsl:text>
</option>
.....
 <option value="Yahoo">
          <xsl:choose>
            <xsl:when 
test="$abperson and $abperson/im[@priority=$priority]">
              <xsl:if 
test="$abperson/im[@priority=$priority]/@service = 'Yahoo'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority = '3'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text>Yahoo</xsl:text>
</option>

               

Example 7–19 shows the modified code that displays Yahoo as the default Service


Example 7–19 Modified code that displays Yahoo as the default Service


<option value="SunONE">
          <xsl:choose>
            <xsl:when 
test="$abperson and $abperson/im[@priority=$priority]">
              <xsl:if 
test="$abperson/im[@priority=$priority]/@service = 'SunONE'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority= '3'">    
 ---- This value is passed by 'phoneEmailAndIM' 
 ----template to have this option default selected
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text>iPlanet</xsl:text>
</option>
.....
 <option value="Yahoo">
          <xsl:choose>
            <xsl:when 
test="$abperson and $abperson/im[@priority=$priority]">
              <xsl:if 
test="$abperson/im[@priority=$priority]/@service = 'Yahoo'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:when>
            <xsl:otherwise>
              <xsl:if test="$priority = '1'">
               <xsl:attribute name="selected"/>
              </xsl:if>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:text>Yahoo</xsl:text>
</option>