Hidden posts display implemented

main
Inga 🏳‍🌈 14 years ago
parent c1e0d60315
commit cb8ca52613
  1. 2
      Builder/IISMainHandler/build.txt
  2. 1
      Common/Common.csproj
  3. 14
      Common/PostVisibilityEnum.cs
  4. 2
      Common/UserContext.cs
  5. 10
      Common/dataobjects/AccountSettings.cs
  6. 16
      Common/dataobjects/AnonymousUserSettings.cs
  7. 2
      Common/dataobjects/IUserSettings.cs
  8. 18
      Common/dataobjects/Post.cs
  9. 2
      Common/dataobjects/Thread.cs
  10. 2
      IISMainHandler/WebContext.cs
  11. 16
      templates/Full/elems/PostInfo.xslt
  12. 18
      templates/Lite/elems/PostInfo.xslt
  13. 21
      templates/Modern/elems/PostInfo.xslt
  14. 4
      templates/Rss/elems/PostInfo.xslt

@ -125,6 +125,7 @@
<Compile Include="IComplexSqlObjectTableSpec.cs" />
<Compile Include="IOutputParams.cs" />
<Compile Include="ISqlObjectTableSpec.cs" />
<Compile Include="PostVisibilityEnum.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SqlObject.cs" />
<Compile Include="TableManager.cs" />

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FLocal.Common {
public enum PostVisibilityEnum {
UNVISIBLE, //we won't show that post
HIDDEN, //we will show that there is some hidden post
VISIBLE,
}
}

@ -28,7 +28,7 @@ namespace FLocal.Common {
get;
}
abstract public bool isPostVisible(dataobjects.Post post);
abstract public PostVisibilityEnum isPostVisible(dataobjects.Post post);
}

@ -135,11 +135,11 @@ namespace FLocal.Common.dataobjects {
}
}
public bool isPostVisible(Post post) {
if(post.layer.name == PostLayer.NAME_HIDDEN) return false;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_NONE) return false;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_PRIVELEGED) return this.account.user.userGroup.name == UserGroup.NAME_JUDGES || this.account.user.userGroup.name == UserGroup.NAME_ADMINISTRATORS;
return true;
public PostVisibilityEnum isPostVisible(Post post) {
if(post.layer.name == PostLayer.NAME_HIDDEN) return PostVisibilityEnum.HIDDEN;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_NONE) return PostVisibilityEnum.HIDDEN;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_PRIVELEGED) return (this.account.user.userGroup.name == UserGroup.NAME_JUDGES || this.account.user.userGroup.name == UserGroup.NAME_ADMINISTRATORS) ? PostVisibilityEnum.VISIBLE : PostVisibilityEnum.HIDDEN;
return PostVisibilityEnum.VISIBLE;
}
protected override void doFromHash(Dictionary<string, string> data) {

@ -63,16 +63,16 @@ namespace FLocal.Common.dataobjects {
}
}
public bool isPostVisible(Post post) {
public PostVisibilityEnum isPostVisible(Post post) {
if(this.account != null) {
if(post.layer.name == PostLayer.NAME_HIDDEN) return false;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_NONE) return false;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_PRIVELEGED) return account.user.userGroup.name == UserGroup.NAME_JUDGES || account.user.userGroup.name == UserGroup.NAME_ADMINISTRATORS;
return true;
if(post.layer.name == PostLayer.NAME_HIDDEN) return PostVisibilityEnum.HIDDEN;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_NONE) return PostVisibilityEnum.HIDDEN;
if(post.poster.showPostsToUsers == User.ENUM_SHOWPOSTSTOUSERS_PRIVELEGED) return (account.user.userGroup.name == UserGroup.NAME_JUDGES || account.user.userGroup.name == UserGroup.NAME_ADMINISTRATORS) ? PostVisibilityEnum.VISIBLE : PostVisibilityEnum.HIDDEN;
return PostVisibilityEnum.VISIBLE;
} else {
if(post.poster.showPostsToUsers != User.ENUM_SHOWPOSTSTOUSERS_ALL) return false;
if(post.layer.name != PostLayer.NAME_NORMAL) return false;
return true;
if(post.poster.showPostsToUsers != User.ENUM_SHOWPOSTSTOUSERS_ALL) return PostVisibilityEnum.HIDDEN;
if(post.layer.name != PostLayer.NAME_NORMAL) return PostVisibilityEnum.HIDDEN;
return PostVisibilityEnum.VISIBLE;
}
}

