From 73505ad15d96d61fee065bb12fab06fba75b3d93 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sat, 12 Jun 2010 17:35:55 +0000 Subject: [PATCH] Initial commit of main page and board page --- Builder/IISMainHandler/build.txt | 2 +- Common/dataobjects/Board.cs | 20 +- Common/dataobjects/Category.cs | 10 +- IISMainHandler/HandlersFactory.cs | 11 +- IISMainHandler/IISMainHandler.csproj | 1 + IISMainHandler/WebContext.cs | 8 + IISMainHandler/handlers/BoardHandler.cs | 30 +++ IISMainHandler/handlers/RootHandler.cs | 4 +- IISMainHandler/handlers/StaticHandler.cs | 2 +- static/css/global.css | 18 ++ static/images/all.gif | Bin 0 -> 110 bytes static/images/book-notread.gif | Bin 0 -> 153 bytes static/images/book-read.gif | Bin 0 -> 153 bytes static/images/chat-notread.gif | Bin 0 -> 106 bytes static/images/chat-read.gif | Bin 0 -> 106 bytes static/images/greyprevious.gif | Bin 0 -> 109 bytes static/images/lb.gif | Bin 0 -> 153 bytes static/images/newpost.gif | Bin 0 -> 132 bytes static/images/next.gif | Bin 0 -> 109 bytes static/images/sticky.gif | Bin 0 -> 151 bytes templates/Full/Board.xslt | 267 +++++++++++++++++++++++ templates/Full/Boards.xslt | 93 +------- templates/Full/Root.xslt | 141 ++++++++++++ templates/Full/elems/BoardInfo.xslt | 84 +++++++ templates/Full/elems/Header.xslt | 40 ++-- templates/Full/elems/Main.xslt | 44 ++-- 26 files changed, 639 insertions(+), 136 deletions(-) create mode 100644 IISMainHandler/handlers/BoardHandler.cs create mode 100644 static/images/all.gif create mode 100644 static/images/book-notread.gif create mode 100644 static/images/book-read.gif create mode 100644 static/images/chat-notread.gif create mode 100644 static/images/chat-read.gif create mode 100644 static/images/greyprevious.gif create mode 100644 static/images/lb.gif create mode 100644 static/images/newpost.gif create mode 100644 static/images/next.gif create mode 100644 static/images/sticky.gif create mode 100644 templates/Full/Board.xslt create mode 100644 templates/Full/Root.xslt create mode 100644 templates/Full/elems/BoardInfo.xslt diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index afbe847..4701cc7 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -126 \ No newline at end of file +150 \ No newline at end of file diff --git a/Common/dataobjects/Board.cs b/Common/dataobjects/Board.cs index 5f699c2..39757a2 100644 --- a/Common/dataobjects/Board.cs +++ b/Common/dataobjects/Board.cs @@ -95,6 +95,11 @@ namespace FLocal.Common.dataobjects { return this._parentBoardId; } } + public Board parentBoard { + get { + return Board.LoadById(this.parentBoardId.Value); + } + } protected override void doFromHash(Dictionary data) { this._sortOrder = int.Parse(data[TableSpec.FIELD_SORTORDER]); @@ -146,7 +151,16 @@ namespace FLocal.Common.dataobjects { } } - public XElement exportToXmlForMainPage(UserContext context) { + public XElement exportToXmlSimpleWithParent(UserContext context) { + return new XElement("board", + new XElement("id", this.id), + new XElement("name", this.name), + new XElement("description", this.description), + new XElement("parent", this.parentBoardId.HasValue ? this.parentBoard.exportToXmlSimpleWithParent(context) : this.category.exportToXmlSimple(context)) + ); + } + + public XElement exportToXml(UserContext context, bool includeSubBoards) { XElement result = new XElement("board", new XElement("id", this.id), new XElement("sortOrder", this.sortOrder), @@ -159,9 +173,9 @@ namespace FLocal.Common.dataobjects { new XElement("lastPostInfo", this.exportLastPostInfo()) ); - if(!this.parentBoardId.HasValue) { + if(includeSubBoards) { result.Add(new XElement("subBoards", - from board in this.subBoards select board.exportToXmlForMainPage(context) + from board in this.subBoards select board.exportToXml(context, false) )); } diff --git a/Common/dataobjects/Category.cs b/Common/dataobjects/Category.cs index c9ec45d..3c9c413 100644 --- a/Common/dataobjects/Category.cs +++ b/Common/dataobjects/Category.cs @@ -96,11 +96,19 @@ namespace FLocal.Common.dataobjects { } } + public XElement exportToXmlSimple(UserContext context) { + return new XElement("category", + new XElement("id", this.id), + new XElement("name", this.name) + ); + } + public XElement exportToXmlForMainPage(UserContext context) { return new XElement("category", + new XElement("id", this.id), new XElement("name", this.name), new XElement("sortOrder", this.sortOrder), - new XElement("boards", from board in this.subBoards select board.exportToXmlForMainPage(context)) + new XElement("boards", from board in this.subBoards select board.exportToXml(context, true)) ); } diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs index 3fd33f3..340175f 100644 --- a/IISMainHandler/HandlersFactory.cs +++ b/IISMainHandler/HandlersFactory.cs @@ -13,15 +13,16 @@ namespace FLocal.IISHandler { // return new handlers.WrongUrlHandler(); // throw new FLocalException("Malformed url"); // } - string[] requestParts = context.httprequest.Path.Split("/", StringSplitOptions.RemoveEmptyEntries); - if(requestParts.Length < 1) return new handlers.RootHandler(); - switch(requestParts[0]) { + if(context.requestParts.Length < 1) return new handlers.RootHandler(); + switch(context.requestParts[0].ToLower()) { case "boards": return new handlers.BoardsHandler(); + case "board": + return new handlers.BoardHandler(); case "static": - return new handlers.StaticHandler(requestParts); + return new handlers.StaticHandler(context.requestParts); default: - return new handlers.DebugHandler(requestParts[0]); + return new handlers.DebugHandler(context.requestParts[0]); } } diff --git a/IISMainHandler/IISMainHandler.csproj b/IISMainHandler/IISMainHandler.csproj index e6467b4..7009b25 100644 --- a/IISMainHandler/IISMainHandler.csproj +++ b/IISMainHandler/IISMainHandler.csproj @@ -53,6 +53,7 @@ + diff --git a/IISMainHandler/WebContext.cs b/IISMainHandler/WebContext.cs index 37d5da6..48a5f1c 100644 --- a/IISMainHandler/WebContext.cs +++ b/IISMainHandler/WebContext.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; +using FLocal.Core; namespace FLocal.IISHandler { class WebContext : Common.UserContext { @@ -15,6 +16,13 @@ namespace FLocal.IISHandler { } } + private object requestParts_Locker = new object(); + public string[] requestParts { + get { + return Cache.instance.get(requestParts_Locker, () => this.httprequest.Path.Split("/", StringSplitOptions.RemoveEmptyEntries)); + } + } + public HttpResponse httpresponse { get { return this.httpcontext.Response; diff --git a/IISMainHandler/handlers/BoardHandler.cs b/IISMainHandler/handlers/BoardHandler.cs new file mode 100644 index 0000000..bde4754 --- /dev/null +++ b/IISMainHandler/handlers/BoardHandler.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.Common; +using FLocal.Common.dataobjects; + +namespace FLocal.IISHandler.handlers { + + class BoardHandler : AbstractGetHandler { + + override protected string templateName { + get { + return "Board.xslt"; + } + } + + override protected XElement[] getSpecificData(WebContext context) { + Board board = Board.LoadById(int.Parse(context.requestParts[1])); + return new XElement[] { + new XElement("currentBoard", board.exportToXmlSimpleWithParent(context)), + new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, true)) + }; + } + + } + +} \ No newline at end of file diff --git a/IISMainHandler/handlers/RootHandler.cs b/IISMainHandler/handlers/RootHandler.cs index a1773a4..de18056 100644 --- a/IISMainHandler/handlers/RootHandler.cs +++ b/IISMainHandler/handlers/RootHandler.cs @@ -11,12 +11,12 @@ namespace FLocal.IISHandler.handlers { override protected string templateName { get { - throw new NotImplementedException(); + return "Root.xslt"; } } override protected XElement[] getSpecificData(WebContext context) { - throw new NotImplementedException(); + return new XElement[0]; } } diff --git a/IISMainHandler/handlers/StaticHandler.cs b/IISMainHandler/handlers/StaticHandler.cs index 0146ddc..41a197f 100644 --- a/IISMainHandler/handlers/StaticHandler.cs +++ b/IISMainHandler/handlers/StaticHandler.cs @@ -21,7 +21,7 @@ namespace FLocal.IISHandler.handlers { throw new HttpException(403, "listing not allowed"); } - Regex checker = new Regex("^[a-z][0-9a-z]*(\\.[a-zA-Z]+)?$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline); + Regex checker = new Regex("^[a-z][0-9a-z\\-]*(\\.[a-zA-Z]+)?$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline); string path = ""; for(int i=1; i tr > td, .tableborders > tr > td { + border:solid 1px black; +} \ No newline at end of file diff --git a/static/images/all.gif b/static/images/all.gif new file mode 100644 index 0000000000000000000000000000000000000000..5982706a53d30fadccb3379b20fb34db46d170f7 GIT binary patch literal 110 zcmZ?wbhEHb6lUOO*vtR||7V{0KlA_pGYtRF82>+$_W#Vx|7XtpKlA_pe}@16jsO2o z`wx}|@_+1CQT)lm$NYR^b HVXy`OKmRt( literal 0 HcmV?d00001 diff --git a/static/images/book-notread.gif b/static/images/book-notread.gif new file mode 100644 index 0000000000000000000000000000000000000000..c327ebbd01b6db26b794c3ccfa26eb7cacb30046 GIT binary patch literal 153 zcmZ?wbhEHbuiNp9ZxL47eO$h=#b+H?-LTQq7G$sn0GcH*761SM literal 0 HcmV?d00001 diff --git a/static/images/book-read.gif b/static/images/book-read.gif new file mode 100644 index 0000000000000000000000000000000000000000..1ee9f271a94da80a92aae1f93b028430413e6a6f GIT binary patch literal 153 zcmZ?wbhEHb_&hY;~16H8;lZ6o^ zp#vg7W;n3837qhJ?VuzR>}Ke$pm2Cz?#fEts)ipO4?8BeZYQ jq)Ur*5>1?@p0Dis7Gb5`$K@Ma?CZ4ZhK-)KAcHjkC|xrR literal 0 HcmV?d00001 diff --git a/static/images/chat-notread.gif b/static/images/chat-notread.gif new file mode 100644 index 0000000000000000000000000000000000000000..c88dfd47d9a679e3d02c243512d4bf7c9fa7e4a6 GIT binary patch literal 106 zcmZ?wbhEHbA;FRh=!NOn- E0MElGRsaA1 literal 0 HcmV?d00001 diff --git a/static/images/chat-read.gif b/static/images/chat-read.gif new file mode 100644 index 0000000000000000000000000000000000000000..351656259c16f1ad3115f7b3042f8b3470381e00 GIT binary patch literal 106 zcmZ?wbhEHb~IJAnlPJrSj?8WJ40XD*X|urKv{X6n%xk?S7>X6spSO7)*$VXy`OQ`ICM literal 0 HcmV?d00001 diff --git a/static/images/greyprevious.gif b/static/images/greyprevious.gif new file mode 100644 index 0000000000000000000000000000000000000000..01db83c3c8da55f7b821b6766d7d3b84463a7288 GIT binary patch literal 109 zcmZ?wbhEHbyA=KuddbcW&o8RP$F(*6VaXU_aT^Z);UhX4PK|Nl>e zNCWvl_NyrVWMO0gYSm!?0+1ODEK(m%damAU;k`iq!AX=Z89o)oJSFUVjG E09>CnVgLXD literal 0 HcmV?d00001 diff --git a/static/images/lb.gif b/static/images/lb.gif new file mode 100644 index 0000000000000000000000000000000000000000..c50f6cd5358c0a87a6e190511246539fc429ba5c GIT binary patch literal 153 zcmZ?wbhEHbC%$hqxsl<+$_W#Vx|7XtpKlA_pe}@16jsO2o z`wx}|@_+1CQT)lm$Nds6V*Np7y9>YFcPk(u{erI_Cu$ FtO4%nG{OJ? literal 0 HcmV?d00001 diff --git a/static/images/sticky.gif b/static/images/sticky.gif new file mode 100644 index 0000000000000000000000000000000000000000..9c3092abf907a896809279a1d3474b89527d8c47 GIT binary patch literal 151 zcmZ?wbhEHb6krfw*v!KK1poj4|HHy^hlS+`3(FoBmNhIaK0G{sbaaj!Idb5@0Tvb( zpaPIOFi`x-!pOkD!=MA=fy`iFahY(^vU_QT)DiDv(oQ1B)FoFKPK(?n`Q&?EQ^P5a vt{d}Wq?x5Jg#1{@vX>`Oz@$#B=WycDQw|H4oiz2nS)|JSrd+3!fx#L8?RGOt literal 0 HcmV?d00001 diff --git a/templates/Full/Board.xslt b/templates/Full/Board.xslt new file mode 100644 index 0000000..6afcc51 --- /dev/null +++ b/templates/Full/Board.xslt @@ -0,0 +1,267 @@ + + + + + + + + + +
+ + + + +
+ + + + + +
+ + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + +
ПодразделыТемыСообщенийПоследнееМодератор
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + +
ТемаАвторПросмотрыОтветыПоследнее
+ Давайте выкладывать сюда свои фотографии с претензией на художественность или просто красивые. +А потом проведем конкурс и дадим какой-нть приз + + Если Вы нашли этот тред в мусорке, верните его пожалуйста в Common. Atilla + + + Специализированный сайт фото-выставки: http://hg.b.gz.ru/peg/ by heGoat. + * + + + Фото-выставка. + + + 0 + 20 + 4620 + 4640 + Все + + + heGoat + + 811077 + + 26633 + + (10) + + + (41) + + + 13.09.2003 15:08 +
+ + страницы: + 0 + + /Board/1/p20/ + 20 + + + /Board/1/p40/ + 40 + + + /Board/1/p60/ + 60 + + +
+
+
+ + + + +
+ + + + + + + + + + + + + + +
Дополнительная информация
+ 11 зарегистрированных и 1 анонимных пользователей просматривают этот форум. +
+
+ Модераторы: + Sash + DeadmoroZ  +
+
+
+ Права + + + + + +
Вы можете создавать новые темы
Вы можете отвечать на сообщения
HTML отключен
UBBCode включен
+
+ Легенда: + + + + + + + + + + + + + + + + + +
Новые сообщения
Нет новых сообщений
Новые сообщения
Нет новых сообщений
+
+
+ Поиск в форуме + + +
+
+
+ +
+
+ +
+
+ +
+
+
+ Переход в + + +
+
+
+
+ + + + + + + + + + + +
ТемыСообщенийПоследнееМодератор
+
+ +
\ No newline at end of file diff --git a/templates/Full/Boards.xslt b/templates/Full/Boards.xslt index 626eb07..47ecf73 100644 --- a/templates/Full/Boards.xslt +++ b/templates/Full/Boards.xslt @@ -1,6 +1,7 @@ + @@ -21,17 +22,17 @@
- Вы вошли в форум как summersun + Вы вошли в форум как summersun
- 18983 Зарегистрированных пользователей. + 18983 Зарегистрированных пользователей.
- Приветствуем нового пользователя, + Приветствуем нового пользователя, _PC
- Сейчас 222 зарегистрированных и 54 анонимных пользователей в онлайне. + Сейчас 222 зарегистрированных и 54 анонимных пользователей в онлайне.
Текущее время: - 08.06.2010 14:17, Вторник + 08.06.2010 14:17, Вторник
Просмотр новых сообщений @@ -48,10 +49,10 @@ Легенда:
* - Новые сообщения + Новые сообщения
* - Нет новых сообщений + Нет новых сообщений
@@ -73,82 +74,4 @@
- - - - - if(!confirm('Пометить все сообщения как прочитанные?')) {event.returnValue=false; return false;} else { alert("Not implemented yet"); } - - - - - - - - - - - - - - /Threads// - - - -
- - - - - - - - - - - -
- - /Threads// - A - -
  - -
- - - - - - - - Sash, - DeadmoroZ - - -
- - - - -
- - /Thread/NOTIMPLEMENTED/p/ - от - -
- - N/A - -
-
- - - - - /Threads// - - - -
\ No newline at end of file diff --git a/templates/Full/Root.xslt b/templates/Full/Root.xslt new file mode 100644 index 0000000..09bc028 --- /dev/null +++ b/templates/Full/Root.xslt @@ -0,0 +1,141 @@ + + + + + + + + <xsl:value-of select="title"/> + + + +
+ Всегда полезно: +
+ Yandex + Google + Mail.ru + Rambler +
+
+ +
+
+ + + + +
+ + + + + + +
+
+ + + + +
+ Hello, summersun (External IP). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ Найти файл в сети: +
+ + +
+
+
+ Может пригодиться: +
+ Энциклопедия "Кирилла и Мефодия" + Lingvo - электронный словарь + Карты городов и стран мира + Погода от Фобос + Afisha - Все развлечения Москвы + Online переводчик + Metal Library +
+
+ Без рекламы никуда: +
+ Rabot +
+ FXMoney +
+ ZheleZona +
+
+
+
+ + +
+ +
+ diff --git a/templates/Full/elems/BoardInfo.xslt b/templates/Full/elems/BoardInfo.xslt new file mode 100644 index 0000000..e807778 --- /dev/null +++ b/templates/Full/elems/BoardInfo.xslt @@ -0,0 +1,84 @@ + + + + + + + + if(!confirm('Пометить все сообщения как прочитанные?')) {event.returnValue=false; return false;} else { alert("Not implemented yet"); } + + + + + + + + + + + + + + /Board// + + + +
+ + + + + + + + + + + +
+ + /Board// + A + +
  + +
+ + + + + + + + Sash + , + DeadmoroZ + + +
+ + + + +
+ + /Thread/NOTIMPLEMENTED/p/ + от + + +
+ + N/A + +
+
+ + + + + /Board// + + + + +
\ No newline at end of file diff --git a/templates/Full/elems/Header.xslt b/templates/Full/elems/Header.xslt index a488eae..01dfd8d 100644 --- a/templates/Full/elems/Header.xslt +++ b/templates/Full/elems/Header.xslt @@ -8,17 +8,20 @@ Root - | Google - | Yandex - | Mail.ru - | Vedomosti - | Afisha - | Weather - | LAN Support - - - - + | + Google + | + Yandex + | + Mail.ru + | + Vedomosti + | + Afisha + | + Weather + | + LAN Support @@ -31,18 +34,19 @@
diff --git a/templates/Full/elems/Main.xslt b/templates/Full/elems/Main.xslt index 143e3c0..b0bbe56 100644 --- a/templates/Full/elems/Main.xslt +++ b/templates/Full/elems/Main.xslt @@ -14,30 +14,34 @@
-Data used for authoring this XHTML document: +Data used for authoring this XHTML document: <xsl:copy-of select="/"/> + + + + + /Boards/ + + + >> + + + + /Board// + + + >> + + + + + + + + - \ No newline at end of file