Refactored Thread.exportToXml, Post.exportToXml, BoardAsThread

main
Inga 🏳‍🌈 14 years ago
parent 30c5204a49
commit fa3dd2c456
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Common/dataobjects/Board.cs
  3. 4
      Common/dataobjects/Post.cs
  4. 5
      Common/dataobjects/Thread.cs
  5. 2
      IISMainHandler/handlers/BoardHandler.cs
  6. 4
      IISMainHandler/handlers/PostHandler.cs
  7. 4
      IISMainHandler/handlers/ThreadHandler.cs
  8. 2
      IISMainHandler/handlers/request/CreateThreadHandler.cs
  9. 2
      IISMainHandler/handlers/request/EditHandler.cs
  10. 2
      IISMainHandler/handlers/request/ReplyHandler.cs
  11. 2
      IISMainHandler/handlers/response/AllPostsHandler.cs
  12. 4
      IISMainHandler/handlers/response/BoardAsThread.cs
  13. 4
      IISMainHandler/handlers/response/EditHandler.cs
  14. 4
      IISMainHandler/handlers/response/PMReplyToPostHandler.cs
  15. 4
      IISMainHandler/handlers/response/ReplyHandler.cs
  16. 2
      IISMainHandler/handlers/response/UserPostsHandler.cs
  17. 2
      IISMainHandler/handlers/response/UserRepliesHandler.cs
  18. 6
      templates/Full/BoardAsThread.xslt
  19. 6
      templates/Lite/BoardAsThread.xslt

@ -188,7 +188,7 @@ namespace FLocal.Common.dataobjects {
if(!this.lastPostId.HasValue) { if(!this.lastPostId.HasValue) {
return new XElement("none"); return new XElement("none");
} else { } else {
return this.lastPost.exportToXmlWithoutThread(context, false); return this.lastPost.exportToXml(context, false);
} }
} }

@ -179,7 +179,7 @@ namespace FLocal.Common.dataobjects {
return XElement.Parse("<body>" + context.outputParams.preprocessBodyIntermediate(this.body) + "</body>", LoadOptions.PreserveWhitespace); return XElement.Parse("<body>" + context.outputParams.preprocessBodyIntermediate(this.body) + "</body>", LoadOptions.PreserveWhitespace);
} }
public XElement exportToXmlWithoutThread(UserContext context, bool includeParentPost, params XElement[] additional) { public XElement exportToXml(UserContext context, bool includeParentPost, params XElement[] additional) {
if(!context.isPostVisible(this)) return null; if(!context.isPostVisible(this)) return null;
@ -200,7 +200,7 @@ namespace FLocal.Common.dataobjects {
); );
if(includeParentPost) { if(includeParentPost) {
if(this.parentPostId.HasValue) { if(this.parentPostId.HasValue) {
result.Add(new XElement("parentPost", this.parentPost.exportToXmlWithoutThread(context, false))); result.Add(new XElement("parentPost", this.parentPost.exportToXml(context, false)));
} }
} }
if(additional.Length > 0) { if(additional.Length > 0) {

@ -183,7 +183,7 @@ namespace FLocal.Common.dataobjects {
); );
} }
public XElement exportToXml(UserContext context, bool includeFirstPost, params XElement[] additional) { public XElement exportToXml(UserContext context, params XElement[] additional) {
if(!context.isPostVisible(this.firstPost)) return null; if(!context.isPostVisible(this.firstPost)) return null;
@ -203,9 +203,6 @@ namespace FLocal.Common.dataobjects {
new XElement("layerName", this.firstPost.layer.name), new XElement("layerName", this.firstPost.layer.name),
context.formatTotalPosts(this.totalPosts) context.formatTotalPosts(this.totalPosts)
); );
if(includeFirstPost) {
result.Add(new XElement("firstPost", this.firstPost.exportToXmlWithoutThread(context, false)));
}
if(context.account != null) { if(context.account != null) {
int lastReadId = this.getLastReadId(context.account); int lastReadId = this.getLastReadId(context.account);
result.Add( result.Add(

@ -27,7 +27,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),
pageOuter.exportToXml(1, 5, 1) pageOuter.exportToXml(1, 5, 1)
) )
}; };

