Sun Java System Communications Express 6.3 Customization Guide

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 common-editcontact.xsl

Table 7–2 lists 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 

common-editcontact.xsl

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–11 shows the code that displays Address before Online information.


Example 7–11 Code that Displays Address 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–12 shows how to display Online information before Address.


Example 7–12 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>

            

Phone

Address Book allows you to set five types of phones that 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 the 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–13 displays the default code where Work phone is displayed as priority 1 and Home phone is displayed as priority 2.


Example 7–13 Default Code that Displays Work Phone 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–14 shows how to change the code so that it displays Home phone as priority 1 and Work phone as priority 2.


Example 7–14 Code that Displays Home Phone as Priority 1 and Work Phoneas 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>


               

Email

Address Book allows you to set three types of email that are defined in phoneEmailAndIM. The three definitions of email templates are called and the priority values are passed to them. You can change the priority orders.

Figure 7–2 Customizing Email

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

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 can customize the labels, change layout such as size of fields for the dates or their respective positions.


Example 7–15 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–16 shows how to display the fields in a vertical layout and also rearranges Anniversary as the first date and Birthday as second


Example 7–16 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>

               

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 can change the order in which these addresses appear in a way similar to the examples illustrated above.

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–17 shows the default code that displays SunONE as the default selected service


Example 7–17 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–18 shows the modified code that displays Yahoo as the default Service


Example 7–18 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>