>(postInsert, changes);
+ }
+
}
}
diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs
index 5e3c3e6..9714fd9 100644
--- a/IISMainHandler/HandlersFactory.cs
+++ b/IISMainHandler/HandlersFactory.cs
@@ -25,7 +25,18 @@ namespace FLocal.IISHandler {
case "boards":
return new handlers.BoardsHandler();
case "board":
- return new handlers.BoardHandler();
+ if(context.requestParts.Length < 2) {
+ return new handlers.WrongUrlHandler();
+ }
+ if(context.requestParts.Length == 2) {
+ return new handlers.BoardHandler();
+ }
+ switch(context.requestParts[2].ToLower()) {
+ case "newthread":
+ return new handlers.response.CreateThreadHandler();
+ default:
+ return new handlers.WrongUrlHandler();
+ }
case "boardasthread":
return new handlers.response.BoardAsThreadHandler();
case "thread":
@@ -34,11 +45,14 @@ namespace FLocal.IISHandler {
if(context.requestParts.Length < 2) {
return new handlers.WrongUrlHandler();
}
+ if(context.requestParts.Length == 2) {
+ return new handlers.PostHandler();
+ }
switch(context.requestParts[2].ToLower()) {
case "reply":
return new handlers.response.ReplyHandler();
default:
- return new handlers.PostHandler();
+ return new handlers.WrongUrlHandler();
}
case "login":
return new handlers.response.LoginHandler();
@@ -77,6 +91,8 @@ namespace FLocal.IISHandler {
return new handlers.request.MigrateAccountHandler();
case "reply":
return new handlers.request.ReplyHandler();
+ case "newthread":
+ return new handlers.request.CreateThreadHandler();
default:
return new handlers.WrongUrlHandler();
}
diff --git a/IISMainHandler/IISMainHandler.csproj b/IISMainHandler/IISMainHandler.csproj
index 28ea5e3..8d1f8a5 100644
--- a/IISMainHandler/IISMainHandler.csproj
+++ b/IISMainHandler/IISMainHandler.csproj
@@ -67,6 +67,7 @@
+
diff --git a/IISMainHandler/handlers/request/AbstractNewMessageHandler.cs b/IISMainHandler/handlers/request/AbstractNewMessageHandler.cs
index e7b3b9e..9a976ea 100644
--- a/IISMainHandler/handlers/request/AbstractNewMessageHandler.cs
+++ b/IISMainHandler/handlers/request/AbstractNewMessageHandler.cs
@@ -7,6 +7,12 @@ using FLocal.Core;
namespace FLocal.IISHandler.handlers.request {
abstract class AbstractNewMessageHandler : AbstractPostHandler {
+ protected override string templateName {
+ get {
+ return "result/MessageCreated.xslt";
+ }
+ }
+
protected string getTitle(WebContext context) {
string title = context.httprequest.Form["title"].Trim();
if(title == "") {
diff --git a/IISMainHandler/handlers/request/CreateThreadHandler.cs b/IISMainHandler/handlers/request/CreateThreadHandler.cs
index 1d03ca1..ad5598b 100644
--- a/IISMainHandler/handlers/request/CreateThreadHandler.cs
+++ b/IISMainHandler/handlers/request/CreateThreadHandler.cs
@@ -3,18 +3,27 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
+using FLocal.Common.dataobjects;
namespace FLocal.IISHandler.handlers.request {
class CreateThreadHandler : AbstractNewMessageHandler {
- protected override string templateName {
- get {
- throw new NotImplementedException();
- }
- }
-
protected override XElement[] Do(WebContext context) {
- throw new NotImplementedException();
+
+ Thread newThread = Board.LoadById(
+ int.Parse(context.httprequest.Form["board"])
+ ).CreateThread(
+ context.session.account.user,
+ this.getTitle(context),
+ this.getBody(context),
+ int.Parse(context.httprequest.Form["layerId"])
+ );
+
+ Post newPost = newThread.firstPost;
+
+ newThread.markAsRead(context.session.account, newPost, newPost);
+
+ return new XElement[] { newPost.exportToXmlWithoutThread(context, false) };
}
}
}
diff --git a/IISMainHandler/handlers/request/ReplyHandler.cs b/IISMainHandler/handlers/request/ReplyHandler.cs
index 50a4a36..fd23132 100644
--- a/IISMainHandler/handlers/request/ReplyHandler.cs
+++ b/IISMainHandler/handlers/request/ReplyHandler.cs
@@ -8,12 +8,6 @@ using FLocal.Common.dataobjects;
namespace FLocal.IISHandler.handlers.request {
class ReplyHandler : AbstractNewMessageHandler {
- protected override string templateName {
- get {
- return "result/MessageCreated.xslt";
- }
- }
-
protected override XElement[] Do(WebContext context) {
// Post post = Post.LoadById(int.Parse(context.httprequest.Form["parent"]));
//int desiredLayerId = Math.Min(context.session.account.user.getMinAllowedLayer(post.thread.board), int.Parse(context.httprequest.Form["layer"]));
diff --git a/IISMainHandler/handlers/response/CreateThreadHandler.cs b/IISMainHandler/handlers/response/CreateThreadHandler.cs
new file mode 100644
index 0000000..a39f637
--- /dev/null
+++ b/IISMainHandler/handlers/response/CreateThreadHandler.cs
@@ -0,0 +1,30 @@
+п»їusing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+using System.Xml.Linq;
+using FLocal.Core;
+using FLocal.Common;
+using FLocal.Common.dataobjects;
+
+namespace FLocal.IISHandler.handlers.response {
+
+ class CreateThreadHandler : AbstractGetHandler {
+
+ override protected string templateName {
+ get {
+ return "NewThread.xslt";
+ }
+ }
+
+ override protected XElement[] getSpecificData(WebContext context) {
+ Board board = Board.LoadById(int.Parse(context.requestParts[1]));
+
+ return new XElement[] {
+ board.exportToXml(context, false),
+ };
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/templates/Full/Board.xslt b/templates/Full/Board.xslt
index a370b67..6c10931 100644
--- a/templates/Full/Board.xslt
+++ b/templates/Full/Board.xslt
@@ -21,6 +21,7 @@
+ /Board/ /NewThread/
Сообщение
diff --git a/templates/Full/BoardAsThread.xslt b/templates/Full/BoardAsThread.xslt
index 0a545bd..7395488 100644
--- a/templates/Full/BoardAsThread.xslt
+++ b/templates/Full/BoardAsThread.xslt
@@ -19,8 +19,9 @@
-
+ /Board/ /NewThread/
+
Сообщение
diff --git a/templates/Full/NewThread.xslt b/templates/Full/NewThread.xslt
new file mode 100644
index 0000000..34ea165
--- /dev/null
+++ b/templates/Full/NewThread.xslt
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Заполните приведенную ниже форму для отправки сообщения в форум. HTML отключен. UBBCode включен, и вы можете использовать UBBCode в ваших сообщениях. Анонимные сообщения разрешены, и вы можете выбрать любое незарегистрированное имя.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/Full/PostReply.xslt b/templates/Full/PostReply.xslt
index 2da3a4c..54c6994 100644
--- a/templates/Full/PostReply.xslt
+++ b/templates/Full/PostReply.xslt
@@ -33,7 +33,7 @@
-
+
@@ -54,11 +54,11 @@
-
+
Я хочу предварительно просмотреть сообщение перед отправкой
-
+
Проверить правописание