home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
- <!DOCTYPE SYSTEM [
- <!ENTITY % baselibDTD SYSTEM "xb://locale/baselib.dtd">
- %baselibDTD;
- ]>
- <library xmlns:f="http://bar.yandex.ru/dev/functional"
- xmlns:ui="http://bar.yandex.ru/dev/gui"
- xmlns="">
-
- <widget id="A78155FC-41D5-4304-BD60-A01D8C1FB9FA" name="&wgt.quotes.name;" icon="quotes/quotes.png" unique="false">
- <f:setting name="quote-id" scope="instance" default="&wgt.quotes.default-qid;"/>
- <f:setting name="update-interval" scope="widget" default="15"/>
-
- <f:data name="quotes list">
- <f:coalesce>
- <f:content>
- <f:request
- url="http://export.yandex.ru/bar/quotelist.xml"
- format="xml"
- update="1209600"
- expire="31536000"
- valid-xpath="count(quotes/group) > 0"/>
- </f:content>
- <f:file type="xml" path="quotes/quotelist.xml"/>
- </f:coalesce>
- </f:data>
-
- <f:data name="quotes request data">
- <f:request format="xml"
- expire="172800"
- valid-xpath="count(quotes/quote) > 0">
- <f:param name="url">
- <f:concat start="http://export.yandex.ru/bar/quotes.xml?id=" end="${quote-id}"/>
- </f:param>
- <f:param name="update">
- <f:mul p1="${update-interval}" p2="60"/>
- </f:param>
- </f:request>
- </f:data>
-
- <f:variable name="quotes try id" scope="instance"/>
- <f:variable name="quotes refresh timestamp" scope="instance"/>
-
- <f:data name="quote info">
- <f:xpath expression="quotes/quote[1]/*">
- <f:content request="${quotes request data}"/>
- </f:xpath>
- </f:data>
-
- <f:data name="quote">
- <f:xpath expression="number(./value)" source="${quote info}"/>
- </f:data>
-
- <f:data name="quote name">
- <f:try>
- <f:xpath source="${quotes list}">
- <f:concat p1="string(//quote[@id='" p2="${quote-id}" p3="']/name)"/>
- </f:xpath>
- <f:param name="...">
- <f:value type="empty"/>
- </f:param>
- </f:try>
- </f:data>
-
- <f:data name="quote short name">
- <f:try>
- <f:xpath source="${quotes list}">
- <f:concat p1="string(//quote[@id='" p2="${quote-id}" p3="']/shortname)"/>
- </f:xpath>
- <f:param name="...">
- <f:value type="empty"/>
- </f:param>
- </f:try>
- </f:data>
-
- <f:data name="quote-2">
- <f:try>
- <f:format-number precision="2" value="${quote}"/>
- <f:param name="...">
- <f:value type="empty"/>
- </f:param>
- </f:try>
- </f:data>
-
- <f:data name="quote-4">
- <f:try>
- <f:format-number precision="4" value="${quote}"/>
- <f:param name="...">
- <f:value type="empty"/>
- </f:param>
- </f:try>
- </f:data>
-
- <f:data name="tomorrow-4">
- <f:try>
- <f:format-number precision="4">
- <f:xpath expression="number(./tomorrow)" source="${quote info}"/>
- </f:format-number>
- <f:param name="...">
- <f:value type="empty"/>
- </f:param>
- </f:try>
- </f:data>
-
- <f:data name="quote change">
- <f:try>
- <f:xpath expression="number(./change)" source="${quote info}"/>
- <f:param name="...">
- <f:value type="number">0</f:value>
- </f:param>
- </f:try>
- </f:data>
-
- <f:data name="color">
- <f:if ontrue="#c21600">
- <f:lt lhs="${quote change}" rhs="0"/>
- <f:if ontrue="#539a0e" onfalse="black">
- <f:gt lhs="${quote change}" rhs="0"/>
- </f:if>
- </f:if>
- </f:data>
-
- <ui:button>
- <ui:action>
- <f:navigate target="new tab" yandex-action="2120">
- <f:xpath source="${quotes list}">
- <f:concat p1="//quote[@id='" p2="${quote-id}" p3="']/url"/>
- </f:xpath>
- </f:navigate>
- </ui:action>
-
- <ui:icon>
- <f:if>
- <f:or>
- <f:is-empty value="${quotes try id}"/>
- <f:and>
- <f:finished requestid="${quotes try id}"/>
- <f:time-passed timestamp="${quotes refresh timestamp}"/>
- </f:and>
- </f:or>
- <f:param name="ontrue"/>
- <f:param name="onfalse">misc/throbber.gif</f:param>
- </f:if>
- </ui:icon>
-
- <ui:text>
- <f:value-of name="quote short name"/>
- <f:if>
- <f:is-empty value="${quote-2}"/>
- <f:param name="onfalse">
- <ui:style weight="bold">
- <ui:attribute name="color">
- <f:value-of name="color"/>
- </ui:attribute>
- <f:concat p1=" " p2="${quote-2}"/>
- </ui:style>
- </f:param>
- </f:if>
- </ui:text>
-
- <ui:tooltip>
- <ui:grid padding="3">
- <f:if>
- <f:is-empty value="quote name"/>
- <f:param name="onfalse">
- <ui:row>
- <ui:cell h-align="center">
- <ui:text>
- <ui:style weight="bold">
- <f:value-of name="quote name"/>
- </ui:style>
- </ui:text>
- </ui:cell>
- <ui:cell merge-left="true"/>
- </ui:row>
- </f:param>
- </f:if>
-
- <f:if>
- <f:is-empty value="${quote-4}"/>
- <f:param name="ontrue">
- <ui:row>
- <ui:cell h-align="center">
- <ui:text>&wgt.quotes.nodata;</ui:text>
- </ui:cell>
- <ui:cell merge-left="true"/>
- </ui:row>
- </f:param>
- <f:param name="onfalse">
- <ui:row>
- <ui:cell h-align="right">
- <ui:text>&wgt.quotes.tooltip.today;: </ui:text>
- </ui:cell>
- <ui:cell>
- <ui:text>
- <f:value-of name="quote-4"/>
- <f:if>
- <f:neq lhs="0" rhs="${quote change}"/>
- <f:concat>
- <f:param name="p1">
- <f:value type="string"> (</f:value>
- </f:param>
- <f:param name="p2">
- <f:if>
- <f:gt lhs="${quote change}" rhs="0"/>
- <f:value type="string">+</f:value>
- </f:if>
- </f:param>
- <f:param name="p3">
- <f:format-number precision="4">
- <f:value-of name="quote change"/>
- </f:format-number>)</f:param>
- </f:concat>
- </f:if>
- </ui:text>
- </ui:cell>
- </ui:row>
- </f:param>
- </f:if>
-
- <f:if>
- <f:is-empty value="${tomorrow-4}"/>
- <f:param name="onfalse">
- <ui:row>
- <ui:cell h-align="right">
- <ui:text>&wgt.quotes.tooltip.tomorrow;: </ui:text>
- </ui:cell>
- <ui:cell>
- <ui:text>
- <f:value-of name="tomorrow-4"/>
- </ui:text>
- </ui:cell>
- </ui:row>
- </f:param>
- </f:if>
- </ui:grid>
- </ui:tooltip>
-
- <ui:menu>
- <ui:menuitem>
- <ui:text>&wgt.quotes.refresh;</ui:text>
- <ui:action>
- <f:setvar name="quotes try id">
- <f:update request="${quotes request data}"/>
- </f:setvar>
- <f:setvar name="quotes refresh timestamp">
- <f:add>
- <f:timestamp/> 2
- </f:add>
- </f:setvar>
- </ui:action>
- </ui:menuitem>
- <ui:separator/>
- <ui:menuitem>
- <ui:text>&wgt.quotes.copy;</ui:text>
- <ui:action>
- <f:copy-to-clipboard value="${quote-4}"/>
- </ui:action>
- </ui:menuitem>
- <ui:separator/>
- <ui:menuitem>
- <ui:text>&wgt.quotes.change;</ui:text>
- <ui:action command="setup"/>
- </ui:menuitem>
- <ui:menuitem>
- <ui:text>&wgt.quotes.delete;</ui:text>
- <ui:action command="delete"/>
- </ui:menuitem>
- <ui:menuitem>
- <ui:text>&wgt.quotes.add;</ui:text>
- <ui:action command="add"/>
- </ui:menuitem>
- </ui:menu>
- </ui:button>
- </widget>
- </library>