From 3397d6da3fc8b3f07824b0e15b3a60fa424d11c6 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 20 Jun 2010 10:58:50 +0000 Subject: [PATCH] Odd-even table rows coloring implemented --- IISMainHandler/Extensions.cs | 13 +++++++++++++ IISMainHandler/handlers/BoardHandler.cs | 2 +- .../handlers/response/UserListHandler.cs | 2 +- templates/Full/UserList.xslt | 10 +++++++++- templates/Full/elems/ThreadInfo.xslt | 16 ++++++++++++---- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/IISMainHandler/Extensions.cs b/IISMainHandler/Extensions.cs index 35a8e44..cca4477 100644 --- a/IISMainHandler/Extensions.cs +++ b/IISMainHandler/Extensions.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; +using System.Xml.Linq; +using FLocal.Core; namespace FLocal.IISHandler { static class Extensions { @@ -16,5 +18,16 @@ namespace FLocal.IISHandler { return str.Split(new string[] { separator }, options); } + public static IEnumerable addNumbers(this IEnumerable 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; + } + } + } } diff --git a/IISMainHandler/handlers/BoardHandler.cs b/IISMainHandler/handlers/BoardHandler.cs index 0946b2b..19f56fb 100644 --- a/IISMainHandler/handlers/BoardHandler.cs +++ b/IISMainHandler/handlers/BoardHandler.cs @@ -26,7 +26,7 @@ namespace FLocal.IISHandler.handlers { new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)), new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, true)), 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) ) }; diff --git a/IISMainHandler/handlers/response/UserListHandler.cs b/IISMainHandler/handlers/response/UserListHandler.cs index 0e75003..9559335 100644 --- a/IISMainHandler/handlers/response/UserListHandler.cs +++ b/IISMainHandler/handlers/response/UserListHandler.cs @@ -23,7 +23,7 @@ namespace FLocal.IISHandler.handlers.response { IEnumerable users = User.getUsers(pageOuter, context); return new XElement[] { 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) ) }; diff --git a/templates/Full/UserList.xslt b/templates/Full/UserList.xslt index 69a71f7..3b753ba 100644 --- a/templates/Full/UserList.xslt +++ b/templates/Full/UserList.xslt @@ -65,7 +65,15 @@ - + + + + lighttable + + + darktable + + /User// diff --git a/templates/Full/elems/ThreadInfo.xslt b/templates/Full/elems/ThreadInfo.xslt index f356016..50c8718 100644 --- a/templates/Full/elems/ThreadInfo.xslt +++ b/templates/Full/elems/ThreadInfo.xslt @@ -3,7 +3,15 @@ - + + + lighttable + + + darktable + + + * @@ -28,7 +36,7 @@ - + /User// @@ -37,7 +45,7 @@ - + @@ -49,7 +57,7 @@ (41) - +