BoardAsThread page implemented

main
Inga 🏳‍🌈 15 years ago
parent 5985b05691
commit 33af0e6fc4
  1. 2
      Builder/IISMainHandler/build.txt
  2. 4
      Common/dataobjects/AnonymousUserSettings.cs
  3. 8
      Common/dataobjects/Thread.cs
  4. 2
      IISMainHandler/HandlersFactory.cs
  5. 1
      IISMainHandler/IISMainHandler.csproj
  6. 2
      IISMainHandler/handlers/BoardHandler.cs
  7. 37
      IISMainHandler/handlers/response/BoardAsThread.cs
  8. 21
      templates/Full/Board.xslt
  9. 121
      templates/Full/BoardAsThread.xslt

@ -8,13 +8,13 @@ namespace FLocal.Common.dataobjects {
public int threadsPerPage {
get {
return 20;
return 40;
}
}
public int postsPerPage {
get {
return 40;
return 20;
}
}

@ -150,8 +150,8 @@ namespace FLocal.Common.dataobjects {
);
}
public XElement exportToXml(UserContext context) {
return new XElement("thread",
public XElement exportToXml(UserContext context, bool includeFirstPost) {
XElement result = new XElement("thread",
new XElement("id", this.id),
new XElement("firstPostId", this.firstPostId),
new XElement("topicstarter", this.topicstarter.exportToXmlForViewing(context)),
@ -166,6 +166,10 @@ namespace FLocal.Common.dataobjects {
new XElement("bodyShort", this.firstPost.bodyShort),
context.formatTotalPosts(this.totalPosts)
);
if(includeFirstPost) {
result.Add(new XElement("firstPost", this.firstPost.exportToXmlWithoutThread(context, false)));
}
return result;
}
public IEnumerable<Post> getPosts(Diapasone diapasone, UserContext context) {

@ -19,6 +19,8 @@ namespace FLocal.IISHandler {
return new handlers.BoardsHandler();
case "board":
return new handlers.BoardHandler();
case "boardasthread":
return new handlers.BoardAsThreadHandler();
case "thread":
return new handlers.ThreadHandler();
case "post":

@ -57,6 +57,7 @@
<Compile Include="handlers\BoardsHandler.cs" />
<Compile Include="handlers\DebugHandler.cs" />
<Compile Include="handlers\PostHandler.cs" />
<Compile Include="handlers\response\BoardAsThread.cs" />
<Compile Include="handlers\RootHandler.cs" />
<Compile Include="handlers\StaticHandler.cs" />
<Compile Include="handlers\ThreadHandler.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),
from thread in threads select thread.exportToXml(context, false),
pageOuter.exportToXml(1, 5, 1)
)
};

@ -0,0 +1,37 @@
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.DB;
namespace FLocal.IISHandler.handlers {
class BoardAsThreadHandler : AbstractGetHandler {
override protected string templateName {
get {
return "BoardAsThread.xslt";
}
}
override protected XElement[] getSpecificData(WebContext context) {
Board board = Board.LoadById(int.Parse(context.requestParts[1]));
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.postsPerPage);
IEnumerable<Thread> threads = board.getThreads(pageOuter, context);
return new XElement[] {
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, true),
pageOuter.exportToXml(1, 5, 1)
)
};
}
}
}

@ -20,8 +20,10 @@
<tr>
<td class="navigation" nowrap="nowrap">
<!-- postoption is either newpost.gif or greynewpost.gif -->
<a>
<img src="/static/images/newpost.gif" alt="Íîâîå ñîîáùåíèå" border="0" width="13" height="15" style="vertical-align: text-bottom" />
<a href="/newpost.php?Cat=&amp;Board=Common&amp;page=0&amp;src=&amp;sb=5&amp;o=&amp;showlite=">Ñîîáùåíèå</a>
<xsl:text>Ñîîáùåíèå</xsl:text>
</a>
</td>
<td class="navigation" nowrap="nowrap">
<form method="get" action="/postlist.php" name="fullview">
@ -42,14 +44,14 @@
</a>
</td>
<td class="navigation" nowrap="nowrap">
<a href="/ubbthreads.php?Cat=&amp;C=1">
<a>
<img src="/static/images/all.gif" alt="Ñïèñîê ôîðóìîâ" border="0" width="19" height="15" style="vertical-align: text-bottom" />
<xsl:text>Ñïèñîê</xsl:text>
</a>
</td>
<td class="navigation" nowrap="nowrap">
<!-- nextoption is either next.gif or greynext.gif -->
<a href="/postlist.php?Cat=&amp;Board=Common&amp;page=1&amp;fullview=&amp;src=&amp;sb=5&amp;o=&amp;showlite=">
<a>
<img alt="Ñëåäóþùàÿ ñòðàíèöà" border="0" width="14" height="15" style="vertical-align: text-bottom">
<xsl:attribute name="src">/static/images/next.gif</xsl:attribute>
</img>
@ -57,10 +59,21 @@
</a>
</td>
<td class="navigation">
<a href="/ubbthreads.php?check=Common&amp;src=&amp;showlite=">
<a>
<img src="/static/images/lb.gif" border="0" alt="Ïðî÷èòàòü âñ¸" style="vertical-align: text-bottom" />
</a>
</td>
<td class="navigation">
<a>
<xsl:text>Êàê ðàçäåë</xsl:text>
</a>
</td>
<td class="navigation">
<a>
<xsl:attribute name="href">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:attribute>
<xsl:text>Êàê òðåä</xsl:text>
</a>
</td>
</tr>
</table>
</td>

