jbidwatcher / auctionTransform.xsl
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 1 | <?xml version="1.0" encoding="utf-8"?> | |
| 2 | <!DOCTYPE stylesheet [ | ||||
| 3 | <!ENTITY space "<xsl:text> </xsl:text>"> | ||||
| 4 | <!ENTITY bidColor ""> | ||||
| 5 | ]> | ||||
| f5a628f2 » | cyberfox | 2008-05-03 | 6 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:jxf="com.jbidwatcher.auction.AuctionTransformer"> | |
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 7 | <xsl:output method="html" indent="yes" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/> | |
| 8 | <xsl:template name="textify" match="/"> | ||||
| 9 | <xsl:for-each select="jbidwatcher/auctions/server/auction"> | ||||
| 10 | Title: <b><xsl:value-of select="./info/title"/></b> | ||||
| 11 | </xsl:for-each> | ||||
| 12 | </xsl:template> | ||||
| 13 | <xsl:template match="/"> | ||||
| 14 | <html> | ||||
| 15 | <head> | ||||
| 16 | <title>Auction List</title> | ||||
| 3b563864 » | cyberfox | 2008-10-22 | 17 | <link rel="shortcut icon" href="/favicon.ico"/> | |
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 18 | <style> | |
| 19 | .winner { color: green } | ||||
| 20 | .notwinner { color: red } | ||||
| 21 | .unbid { color: black } | ||||
| 22 | .row0 { background-color: #CFCFCF } | ||||
| 23 | .row1 { background-color: #EFEFEF } | ||||
| 24 | td { border-style: hidden; } | ||||
| 25 | th { font-size: small; } | ||||
| 26 | </style> | ||||
| 9eb79f31 » | cyberfox | 2008-09-07 | 27 | <script> | |
| 28 | function resetRows() { | ||||
| 29 | toggle = 0; | ||||
| 30 | rows=document.getElementsByTagName('tr'); | ||||
| 31 | for(i in rows) { | ||||
| 32 | row=rows[i]; | ||||
| 33 | if(row) { | ||||
| 34 | if(row.style) row.style.display='table-row'; | ||||
| 35 | if(row.className && row.className != '') { | ||||
| 36 | do_toggle(Math.floor(toggle / 2), row); | ||||
| 37 | toggle = (toggle +1) % 4; | ||||
| 38 | } | ||||
| 39 | } | ||||
| 40 | } | ||||
| 41 | } | ||||
| 42 | |||||
| 43 | function do_toggle(toggle, row) { | ||||
| 44 | row.className = row.className.replace('row0 ', '').replace('row1 ', ''); | ||||
| 45 | row.className = 'row' + toggle + ' ' + row.className; | ||||
| 46 | } | ||||
| 47 | |||||
| 48 | function onlyRows(classname) { | ||||
| 49 | toggle = 2; | ||||
| 50 | rows=document.getElementsByTagName('tr'); | ||||
| 51 | for(i in rows) { | ||||
| 52 | row=rows[i]; | ||||
| 53 | if(row.className && row.className != '') { | ||||
| 54 | if(!row.className.match(classname)) { | ||||
| 55 | row.style.display='none'; | ||||
| 56 | } else { | ||||
| 57 | do_toggle(Math.floor(toggle / 2), row); | ||||
| 58 | toggle = (toggle +1) % 4; | ||||
| 59 | } | ||||
| 60 | } | ||||
| 61 | } | ||||
| 62 | }; | ||||
| 63 | |||||
| 64 | function categories() { | ||||
| 65 | cats = new Array(); | ||||
| 66 | rows = document.getElementsByTagName('tr'); | ||||
| 67 | for(i in rows) { | ||||
| 68 | row = rows[i]; | ||||
| 69 | |||||
| 70 | if(row.className && row.className != '') { | ||||
| 6a559dc1 » | cyberfox | 2008-09-08 | 71 | cn = row.className.replace('row0 ', '').replace('row1 ', ''); | |
| 72 | if(cn && cn != '' && cats[cn] != 1) { | ||||
| 73 | cats[cn] = 1; | ||||
| 9eb79f31 » | cyberfox | 2008-09-07 | 74 | } | |
| 75 | } | ||||
| 76 | } | ||||
| 77 | return cats; | ||||
| 78 | }; | ||||
| 79 | |||||
| 80 | function fillSelect() { | ||||
| 81 | c = categories(); | ||||
| 82 | select = document.getElementById('tabselect'); | ||||
| 83 | for(i in c) add_select_val(select, i); | ||||
| 84 | }; | ||||
| 85 | |||||
| 86 | function add_select_val(select_elm, val){ | ||||
| 87 | var option = document.createElement('option'); | ||||
| 88 | option.setAttribute('value', val); | ||||
| 89 | option.innerHTML = val; | ||||
| 90 | select_elm.appendChild(option); | ||||
| 91 | }; | ||||
| 92 | </script> | ||||
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 93 | </head> | |
| 94 | <body> | ||||
| 9eb79f31 » | cyberfox | 2008-09-07 | 95 | <div style="padding-bottom: 3px;"> | |
| 96 | <form name="Add Auction" action="./addAuction" method="GET" style="display: inline;"> | ||||
| 97 | <label for="id">Auction Id:</label><input name="id" size="20" value=""/><input type="submit" name="action" value="Add Auction" onClick=""/> | ||||
| 98 | </form> | | ||||
| 99 | <form style="display: inline;">Select Tab to View: <select name="tab" id="tabselect" onchange="resetRows(); if(this.value != 'all') onlyRows(this.value);"><option value="all">All</option></select></form> | ||||
| 100 | </div> | ||||
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 101 | <table border="1" cellpadding="0" cellspacing="0" width="100%" bgcolor="#CCCCFF"> | |
| 102 | <tr> | ||||
| 103 | <font size="2"> | ||||
| 104 | <th align="center" width="10%">Item</th> | ||||
| 105 | <th align="center" width="10%">Start Price</th> | ||||
| 106 | <th align="center" width="11%">Current Price</th> | ||||
| 107 | <th align="center" width="11%">My Max/Snipe Bid</th> | ||||
| 108 | <th align="center" width="8%"># of Bids</th> | ||||
| 109 | <th align="center" width="11%">Start Date</th> | ||||
| 110 | <th align="center" width="18%"><strong>End Date PDT</strong></th> | ||||
| 111 | <th align="center" width="9%">Time Left</th> | ||||
| 112 | </font> | ||||
| 113 | </tr> | ||||
| 114 | <xsl:for-each select="jbidwatcher/auctions/server/auction"> | ||||
| 115 | <xsl:variable name="rowclass"><xsl:value-of select="position() mod 2"/></xsl:variable> | ||||
| 116 | <xsl:variable name="curid"><xsl:value-of select="@id"/></xsl:variable> | ||||
| 9eb79f31 » | cyberfox | 2008-09-07 | 117 | <xsl:variable name="category"><xsl:value-of select="category"/></xsl:variable> | |
| 118 | <tr class="row{$rowclass} {$category}"> | ||||
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 119 | <td width="100%" colspan="8"> | |
| 120 | <font size="3"><strong><a href="/{$curid}"><xsl:value-of select="info/title"/></a></strong></font> | ||||
| 121 | </td> | ||||
| 122 | </tr> | ||||
| 9eb79f31 » | cyberfox | 2008-09-07 | 123 | <tr class="row{$rowclass} {$category}" style="font-size: small"> | |
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 124 | <xsl:variable name="item_class"> | |
| 125 | <xsl:choose> | ||||
| 126 | <xsl:when test="info/highbidder = ../../server/@user">winner</xsl:when> | ||||
| 127 | <xsl:when test='info/bidcount = 0'>unbid</xsl:when> | ||||
| 128 | <xsl:otherwise>notwinner</xsl:otherwise> | ||||
| 129 | </xsl:choose></xsl:variable> | ||||
| 130 | <td width="10%" align="center" class="{$item_class}"><xsl:value-of select="@id"/></td> | ||||
| 131 | <td width="10%" align="right" class="{$item_class}"><xsl:value-of select="info/minimum/@currency"/>&space;<xsl:value-of select="info/minimum/@price"/></td> | ||||
| 132 | <td width="11%" align="right" class="{$item_class}"><xsl:value-of select="info/currently/@currency"/>&space;<xsl:value-of select="info/currently/@price"/></td> | ||||
| 133 | <td width="11%" align="right" class="{$item_class}"> | ||||
| 134 | <xsl:choose> | ||||
| 64593833 » | cyberfox | 2007-10-02 | 135 | <xsl:when test="snipe"> | |
| 136 | Snipe: <xsl:value-of select="snipe/@quantity"/> @ <xsl:value-of select="snipe/@currency"/>&space;<xsl:value-of select="snipe/@price"/> | ||||
| 137 | </xsl:when> | ||||
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 138 | <xsl:when test="bid"> | |
| 139 | <xsl:value-of select="bid/@quantity"/> @ <xsl:value-of select="bid/@currency"/>&space;<xsl:value-of select="bid/@price"/> | ||||
| 140 | </xsl:when> | ||||
| 141 | <xsl:otherwise>--</xsl:otherwise> | ||||
| 142 | </xsl:choose> | ||||
| 143 | </td> | ||||
| 144 | <td width="8%" align="center" class="{$item_class}"><xsl:choose><xsl:when test="info/fixed">(FP)</xsl:when><xsl:otherwise><xsl:value-of select="info/bidcount"/></xsl:otherwise></xsl:choose></td> | ||||
| 145 | <td width="11%" align="center" class="{$item_class}"> | ||||
| 146 | <xsl:variable name="curdate"><xsl:value-of select="info/start"/></xsl:variable> | ||||
| 147 | <xsl:value-of select="jxf:formatDate($curdate)"/> | ||||
| 148 | </td> | ||||
| 149 | <td width="18%" align="center" class="{$item_class}"> | ||||
| 150 | <xsl:variable name="curdate"><xsl:value-of select="info/end"/></xsl:variable> | ||||
| 151 | <xsl:value-of select="jxf:formatDate($curdate)"/> | ||||
| 152 | </td> | ||||
| 153 | <td width="9%" align="center" class="{$item_class}"> | ||||
| 154 | <xsl:choose> | ||||
| 155 | <xsl:when test="complete">Auction Ended</xsl:when> | ||||
| 156 | <xsl:otherwise> | ||||
| 157 | <xsl:variable name="thisid"><xsl:value-of select="@id"/></xsl:variable> | ||||
| 158 | <a href="snipe?id={$thisid}"><xsl:value-of select="jxf:getTimeLeft($thisid)"/></a> | ||||
| 159 | </xsl:otherwise> | ||||
| 160 | </xsl:choose> | ||||
| 161 | </td> | ||||
| 162 | <xsl:text> | ||||
| 163 | </xsl:text> | ||||
| 164 | </tr> | ||||
| 165 | </xsl:for-each> | ||||
| 166 | </table> | ||||
| 9eb79f31 » | cyberfox | 2008-09-07 | 167 | <script type="text/javascript">fillSelect();</script> | |
| 5b7ba1b2 » | cyberfox | 2006-09-24 | 168 | </body> | |
| 169 | </html> | ||||
| 170 | </xsl:template> | ||||
| 171 | </xsl:stylesheet> | ||||
