PollsParticipated page implemented

main
Inga 🏳‍🌈 15 years ago
parent e556967725
commit 11bf04bf9f
  1. 2
      Builder/IISMainHandler/build.txt
  2. 14
      Common/dataobjects/Poll.cs
  3. 62
      IISMainHandler/handlers/response/UserPollsParticipatedHandler.cs
  4. 5
      templates/Full/Boards.xslt
  5. 62
      templates/Full/UserPollsParticipated.xslt
  6. 38
      templates/Full/elems/PollShortInfo.xslt

@ -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<int> _options; private HashSet<int> _options;
public HashSet<int> options { public HashSet<int> options {
get { get {
@ -72,6 +85,7 @@ namespace FLocal.Common.dataobjects {
protected override void doFromHash(Dictionary<string, string> data) { protected override void doFromHash(Dictionary<string, string> data) {
this._userId = int.Parse(data[TableSpec.FIELD_USERID]); this._userId = int.Parse(data[TableSpec.FIELD_USERID]);
this._pollId = int.Parse(data[TableSpec.FIELD_POLLID]);
this._options = new HashSet<int>(from elem in XElement.Parse(data[TableSpec.FIELD_VOTEINFO]).Descendants("vote") select int.Parse(elem.Attribute("optionId").Value)); this._options = new HashSet<int>(from elem in XElement.Parse(data[TableSpec.FIELD_VOTEINFO]).Descendants("vote") select int.Parse(elem.Attribute("optionId").Value));
} }

@ -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<Poll.Vote> 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;
}
}
}

@ -61,6 +61,11 @@
<xsl:text>Последние ответы на мои сообщения</xsl:text> <xsl:text>Последние ответы на мои сообщения</xsl:text>
</a> </a>
<br /> <br />
<a>
<xsl:attribute name="href">/User/<xsl:value-of select="session/user/id"/>/PollsParticipated/</xsl:attribute>
<xsl:text>Ïîñëåäíèå îïðîñû ñ ìîèì ó÷àñòèåì</xsl:text>
</a>
<br />
<a>Мои сообщения с оценками</a> <a>Мои сообщения с оценками</a>
<br /> <br />
<a>Рейтинги сообщений</a> <a>Рейтинги сообщений</a>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:import href="elems\Main.xslt"/>
<xsl:import href="elems\PollShortInfo.xslt"/>
<xsl:template name="specificTitle">Îïðîñû</xsl:template>
<xsl:template name="specific">
<table width="95%" align="center" cellpadding="1" cellspacing="1" class="tablesurround">
<tr>
<td>
<table cellpadding="3" cellspacing="1" width="100%" border="0" class="tableborders">
<tr class="darktable">
<td colspan="6">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" class="catandforum">
<a>
<xsl:attribute name="href">/Users/</xsl:attribute>
<xsl:text>Ïîëüçîâàòåëè</xsl:text>
</a>
<xsl:text> &gt;&gt; </xsl:text>
<xsl:apply-templates select="user" mode="userLink"/>
<xsl:text> &gt;&gt; </xsl:text>
<xsl:text>Îïðîñû ñ ó÷àñòèåì ïîëüçîâàòåëÿ</xsl:text>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<table width="95%" align="center" class="tablesurround">
<tr>
<td>
<table cellpadding="3" cellspacing="1" width="100%" class="tableborders">
<tr>
<td align="left" nowrap="nowrap" width="75%" class="tdheader">Íàçâàíèå</td>
<td nowrap="nowrap" width="15%" class="tdheader" align="center">Àâòîð</td>
<td nowrap="nowrap" width="20%" class="tdheader" align="center">Äàòà</td>
</tr>
<!-- BEGIN POST LOOP DO NOT DELETE -->
<xsl:apply-templates select="polls/poll"/>
<!-- END OF LOOP -->
<tr class="tdheader">
<td colspan="3">
<font class="onbody">
<xsl:text>ñòðàíèöû:</xsl:text>
<xsl:apply-templates select="polls/pageOuter" mode="withCurrent">
<xsl:with-param name="baseLink">/User/<xsl:value-of select="user/id"/>/PollsParticipated/</xsl:with-param>
</xsl:apply-templates>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="poll">
<tr>
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<xsl:attribute name="class">lighttable</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">darktable</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<td align="left">
<img alt="*" hspace="5" style="vertical-align: text-bottom">
<xsl:attribute name="src">/static/images/message-normal-read.gif</xsl:attribute>
</img>
<xsl:text> </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:text>/Poll/</xsl:text>
<xsl:value-of select="id"/>
<xsl:text>/</xsl:text>
</xsl:attribute>
<xsl:value-of select="title"/>
</a>
</td>
<td align="left" nowrap="nowrap">
<xsl:apply-templates select="poster/user" mode="userLink"/>
</td>
<td nowrap="nowrap" align="center">
<xsl:apply-templates select="postDate/date" mode="dateTime"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save