home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 March / Chip_2011.03_CD.iso / Tools / yabar.msi / fil6629E3C05A5BE63FA11ECAAC14E1BE69 < prev    next >
Encoding:
Extensible Markup Language  |  2010-04-16  |  11.1 KB  |  276 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE SYSTEM [
  3.   <!ENTITY % baselibDTD SYSTEM "xb://locale/baselib.dtd">
  4.   %baselibDTD;
  5. ]>
  6. <library xmlns:f="http://bar.yandex.ru/dev/functional"
  7.          xmlns:ui="http://bar.yandex.ru/dev/gui"
  8.          xmlns="">
  9.     
  10.     <widget id="A78155FC-41D5-4304-BD60-A01D8C1FB9FA" name="&wgt.quotes.name;" icon="quotes/quotes.png" unique="false">
  11.         <f:setting name="quote-id" scope="instance" default="&wgt.quotes.default-qid;"/>
  12.         <f:setting name="update-interval" scope="widget" default="15"/>
  13.         
  14.         <f:data name="quotes list">
  15.             <f:coalesce>
  16.                 <f:content>
  17.                     <f:request
  18.                         url="http://export.yandex.ru/bar/quotelist.xml"
  19.                         format="xml"
  20.                         update="1209600"
  21.                         expire="31536000"
  22.                         valid-xpath="count(quotes/group) > 0"/>
  23.                 </f:content>
  24.                 <f:file type="xml" path="quotes/quotelist.xml"/>
  25.             </f:coalesce>
  26.         </f:data>
  27.         
  28.         <f:data name="quotes request data">
  29.             <f:request format="xml"
  30.                        expire="172800"
  31.                        valid-xpath="count(quotes/quote) > 0">
  32.                 <f:param name="url">
  33.                     <f:concat start="http://export.yandex.ru/bar/quotes.xml?id=" end="${quote-id}"/>
  34.                 </f:param>
  35.                 <f:param name="update">
  36.                     <f:mul p1="${update-interval}" p2="60"/>
  37.                 </f:param>
  38.             </f:request>
  39.         </f:data>
  40.         
  41.         <f:variable name="quotes try id" scope="instance"/>
  42.         <f:variable name="quotes refresh timestamp" scope="instance"/>
  43.         
  44.         <f:data name="quote info">
  45.             <f:xpath expression="quotes/quote[1]/*">
  46.                 <f:content request="${quotes request data}"/>
  47.             </f:xpath>
  48.         </f:data>
  49.         
  50.         <f:data name="quote">
  51.             <f:xpath expression="number(./value)" source="${quote info}"/>
  52.         </f:data>
  53.         
  54.         <f:data name="quote name">
  55.             <f:try>
  56.                 <f:xpath source="${quotes list}">
  57.                     <f:concat p1="string(//quote[@id='" p2="${quote-id}" p3="']/name)"/>
  58.                 </f:xpath>
  59.                 <f:param name="...">
  60.                     <f:value type="empty"/>
  61.                 </f:param>
  62.             </f:try>
  63.         </f:data>
  64.         
  65.         <f:data name="quote short name">
  66.             <f:try>
  67.                 <f:xpath source="${quotes list}">
  68.                     <f:concat p1="string(//quote[@id='" p2="${quote-id}" p3="']/shortname)"/>
  69.                 </f:xpath>
  70.                 <f:param name="...">
  71.                     <f:value type="empty"/>
  72.                 </f:param>
  73.             </f:try>
  74.         </f:data>
  75.         
  76.         <f:data name="quote-2">
  77.             <f:try>
  78.                 <f:format-number precision="2" value="${quote}"/>
  79.                 <f:param name="...">
  80.                     <f:value type="empty"/>
  81.                 </f:param>
  82.             </f:try>
  83.         </f:data>
  84.         
  85.         <f:data name="quote-4">
  86.             <f:try>
  87.                 <f:format-number precision="4" value="${quote}"/>
  88.                 <f:param name="...">
  89.                     <f:value type="empty"/>
  90.                 </f:param>
  91.             </f:try>
  92.         </f:data>
  93.         
  94.         <f:data name="tomorrow-4">
  95.             <f:try>
  96.                 <f:format-number precision="4">
  97.                     <f:xpath expression="number(./tomorrow)" source="${quote info}"/>
  98.                 </f:format-number>
  99.                 <f:param name="...">
  100.                     <f:value type="empty"/>
  101.                 </f:param>
  102.             </f:try>
  103.         </f:data>
  104.         
  105.         <f:data name="quote change">
  106.             <f:try>
  107.                 <f:xpath expression="number(./change)" source="${quote info}"/>
  108.                 <f:param name="...">
  109.                     <f:value type="number">0</f:value>
  110.                 </f:param>
  111.             </f:try>
  112.         </f:data>
  113.         
  114.         <f:data name="color">
  115.             <f:if ontrue="#c21600">
  116.                 <f:lt lhs="${quote change}" rhs="0"/>
  117.                 <f:if ontrue="#539a0e" onfalse="black">
  118.                     <f:gt lhs="${quote change}" rhs="0"/>
  119.                 </f:if>
  120.             </f:if>
  121.         </f:data>
  122.         
  123.         <ui:button>
  124.             <ui:action>
  125.                 <f:navigate target="new tab" yandex-action="2120">
  126.                     <f:xpath source="${quotes list}">
  127.                         <f:concat p1="//quote[@id='" p2="${quote-id}" p3="']/url"/>
  128.                     </f:xpath>
  129.                 </f:navigate>
  130.             </ui:action>
  131.             
  132.             <ui:icon>
  133.                 <f:if>
  134.                     <f:or>
  135.                         <f:is-empty value="${quotes try id}"/>
  136.                         <f:and>
  137.                             <f:finished requestid="${quotes try id}"/>
  138.                             <f:time-passed timestamp="${quotes refresh timestamp}"/>
  139.                         </f:and>
  140.                     </f:or>
  141.                     <f:param name="ontrue"/>
  142.                     <f:param name="onfalse">misc/throbber.gif</f:param>
  143.                 </f:if>
  144.             </ui:icon>
  145.             
  146.             <ui:text>
  147.                 <f:value-of name="quote short name"/>
  148.                 <f:if>
  149.                     <f:is-empty value="${quote-2}"/>
  150.                     <f:param name="onfalse">
  151.                         <ui:style weight="bold">
  152.                             <ui:attribute name="color">
  153.                                 <f:value-of name="color"/>
  154.                             </ui:attribute>
  155.                             <f:concat p1=" " p2="${quote-2}"/>
  156.                         </ui:style>
  157.                     </f:param>
  158.                 </f:if>
  159.             </ui:text>
  160.             
  161.             <ui:tooltip>
  162.                 <ui:grid padding="3">
  163.                     <f:if>
  164.                         <f:is-empty value="quote name"/>
  165.                         <f:param name="onfalse">
  166.                             <ui:row>
  167.                                 <ui:cell h-align="center">
  168.                                     <ui:text>
  169.                                         <ui:style weight="bold">
  170.                                             <f:value-of name="quote name"/>
  171.                                         </ui:style>
  172.                                     </ui:text>
  173.                                 </ui:cell>
  174.                                 <ui:cell merge-left="true"/>
  175.                             </ui:row>
  176.                         </f:param>
  177.                     </f:if>
  178.                     
  179.                     <f:if>
  180.                         <f:is-empty value="${quote-4}"/>
  181.                         <f:param name="ontrue">
  182.                             <ui:row>
  183.                                 <ui:cell h-align="center">
  184.                                     <ui:text>&wgt.quotes.nodata;</ui:text>
  185.                                 </ui:cell>
  186.                                 <ui:cell merge-left="true"/>
  187.                             </ui:row>
  188.                         </f:param>
  189.                         <f:param name="onfalse">
  190.                             <ui:row>
  191.                                 <ui:cell h-align="right">
  192.                                     <ui:text>&wgt.quotes.tooltip.today;: </ui:text>
  193.                                 </ui:cell>
  194.                                 <ui:cell>
  195.                                     <ui:text>
  196.                                         <f:value-of name="quote-4"/>
  197.                                         <f:if>
  198.                                             <f:neq lhs="0" rhs="${quote change}"/>
  199.                                             <f:concat>
  200.                                                 <f:param name="p1">
  201.                                                     <f:value type="string"> (</f:value>
  202.                                                 </f:param>
  203.                                                 <f:param name="p2">
  204.                                                     <f:if>
  205.                                                         <f:gt lhs="${quote change}" rhs="0"/>
  206.                                                         <f:value type="string">+</f:value>
  207.                                                     </f:if>
  208.                                                 </f:param>
  209.                                                 <f:param name="p3">
  210.                                                     <f:format-number precision="4">
  211.                                                         <f:value-of name="quote change"/>
  212.                                                     </f:format-number>)</f:param>
  213.                                             </f:concat>
  214.                                         </f:if>
  215.                                     </ui:text>
  216.                                 </ui:cell>
  217.                             </ui:row>
  218.                         </f:param>
  219.                     </f:if>
  220.                     
  221.                     <f:if>
  222.                         <f:is-empty value="${tomorrow-4}"/>
  223.                         <f:param name="onfalse">
  224.                             <ui:row>
  225.                                 <ui:cell h-align="right">
  226.                                     <ui:text>&wgt.quotes.tooltip.tomorrow;: </ui:text>
  227.                                 </ui:cell>
  228.                                 <ui:cell>
  229.                                     <ui:text>
  230.                                         <f:value-of name="tomorrow-4"/>
  231.                                     </ui:text>
  232.                                 </ui:cell>
  233.                             </ui:row>
  234.                         </f:param>
  235.                     </f:if>
  236.                 </ui:grid>
  237.             </ui:tooltip>
  238.             
  239.             <ui:menu>
  240.                 <ui:menuitem>
  241.                     <ui:text>&wgt.quotes.refresh;</ui:text>
  242.                     <ui:action>
  243.                         <f:setvar name="quotes try id">
  244.                             <f:update request="${quotes request data}"/>
  245.                         </f:setvar>
  246.                         <f:setvar name="quotes refresh timestamp">
  247.                             <f:add>
  248.                                 <f:timestamp/> 2
  249.                             </f:add>
  250.                         </f:setvar>
  251.                     </ui:action>
  252.                 </ui:menuitem>
  253.                 <ui:separator/>
  254.                 <ui:menuitem>
  255.                     <ui:text>&wgt.quotes.copy;</ui:text>
  256.                     <ui:action>
  257.                         <f:copy-to-clipboard value="${quote-4}"/>
  258.                     </ui:action>
  259.                 </ui:menuitem>
  260.                 <ui:separator/>
  261.                 <ui:menuitem>
  262.                     <ui:text>&wgt.quotes.change;</ui:text>
  263.                     <ui:action command="setup"/>
  264.                 </ui:menuitem>
  265.                 <ui:menuitem>
  266.                     <ui:text>&wgt.quotes.delete;</ui:text>
  267.                     <ui:action command="delete"/>
  268.                 </ui:menuitem>
  269.                 <ui:menuitem>
  270.                     <ui:text>&wgt.quotes.add;</ui:text>
  271.                     <ui:action command="add"/>
  272.                 </ui:menuitem>
  273.             </ui:menu>
  274.         </ui:button>
  275.     </widget>
  276. </library>