@ -28,8 +28,8 @@ namespace FLocal.IISHandler.handlers {
XElement[] result = new XElement[] { XElement[] result = new XElement[] {
new XElement("currentLocation", post.exportToXmlSimpleWithParent(context)), new XElement("currentLocation", post.exportToXmlSimpleWithParent(context)),
post.thread.exportToXml(context, false), post.thread.exportToXml(context),
new XElement("posts", post.exportToXmlWithoutThread(context, true, new XElement("isUnread", (post.id > lastReadId).ToPlainString()))) new XElement("posts", post.exportToXml(context, true, new XElement("isUnread", (post.id > lastReadId).ToPlainString())))
}; };
post.thread.incrementViewsCounter(); post.thread.incrementViewsCounter();

@ -57,9 +57,9 @@ namespace FLocal.IISHandler.handlers {
XElement[] result = new XElement[] { XElement[] result = new XElement[] {
new XElement("currentLocation", thread.exportToXmlSimpleWithParent(context)), new XElement("currentLocation", thread.exportToXmlSimpleWithParent(context)),
thread.exportToXml(context, false), thread.exportToXml(context),
new XElement("posts", new XElement("posts",
from post in posts select post.exportToXmlWithoutThread(context, true, new XElement("isUnread", (post.id > lastReadId).ToPlainString())), from post in posts select post.exportToXml(context, true, new XElement("isUnread", (post.id > lastReadId).ToPlainString())),
pageOuter.exportToXml(2, 5, 2) pageOuter.exportToXml(2, 5, 2)
) )
}; };

@ -25,7 +25,7 @@ namespace FLocal.IISHandler.handlers.request {
return new XElement[] { return new XElement[] {
newThread.board.exportToXml(context, false), newThread.board.exportToXml(context, false),
newPost.exportToXmlWithoutThread(context, false) newPost.exportToXml(context, false)
}; };
} }
} }

