Mobile Template File Types

Mobile template file types allow you to predefine the position and layout for mobile applications that contain one or more elements. You can generate these types of mobile templates:

HTML templates

All mobile applications are wrapped in an HTML template to display in a Web browser. Other mobile template types are available only when you are creating that type of mobile application; that is, you can access JSP templates only when you are creating a JSP mobile application. When you create an HTML template that includes a table, the code must include the <OPContent> tag in each HTML table row description. The <OPContent> creates cells in which to add content. The <OPContent> tag uses this syntax:

<OPContent id="id_number"  name="position_descriptor_name"/>

The id_number and position_descriptor_name for each <OPContent> tag must be unique. Only content that would normally occur between the opening and closing <body> tags should be included in the HTML template.

This code represents an HTML template. The code between the <STYLE> tags uses the Cascading Style Sheet (CSS) classes that define the formatting of data-capable elements.

<STYLE TYPE="text/css">
.gridRowHeader{background:#DEDEB9;padding:4px;padding-bottom:0px;border:1px
solid #FFF;font-size:13px;font-family:verdana;color:#336699;font-weight:bold;}
.gridRowA{background:#EEF9FF;padding:4px;padding-bottom:0px;border:1px  solid #FFF;font-size:13px;fontfamily:verdana;}
.gridRowB{background:#FFFFFF;padding:4px;padding-bottom:0px;border:1px  solid #FFF;font-size:13px;font-family:verdana;}</STYLE>
<table  width="100%" border="1" cellspacing="0"  cellpadding="0">
<tr align="center"  valign="middle">
<td height="10"  colspan="2"><OPContent id="0"  name="Top Content"/></td></tr>
<tr  align="center" valign="middle">
<td  height="10" width="50%"><OPContent  id="1" name="Middle Left Content"/></td>
<td  height="10" width="50%"><OPContent  id="2" name="Middle Right Content"/>
</td></tr>
<tr  align="center" valign="middle">
<td  height="10" colspan="2"><OPContent  id="3" name="Bottom Content"/>
</td></tr></table>

Help template

Help templates are HTML files that you save to the database and display when a user clicks the help icon in the playback environment. The playback environment is the portal or the device.

In the Presentation window of the mobile application, you can set the help URL. You can either enter the URL of a Web page or select a Help template from the database. This HTML code represents a Help template:

<script language="JavaScript">
<!--
function  openWindow(URL)
{
window.open(URL,"PopUp","scrollbars=yes,resizable=yes,width=400,height=400";
}
function  Winload()
{
}
//-->
</script>
<body  bgcolor="#FFFFFF" text="#000000">
<table  width="100%" border="0" cellspacing="5"  cellpadding="5" height="190">
<tr> 
<td  colspan="2" height="27" bgcolor="#336666">
<p><font  color="#FFFFFF" size="2" >
<b><font  face="Arial, Helvetica, sans-serif">Portal Interface  Online Help</font></b></font></td></tr>
<tr  height="16">
<td bgcolor="#FFFFFF"  colspan="2" height="20">
<OPContent  id="0" name="Middle Content"/> 
<b><font  face="Arial, Helvetica, sans-serif" size="2"></font></b> 
<hr  noshade width="100%" size="1"></td></tr>
<tr>
<td  colspan="2" bgcolor="#FFFFCC"><OPContent  id="0" name="Bottom Content"/>
<p><font  face="Arial, Helvetica, sans-serif" size="2"></font></p></td></tr>
<tr  bgcolor="#FFFFCC"><td width="100%"  bgcolor="#FFFFFF">
<p  align="center"><b>
<a  href="JavaScript:openWindow('index.html')">
<font  face="Arial, Helvetica, sans-serif" size="2">Help  Contents</a></font></b>
<imgsrc="images/spacer.gif"  width="122" height="6">
<a  href="javascript:window.close();"><b>CloseWindow</b></a></font></td></tr>
</table>

JSP templates

You can create Web applications and deploy them as a mobile application. Alternatively, you can use JSP files for small reusable pieces of functionality. The JSP approach requires you to create a .jsp file with embedded Java and HTML code. Servlets or other JSPs can invoke the JSP code by referring to the file.

JSP-based templates allow you to manage JSP code across mobile applications. Most mobile templates generated by the wizards are either XSLT, or more frequently JSP. You can create mobile templates without managing individual files in the file system. Once you create a mobile template, you can populate it with mobile applications, which can be included in other mobile applications. When you change a mobile template definition, those changes are applied universally to all the associated mobile applications of that mobile template.

XSL templates

You can create an XSL template (XSLT) that you can use for XML mobile applications and elements. Code the XSLs for data-capable elements to use the internal document type definition (DTD). Allows you to apply one style document to multiple mobile applications. XSL also lets you dictate the manner in which Web content prints, and let's you transfer XML documents across applications.

Note

The only XSL style sheet supported to create XSL templates is:

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0">

If you use a later style sheet, a parsing error is generated because of the version of Xerces used.

This is a sample of an XSL template for a data-capable user interface XSLT.

<?xml version="1.0"?>
<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"version="1.0">
  <xsl:template  match="/">
   <TABLE  WIDTH="100%" BORDER="1" BORDERCOLOR="#000000">
    <xsl:for-each  select="//Record">
     <xsl:text> </xsl:text>
      <TR><xsl:for-each  select="Field"><xsl:text></xsl:text>
        <TD>
         <xsl:for-each  select="./text()">
         <xsl:value-of  select="."/>
        </xsl:for-each>
       </TD>
      </xsl:for-each>
     <xsl:text> </xsl:text>
    </TR>
   </xsl:for-each>
  </TABLE>
 </xsl:template>
</xsl:stylesheet>

XML templates

XML types are only used in the Blackberry Device template. The wizard generates the XML content that is used for describing the device format for the Blackberry. For example:

<?xml version="1.0" encoding="UTF-8"?>

<Custom>
  <coddef name="uaclient"/>
  <listscreen>
    <header icon="" label="Unwired Accelerator" text_color="#FFFFFF" bgcolor="#006C85"/>
    <footer label="Copyright 2005-2006 Sybase, Inc." text_color="#FFFFFF" bgcolor="#006C85"/>
    <listitem text_color="#000000" border_color="#8A8A8A" bgcolor="#DAD8DA"/>
  </listscreen>
  <appitems>
    <app id="281" name="RemedyRSDList" display_name="RemedyRSDList" icon="" show_listing="false" sequence="1"/>
    <app id="211" name="test" display_name="test" icon="" show_listing="false" sequence="2"/>
    <app id="341" name="suite1Read" display_name="suite1Read" icon="" show_listing="false" sequence="3"/>
    <app id="441" name="suite1Delete" display_name="suite1Delete" icon="" show_listing="false" sequence="4"/>
    <app id="291" name="GetHelpDeskList" display_name="GetHelpDeskList" icon="" show_listing="false" sequence="5"/>
    <app id="421" name="remedy linked" display_name="remedy linked" icon="" show_listing="false" sequence="6"/>
    <app id="461" name="suite1Insert" display_name="suite1Insert" icon="" show_listing="false" sequence="7"/>
    <app id="321" name="suite1Create" display_name="suite1Create" icon="" show_listing="false" sequence="8"/>
    <app id="411" name="suite1Update" display_name="suite1Update" icon="" show_listing="false" sequence="9"/>
    <app id="431" name="suite1Linked Parameter" display_name="suite1Linked Parameter" icon="" show_listing="false" sequence="10"/>
  </appitems>
  <defaultappdefs header_text_color="#FFFFFF" header_bgcolor="#006C85" altrowcolor="true" even_row_text_color="#000000" even_row_color="#EEEEEE" odd_row_text_color="#000000" odd_row_color="#FFFFFF" row_text_color="#000000" row_color="#FFFFFF"/>
  <splashscreen text="" icon=""/>
  <menuitems>
    <screen name="list">
      <menu name="Open" value="OPEN_APP" sequence="1" require="true"/>
      <menu name="Delete" value="DELETE_APP" sequence="2" require="false"/>
      <menu name="Refresh App" value="SYNC_APP" sequence="3" require="false"/>
      <menu name="Application Info" value="APP_INFO" sequence="4" require="false"/>
      <menu name="Send Update" value="SEND_UPDATE" sequence="5" require="false"/>
      <menu name="Logs" value="SHOW_LOGS" sequence="6" require="false"/>
      <menu name="Refresh Question" value="REFRESH_ASKUA" sequence="7" require="false"/>
      <menu name="----------------------" value="----------------------" sequence="8" require="false"/>
      <menu name="AskUA" value="OPEN_ASKUA" sequence="9" require="false"/>
      <menu name="----------------------" value="----------------------" sequence="10" require="false"/>
      <menu name="Refresh All Apps" value="REFRESH_ALL" sequence="11" require="false"/>
      <menu name="Search All" value="SEARCH_ALL" sequence="12" require="false"/>
      <menu name="Profiles" value="OPEN_PROFILES" sequence="13" require="false"/>
      <menu name="Settings" value="OPEN_SETTINGS" sequence="14" require="false"/>
      <menu name="Delete All Apps" value="DELETE_ALL" sequence="15" require="false"/>
      <menu name="About UA" value="OPEN_ABOUT" sequence="16" require="false"/>
      <menu name="----------------------" value="----------------------" sequence="17" require="false"/>
      <menu name="Close" value="CLOSE_APP" sequence="18" require="true"/>
    </screen>
    <screen name="application">
      <menu name="Details" value="DETAILS" sequence="1" require="true"/>
      <menu name="Click Thru" value="CLICK_ACROSS" sequence="2" require="true"/>
      <menu name="Find" value="ASKUA_FIND" sequence="3" require="true"/>
      <menu name="Clear Field" value="ASKUA_CLEAR_FIELD" sequence="4" require="false"/>
      <menu name="Save Question/Answer" value="ASKUA_SAVE_ANSWER" sequence="5" require="true"/>
      <menu name="----------------------" value="----------------------" sequence="6" require="false"/>
      <menu name="History" value="ASKUA_HISTORY" sequence="7" require="false"/>
      <menu name="----------------------" value="----------------------" sequence="8" require="false"/>
      <menu name="Fix Update" value="FIX_UPDATE" sequence="9" require="false"/>
      <menu name="Delete Log" value="DELETE_LOG" sequence="10" require="true"/>
      <menu name="Delete All Log" value="DELETE_ALL_LOG" sequence="11" require="false"/>
      <menu name="Edit" value="EDIT" sequence="12" require="true"/>
      <menu name="Delete" value="DELETE_RECORD" sequence="13" require="true"/>
      <menu name="Send Update" value="SEND_UPDATE" sequence="14" require="false"/>
      <menu name="Insert" value="INSERT" sequence="15" require="true"/>
      <menu name="----------------------" value="----------------------" sequence="16" require="false"/>
      <menu name="Add to Address Book" value="ADD_CONTACT" sequence="17" require="false"/>
      <menu name="Add to Calendar" value="ADD_CALENDAR" sequence="18" require="false"/>
      <menu name="Add to Tasks" value="ADD_TASK" sequence="19" require="false"/>
      <menu name="----------------------" value="----------------------" sequence="20" require="false"/>
      <menu name="Back" value="BACK" sequence="21" require="false"/>
      <menu name="----------------------" value="----------------------" sequence="22" require="false"/>
      <menu name="Search" value="SEARCH" sequence="23" require="false"/>
      <menu name="----------------------" value="----------------------" sequence="24" require="false"/>
      <menu name="Home" value="HOME" sequence="25" require="true"/>
      <menu name="----------------------" value="----------------------" sequence="26" require="false"/>
      <menu name="Contents for" value="CGI_CONTENTS" sequence="27" require="true"/>
      <menu name="Sort on Column" value="SORT" sequence="28" require="false"/>
    </screen>
    <screen name="profiles"/>
  </menuitems>
</Custom>

Generating and Editing BlackBerry Device Templates

Generating and Editing Dashboard Templates

Generating a Mobile Template

Mobile Device Types

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com