Index:
The Snom Minibrowser provides built-in templates which can be accessed through an internal URL. These templates can be used to achieve common tasks faster and avoid writing duplicate code. Currently (version 10.1.64.14) it is possible to use templates for quickly writing the following applications: user input, text display, selection menu and decision application. See below for details for each template.
This article provides documentation for the templates in firmware version 10.1.64.14. The content of the templates might change in future versions. |
The templates can be used to create URLs. You can then use the URLs in different ways:
As any URL inside a Minibrowser instance, for example:
<?xml version="1.0" encoding="UTF-8"?> <SnomIPPhoneMenu> <MenuItem name="Trigger template example"> <Url>file:///xml/gui/templates.xml#sub=*[@id="text_template"]&var:text_title=Text&var:text_content=Hello&var:text_translate=no</Url> </MenuItem> </SnomIPPhoneMenu> |
In addition to the existing templates, you can also add your own templates by replacing the templates.xml file with an extended version of your own. For instructions how to replace files on Snom deskphones, see Phone menu customization .
The file templates.xml is located at file:///xml/gui/templates.xml. You can find a copy of this file for a specific firmware version in the Firmware Update Center (click on the firmware version, scroll down to Customization Files, dowload the archive and look under xml/gui/ inside the archive).
Below is as a copy of this file for your reference, taken from firmware version 10.1.64.14 (click 'Expand source' to view it).
<IPPhoneBatch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd"> <IPPhoneInput track="no" dtmf="off" id="input_template" document_id="user_input_template"> <Url input_required="$(var:input_required)">$(var:input_url)</Url> <InputItem> <DisplayName>$(var:input_displayname)</DisplayName> <InputToken>$(var:input_token)</InputToken> <InputFlags>$(var:input_flags)</InputFlags> <InputMask>$(var:input_mask)</InputMask> <DefaultValue>$(var:input_default)</DefaultValue> <Range>$(var:input_range)</Range> <ContactPoolInEdit>$(var:input_pool_key)</ContactPoolInEdit> </InputItem> <If condition="$(is_set:$(var:custom_f4))"> <SoftKeyItem> <Name>F4</Name> <SoftKey>$(var:custom_f4)</SoftKey> </SoftKeyItem> </If> </IPPhoneInput> <IPPhoneMenu track="no" id="selection_template" document_id="user_selection_template"> <Title>$(var:list_title)</Title> <If condition="!$(empty:$(repeat_values:$(var:list_values)))"> <Repeat values="$(repeat_values:$(var:list_values))" token="|__NAME__|__ID__|__URL__|"> <MenuItem name="__NAME__" id="__ID__"> <Url>__URL__</Url> </MenuItem> </Repeat> </If> <Else> <MenuItem sel="true" name="$(lang:list_no_data)"></MenuItem> </Else>some </IPPhoneMenu> <IPPhoneText track="no" id="text_template" document_id="user_text_template"> <Title>$(var:text_title)</Title> <If condition="$(is_set:$(var:text_image_url))"> <Image> <LocationX>$(var:text_image_locationx)</LocationX> <LocationY>$(var:text_image_locationy)</LocationY> <Url>$(var:text_image_url)</Url> </Image> </If> <LocationX>$(var:text_locationx)</LocationX> <LocationY>$(var:text_locationy)</LocationY> <Text translate_callbacks="$(var:text_translate)">$(var:text_content)</Text> <If condition="$(is_set:$(var:text_softkeys))"> <Repeat values="$(var:text_softkeys)" token="|__NAME__|__LABEL__|__URL__|__SOFTKEY__|"> <SoftKeyItem> <Name>__NAME__</Name> <Label>__LABEL__</Label> <Url>__URL__</Url> <SoftKey>__SOFTKEY__</SoftKey> </SoftKeyItem> </Repeat> </If> </IPPhoneText> </IPPhoneBatch> |
Provides a SnomIPPhoneInput
Parameters:
You can find detailed definitions of the attributes and subtags under SnomIPPhoneInput.
Example:
Consider the following URL (the newlines were added for better readability):
file:///xml/gui/templates.xml #sub=*[@id="input_template"] &var:input_displayname=ChangePreNr &var:input_token=__Y__ &var:input_flags=n &var:input_url=snom://mb_exit#set:preselection_nr=__Y__ |
assign value to variable input_url. This contains a target URL which tells the Minibrowser where to go after the user confirms the input. In this case, the Minibrowser will set the preselection_nr to the entered number and then exit via the mb_exit path.
Here is a possible XML code for using this example:
<?xml version="1.0" encoding="UTF-8"?> <SnomIPPhoneMenu> <MenuItem name="Change preselection number"> <Url>file:///xml/gui/templates.xml#sub=*[@id="input_template"]&var:input_displayname=ChangePreNr&var:input_token=__Y__&var:input_flags=n&var:input_url=snom://mb_exit#set:preselection_nr=__Y__</Url> </MenuItem> </SnomIPPhoneMenu> |
Result (after setting preselection_nr to 123, when dialing 0 the dialed result will be 1230) :
Provides a SnomIPPhoneText
Parameters:
You can find detailed definitions of the attributes and subtags under SnomIPPhoneText
Example:
Consider the following URL (the newline added for better readability):
file:///xml/gui/templates.xml #sub=*[@id="text_template"] &var:text_title=Text &var:text_content=Hello &var:text_translate=no |
Here is a possible XML code for using this example:
<?xml version="1.0" encoding="UTF-8"?> <SnomIPPhoneMenu> <MenuItem name="Trigger template example"> <Url>file:///xml/gui/templates.xml#sub=*[@id="text_template"]&var:text_title=Text&var:text_content=Hello&var:text_translate=no</Url> </MenuItem> </SnomIPPhoneMenu> |
Result:
Provides a SnomIPPhoneMenu
The phone provides two more templates which are not present in templates.xml but can also be quite useful.
This template can be used for displaying very simple text. It is hard-coded on the phone and cannot be changed, but it can be accessed via file:///xml/text.xml. It contains only the following:
<?xml version="1.0" encoding="UTF-8"?> <IPPhoneText> <Title>$(var:title)</Title> <Text>$(var:text)</Text> </IPPhoneText> |
The parameters for this templates are self explanatory. Here is an example of using this template for displaying simple text:
<?xml version="1.0" encoding="UTF-8"?> <SnomIPPhoneMenu> <MenuItem name="Trigger template example"> <Url>file:///xml/text.xml#var:title=Text&var:text=Hello</Url> </MenuItem> </SnomIPPhoneMenu> |
This template can be used for displaying a decision application . It can be accessed via file:///xml/gui/decision.xml and it can be customized in the same way as templates.xml. It contains the following (taken from version 10.1.64.14):
<?xml version="1.0" encoding="UTF-8"?> <IPPhoneBatch> <IPPhoneText id="dsc_std" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd"> <Title>$(var:dsc_title)</Title> <Text>$(var:dsc_text)</Text> <If condition="$(var:dsc_yes)"> <SoftKeyItem> <Name>ENTER</Name> <Url>phone://mb_exit#$(var:action)=yes,$(var:pass_params)</Url> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_yes_fkey))"> <Name>$(var:xml_yes_fkey)</Name> </If> <Else> <Name>F1</Name> </Else> <Label>F_OK</Label> <Url>phone://mb_exit#$(var:action)=yes,$(var:pass_params)</Url> </SoftKeyItem> </If> <If condition="$(var:dsc_no)"> <SoftKeyItem> <Name>CANCEL</Name> <Url>phone://mb_exit#$(var:action)=no,$(var:pass_params)</Url> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_no_fkey))"> <Name>$(var:xml_no_fkey)</Name> </If> <Else> <Name>F2</Name> </Else> <Label>F_CANCEL</Label> <Url>phone://mb_exit#$(var:action)=no,$(var:pass_params)</Url> </SoftKeyItem> </If> <If condition="$(var:dsc_abort)"> <SoftKeyItem> <Name>F_ABORT</Name> <Url>phone://mb_exit#$(var:action)=abort,$(var:pass_params)</Url> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_abort_fkey))"> <Name>$(var:xml_abort_fkey)</Name> </If> <Else> <Name>F3</Name> </Else> <Label>F_ABORT</Label> <Url>phone://mb_exit#$(var:action)=abort,$(var:pass_params)</Url> </SoftKeyItem> </If> </IPPhoneText> <IPPhoneText track="no" id="dsc_url" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd"> <Title>$(var:dsc_title)</Title> <If condition="!$(empty:$(var:text_x))"> <LocationX>$(var:text_x)</LocationX> </If> <If condition="!$(empty:$(var:text_y))"> <LocationY>$(var:text_y)</LocationY> </If> <If condition="!$(empty:$(var:number))"> <Text>$(var:number)<br/>$(var:dsc_text)</Text> </If> <Else> <Text>$(var:dsc_text)</Text> </Else> <If condition="$(var:dsc_yes)"> <SoftKeyItem> <Name>ENTER</Name> <Url track="no">$(var:dsc_yes_url)</Url> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_yes_fkey))"> <Name>$(var:xml_yes_fkey)</Name> </If> <Else> <Name>F1</Name> </Else> <Label>F_OK</Label> <Url track="no">$(var:dsc_yes_url)</Url> </SoftKeyItem> </If> <If condition="$(var:dsc_no)"> <SoftKeyItem> <Name>CANCEL</Name> <Url track="no">$(var:dsc_no_url)</Url> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_no_fkey))"> <Name>$(var:xml_no_fkey)</Name> </If> <Else> <Name>F2</Name> </Else> <Label>F_CANCEL</Label> <Url track="no">$(var:dsc_no_url)</Url> </SoftKeyItem> </If> <If condition="$(var:dsc_abort)"> <SoftKeyItem> <Name>F_ABORT</Name> <Url>$(var:dsc_abort_url)</Url> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_abort_fkey))"> <Name>$(var:xml_abort_fkey)</Name> </If> <Else> <Name>F3</Name> </Else> <Label>F_ABORT</Label> <Url>$(var:dsc_abort_url)</Url> </SoftKeyItem> </If> </IPPhoneText> <IPPhoneText track="no" state="$(var:dsc_state)" id="dsc_key" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schemas/minibrowser.xsd"> <Title>$(var:dsc_title)</Title> <Text>$(var:dsc_text)</Text> <If condition="$(var:dsc_yes)"> <SoftKeyItem> <Name>ENTER</Name> <SoftKey>F_OK</SoftKey> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_yes_fkey))"> <Name>$(var:xml_yes_fkey)</Name> </If> <Else> <Name>F1</Name> </Else> <Label>F_OK</Label> <SoftKey>F_OK</SoftKey> </SoftKeyItem> </If> <If condition="$(var:dsc_no)"> <SoftKeyItem> <Name>CANCEL</Name> <SoftKey>F_CANCEL</SoftKey> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_no_fkey))"> <Name>$(var:xml_no_fkey)</Name> </If> <Else> <Name>F2</Name> </Else> <Label>F_CANCEL</Label> <SoftKey>F_CANCEL</SoftKey> </SoftKeyItem> </If> <If condition="$(var:dsc_abort)"> <SoftKeyItem> <Name>F_ABORT</Name> <SoftKey>F_ABORT</SoftKey> </SoftKeyItem> <SoftKeyItem> <If condition="!$(empty:$(var:xml_abort_fkey))"> <Name>$(var:xml_abort_fkey)</Name> </If> <Else> <Name>F3</Name> </Else> <Label>F_ABORT</Label> <SoftKey>F_ABORT</SoftKey> </SoftKeyItem> </If> </IPPhoneText> </IPPhoneBatch> |
Example:
Consider the following URL (the newline was added for better readability):
file:///xml/gui/decision.xml #sub=*[@id="dsc_url"] &var:dsc_title=decision.xml%20example &var:dsc_text=Dial%20Alice%253F &var:dsc_yes=yes &var:dsc_yes_url=snom%3A%2F%2Fmb_nop%23numberdial%3D700 &var:dsc_no=yes &var:dsc_no_url=snom%3A%2F%2Fmb_exit |
Here is a possible XML code for using this example:
<?xml version="1.0" encoding="UTF-8"?> <SnomIPPhoneMenu> <MenuItem name="Trigger template example"> <Url>file:///xml/gui/decision.xml#sub=*[@id="dsc_url"]&var:dsc_title=decision.xml%20example&var:dsc_text=Dial%20Alice%253F&var:dsc_yes=yes&var:dsc_yes_url=snom%3A%2F%2Fmb_nop%23numberdial%3D700&var:dsc_no=yes&var:dsc_no_url=snom%3A%2F%2Fmb_exit</Url> </MenuItem> </SnomIPPhoneMenu> |
Result: