diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 0a1b63d..b0e9f8d 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -353 \ No newline at end of file +358 \ No newline at end of file diff --git a/Builder/IISUploadHandler/build.txt b/Builder/IISUploadHandler/build.txt index 615be70..0fa6a7b 100644 --- a/Builder/IISUploadHandler/build.txt +++ b/Builder/IISUploadHandler/build.txt @@ -1 +1 @@ -85 \ No newline at end of file +90 \ No newline at end of file diff --git a/Common/UploadManager.cs b/Common/UploadManager.cs index 4735792..666c0a7 100644 --- a/Common/UploadManager.cs +++ b/Common/UploadManager.cs @@ -59,7 +59,7 @@ namespace FLocal.Common { int? uploadId = null; try { - if(Config.instance.mainConnection.GetCountByConditions(Upload.TableSpec.instance, condition, new JoinSpec[0]) > 0) { + if(Config.instance.mainConnection.GetCountByConditions(Upload.TableSpec.instance, condition) > 0) { throw new _AlreadyUploadedException(); } Config.Transactional(transaction => { diff --git a/Common/dataobjects/Thread.cs b/Common/dataobjects/Thread.cs index 5f4128e..20fd277 100644 --- a/Common/dataobjects/Thread.cs +++ b/Common/dataobjects/Thread.cs @@ -179,7 +179,29 @@ namespace FLocal.Common.dataobjects { result.Add(new XElement("firstPost", this.firstPost.exportToXmlWithoutThread(context, false))); } if(context.account != null) { - result.Add(new XElement("afterLastRead", this.getLastReadId(context.account) + 1)); + int lastReadId = this.getLastReadId(context.account); + result.Add( + new XElement("afterLastRead", lastReadId + 1), + new XElement( + "totalNewPosts", + Config.instance.mainConnection.GetCountByConditions( + Post.TableSpec.instance, + new ComplexCondition( + ConditionsJoinType.AND, + new ComparisonCondition( + Post.TableSpec.instance.getColumnSpec(Post.TableSpec.FIELD_THREADID), + ComparisonType.EQUAL, + this.id.ToString() + ), + new ComparisonCondition( + Post.TableSpec.instance.getIdSpec(), + ComparisonType.GREATERTHAN, + lastReadId.ToString() + ) + ) + ) + ) + ); } if(additional.Length > 0) { result.Add(additional); @@ -307,8 +329,7 @@ namespace FLocal.Common.dataobjects { ComparisonType.LESSTHAN, minPost.id.ToString() ) - ), - new JoinSpec[0] + ) ); if(count > 0) { return (s == "0") ? null : s; //if there are some unread posts earlier than minPost diff --git a/Core/DB/IDBConnection.cs b/Core/DB/IDBConnection.cs index 109ec72..8565d75 100644 --- a/Core/DB/IDBConnection.cs +++ b/Core/DB/IDBConnection.cs @@ -10,7 +10,7 @@ namespace FLocal.Core.DB { List LoadIdsByConditions(ITableSpec table, conditions.AbstractCondition conditions, Diapasone diapasone, JoinSpec[] joins, SortSpec[] sorts, bool allowHugeLists); - long GetCountByConditions(ITableSpec table, conditions.AbstractCondition conditions, JoinSpec[] joins); + long GetCountByConditions(ITableSpec table, conditions.AbstractCondition conditions, params JoinSpec[] joins); Transaction beginTransaction(System.Data.IsolationLevel iso); diff --git a/IISMainHandler/handlers/BoardsHandler.cs b/IISMainHandler/handlers/BoardsHandler.cs index 175e476..5b04cd2 100644 --- a/IISMainHandler/handlers/BoardsHandler.cs +++ b/IISMainHandler/handlers/BoardsHandler.cs @@ -23,7 +23,7 @@ namespace FLocal.IISHandler.handlers { override protected XElement[] getSpecificData(WebContext context) { return new XElement[] { new XElement("categories", from category in Category.allCategories select category.exportToXmlForMainPage(context)), - new XElement("totalRegistered", Config.instance.mainConnection.GetCountByConditions(User.TableSpec.instance, new EmptyCondition(), new JoinSpec[0])), + new XElement("totalRegistered", Config.instance.mainConnection.GetCountByConditions(User.TableSpec.instance, new EmptyCondition())), new XElement("activity", new XElement("threshold", Config.instance.ActivityThreshold.ToString()), new XElement("sessions", Config.instance.mainConnection.GetCountByConditions( @@ -32,8 +32,7 @@ namespace FLocal.IISHandler.handlers { Session.TableSpec.instance.getColumnSpec(Session.TableSpec.FIELD_LASTACTIVITY), ComparisonType.GREATEROREQUAL, DateTime.Now.Subtract(Config.instance.ActivityThreshold).ToUTCString() - ), - new JoinSpec[0] + ) )) ), new XElement("currentDate", DateTime.Now.ToXml()), diff --git a/IISMainHandler/handlers/ThreadHandler.cs b/IISMainHandler/handlers/ThreadHandler.cs index 2311562..2b788a1 100644 --- a/IISMainHandler/handlers/ThreadHandler.cs +++ b/IISMainHandler/handlers/ThreadHandler.cs @@ -42,8 +42,7 @@ namespace FLocal.IISHandler.handlers { ComparisonType.LESSTHAN, int.Parse(context.requestParts[2].PHPSubstring(1)).ToString() ) - ), - new JoinSpec[0] + ) ) } }, diff --git a/MySQLConnector/Connection.cs b/MySQLConnector/Connection.cs index c7a7aa1..5e73467 100644 --- a/MySQLConnector/Connection.cs +++ b/MySQLConnector/Connection.cs @@ -157,7 +157,7 @@ namespace FLocal.MySQLConnector { } } - public long GetCountByConditions(ITableSpec table, FLocal.Core.DB.conditions.AbstractCondition conditions, JoinSpec[] joins) { + public long GetCountByConditions(ITableSpec table, FLocal.Core.DB.conditions.AbstractCondition conditions, params JoinSpec[] joins) { using(DbConnection connection = this.createConnection()) { using(DbCommand command = connection.CreateCommand()) { diff --git a/templates/Full/Board.xslt b/templates/Full/Board.xslt index f865683..a370b67 100644 --- a/templates/Full/Board.xslt +++ b/templates/Full/Board.xslt @@ -106,8 +106,8 @@ Тема Автор - Просмотры - Ответы + Просмотров + Постов Последнее diff --git a/templates/Full/elems/ThreadInfo.xslt b/templates/Full/elems/ThreadInfo.xslt index 57a6f57..40e2b16 100644 --- a/templates/Full/elems/ThreadInfo.xslt +++ b/templates/Full/elems/ThreadInfo.xslt @@ -58,12 +58,11 @@ - - (10) - - - (41) - + + + () + +