Odd-even table rows coloring implemented

main
Inga 🏳‍🌈 15 years ago
parent 1fc22b4dc8
commit 3397d6da3f
  1. 13
      IISMainHandler/Extensions.cs
  2. 2
      IISMainHandler/handlers/BoardHandler.cs
  3. 2
      IISMainHandler/handlers/response/UserListHandler.cs
  4. 10
      templates/Full/UserList.xslt
  5. 16
      templates/Full/elems/ThreadInfo.xslt

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Web; using System.Web;
using System.Xml.Linq;
using FLocal.Core;
namespace FLocal.IISHandler { namespace FLocal.IISHandler {
static class Extensions { static class Extensions {
@ -16,5 +18,16 @@ namespace FLocal.IISHandler {
return str.Split(new string[] { separator }, options); return str.Split(new string[] { separator }, options);
} }
public static IEnumerable<XElement> addNumbers(this IEnumerable<XElement> elements) {
int i=0;
foreach(XElement element in elements) {
XElement result = new XElement(element);
result.Add(new XElement("number", i));
result.Add(new XElement("even", (i%2 == 0).ToPlainString()));
i++;
yield return result;
}
}
} }
} }

@ -26,7 +26,7 @@ namespace FLocal.IISHandler.handlers {
new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)), new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)),
new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, true)), new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, true)),
new XElement("threads", new XElement("threads",
from thread in threads select thread.exportToXml(context, false), (from thread in threads select thread.exportToXml(context, false)).addNumbers(),
pageOuter.exportToXml(1, 5, 1) pageOuter.exportToXml(1, 5, 1)
) )
}; };

@ -23,7 +23,7 @@ namespace FLocal.IISHandler.handlers.response {
IEnumerable<User> users = User.getUsers(pageOuter, context); IEnumerable<User> users = User.getUsers(pageOuter, context);
return new XElement[] { return new XElement[] {
new XElement("users", new XElement("users",
from user in users select user.exportToXmlForViewing(context), (from user in users select user.exportToXmlForViewing(context)).addNumbers(),
pageOuter.exportToXml(2, 5, 2) pageOuter.exportToXml(2, 5, 2)
) )
}; };

@ -65,7 +65,15 @@
</xsl:template> </xsl:template>
<xsl:template match="users/user"> <xsl:template match="users/user">
<tr class="lighttable"> <tr>
<xsl:choose>
<xsl:when test="even='true'">
<xsl:attribute name="class">lighttable</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">darktable</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td> <td>
<a> <a>
<xsl:attribute name="href">/User/<xsl:value-of select="id"/>/</xsl:attribute> <xsl:attribute name="href">/User/<xsl:value-of select="id"/>/</xsl:attribute>

@ -3,7 +3,15 @@
<xsl:template match="thread"> <xsl:template match="thread">
<tr> <tr>
<td align="left" class="lighttable"> <xsl:choose>
<xsl:when test="even='true'">
<xsl:attribute name="class">lighttable</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">darktable</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td align="left">
<xsl:attribute name="title"><xsl:value-of select="bodyShort"/></xsl:attribute> <xsl:attribute name="title"><xsl:value-of select="bodyShort"/></xsl:attribute>
<img alt="*" hspace="5" style="vertical-align: text-bottom"> <img alt="*" hspace="5" style="vertical-align: text-bottom">
<xsl:choose> <xsl:choose>
@ -28,7 +36,7 @@
</xsl:apply-templates> </xsl:apply-templates>
</span> </span>
</td> </td>
<td align="left" nowrap="nowrap" class="lighttable"> <td align="left" nowrap="nowrap">
<a> <a>
<xsl:attribute name="href">/User/<xsl:value-of select="topicstarter/user/id"/>/</xsl:attribute> <xsl:attribute name="href">/User/<xsl:value-of select="topicstarter/user/id"/>/</xsl:attribute>
<font> <font>
@ -37,7 +45,7 @@
</font> </font>
</a> </a>
</td> </td>
<td align="center" class="lighttable"> <td align="center">
<xsl:value-of select="totalViews"/> <xsl:value-of select="totalViews"/>
</td> </td>
<td align="center" nowrap="nowrap" class="lighttable"> <td align="center" nowrap="nowrap" class="lighttable">
@ -49,7 +57,7 @@
<font class="new2"><i>(41)</i></font> <font class="new2"><i>(41)</i></font>
</a> </a>
</td> </td>
<td nowrap="nowrap" align="center" class="lighttable"> <td nowrap="nowrap" align="center">
<xsl:apply-templates select="lastPostDate/date" mode="dateTime"/> <xsl:apply-templates select="lastPostDate/date" mode="dateTime"/>
</td> </td>
</tr> </tr>

Loading…
Cancel
Save