Main Subelements examples #
Conditional blocks #
The Snom Minibrowser supports also conditional code block that can be executed after a condition evaluation. Conditional blocks are implemented trough the tags If, Elif and Else
Demo
- Example1: Try on your phone
- Example2: Try on your phone
- Example3: Try on your phone
- These tags actually can be written almost anywhere (except as child tag of
). - The test in condition attribute are case sensitive.
- The white space will also be accounted comparison if exist on operand(s).
- Character or word(s) comparison can use only these operators == or !=.
- Number comparison can use those operators and also these additional operators >, <, >=, <=.
- Using number comparison additional operators on alphabet or word(s) comparison will unexpected result.
- Write these operators >=, <=,!= in correct order.
Conditionals example 1 #
Simple use of tags:
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
<If condition="$(set:phone_type)==snomD375">
<Title>Snom D375</Title>
</If>
<Elif condition="$(set:phone_type)==snomD765">
<Title>Snom D765</Title>
</Elif>
<Else>
<Title>Unknown Snom phone</Title>
</Else>
<Text>Snom phone sample text</Text>
</SnomIPPhoneText>
Result
Conditionals example 2 #
Show different text on different Snom phone model:
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../minibrowser_test.xsd">
<If condition="$(set:phone_type)==snomD375">
<Title>Snom D375</Title>
<Text>Your phone is a Snom D375</Text>
</If>
<Elif condition="$(set:phone_type)==snomD765">
<Title>Snom D765</Title>
<Text>Your phone is a Snom D765</Text>
</Elif>
<Else>
<Title>Unknown Snom phone</Title>
<Text>Snom phone not recognised</Text>
</Else>
</SnomIPPhoneText>
Result
Conditionals example 3 #
Test on some operators:
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../minibrowser_test.xsd">
<Menu name="Menu1">
<!-- TRUE --> <If condition="a==a"><MenuItem name="TRUE>>a==a" /></If>
<Else><MenuItem name="FALSE>>a==a" /></Else>
<!-- FALSE --> <If condition="a==A"><MenuItem name="TRUE>>a==A" /></If>
<Else><MenuItem name="FALSE>>a==A" /></Else>
<!-- FALSE --> <If condition="!a==a"><MenuItem name="TRUE>>!a==a" /></If>
<Else><MenuItem name="FALSE>>!a==a" /></Else>
<!-- FALSE --> <If condition=" a==a"><MenuItem name="TRUE>> a==a" /></If>
<Else><MenuItem name="FALSE>> a==a" /></Else>
<!-- TRUE --> <If condition=" 10>=10"> <MenuItem name="TRUE>> 10>=10" /></If>
<Else><MenuItem name="FALSE>> 10>=10" /></Else>
<!-- TRUE --> <If condition="10>= 10"><MenuItem name="TRUE>>10>= 10" /></If>
<Else><MenuItem name="FALSE>>10>= 10" /></Else>
</Menu>
</SnomIPPhoneMenu>
Result
Repeat #
It is recommended to use unique token. If one token contain another token this will create unexpected result.
Warning
- Good tocken: token="/__NAME__/__URL__/"
- Bad tocken: token="/_name_/_file_name_/"
Demo
- Example1: Try on your phone
- Example2: Try on your phone
Repeat example 1 #
Example code using values attribute
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../minibrowser_test.xsd">
<Repeat token="/__NAME__/__URL__/" values="|foo|http://foo.com|bar|http://bar.com|">
<MenuItem name="__NAME__">
<Url>__URL__</Url>
</MenuItem>
</Repeat>
</SnomIPPhoneMenu>
Result
Repeat example 2 #
Example Code using var_ifc attribute
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneMenu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../minibrowser_test.xsd">
<Title>var_ifc test</Title>
<Repeat token="|__state__|__name__|__file_name__|" var_ifc="lang.pui.*">
<if condition="__state__==active">
<MenuItem name="$(x_o:$(condition:__state__==active)) __name__(__file_name__)" sel="true"/>
</if>
<else>
<MenuItem name="$(x_o:$(condition:__state__==active)) __name__(__file_name__)" sel="false"/>
</else>
</Repeat>
</SnomIPPhoneMenu>
Result
Fetch #
Demo
- Use 1 as value for the of mil attribute to make phone fetch the url as fast as possible
- The real Minimum value for 'mil' attribute depend on phone type and file load time.
- Accuracy of fetch tag is also vary from phone type and file load time. Because of that, it is not recommended to use fetch tag to measure the time.
- Fetch with empty value will not load anything.
Fetch example, first page #
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
<Title>1st page</Title>
<Text>This text shown only for 4 second</Text>
<fetch mil="4000">http://docs.snom.io/xml_minibrowser/examples/xml/Fetch2.xml</fetch>
</SnomIPPhoneText>
Fetch example, second page #
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
<Title>2nd page</Title>
<Text>Bye bye!</Text>
<Fetch mil="4000">snom://mb_exit</Fetch>
</SnomIPPhoneText>
Result
Led #
Demo
- The changed led is not listed on phone state_of_gui.htm web page
- If led have only one colour, this will be triggered by any valid value from Led tag.
- Chassis led and line led have different behaviour based on value of led tag and value of color attribute
- Led tag value of redgreen and greenorange can be activated if:
- Led is multi color
- value of type blink (blink, blinkfast, and blinkslow included)
Led example: led on #
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
<Title>LED Control Feature</Title>
<Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
<Led number="1">On</Led>
<Led number="2">blink</Led>
<Led number="3">blinkfast</Led>
<Led number="4">blinkslow</Led>
<Led number="5" color="green">on</Led>
<SoftKeyItem>
<Name>F1</Name>
<Label>Off</Label>
<URL>http://docs.snom.io/xml_minibrowser/examples/xml/Led-off.xml</URL>
</SoftKeyItem>
<SoftKeyItem>
<Name>F2</Name>
<Label>Exit</Label>
<URL>snom://mb_exit</URL>
</SoftKeyItem>
</SnomIPPhoneText>
Led example: led off #
<?xml version="1.0" encoding="UTF-8"?>
<SnomIPPhoneText>
<Title>LED Control Feature</Title>
<Text>This sample page demonstrates the Minibrowser LED control feature.</Text>
<Led number="1">Off</Led>
<Led number="2">Off</Led>
<Led number="3">Off</Led>
<Led number="4">Off</Led>
<Led number="5" color="green">Off</Led>
<SoftKeyItem>
<Name>F1</Name>
<Label>On</Label>
<URL>http://docs.snom.io/xml_minibrowser/examples/xml/Led.xml</URL>
</SoftKeyItem>
<SoftKeyItem>
<Name>F2</Name>
<Label>Exit</Label>
<URL>snom://mb_exit</URL>
</SoftKeyItem>
</SnomIPPhoneText>