From 63c7153dda26ca42922c3eb2886f56460ea363b8 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Fri, 2 Jul 2010 12:12:01 +0000 Subject: [PATCH] User's posts list implemented --- Builder/IISMainHandler/build.txt | 2 +- Builder/IISUploadHandler/build.txt | 2 +- Common/dataobjects/User.cs | 21 ++++++++ IISMainHandler/HandlersFactory.cs | 13 ++++- IISMainHandler/IISMainHandler.csproj | 1 + templates/Full/UserInfo.xslt | 1 + templates/Full/UserPosts.xslt | 77 ++++++++++++++++++++++++++++ 7 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 templates/Full/UserPosts.xslt diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 281cd66..2d3d9c2 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -469 \ No newline at end of file +472 \ No newline at end of file diff --git a/Builder/IISUploadHandler/build.txt b/Builder/IISUploadHandler/build.txt index e0d1ea1..6e16ebf 100644 --- a/Builder/IISUploadHandler/build.txt +++ b/Builder/IISUploadHandler/build.txt @@ -1 +1 @@ -205 \ No newline at end of file +208 \ No newline at end of file diff --git a/Common/dataobjects/User.cs b/Common/dataobjects/User.cs index fa55d18..a9b6e31 100644 --- a/Common/dataobjects/User.cs +++ b/Common/dataobjects/User.cs @@ -201,5 +201,26 @@ namespace FLocal.Common.dataobjects { return desiredLayer; } + public IEnumerable getPosts(Diapasone diapasone) { + return Post.LoadByIds( + from stringId in Config.instance.mainConnection.LoadIdsByConditions( + Post.TableSpec.instance, + new ComparisonCondition( + Post.TableSpec.instance.getColumnSpec(Post.TableSpec.FIELD_POSTERID), + ComparisonType.EQUAL, + this.id.ToString() + ), + diapasone, + new JoinSpec[0], + new SortSpec[] { + new SortSpec( + Post.TableSpec.instance.getIdSpec(), + false + ), + } + ) select int.Parse(stringId) + ); + } + } } diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs index de74123..9f601dc 100644 --- a/IISMainHandler/HandlersFactory.cs +++ b/IISMainHandler/HandlersFactory.cs @@ -63,7 +63,18 @@ namespace FLocal.IISHandler { case "users": return new handlers.response.UserListHandler(); case "user": - return new handlers.response.UserInfoHandler(); + if(context.requestParts.Length < 2) { + return new handlers.WrongUrlHandler(); + } + if(context.requestParts.Length == 2) { + return new handlers.response.UserInfoHandler(); + } + switch(context.requestParts[2].ToLower()) { + case "posts": + return new handlers.response.UserPostsHandler(); + default: + return new handlers.WrongUrlHandler(); + } case "settings": return new handlers.response.SettingsHandler(); case "conversations": diff --git a/IISMainHandler/IISMainHandler.csproj b/IISMainHandler/IISMainHandler.csproj index dac0827..bd5b96f 100644 --- a/IISMainHandler/IISMainHandler.csproj +++ b/IISMainHandler/IISMainHandler.csproj @@ -86,6 +86,7 @@ + diff --git a/templates/Full/UserInfo.xslt b/templates/Full/UserInfo.xslt index b414d17..4997641 100644 --- a/templates/Full/UserInfo.xslt +++ b/templates/Full/UserInfo.xslt @@ -196,6 +196,7 @@ | + /User//Posts/ Показать все сообщения пользователя diff --git a/templates/Full/UserPosts.xslt b/templates/Full/UserPosts.xslt new file mode 100644 index 0000000..3f84be1 --- /dev/null +++ b/templates/Full/UserPosts.xslt @@ -0,0 +1,77 @@ + + + + + + + + + +
+ + + + +
+ + + + +
+ + + /Users/ + Пользователи + + >> + + /User/ + + + >> + Посты + +
+
+
+
+ + + + +
+ + + + + + + + +
+ + + + +
+ страницы: + + /User//Posts/ + +
+
+ + + + +
+ страницы: + + /User//Posts/ + +
+
+
+
+ +
\ No newline at end of file