@ -35,7 +35,7 @@ namespace FLocal.Common.dataobjects {
get;
}
bool isPostVisible(Post post);
PostVisibilityEnum isPostVisible(Post post);
int maxUploadImageWidth {
get;

@ -221,7 +221,7 @@ namespace FLocal.Common.dataobjects {
return new XElement("post",
new XElement("id", this.id),
new XElement("poster", this.poster.exportToXmlForViewing(context)),
new XElement("bodyShort", context.isPostVisible(this) ? this.bodyShort : ""),
new XElement("bodyShort", context.isPostVisible(this) == PostVisibilityEnum.VISIBLE ? this.bodyShort : ""),
new XElement("title", this.title)
);
}
@ -232,9 +232,19 @@ namespace FLocal.Common.dataobjects {
public XElement exportToXml(UserContext context, params XElement[] additional) {
if(!context.isPostVisible(this)) return null;
XElement result = null;
XElement result = new XElement("post",
switch(context.isPostVisible(this)) {
case PostVisibilityEnum.UNVISIBLE:
return null;
case PostVisibilityEnum.HIDDEN:
result = new XElement("post",
new XElement("hidden"),
new XElement("id", this.id)
);
break;
case PostVisibilityEnum.VISIBLE:
result = new XElement("post",
new XElement("id", this.id),
new XElement("poster",
this.poster.exportToXmlForViewing(
@ -268,6 +278,8 @@ namespace FLocal.Common.dataobjects {
if(this.parentPostId.HasValue) {
result.Add(new XElement("parentPost", this.parentPost.exportToXmlBase(context)));
}
break;
}
if(additional.Length > 0) {
result.Add(additional);
}

@ -191,7 +191,7 @@ namespace FLocal.Common.dataobjects {
public XElement exportToXml(UserContext context, params XElement[] additional) {
if(!context.isPostVisible(this.firstPost)) return null;
if(context.isPostVisible(this.firstPost) != PostVisibilityEnum.VISIBLE) return null;
XElement result = new XElement("thread",
new XElement("id", this.id),

@ -92,7 +92,7 @@ namespace FLocal.IISHandler {
}
}
public override bool isPostVisible(Post post) {
public override PostVisibilityEnum isPostVisible(Post post) {
return this.userSettings.isPostVisible(post);
}

@ -2,7 +2,21 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:import href="UserInfoBar.xslt"/>
<xsl:template match="post">
<xsl:template match="post[hidden]">
<tr>
<td>
<a>
<xsl:attribute name="name">Post<xsl:value-of select="id"/></xsl:attribute>
<xsl:comment>fill</xsl:comment>
</a>
<p>Âàì íåëüçÿ âèäåòü ýòîò ñëàäêèé è çàïðåòíûé ïëîä.</p>
<xsl:if test="/root/session/notLoggedIn">
<p>Âîçìîæíî, <a href="/My/Login/Login/">âõîä íà ôîðóì</a> èñïðàâèò ñèòóàöèþ</p>
</xsl:if>
</td>
</tr>
</xsl:template>
<xsl:template match="post[not(hidden)]">
<xsl:param name="isReplyDisabled">true</xsl:param>
<tr>
<td>

@ -1,7 +1,23 @@
<?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="post">
<xsl:template match="post[not(hidden)]">
<div>
<div class="darktable">
<a>
<xsl:attribute name="name">Post<xsl:value-of select="id"/></xsl:attribute>
<xsl:comment>fill</xsl:comment>
</a>
<div class="lighttable post">
<p>Âŕě íĺëüç˙ âčäĺňü ýňîň ńëŕäęčé č çŕďđĺňíűé ďëîä.</p>
<xsl:if test="/root/session/notLoggedIn">
<p>Âîçěîćíî, <a href="/My/Login/Login/">âőîä íŕ ôîđóě</a> čńďđŕâčň ńčňóŕöčţ</p>
</xsl:if>
</div>
</div>
</div>
</xsl:template>
<xsl:template match="post[hidden]">
<xsl:param name="isReplyDisabled">true</xsl:param>
<div>
<div class="darktable">

@ -2,10 +2,27 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:import href="UserInfoBar.xslt"/>
<xsl:template match="post">
<xsl:template match="post[hidden]">
<div class="postcontainer" style="clear:both">
<a>
<xsl:attribute name="name">Post<xsl:value-of select="id"/></xsl:attribute>
<xsl:comment>fill</xsl:comment>
</a>
<div class="postContent">
<p>Âàì íåëüçÿ âèäåòü ýòîò ñëàäêèé è çàïðåòíûé ïëîä.</p>
<xsl:if test="/root/session/notLoggedIn">
<p>Âîçìîæíî, <a href="/My/Login/Login/">âõîä íà ôîðóì</a> èñïðàâèò ñèòóàöèþ</p>
</xsl:if>
</div>
</div>
</xsl:template>
<xsl:template match="post[not(hidden)]">
<xsl:param name="isReplyDisabled">true</xsl:param>
<div class="postcontainer" style="clear:both">
<a><xsl:attribute name="name">Post<xsl:value-of select="id"/></xsl:attribute></a>
<a>
<xsl:attribute name="name">Post<xsl:value-of select="id"/></xsl:attribute>
<xsl:comment>fill</xsl:comment>
</a>
<div class="userbarcontainer" style="float:left">
<xsl:apply-templates select="poster/user" mode="userInfoBar"/>
</div>

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="post">
<xsl:template match="post[hidden]"/>
<xsl:template match="post[not(hidden)]">
<xsl:if test="not(poster/user/name = /root/session/user/name)">
<item>
<title>

Loading…
Cancel
Save