Punishments in UserInfo

main
Inga 🏳‍🌈 14 years ago
parent 2025c058f7
commit 46c0e2c484
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Common/dataobjects/Punishment.cs
  3. 27
      Common/dataobjects/User.cs
  4. 1
      IISMainHandler/handlers/response/UserInfoHandler.cs
  5. 26
      templates/Full/UserInfo.xslt

@ -179,7 +179,7 @@ namespace FLocal.Common.dataobjects {
this.punishmentType.exportToXml(context),
new XElement("isWithdrawed", this.isWithdrawed.ToPlainString()),
new XElement("comment", this.comment),
new XElement("expires", this.expires),
new XElement("expires", this.expires.ToXml()),
this.transferId.HasValue ? this.transfer.exportToXml(context) : null,
this.layerChangeId.HasValue ? this.layerChange.exportToXml(context) : null
);

@ -342,5 +342,32 @@ namespace FLocal.Common.dataobjects {
);
}
public IEnumerable<Punishment> getPunishments(Diapasone diapasone) {
return Punishment.LoadByIds(
from stringId in Config.instance.mainConnection.LoadIdsByConditions(
Punishment.TableSpec.instance,
new ComplexCondition(
ConditionsJoinType.AND,
new ComparisonCondition(
Punishment.TableSpec.instance.getColumnSpec(Punishment.TableSpec.FIELD_OWNERID),
ComparisonType.EQUAL,
this.id.ToString()
),
new ComparisonCondition(
Punishment.TableSpec.instance.getColumnSpec(Punishment.TableSpec.FIELD_EXPIRES),
ComparisonType.GREATEROREQUAL,
DateTime.Now.ToUTCString()
),
new ComparisonCondition(
Punishment.TableSpec.instance.getColumnSpec(Punishment.TableSpec.FIELD_ISWITHDRAWED),
ComparisonType.EQUAL,
"0"
)
),
diapasone
) select int.Parse(stringId)
);
}
}
}

@ -22,6 +22,7 @@ namespace FLocal.IISHandler.handlers.response {
override protected IEnumerable<XElement> getUserSpecificData(WebContext context, User user) {
return new XElement[] {
new XElement("punishments", from punishment in user.getPunishments(Diapasone.unlimited) select punishment.exportToXml(context)),
};
}

@ -168,7 +168,16 @@
<xsl:text>Penalties</xsl:text>
</td>
<td colspan="2">
<xsl:text>Not implemented</xsl:text>
<table border="1" width="90%">
<tr class="tdheader">
<td width="4%">Âåñ</td>
<td width="38%">Ñîîáùåíèå</td>
<td width="10%">Ìîäåðàòîð</td>
<td width="38%">Êîììåíòàðèé</td>
<td width="10%">Èñòåêàåò</td>
</tr>
<xsl:apply-templates select="punishments/punishment"/>
</table>
</td>
</tr>
<tr>
@ -188,4 +197,19 @@
</table>
</xsl:template>
<xsl:template match="punishment">
<tr>
<td><xsl:value-of select="punishmentType/weightDescription"/></td>
<td>
<a>
<xsl:attribute name="href">/Post/<xsl:value-of select="post/id"/>/</xsl:attribute>
<xsl:value-of select="post/title"/>
</a>
</td>
<td><xsl:apply-templates select="moderator" mode="userLink"/></td>
<td><xsl:value-of select="comment"/></td>
<td><xsl:apply-templates select="expires" mode="dateTime"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save