diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index cde50ca..a14c1ee 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -179 \ No newline at end of file +180 \ No newline at end of file diff --git a/Common/dataobjects/AnonymousUserSettings.cs b/Common/dataobjects/AnonymousUserSettings.cs index 3b4c552..10aa0b7 100644 --- a/Common/dataobjects/AnonymousUserSettings.cs +++ b/Common/dataobjects/AnonymousUserSettings.cs @@ -8,13 +8,13 @@ namespace FLocal.Common.dataobjects { public int threadsPerPage { get { - return 20; + return 40; } } public int postsPerPage { get { - return 40; + return 20; } } diff --git a/Common/dataobjects/Thread.cs b/Common/dataobjects/Thread.cs index 11d4b5e..10c281f 100644 --- a/Common/dataobjects/Thread.cs +++ b/Common/dataobjects/Thread.cs @@ -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 getPosts(Diapasone diapasone, UserContext context) { diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs index 40235b4..0433796 100644 --- a/IISMainHandler/HandlersFactory.cs +++ b/IISMainHandler/HandlersFactory.cs @@ -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": diff --git a/IISMainHandler/IISMainHandler.csproj b/IISMainHandler/IISMainHandler.csproj index c013551..17abd8b 100644 --- a/IISMainHandler/IISMainHandler.csproj +++ b/IISMainHandler/IISMainHandler.csproj @@ -57,6 +57,7 @@ + diff --git a/IISMainHandler/handlers/BoardHandler.cs b/IISMainHandler/handlers/BoardHandler.cs index 9857e81..6805743 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), + from thread in threads select thread.exportToXml(context, false), pageOuter.exportToXml(1, 5, 1) ) }; diff --git a/IISMainHandler/handlers/response/BoardAsThread.cs b/IISMainHandler/handlers/response/BoardAsThread.cs new file mode 100644 index 0000000..eb04dac --- /dev/null +++ b/IISMainHandler/handlers/response/BoardAsThread.cs @@ -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 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) + ) + }; + } + + } + +} \ No newline at end of file diff --git a/templates/Full/Board.xslt b/templates/Full/Board.xslt index 3239467..f865683 100644 --- a/templates/Full/Board.xslt +++ b/templates/Full/Board.xslt @@ -20,8 +20,10 @@ - Новое сообщение - Сообщение + + Новое сообщение + Сообщение +
@@ -42,14 +44,14 @@ - + Список форумов Список - + Следующая страница /static/images/next.gif @@ -57,10 +59,21 @@ - + Прочитать всё + + + Как раздел + + + + + /BoardAsThread// + Как тред + + diff --git a/templates/Full/BoardAsThread.xslt b/templates/Full/BoardAsThread.xslt new file mode 100644 index 0000000..0a545bd --- /dev/null +++ b/templates/Full/BoardAsThread.xslt @@ -0,0 +1,121 @@ + + + + + + + + + +
+ + + + +
+ + + + + +
+ + + + + + + + + + + + + +
+
+
+
+
+ + + + +
+ + + + + + + + + + +
+ + страницы: + + /Board// + + +
+ + страницы: + + /Board// + + +
+
+
+ +
\ No newline at end of file