@ -0,0 +1,121 @@
<?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\PostInfo.xslt"/>
<xsl:template name="specific">
<table width="95%" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
<table cellpadding="3" cellspacing="1" width="100%" border="0" class="tableborders">
<tr class="darktable">
<td colspan="6">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" class="catandforum">
<xsl:apply-templates select="currentLocation" mode="breadcrumbs"/>
</td>
<td align="right" valign="bottom">
<table border="0" class="tablesurround">
<tr>
<td class="navigation" nowrap="nowrap">
<!-- postoption is either newpost.gif or greynewpost.gif -->
<img src="/static/images/newpost.gif" alt="Íîâîå ñîîáùåíèå" border="0" width="13" height="15" style="vertical-align: text-bottom" />
<a>
<xsl:text>Ñîîáùåíèå</xsl:text>
</a>
</td>
<td class="navigation" nowrap="nowrap">
<form method="get" action="/postlist.php" name="fullview">
<select name="fullview" class="formboxes" style="font-size:10px" onchange="document.forms.fullview.submit()">
<option value="0">Íîðì</option>
<option value="1">Îôò</option>
<option value="2" selected="selected">Ìóñ</option>
</select>
</form>
</td>
<td class="navigation" nowrap="nowrap">
<!-- prevoption is either previous.gif or greyprevious.gif -->
<a>
<img alt="Ïðåäûäóùàÿ ñòðàíèöà" border="0" width="12" height="15" style="vertical-align: text-bottom">
<xsl:attribute name="src">/static/images/greyprevious.gif</xsl:attribute>
</img>
<xsl:text>Ïðåä.</xsl:text>
</a>
</td>
<td class="navigation" nowrap="nowrap">
<a>
<img src="/static/images/all.gif" alt="Ñïèñîê ôîðóìîâ" border="0" width="19" height="15" style="vertical-align: text-bottom" />
<xsl:text>Ñïèñîê</xsl:text>
</a>
</td>
<td class="navigation" nowrap="nowrap">
<!-- nextoption is either next.gif or greynext.gif -->
<a>
<img alt="Ñëåäóþùàÿ ñòðàíèöà" border="0" width="14" height="15" style="vertical-align: text-bottom">
<xsl:attribute name="src">/static/images/next.gif</xsl:attribute>
</img>
<xsl:text>Ñëåä.</xsl:text>
</a>
</td>
<td class="navigation">
<a>
<img src="/static/images/lb.gif" border="0" alt="Ïðî÷èòàòü âñ¸" style="vertical-align: text-bottom" />
</a>
</td>
<td class="navigation">
<a>
<xsl:attribute name="href">/Board/<xsl:value-of select="currentLocation/board/id"/>/</xsl:attribute>
<xsl:text>Êàê ðàçäåë</xsl:text>
</a>
</td>
<td class="navigation">
<a>
<xsl:text>Êàê òðåä</xsl:text>
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table width="95%" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
<table cellpadding="0" cellspacing="1" width="100%" class="tableborders">
<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">/Board/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param>
</xsl:apply-templates>
</font>
</td>
</tr>
<!-- BEGIN POST LOOP DO NOT DELETE -->
<xsl:apply-templates select="threads/thread/firstPost/post"/>
<!-- END OF LOOP -->
<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">/Board/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param>
</xsl:apply-templates>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save