UserThreads page implemented (follow-up to previous commit)

main
Inga 🏳‍🌈 14 years ago
parent a29d9ca2c1
commit d9f9d5fcb0
  1. 45
      IISMainHandler/handlers/response/UserThreadsHandler.cs
  2. 38
      templates/Full/UserThreads.xslt

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml.Linq;
using FLocal.Common;
using FLocal.Common.dataobjects;
using FLocal.Core;
using FLocal.Core.DB;
using FLocal.Core.DB.conditions;
namespace FLocal.IISHandler.handlers.response {
class UserThreadsHandler : AbstractGetHandler {
override protected string templateName {
get {
return "UserThreads.xslt";
}
}
override protected IEnumerable<XElement> getSpecificData(WebContext context) {
User user = User.LoadById(int.Parse(context.requestParts[2]));
PageOuter pageOuter = PageOuter.createFromGet(
context.requestParts,
context.userSettings.postsPerPage,
4
);
IEnumerable<Thread> threads = user.getThreads(pageOuter);
XElement[] result = new XElement[] {
user.exportToXmlForViewing(context),
new XElement("threads",
from thread in threads select thread.exportToXml(context),
pageOuter.exportToXml(1, 5, 1)
)
};
return result;
}
}
}

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:import href="elems\Main.xslt"/>
<xsl:import href="elems\ThreadInfo.xslt"/>
<xsl:template name="specificTitle">
<xsl:text>Òåìû - </xsl:text>
<xsl:value-of select="user/name"/>
</xsl:template>
<xsl:template name="specific">
<table width="95%" align="center" class="tablesurround">
<tr>
<td>
<table cellpadding="3" cellspacing="1" width="100%" class="tableborders">
<tr>
<td align="left" width="55%" class="tdheader">Òåìà</td>
<td align="left" nowrap="nowrap" width="15%" class="tdheader">Àâòîð</td>
<td nowrap="nowrap" width="5%" class="tdheader" align="center">Ïðîñìîòðîâ</td>
<td nowrap="nowrap" width="5%" class="tdheader" align="center">Ïîñòîâ</td>
<td nowrap="nowrap" width="20%" class="tdheader" align="center">Ïîñëåäíåå</td>
</tr>
<xsl:apply-templates select="threads/thread"/>
<tr class="tdheader">
<td colspan="5">
<font class="onbody">
<xsl:text>ñòðàíèöû:</xsl:text>
<xsl:apply-templates select="threads/pageOuter" mode="withCurrent">
<xsl:with-param name="baseLink">/Users/User/<xsl:value-of select="user/id"/>/Threads/</xsl:with-param>
</xsl:apply-templates>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save