From d912c563756ade184db38c0701532e1ea4fe9522 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Wed, 22 Sep 2010 17:11:08 +0000 Subject: [PATCH] Polls list implemented; polls header implemented --- Builder/IISMainHandler/build.txt | 2 +- Common/Common.csproj | 3 +- Common/URL/UrlManager.cs | 19 +++++++--- Common/URL/polls/List.cs | 24 ++++++++++++ Common/URL/polls/{NewPoll.cs => New.cs} | 6 +-- IISMainHandler/HandlersFactory.cs | 3 +- IISMainHandler/IISMainHandler.csproj | 1 + .../handlers/response/CreatePollHandler.cs | 2 +- .../response/UserPollsParticipatedHandler.cs | 2 +- templates/Full/PollsList.xslt | 33 +++++++++++++++++ templates/Full/elems/Header.xslt | 9 +++++ templates/Full/elems/PollShortInfo.xslt | 4 +- templates/Full/elems/PollsHeader.xslt | 37 +++++++++++++++++++ templates/Full/elems/TextEditor.xslt | 2 +- 14 files changed, 130 insertions(+), 17 deletions(-) create mode 100644 Common/URL/polls/List.cs rename Common/URL/polls/{NewPoll.cs => New.cs} (64%) create mode 100644 templates/Full/PollsList.xslt create mode 100644 templates/Full/elems/PollsHeader.xslt diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 222272a..3bd8434 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -1488 \ No newline at end of file +1492 \ No newline at end of file diff --git a/Common/Common.csproj b/Common/Common.csproj index 008c7eb..04844c3 100644 --- a/Common/Common.csproj +++ b/Common/Common.csproj @@ -160,7 +160,8 @@ - + + diff --git a/Common/URL/UrlManager.cs b/Common/URL/UrlManager.cs index e5e450a..bd995e6 100644 --- a/Common/URL/UrlManager.cs +++ b/Common/URL/UrlManager.cs @@ -29,7 +29,7 @@ namespace FLocal.Common.URL { return null; } - switch(scriptParts[0].ToLower()) { + switch(scriptParts[0].TrimStart('/').ToLower()) { case "showflat": case "ashowflat": dataobjects.Post post = dataobjects.Post.LoadById(int.Parse(Query["Number"])); @@ -47,6 +47,8 @@ namespace FLocal.Common.URL { } if(Path.ToLower().StartsWith("/images/graemlins/") || Path.ToLower().StartsWith("/images/icons/")) { return new Static("smileys/" + GetRemainder(requestParts, 2)); + } else if(Path.ToLower().StartsWith("/smiles/")) { + return new Static("smileys/" + GetRemainder(requestParts, 1)); } #endregion @@ -245,18 +247,23 @@ namespace FLocal.Common.URL { #endregion my; #region polls case "poll": - case "polls": if(requestParts.Length < 2) { return null; } + return new polls.Info(requestParts[1], GetRemainder(requestParts, 2)); + case "polls": + if(requestParts.Length < 2) { + return new polls.List(""); + } switch(requestParts[1].ToLower()) { case "info": return new polls.Info(requestParts[2], GetRemainder(requestParts, 3)); - case "newpoll": - case "create": - return new polls.NewPoll(GetRemainder(requestParts, 2)); + case "new": + return new polls.New(GetRemainder(requestParts, 2)); + case "list": + return new polls.List(GetRemainder(requestParts, 2)); default: - return new polls.Info(requestParts[1], GetRemainder(requestParts, 2)); + return null; } #endregion polls #region upload; diff --git a/Common/URL/polls/List.cs b/Common/URL/polls/List.cs new file mode 100644 index 0000000..d6f2e4b --- /dev/null +++ b/Common/URL/polls/List.cs @@ -0,0 +1,24 @@ +п»їusing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FLocal.Common.URL.polls { + public class List : AbstractUrl { + + public List(string remainder) : base(remainder) { + } + + public override string title { + get { + return "Polls"; + } + } + + protected override string _canonical { + get { + return "/Polls/List/"; + } + } + } +} diff --git a/Common/URL/polls/NewPoll.cs b/Common/URL/polls/New.cs similarity index 64% rename from Common/URL/polls/NewPoll.cs rename to Common/URL/polls/New.cs index 3f22214..2a7c43c 100644 --- a/Common/URL/polls/NewPoll.cs +++ b/Common/URL/polls/New.cs @@ -4,9 +4,9 @@ using System.Linq; using System.Text; namespace FLocal.Common.URL.polls { - public class NewPoll : AbstractUrl { + public class New : AbstractUrl { - public NewPoll(string remainder) : base(remainder) { + public New(string remainder) : base(remainder) { } public override string title { @@ -17,7 +17,7 @@ namespace FLocal.Common.URL.polls { protected override string _canonical { get { - return "/Polls/NewPoll/"; + return "/Polls/New/"; } } } diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs index eac400c..51b1a22 100644 --- a/IISMainHandler/HandlersFactory.cs +++ b/IISMainHandler/HandlersFactory.cs @@ -36,7 +36,8 @@ namespace FLocal.IISHandler { { typeof(URL.my.Settings), CreateHandler }, { typeof(URL.my.UserData), CreateHandler }, { typeof(URL.polls.Info), CreateHandler }, - { typeof(URL.polls.NewPoll), CreateHandler }, + { typeof(URL.polls.List), CreateHandler }, + { typeof(URL.polls.New), CreateHandler }, { typeof(URL.QuickLink), CreateHandler }, { typeof(URL.Robots), CreateHandler }, { typeof(URL.Static), CreateHandler }, diff --git a/IISMainHandler/IISMainHandler.csproj b/IISMainHandler/IISMainHandler.csproj index 2731136..f15dd97 100644 --- a/IISMainHandler/IISMainHandler.csproj +++ b/IISMainHandler/IISMainHandler.csproj @@ -150,6 +150,7 @@ + diff --git a/IISMainHandler/handlers/response/CreatePollHandler.cs b/IISMainHandler/handlers/response/CreatePollHandler.cs index f4e8960..c402485 100644 --- a/IISMainHandler/handlers/response/CreatePollHandler.cs +++ b/IISMainHandler/handlers/response/CreatePollHandler.cs @@ -10,7 +10,7 @@ using FLocal.Common.dataobjects; namespace FLocal.IISHandler.handlers.response { - class CreatePollHandler : AbstractGetHandler { + class CreatePollHandler : AbstractGetHandler { override protected string templateName { get { diff --git a/IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs b/IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs index 7cc3f69..2d866b9 100644 --- a/IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs +++ b/IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs @@ -21,7 +21,7 @@ namespace FLocal.IISHandler.handlers.response { } override protected IEnumerable getUserSpecificData(WebContext context, User user) { - PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.postsPerPage); + PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.threadsPerPage); IEnumerable votes = Poll.Vote.LoadByIds( from stringId in Config.instance.mainConnection.LoadIdsByConditions( Poll.Vote.TableSpec.instance, diff --git a/templates/Full/PollsList.xslt b/templates/Full/PollsList.xslt new file mode 100644 index 0000000..9d48b9e --- /dev/null +++ b/templates/Full/PollsList.xslt @@ -0,0 +1,33 @@ + + + + + Опросы + + + + + +
+ + + + + + + + + + + + +
НазваниеАвторДата
+ + страницы: + + +
+
+
+ +
\ No newline at end of file diff --git a/templates/Full/elems/Header.xslt b/templates/Full/elems/Header.xslt index 88e54cf..dac8be1 100644 --- a/templates/Full/elems/Header.xslt +++ b/templates/Full/elems/Header.xslt @@ -2,6 +2,7 @@ + @@ -53,6 +54,11 @@ Форум | + + /Polls/ + Опросы + + | /Upload/ Аплоад @@ -161,6 +167,9 @@ + + +
  
diff --git a/templates/Full/elems/PollShortInfo.xslt b/templates/Full/elems/PollShortInfo.xslt index 78e45ea..c4b3b28 100644 --- a/templates/Full/elems/PollShortInfo.xslt +++ b/templates/Full/elems/PollShortInfo.xslt @@ -18,11 +18,11 @@ - /Poll/ + /Poll/Info/ / - + diff --git a/templates/Full/elems/PollsHeader.xslt b/templates/Full/elems/PollsHeader.xslt new file mode 100644 index 0000000..c98fcb9 --- /dev/null +++ b/templates/Full/elems/PollsHeader.xslt @@ -0,0 +1,37 @@ + + + + + + + + +
+ + + + +
+
+
+
+ diff --git a/templates/Full/elems/TextEditor.xslt b/templates/Full/elems/TextEditor.xslt index 30183c3..13520ea 100644 --- a/templates/Full/elems/TextEditor.xslt +++ b/templates/Full/elems/TextEditor.xslt @@ -145,7 +145,7 @@ function insertInBody(str) { --> - Создать опрос + Создать опрос