From 2292625798298d0e4f346f13fa2003b084934203 Mon Sep 17 00:00:00 2001 From: amaron Date: Sun, 12 Aug 2012 02:07:02 +0530 Subject: [PATCH] load more tweets done on all pages. --- .../controller/HomePageController.java | 19 +++- .../TwitMini/controller/LoginController.java | 2 +- .../controller/ProfileViewController.java | 19 ++++ src/main/webapp/WEB-INF/jsp/mentions.jsp | 82 +++++----------- src/main/webapp/WEB-INF/jsp/profileview.jsp | 27 +++++- src/main/webapp/WEB-INF/jsp/randomhome.jsp | 2 - src/main/webapp/WEB-INF/jsp/search.jsp | 35 ++++++- src/main/webapp/static/js/displayNew.js | 8 +- src/main/webapp/static/userActivityLog.log | 94 +++++++++++++++++++ 9 files changed, 215 insertions(+), 73 deletions(-) diff --git a/src/main/java/TwitMini/controller/HomePageController.java b/src/main/java/TwitMini/controller/HomePageController.java index ef6b74b..993e8cc 100644 --- a/src/main/java/TwitMini/controller/HomePageController.java +++ b/src/main/java/TwitMini/controller/HomePageController.java @@ -2,6 +2,7 @@ import TwitMini.model.TweetData; +import TwitMini.model.User; import TwitMini.services.TweetService; import TwitMini.services.UserService; import TwitMini.services.ViewService; @@ -46,18 +47,30 @@ public ModelAndView homeredirect(){ @RequestMapping(value="/search/moreSearchTweets.json", method=RequestMethod.GET) @ResponseBody - public List moreSearchResults(@RequestParam String searchtext, @RequestParam int offset){ + public List moreSearchResultsTweets(@RequestParam String searchtext, @RequestParam int offset){ return viewService.searchTweets(searchtext,offset,10); } + @RequestMapping(value="/search/moreSearchUsers.json", method=RequestMethod.GET) + @ResponseBody + public List moreSearchResultsUsers(@RequestParam String searchtext, @RequestParam int offset){ + return viewService.searchUsers(searchtext, offset, 10); + } + @RequestMapping("/search") public ModelAndView Search(@RequestParam final String searchtext, HttpSession Session){ logger.info("User " + (String)Session.getAttribute("userName") + " searched for "+ searchtext ); + + final List tweet_list= viewService.searchTweets(searchtext,0,10); + final List user_list = viewService.searchUsers(searchtext,0,10); + return new ModelAndView("search"){{ addObject("searchtext",searchtext); - addObject("UserList", viewService.searchUsers(searchtext,0,1000)); - addObject("TweetList", viewService.searchTweets(searchtext,0,10)); + addObject("UserList", user_list); + addObject("TweetList", tweet_list ); + addObject("UserListSize",user_list.size()); + addObject("TweetListSize",tweet_list.size()); } }; diff --git a/src/main/java/TwitMini/controller/LoginController.java b/src/main/java/TwitMini/controller/LoginController.java index 60f40bb..60bf242 100644 --- a/src/main/java/TwitMini/controller/LoginController.java +++ b/src/main/java/TwitMini/controller/LoginController.java @@ -37,7 +37,7 @@ public LoginController(JdbcTemplate db, UserService userService, Logger logger) public ModelAndView index(HttpSession Session) { String userName = (String) Session.getAttribute("userName"); if(userName==null) - return new ModelAndView("index-Karthik"); // will change it to specific register page with only register + return new ModelAndView("index"); // will change it to specific register page with only register else return new ModelAndView("redirect:/home"); } diff --git a/src/main/java/TwitMini/controller/ProfileViewController.java b/src/main/java/TwitMini/controller/ProfileViewController.java index 839b7f5..8b1c40f 100644 --- a/src/main/java/TwitMini/controller/ProfileViewController.java +++ b/src/main/java/TwitMini/controller/ProfileViewController.java @@ -1,5 +1,6 @@ package TwitMini.controller; +import TwitMini.model.TweetData; import TwitMini.model.User; import TwitMini.services.TweetService; import TwitMini.services.UserService; @@ -12,6 +13,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.util.Hashtable; +import java.util.List; import java.util.logging.Logger; /** @@ -102,6 +104,23 @@ public ModelAndView mentions(@PathVariable final String handle) }; } + @RequestMapping(value="{handle}/getMoreMentions.json", method=RequestMethod.GET) + @ResponseBody + public List moreMentions(@PathVariable final String handle, @RequestParam final int offset) + { + + return viewService.listUserMentions(handle,offset,10); + } + + + @RequestMapping(value="{handle}/getMoreUserTweets.json", method=RequestMethod.GET) + @ResponseBody + public List moreUserTwees(@PathVariable final String handle, @RequestParam final int offset) + { + + return viewService.listUserTweets(handle,offset,10); + } + @RequestMapping("{handle}/followers") diff --git a/src/main/webapp/WEB-INF/jsp/mentions.jsp b/src/main/webapp/WEB-INF/jsp/mentions.jsp index 5bab8d3..27bf700 100644 --- a/src/main/webapp/WEB-INF/jsp/mentions.jsp +++ b/src/main/webapp/WEB-INF/jsp/mentions.jsp @@ -1,63 +1,5 @@ - @@ -188,6 +130,26 @@ User ${handle}'s Tweets ${User.num_tweets} + @@ -290,7 +252,9 @@ User ${handle}'s Tweets ${User.num_tweets} - +
+ +
diff --git a/src/main/webapp/WEB-INF/jsp/profileview.jsp b/src/main/webapp/WEB-INF/jsp/profileview.jsp index 9eaaf62..c4bc68e 100644 --- a/src/main/webapp/WEB-INF/jsp/profileview.jsp +++ b/src/main/webapp/WEB-INF/jsp/profileview.jsp @@ -130,6 +130,29 @@ + + + + @@ -291,7 +314,9 @@ - +
+ +
diff --git a/src/main/webapp/WEB-INF/jsp/randomhome.jsp b/src/main/webapp/WEB-INF/jsp/randomhome.jsp index 4019567..4468ce4 100644 --- a/src/main/webapp/WEB-INF/jsp/randomhome.jsp +++ b/src/main/webapp/WEB-INF/jsp/randomhome.jsp @@ -10,8 +10,6 @@ - - diff --git a/src/main/webapp/WEB-INF/jsp/search.jsp b/src/main/webapp/WEB-INF/jsp/search.jsp index 25ec64f..9ae6860 100644 --- a/src/main/webapp/WEB-INF/jsp/search.jsp +++ b/src/main/webapp/WEB-INF/jsp/search.jsp @@ -9,23 +9,46 @@