From 90aa816ff404fe8dd85dfe49ad6961de428c04eb Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Tue, 6 Jul 2010 19:53:12 +0000 Subject: [PATCH] 'ActualPosts' counter implemented on ActiveAccountList page --- Builder/IISMainHandler/build.txt | 2 +- Builder/IISUploadHandler/build.txt | 2 +- Common/dataobjects/Thread.cs | 2 +- Common/dataobjects/User.cs | 5 +++- .../response/ActiveAccountListHandler.cs | 25 ++++++++++++++++++- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index e1f2760..ca6d18c 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -613 \ No newline at end of file +616 \ No newline at end of file diff --git a/Builder/IISUploadHandler/build.txt b/Builder/IISUploadHandler/build.txt index d35d5f7..0dbf139 100644 --- a/Builder/IISUploadHandler/build.txt +++ b/Builder/IISUploadHandler/build.txt @@ -1 +1 @@ -347 \ No newline at end of file +350 \ No newline at end of file diff --git a/Common/dataobjects/Thread.cs b/Common/dataobjects/Thread.cs index 6c5452b..31d83b3 100644 --- a/Common/dataobjects/Thread.cs +++ b/Common/dataobjects/Thread.cs @@ -11,7 +11,7 @@ using FLocal.Common.actions; namespace FLocal.Common.dataobjects { public class Thread : SqlObject { - private const int FORMALREADMIN = 10000001; + public const int FORMALREADMIN = 10000001; public class TableSpec : ISqlObjectTableSpec { public const string TABLE = "Threads"; diff --git a/Common/dataobjects/User.cs b/Common/dataobjects/User.cs index 283ff2c..7220abc 100644 --- a/Common/dataobjects/User.cs +++ b/Common/dataobjects/User.cs @@ -162,7 +162,7 @@ namespace FLocal.Common.dataobjects { this._avatarId = Util.ParseInt(data[TableSpec.FIELD_AVATARID]); } - public XElement exportToXmlForViewing(UserContext context) { + public XElement exportToXmlForViewing(UserContext context, params XElement[] additional) { XElement result = new XElement("user", new XElement("id", this.id), new XElement("regDate", this.regDate.ToXml()), @@ -177,6 +177,9 @@ namespace FLocal.Common.dataobjects { if(this.avatarId.HasValue) { result.Add(new XElement("avatar", this.avatarId)); } + foreach(XElement elem in additional) { + result.Add(elem); + } return result; } diff --git a/IISMainHandler/handlers/response/ActiveAccountListHandler.cs b/IISMainHandler/handlers/response/ActiveAccountListHandler.cs index e5a949e..8c92f9d 100644 --- a/IISMainHandler/handlers/response/ActiveAccountListHandler.cs +++ b/IISMainHandler/handlers/response/ActiveAccountListHandler.cs @@ -7,6 +7,7 @@ using System.Xml.Linq; using FLocal.Common; using FLocal.Common.dataobjects; using FLocal.Core.DB; +using FLocal.Core.DB.conditions; namespace FLocal.IISHandler.handlers.response { @@ -34,7 +35,29 @@ namespace FLocal.IISHandler.handlers.response { ); return new XElement[] { new XElement("users", - from account in accounts select account.user.exportToXmlForViewing(context), + from account in accounts + select account.user.exportToXmlForViewing( + context, + new XElement( + "actualPosts", + Config.instance.mainConnection.GetCountByConditions( + Post.TableSpec.instance, + new ComplexCondition( + ConditionsJoinType.AND, + new ComparisonCondition( + Post.TableSpec.instance.getColumnSpec(Post.TableSpec.FIELD_POSTERID), + ComparisonType.EQUAL, + account.user.id.ToString() + ), + new ComparisonCondition( + Post.TableSpec.instance.getIdSpec(), + ComparisonType.GREATEROREQUAL, + Thread.FORMALREADMIN.ToString() + ) + ) + ) + ) + ), pageOuter.exportToXml(2, 5, 2) ) };