@ -17,7 +17,7 @@ namespace FLocal.IISHandler.handlers.request {
protected override XElement[] Do(WebContext context) { protected override XElement[] Do(WebContext context) {
Post post = Post.LoadById(int.Parse(context.httprequest.Form["postId"])); Post post = Post.LoadById(int.Parse(context.httprequest.Form["postId"]));
XElement postXml = post.exportToXmlWithoutThread(context, false); XElement postXml = post.exportToXml(context, false);
post.Edit( post.Edit(
context.session.account.user, context.session.account.user,
this.getTitle(context), this.getTitle(context),

@ -25,7 +25,7 @@ namespace FLocal.IISHandler.handlers.request {
return new XElement[] { return new XElement[] {
newPost.thread.board.exportToXml(context, false), newPost.thread.board.exportToXml(context, false),
newPost.exportToXmlWithoutThread(context, false) newPost.exportToXml(context, false)
}; };
} }

@ -49,7 +49,7 @@ namespace FLocal.IISHandler.handlers.response {
XElement[] result = new XElement[] { XElement[] result = new XElement[] {
new XElement("posts", new XElement("posts",
from post in posts select post.exportToXmlWithoutThread(context, true), from post in posts select post.exportToXml(context, true),
pageOuter.exportToXml(2, 5, 2) pageOuter.exportToXml(2, 5, 2)
) )
}; };

@ -33,8 +33,8 @@ namespace FLocal.IISHandler.handlers.response {
return new XElement[] { return new XElement[] {
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("posts",
from thread in threads select thread.exportToXml(context, true), from thread in threads select thread.firstPost.exportToXml(context, true),
pageOuter.exportToXml(1, 5, 1) pageOuter.exportToXml(1, 5, 1)
) )
}; };

@ -23,8 +23,8 @@ namespace FLocal.IISHandler.handlers.response {
return new XElement[] { return new XElement[] {
post.thread.board.exportToXml(context, false), post.thread.board.exportToXml(context, false),
post.thread.exportToXml(context, false), post.thread.exportToXml(context),
post.exportToXmlWithoutThread(context, false), post.exportToXml(context, false),
post.latestRevision.exportToXml(context), post.latestRevision.exportToXml(context),
new XElement("layers", new XElement("layers",
from layer in PostLayer.allLayers select layer.exportToXml(context) from layer in PostLayer.allLayers select layer.exportToXml(context)

@ -32,8 +32,8 @@ namespace FLocal.IISHandler.handlers.response {
return new XElement[] { return new XElement[] {
post.thread.board.exportToXml(context, false), post.thread.board.exportToXml(context, false),
post.thread.exportToXml(context, false), post.thread.exportToXml(context),
post.exportToXmlWithoutThread(context, false), post.exportToXml(context, false),
new XElement("receiver", Account.LoadByUser(post.poster).exportToXml(context)), new XElement("receiver", Account.LoadByUser(post.poster).exportToXml(context)),
new XElement("quoted", quoted), new XElement("quoted", quoted),
}; };

@ -32,8 +32,8 @@ namespace FLocal.IISHandler.handlers.response {
return new XElement[] { return new XElement[] {
post.thread.board.exportToXml(context, false), post.thread.board.exportToXml(context, false),
post.thread.exportToXml(context, false), post.thread.exportToXml(context),
post.exportToXmlWithoutThread(context, false), post.exportToXml(context, false),
new XElement("layers", new XElement("layers",
from layer in PostLayer.allLayers select layer.exportToXml(context) from layer in PostLayer.allLayers select layer.exportToXml(context)
), ),

@ -32,7 +32,7 @@ namespace FLocal.IISHandler.handlers.response {
XElement[] result = new XElement[] { XElement[] result = new XElement[] {
user.exportToXmlForViewing(context), user.exportToXmlForViewing(context),
new XElement("posts", new XElement("posts",
from post in posts select post.exportToXmlWithoutThread(context, true), from post in posts select post.exportToXml(context, true),
pageOuter.exportToXml(2, 5, 2) pageOuter.exportToXml(2, 5, 2)
) )
}; };

@ -32,7 +32,7 @@ namespace FLocal.IISHandler.handlers.response {
XElement[] result = new XElement[] { XElement[] result = new XElement[] {
user.exportToXmlForViewing(context), user.exportToXmlForViewing(context),
new XElement("posts", new XElement("posts",
from post in posts select post.exportToXmlWithoutThread(context, true), from post in posts select post.exportToXml(context, true),
pageOuter.exportToXml(2, 5, 2) pageOuter.exportToXml(2, 5, 2)
) )
}; };

@ -99,20 +99,20 @@
<td colspan="5"> <td colspan="5">
<font class="onbody"> <font class="onbody">
<xsl:text>ñòðàíèöû:</xsl:text> <xsl:text>ñòðàíèöû:</xsl:text>
<xsl:apply-templates select="threads/pageOuter" mode="withCurrent"> <xsl:apply-templates select="posts/pageOuter" mode="withCurrent">
<xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param> <xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
</font> </font>
</td> </td>
</tr> </tr>
<!-- BEGIN POST LOOP DO NOT DELETE --> <!-- BEGIN POST LOOP DO NOT DELETE -->
<xsl:apply-templates select="threads/thread/firstPost/post"/> <xsl:apply-templates select="posts/post"/>
<!-- END OF LOOP --> <!-- END OF LOOP -->
<tr class="tdheader"> <tr class="tdheader">
<td colspan="5"> <td colspan="5">
<font class="onbody"> <font class="onbody">
<xsl:text>ñòðàíèöû:</xsl:text> <xsl:text>ñòðàíèöû:</xsl:text>
<xsl:apply-templates select="threads/pageOuter" mode="withCurrent"> <xsl:apply-templates select="posts/pageOuter" mode="withCurrent">
<xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param> <xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
</font> </font>

@ -99,20 +99,20 @@
<td colspan="5"> <td colspan="5">
<font class="onbody"> <font class="onbody">
<xsl:text>ñòðàíèöû:</xsl:text> <xsl:text>ñòðàíèöû:</xsl:text>
<xsl:apply-templates select="threads/pageOuter" mode="withCurrent"> <xsl:apply-templates select="posts/pageOuter" mode="withCurrent">
<xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param> <xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
</font> </font>
</td> </td>
</tr> </tr>
<!-- BEGIN POST LOOP DO NOT DELETE --> <!-- BEGIN POST LOOP DO NOT DELETE -->
<xsl:apply-templates select="threads/thread/firstPost/post"/> <xsl:apply-templates select="posts/post"/>
<!-- END OF LOOP --> <!-- END OF LOOP -->
<tr class="tdheader"> <tr class="tdheader">
<td colspan="5"> <td colspan="5">
<font class="onbody"> <font class="onbody">
<xsl:text>ñòðàíèöû:</xsl:text> <xsl:text>ñòðàíèöû:</xsl:text>
<xsl:apply-templates select="threads/pageOuter" mode="withCurrent"> <xsl:apply-templates select="posts/pageOuter" mode="withCurrent">
<xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param> <xsl:with-param name="baseLink">/BoardAsThread/<xsl:value-of select="currentLocation/board/id"/>/</xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
</font> </font>

Loading…
Cancel
Save