diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 4c88dcf..8e44f67 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -805 \ No newline at end of file +812 \ No newline at end of file diff --git a/Common/dataobjects/Poll.cs b/Common/dataobjects/Poll.cs index 56f8219..a6c03ad 100644 --- a/Common/dataobjects/Poll.cs +++ b/Common/dataobjects/Poll.cs @@ -62,6 +62,19 @@ namespace FLocal.Common.dataobjects { } } + private int _pollId; + public int pollId { + get { + this.LoadIfNotLoaded(); + return this._pollId; + } + } + public Poll poll { + get { + return Poll.LoadById(this.pollId); + } + } + private HashSet _options; public HashSet options { get { @@ -72,6 +85,7 @@ namespace FLocal.Common.dataobjects { protected override void doFromHash(Dictionary data) { this._userId = int.Parse(data[TableSpec.FIELD_USERID]); + this._pollId = int.Parse(data[TableSpec.FIELD_POLLID]); this._options = new HashSet(from elem in XElement.Parse(data[TableSpec.FIELD_VOTEINFO]).Descendants("vote") select int.Parse(elem.Attribute("optionId").Value)); } diff --git a/IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs b/IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs new file mode 100644 index 0000000..30da945 --- /dev/null +++ b/IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs @@ -0,0 +1,62 @@ +п»ї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; +using FLocal.Core.DB; +using FLocal.Core.DB.conditions; + +namespace FLocal.IISHandler.handlers.response { + + class UserPollsParticipatedHandler : AbstractGetHandler { + + override protected string templateName { + get { + return "UserPollsParticipated.xslt"; + } + } + + override protected XElement[] getSpecificData(WebContext context) { + User user = User.LoadById(int.Parse(context.requestParts[1])); + PageOuter pageOuter = PageOuter.createFromGet( + context.requestParts, + context.userSettings.postsPerPage, + 3 + ); + IEnumerable votes = Poll.Vote.LoadByIds( + from stringId in Config.instance.mainConnection.LoadIdsByConditions( + Poll.Vote.TableSpec.instance, + new ComparisonCondition( + Poll.Vote.TableSpec.instance.getColumnSpec(Poll.Vote.TableSpec.FIELD_USERID), + ComparisonType.EQUAL, + context.session.account.user.id.ToString() + ), + pageOuter, + new JoinSpec[0], + new SortSpec[] { + new SortSpec( + Poll.Vote.TableSpec.instance.getIdSpec(), + false + ) + } + ) select int.Parse(stringId) + ); + + XElement[] result = new XElement[] { + user.exportToXmlForViewing(context), + new XElement("polls", + from vote in votes select vote.poll.exportToXml(context), + pageOuter.exportToXml(2, 5, 2) + ) + }; + + return result; + } + + } + +} \ No newline at end of file diff --git a/templates/Full/Boards.xslt b/templates/Full/Boards.xslt index 1f4bb7e..15a22c3 100644 --- a/templates/Full/Boards.xslt +++ b/templates/Full/Boards.xslt @@ -61,6 +61,11 @@ Последние ответы на мои сообщения
+ + /User//PollsParticipated/ + Последние опросы с моим участием + +
Мои сообщения с оценками
Рейтинги сообщений diff --git a/templates/Full/UserPollsParticipated.xslt b/templates/Full/UserPollsParticipated.xslt new file mode 100644 index 0000000..4687e3a --- /dev/null +++ b/templates/Full/UserPollsParticipated.xslt @@ -0,0 +1,62 @@ + + + + + Опросы + + + + + +
+ + + + +
+ + + + +
+ + /Users/ + Пользователи + + >> + + >> + Опросы с участием пользователя +
+
+
+
+ + + + +
+ + + + + + + + + + + + +
НазваниеАвторДата
+ + страницы: + + /User//PollsParticipated/ + + +
+
+
+ +
\ No newline at end of file diff --git a/templates/Full/elems/PollShortInfo.xslt b/templates/Full/elems/PollShortInfo.xslt new file mode 100644 index 0000000..78e45ea --- /dev/null +++ b/templates/Full/elems/PollShortInfo.xslt @@ -0,0 +1,38 @@ + + + + + + + + lighttable + + + darktable + + + + * + /static/images/message-normal-read.gif + + + + + /Poll/ + + / + + + + + + + + + + + + + + + \ No newline at end of file