diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (25).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (25).png new file mode 100644 index 0000000..3bcda89 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (25).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (26).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (26).png new file mode 100644 index 0000000..cf0c6fb Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (26).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (27).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (27).png new file mode 100644 index 0000000..4d98c63 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (27).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (28).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (28).png new file mode 100644 index 0000000..45dd9e6 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (28).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (29).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (29).png new file mode 100644 index 0000000..dfa9577 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (29).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (30).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (30).png new file mode 100644 index 0000000..0e1ac8a Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (30).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (31).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (31).png new file mode 100644 index 0000000..c4eeb44 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (31).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (32).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (32).png new file mode 100644 index 0000000..5d7d704 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (32).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (33).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (33).png new file mode 100644 index 0000000..ca98de0 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (33).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (34).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (34).png new file mode 100644 index 0000000..5304df2 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (34).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (35).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (35).png new file mode 100644 index 0000000..8f0525a Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (35).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (36).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (36).png new file mode 100644 index 0000000..8ba3fd2 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (36).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (37).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (37).png new file mode 100644 index 0000000..4045ae7 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (37).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (38).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (38).png new file mode 100644 index 0000000..5256a44 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (38).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (39).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (39).png new file mode 100644 index 0000000..759727c Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (39).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (40).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (40).png new file mode 100644 index 0000000..e76b125 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (40).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (41).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (41).png new file mode 100644 index 0000000..be69f7a Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (41).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (42).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (42).png new file mode 100644 index 0000000..c6a167f Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (42).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (43).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (43).png new file mode 100644 index 0000000..0a0daf8 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (43).png differ diff --git a/Samarth_1710991710_6G-02/Screenshots/Screenshot (44).png b/Samarth_1710991710_6G-02/Screenshots/Screenshot (44).png new file mode 100644 index 0000000..a30b1e6 Binary files /dev/null and b/Samarth_1710991710_6G-02/Screenshots/Screenshot (44).png differ diff --git a/Samarth_1710991710_6G-02/dispatcher-servlet.xml b/Samarth_1710991710_6G-02/dispatcher-servlet.xml new file mode 100644 index 0000000..78e1720 --- /dev/null +++ b/Samarth_1710991710_6G-02/dispatcher-servlet.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/hibernate.cfg.xml b/Samarth_1710991710_6G-02/hibernate.cfg.xml new file mode 100644 index 0000000..0c73400 --- /dev/null +++ b/Samarth_1710991710_6G-02/hibernate.cfg.xml @@ -0,0 +1,38 @@ + + + + + + + + org.hibernate.dialect.MySQLDialect + + + + com.mysql.jdbc.Driver + + + + + + jdbc:mysql://localhost:3306/news_hunt + + + + root + + + + rootroot + + update + + + + + + + + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/accountmanagement/controller/AccountInfo.java b/Samarth_1710991710_6G-02/newshunt/accountmanagement/controller/AccountInfo.java new file mode 100644 index 0000000..07a7a7f --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/accountmanagement/controller/AccountInfo.java @@ -0,0 +1,70 @@ +package com.newshunt.accountmanagement.controller; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.signup; +@Controller + +public class AccountInfo +{ + @RequestMapping("/accountInfo") + public String accountInfo() + { + return "accountPage"; + } + + @RequestMapping(value="/updateAccountInfo", method=RequestMethod.POST) + @ResponseBody + public byte updateAccountInfo(@RequestBody signup rec, HttpSession hs) + { + byte flag = 0; + try + { + String un = hs.getAttribute("un").toString(); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(signup.class); + cr.add(Restrictions.eq("email", un)); + signup r = (signup)cr.uniqueResult(); + r.setName(rec.getName()); + r.setPassword(rec.getPassword()); + r.setPhone(rec.getPhone()); + ss.beginTransaction().commit(); + flag = 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return flag; + } + + @RequestMapping(value="/fetchAccountInfo", method=RequestMethod.POST) + @ResponseBody + public signup fetchinfo(HttpSession hs) + { + String un = hs.getAttribute("un").toString(); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(signup.class); + cr.add(Restrictions.eq("email", un)); + signup r = (signup)cr.uniqueResult(); + return r; + } + +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminChannelManagement.java b/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminChannelManagement.java new file mode 100644 index 0000000..2ee72f4 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminChannelManagement.java @@ -0,0 +1,136 @@ +package com.newshunt.admin.controller; + +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.ChannelListDao; +import com.newshunt.daomodel.MenuDao; +import com.newshunt.daomodel.signup; + +@Controller +public class AdminChannelManagement +{ + @RequestMapping("/AddUserChannel") + public String AddUserChannel() + { + return "admin/addUserChannel"; + } + + @RequestMapping(value="/ChannelAddOn", method = RequestMethod.POST) + @ResponseBody + public byte ChannelAddOn(@RequestBody ChannelListDao r) + { + byte a=0; + try + { + ChannelListDao p = new ChannelListDao(); + p.setId(r.getId()); + p.setTitle(r.getTitle()); + p.setDescription(r.getDescription()); + p.setImage(r.getImage()); + p.setUrl(r.getUrl()); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.save(p); + ss.beginTransaction().commit(); + a=1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return a; + } + + @RequestMapping("/ChannelList") + public String ChannelList() + { + return "admin/channelList"; + } + + @RequestMapping(value = "/ShowChannelList" , method = RequestMethod.POST) + @ResponseBody + public ListShowChannelList() + { + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(ChannelListDao.class); + Listp=cr.list(); + if(p.isEmpty()!=true) + return p; + + return null; + } + + @RequestMapping(value="/updateChannelInfo", method=RequestMethod.POST) + @ResponseBody + public byte updateChannelInfo(@RequestBody ChannelListDao rec, HttpSession hs) + { + byte flag = 0; + try + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.update(rec); + ss.beginTransaction().commit(); + flag = 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return flag; + } + + @RequestMapping(value="/deleteChannelInfo", method=RequestMethod.POST) + @ResponseBody + public int del1(@RequestBody ChannelListDao rec) + { + int flag=0; + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria criteria = ss.createCriteria(signup.class); + Listinfo =criteria.list(); + for(signup w : info) { + String updateChannel=""; + if(w.getMychannel().contains(rec.getId()+"")); + { + String m[] = w.getMychannel().split(","); + for(String v: m) { + if(v.equals(rec.getId()+"")){ + continue; + } + else { + updateChannel = updateChannel + v +","; + } + } + w.setMychannel(updateChannel); + ss.update(w); + flag=1; + } + } + ss.delete(rec); + ss.beginTransaction().commit(); + return flag; + } + +} diff --git a/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminHome.java b/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminHome.java new file mode 100644 index 0000000..a4c46e0 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminHome.java @@ -0,0 +1,105 @@ +package com.newshunt.admin.controller; + +import java.util.HashSet; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.AdminMenuDao; +import com.newshunt.daomodel.ChannelListDao; +import com.newshunt.daomodel.signup; + +@Controller +public class AdminHome +{ + @RequestMapping("/AdminHome") + public String adminhome() + { + return "admin/adminHome"; + } + + @RequestMapping(value = "/AdminMenuList" , method = RequestMethod.POST) + @ResponseBody + public ListadminMenuList() + { + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(AdminMenuDao.class); + Listp=cr.list(); + if(p.isEmpty()!=true) + return p; + + return null; + } + + @RequestMapping(value = "/userListCount" , method = RequestMethod.POST) + @ResponseBody + public int userListCount() + { + int count=0; + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(signup.class); + Listp=cr.list(); + for(signup x:p) + { + count++; + } + return count; + } + + @RequestMapping(value = "/ChannelListCount" , method = RequestMethod.POST) + @ResponseBody + public int ChannelListCount() + { + int count=0; + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(ChannelListDao.class); + Listp=cr.list(); + for(ChannelListDao x:p) + { + count++; + } + + return count; + } + + @RequestMapping(value="/SuscribedListCount", method=RequestMethod.POST) + @ResponseBody + public int SuscribedListCount() + { + int flag=0; + HashSet hs=new HashSet(); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria criteria = ss.createCriteria(signup.class); + Listinfo =criteria.list(); + for(signup w : info) + { + String m[] = w.getMychannel().split(","); + for(String v: m) + { + hs.add(v); + } + } + flag=hs.size(); + return flag; + } +} diff --git a/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminMenuManagement.java b/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminMenuManagement.java new file mode 100644 index 0000000..687742d --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/admin/controller/AdminMenuManagement.java @@ -0,0 +1,121 @@ +package com.newshunt.admin.controller; + +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.MenuDao; + +@Controller +public class AdminMenuManagement +{ + + + @RequestMapping("/AddMenu") + public String AddMenu() + { + return "admin/addMenu"; + } + + @RequestMapping(value="/AddUserMenu", method = RequestMethod.POST) + @ResponseBody + public byte AddMenu(@RequestBody MenuDao r) + { + byte a=0; + try + { + MenuDao p = new MenuDao(); + p.setId(r.getId()); + p.setName(r.getName()); + p.setUrl(r.getUrl()); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.save(p); + ss.beginTransaction().commit(); + a=1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return a; + } + + @RequestMapping("/MenuList") + public String MenuList() + { + return "admin/menuList"; + } + + @RequestMapping(value = "/ShowMenuList" , method = RequestMethod.POST) + @ResponseBody + public ListShowMenuList() + { + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(MenuDao.class); + Listp=cr.list(); + if(p.isEmpty()!=true) + return p; + + return null; + } + + @RequestMapping(value="/updateMenuInfo", method=RequestMethod.POST) + @ResponseBody + public byte updateMenuInfo(@RequestBody MenuDao rec, HttpSession hs) + { + byte flag = 0; + try + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.update(rec); + ss.beginTransaction().commit(); + flag = 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return flag; + } + + @RequestMapping(value="/deleteMenuInfo", method=RequestMethod.POST) + @ResponseBody + public byte deleteMenuInfo(@RequestBody MenuDao rec, HttpSession hs) + { + byte flag = 0; + try + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.delete(rec); + ss.beginTransaction().commit(); + flag = 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return flag; + } +} diff --git a/Samarth_1710991710_6G-02/newshunt/admin/controller/FeedbackList.java b/Samarth_1710991710_6G-02/newshunt/admin/controller/FeedbackList.java new file mode 100644 index 0000000..e50678f --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/admin/controller/FeedbackList.java @@ -0,0 +1,66 @@ +package com.newshunt.admin.controller; + +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.FeedbackDao; +import com.newshunt.daomodel.MenuDao; + +@Controller +public class FeedbackList +{ + @RequestMapping("/userfeedback") + public String userfeedback() + { + return "admin/userfeedback"; + } + + @RequestMapping(value = "/feedbackList" , method = RequestMethod.POST) + @ResponseBody + public ListfeedbackList() + { + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(FeedbackDao.class); + Listp=cr.list(); + if(p.isEmpty()!=true) + return p; + + return null; + } + + @RequestMapping(value="/deleteFeedbackInfo", method=RequestMethod.POST) + @ResponseBody + public byte deleteFeedbackInfo(@RequestBody FeedbackDao rec, HttpSession hs) + { + byte flag = 0; + try + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.delete(rec); + ss.beginTransaction().commit(); + flag = 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return flag; + } +} diff --git a/Samarth_1710991710_6G-02/newshunt/admin/controller/UserList.java b/Samarth_1710991710_6G-02/newshunt/admin/controller/UserList.java new file mode 100644 index 0000000..a8c4730 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/admin/controller/UserList.java @@ -0,0 +1,88 @@ +package com.newshunt.admin.controller; + +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.MenuDao; +import com.newshunt.daomodel.signup; + +@Controller +public class UserList +{ + @RequestMapping("/userManagement") + public String userlist() + { + return "admin/userlist"; + } + + @RequestMapping(value = "/userList" , method = RequestMethod.POST) + @ResponseBody + public ListuserList() + { + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(signup.class); + Listp=cr.list(); + if(p.isEmpty()!=true) + return p; + + return null; + } + + @RequestMapping(value="/updateUserInfo", method=RequestMethod.POST) + @ResponseBody + public byte updateUserInfo(@RequestBody signup rec, HttpSession hs) + { + byte flag = 0; + try + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.update(rec); + ss.beginTransaction().commit(); + flag = 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return flag; + } + + @RequestMapping(value="/deleteUserInfo", method=RequestMethod.POST) + @ResponseBody + public byte deleteUserInfo(@RequestBody signup rec, HttpSession hs) + { + byte flag = 0; + try + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.delete(rec); + ss.beginTransaction().commit(); + flag = 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return flag; + } +} diff --git a/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/ChannelList.java b/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/ChannelList.java new file mode 100644 index 0000000..4cc217b --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/ChannelList.java @@ -0,0 +1,108 @@ +package com.newshunt.channelmanagement.controller; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.ChannelListDao; +import com.newshunt.daomodel.signup; +@Controller +public class ChannelList +{ + + @RequestMapping("/addChannel") + public String addChannel() + { + return "addChannels"; + } + + @ResponseBody + @RequestMapping(value= "/channellist", method=RequestMethod.POST) + public List channel(HttpSession hs) + { + String un = hs.getAttribute("un").toString(); + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(signup.class); + cr.add(Restrictions.eq("email", un)); + signup rec = (signup)cr.uniqueResult(); + String z = rec.getMychannel(); + if(z!=null) + { + String m[] = z.split(","); + ArrayList al = new ArrayList(); + for(String p:m) + { + al.add(p); + } + Criteria criteria = ss.createCriteria(ChannelListDao.class); + criteria.add(Restrictions.not(Restrictions.in("id", al))); + Listp=criteria.list(); + if(p.isEmpty()!=true) + return p; + else + return null; + } + else + { + cr = ss.createCriteria(ChannelListDao.class); + Listp=cr.list(); + if(p.isEmpty()!=true) + return p; + else + return null; + } + } + + @RequestMapping(value="/subscribe", method = RequestMethod.POST) + @ResponseBody + public byte suscribe(@RequestBody signup r , HttpSession session) + { + try + { + String un = session.getAttribute("un").toString(); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria criteria = ss.createCriteria(signup.class); + criteria.add(Restrictions.eq("email", un)); + signup rec = (signup)criteria.uniqueResult(); + String z = rec.getMychannel(); + if(z!=null) + { + String x = r.getMychannel(); + String n = z.concat(x); + rec.setMychannel(n); + } + else + { + rec.setMychannel(r.getMychannel()); + } + ss.update(rec); + ss.beginTransaction().commit(); + return 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return 0; + } + + +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/FavChannels.java b/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/FavChannels.java new file mode 100644 index 0000000..c43df41 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/FavChannels.java @@ -0,0 +1,124 @@ +package com.newshunt.channelmanagement.controller; + +import java.net.URL; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.ChannelListDao; +import com.newshunt.daomodel.signup; +import com.newshunt.dto.ChannelNews; +import com.sun.syndication.feed.synd.SyndEntry; +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.io.SyndFeedInput; +import com.sun.syndication.io.XmlReader; + +@Controller +public class FavChannels +{ + @RequestMapping("/favChannel") + public String mychannel() + { + return "favChannel"; + } + + @RequestMapping(value="/fav", method = RequestMethod.POST) + @ResponseBody + public byte fav(@RequestBody signup r , HttpSession session) + { + byte a=0; + try + { + String un = session.getAttribute("un").toString(); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria criteria = ss.createCriteria(signup.class); + criteria.add(Restrictions.eq("email", un)); + signup rec = (signup)criteria.uniqueResult(); + rec.setFavchannel(r.getFavchannel()); + ss.update(rec); + ss.beginTransaction().commit(); + a=1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return a; + } + + @RequestMapping(value = "/myfav" , method = RequestMethod.POST) + @ResponseBody + public List my(HttpSession session) + { + try + { + String email=session.getAttribute("un").toString(); + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory ss = cfg.buildSessionFactory(); + Session s = ss.openSession(); + Criteria cr=s.createCriteria(signup.class); + cr.add(Restrictions.eq("email", email)); + signup rec = (signup)cr.uniqueResult(); + String channel=rec.getFavchannel(); + String m[]=channel.split(","); + ArrayList al=new ArrayList(); + for(String z:m) + { + al.add(z); + } + cr=s.createCriteria(ChannelListDao.class); + cr.add(Restrictions.in("id", al)); + List ls=cr.list(); + LinkedList cn = new LinkedList(); + for(ChannelListDao ch : ls) + { + URL url = new URL(ch.getUrl()); + SyndFeedInput sf = new SyndFeedInput(); + SyndFeed ff = sf.build(new XmlReader(url)); + List list = ff.getEntries(); + for(int j=0;j<2;j++) + { + ChannelNews sc = new ChannelNews(); + String title = ((SyndEntry) list.get(j)).getTitle(); + sc.setTitle(title); + String link = ((SyndEntry) list.get(j)).getLink(); + sc.setLink(link); + Date D = ((SyndEntry) list.get(j)).getPublishedDate(); + Date date = Calendar.getInstance().getTime(); + DateFormat dateFormat = new SimpleDateFormat("dd-MMMM-yyyy"); + String strDate = dateFormat.format(date); + sc.setDate(strDate); + sc.setChannelName(ch.getTitle()); + cn.add(sc); + } + } + return cn; + } + catch(Exception e) + { + e.printStackTrace(); + } + return null; + } +} diff --git a/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/Mychannels.java b/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/Mychannels.java new file mode 100644 index 0000000..eb01380 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/channelmanagement/controller/Mychannels.java @@ -0,0 +1,85 @@ +package com.newshunt.channelmanagement.controller; + +import com.newshunt.daomodel.ChannelListDao; +import com.newshunt.daomodel.signup; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpSession; +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +@Controller +public class Mychannels +{ + + @RequestMapping("/myChannel") + public String mychannel() + { + return "myChannel"; + } + + @ResponseBody + @RequestMapping(value= "/myChannelList", method=RequestMethod.POST) + public ListmyChannelList(HttpSession hs) + { + String un = hs.getAttribute("un").toString(); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cc = ss.createCriteria(signup.class); + cc.add(Restrictions.eq("email", un)); + signup rec = (signup)cc.uniqueResult(); + String ch = rec.getMychannel(); + String m[] = ch.split(","); + ArrayListal = new ArrayList(); + for(String z:m) + { + al.add(z); + } + Criteria c = ss.createCriteria(ChannelListDao.class); + c.add(Restrictions.in("id", al)); + Listsubscribedlist = c.list(); + if(subscribedlist.isEmpty()!=true) + return subscribedlist; + else + return null; + } + + + @RequestMapping(value="/unsubscribe", method = RequestMethod.POST) + @ResponseBody + public byte subscribe(@RequestBody signup r , HttpSession hs) + { + try + { + String un = hs.getAttribute("un").toString(); + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria criteria = ss.createCriteria(signup.class); + criteria.add(Restrictions.eq("email", un)); + signup rec = (signup)criteria.uniqueResult(); + rec.setMychannel(r.getMychannel()); + ss.update(rec); + ss.beginTransaction().commit(); + return 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return 0; + } + +} diff --git a/Samarth_1710991710_6G-02/newshunt/daomodel/AdminMenuDao.java b/Samarth_1710991710_6G-02/newshunt/daomodel/AdminMenuDao.java new file mode 100644 index 0000000..43c0c8b --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/daomodel/AdminMenuDao.java @@ -0,0 +1,42 @@ +package com.newshunt.daomodel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "admin_menu") +public class AdminMenuDao +{ + @Id + int id; + String name; + String url; + + public int getId() + { + return id; + } + public void setId(int id) + { + this.id = id; + } + + public String getName() + { + return name; + } + public void setName(String name) + { + this.name = name; + } + + public String getUrl() + { + return url; + } + public void setUrl(String url) + { + this.url = url; + } +} diff --git a/Samarth_1710991710_6G-02/newshunt/daomodel/ChannelListDao.java b/Samarth_1710991710_6G-02/newshunt/daomodel/ChannelListDao.java new file mode 100644 index 0000000..de7876c --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/daomodel/ChannelListDao.java @@ -0,0 +1,63 @@ +package com.newshunt.daomodel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="channel_list") +public class ChannelListDao +{ + @Id + String id; + String title; + String url; + String description; + String image; + + public String getId() + { + return id; + } + public void setId(String id) + { + this.id = id; + } + + public String getUrl() + { + return url; + } + public void setUrl(String url) + { + this.url = url; + } + + public String getTitle() + { + return title; + } + public void setTitle(String title) + { + this.title = title; + } + + public String getDescription() + { + return description; + } + public void setDescription(String description) + { + this.description = description; + } + + public String getImage() + { + return image; + } + public void setImage(String image) + { + this.image = image; + } + +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/daomodel/FeedbackDao.java b/Samarth_1710991710_6G-02/newshunt/daomodel/FeedbackDao.java new file mode 100644 index 0000000..1dce38b --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/daomodel/FeedbackDao.java @@ -0,0 +1,42 @@ +package com.newshunt.daomodel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="feedback") +public class FeedbackDao +{ + @Id + String email; + String subject; + String message; + + public String getEmail() + { + return email; + } + public void setEmail(String email) + { + this.email = email; + } + + public String getSubject() + { + return subject; + } + public void setSubject(String subject) + { + this.subject = subject; + } + + public String getMessage() + { + return message; + } + public void setMessage(String message) + { + this.message = message; + } +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/daomodel/MenuDao.java b/Samarth_1710991710_6G-02/newshunt/daomodel/MenuDao.java new file mode 100644 index 0000000..7a4860b --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/daomodel/MenuDao.java @@ -0,0 +1,41 @@ +package com.newshunt.daomodel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +@Entity +@Table(name = "menu") +public class MenuDao +{ + @Id + int id; + String name; + String url; + + public int getId() + { + return id; + } + public void setId(int id) + { + this.id = id; + } + + public String getName() + { + return name; + } + public void setName(String name) + { + this.name = name; + } + + public String getUrl() + { + return url; + } + public void setUrl(String url) + { + this.url = url; + } +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/daomodel/signup.java b/Samarth_1710991710_6G-02/newshunt/daomodel/signup.java new file mode 100644 index 0000000..3d04265 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/daomodel/signup.java @@ -0,0 +1,87 @@ +package com.newshunt.daomodel; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="user_account") +public class signup +{ + @Id + @Column(name="email_id") + String email; + String name; + String password; + @Column(name="confirm_password") + String confirmPassword; + @Column(name="phone_no") + String phone; + String mychannel; + String favchannel; + + public String getMychannel() + { + return mychannel; + } + public void setMychannel(String mychannel) + { + this.mychannel = mychannel; + } + + public String getEmail() + { + return email; + } + public void setEmail(String email) + { + this.email = email; + } + + public String getName() + { + return name; + } + public void setName(String name) + { + this.name = name; + } + + public String getPassword() + { + return password; + } + public void setPassword(String password) + { + this.password = password; + } + + public String getConfirmPassword() + { + return confirmPassword; + } + public void setConfirmPassword(String confirmPassword) + { + this.confirmPassword = confirmPassword; + } + + public String getPhone() + { + return phone; + } + public void setPhone(String phone) + { + this.phone = phone; + } + + public String getFavchannel() + { + return favchannel; + } + public void setFavchannel(String favchannel) + { + this.favchannel = favchannel; + } + +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/dto/ChannelNews.java b/Samarth_1710991710_6G-02/newshunt/dto/ChannelNews.java new file mode 100644 index 0000000..2d74f6b --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/dto/ChannelNews.java @@ -0,0 +1,45 @@ +package com.newshunt.dto; + +public class ChannelNews +{ + String title; + String link; + String date; + String channelName; + + public String getTitle() + { + return title; + } + public void setTitle(String title) + { + this.title = title; + } + + public String getLink() + { + return link; + } + public void setLink(String link) + { + this.link = link; + } + + public String getDate() + { + return date; + } + public void setDate(String date) + { + this.date = date; + } + + public String getChannelName() + { + return channelName; + } + public void setChannelName(String channelName) + { + this.channelName = channelName; + } +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/feedback/controller/Feedbackform.java b/Samarth_1710991710_6G-02/newshunt/feedback/controller/Feedbackform.java new file mode 100644 index 0000000..102d575 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/feedback/controller/Feedbackform.java @@ -0,0 +1,44 @@ +package com.newshunt.feedback.controller; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.FeedbackDao; +import com.newshunt.daomodel.signup; + +@Controller +public class Feedbackform +{ + @RequestMapping("/submitFeedback") + public String submitFeedback() + { + return "feedbackPage"; + } + + @RequestMapping(value="/feedbackform" , method=RequestMethod.POST) + @ResponseBody + public byte feedbackform(@RequestBody FeedbackDao rec) + { + try + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + ss.save(rec); + ss.beginTransaction().commit(); + return 1; + } + catch(Exception e) + { + e.printStackTrace(); + } + return 0; + } +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/livenews/controller/News.java b/Samarth_1710991710_6G-02/newshunt/livenews/controller/News.java new file mode 100644 index 0000000..099a216 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/livenews/controller/News.java @@ -0,0 +1,92 @@ +package com.newshunt.livenews.controller; + +import java.net.URI; +import java.net.URL; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.criterion.Restrictions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.ChannelListDao; +import com.newshunt.daomodel.signup; +import com.newshunt.dto.ChannelNews; +import com.sun.syndication.feed.synd.SyndEntry; +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.io.SyndFeedInput; +import com.sun.syndication.io.XmlReader; + +@Controller +public class News +{ + @RequestMapping(value = "/news" , method = RequestMethod.POST) + @ResponseBody + public List news(HttpSession session) + { + try + { + String email=session.getAttribute("un").toString(); + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory ss = cfg.buildSessionFactory(); + Session s = ss.openSession(); + Criteria cr=s.createCriteria(signup.class); + cr.add(Restrictions.eq("email", email)); + signup rec = (signup)cr.uniqueResult(); + String channel=rec.getMychannel(); + String m[]=channel.split(","); + ArrayList al=new ArrayList(); + for(String z:m) + { + al.add(z); + } + cr=s.createCriteria(ChannelListDao.class); + cr.add(Restrictions.in("id", al)); + List ls=cr.list(); + LinkedList cn = new LinkedList(); + for(ChannelListDao ch : ls) + { + URL url = new URL(ch.getUrl()); + SyndFeedInput sf = new SyndFeedInput(); + SyndFeed ff = sf.build(new XmlReader(url)); + List list = ff.getEntries(); + for(int j=0;j<2;j++) + { + ChannelNews sc = new ChannelNews(); + String title = ((SyndEntry) list.get(j)).getTitle(); + sc.setTitle(title); + String link = ((SyndEntry) list.get(j)).getLink(); + sc.setLink(link); + Date D = ((SyndEntry) list.get(j)).getPublishedDate(); + Date date = Calendar.getInstance().getTime(); + DateFormat dateFormat = new SimpleDateFormat("dd-MMMM-yyyy"); + String strDate = dateFormat.format(date); + sc.setDate(strDate); + sc.setChannelName(ch.getTitle()); + cn.add(sc); + } + } + return cn; + } + catch(Exception e) + { + e.printStackTrace(); + } + return null; + } + +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/loginsignup/controller/LoginSignup.java b/Samarth_1710991710_6G-02/newshunt/loginsignup/controller/LoginSignup.java new file mode 100644 index 0000000..5e36f26 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/loginsignup/controller/LoginSignup.java @@ -0,0 +1,116 @@ +package com.newshunt.loginsignup.controller; + +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.signup; + +@Controller +public class LoginSignup +{ + + @RequestMapping("/") + public String login() + { + return "login"; + } + + @RequestMapping("/signup") + public String signup() + { + return "signup"; + } + + @RequestMapping(value="/saveUserInfo" , method=RequestMethod.POST) + @ResponseBody + public int saveUserInfo(@RequestBody signup rec) + { + int a=0; + try + { + if(rec.getName().equals("") || rec.getEmail().equals("") || rec.getPhone().equals("") || rec.getPassword().equals("") || rec.getConfirmPassword().equals("")) + { + a=1; + } + else + { + Configuration cfg= new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(signup.class); + Listz=cr.list(); + for(signup m:z) + { + if(rec.getEmail().equals(m.getEmail())) + { + a=2; + } + } + if(rec.getPassword().equals(rec.getConfirmPassword()) && a!=2) + { + a=3; + ss.save(rec); + ss.beginTransaction().commit(); + } + } + } + catch(Exception e) + { + a=1; + e.printStackTrace(); + } + return a; + } + + @ResponseBody + @RequestMapping(value="/checkInfo", method=RequestMethod.POST) + public int checkInfo(@RequestBody signup r, HttpSession session) + { + String un=""; + int flag=0; + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(signup.class); + Listp=cr.list(); + for(signup x:p) + { + if(r.getEmail().equals(x.getEmail()) && r.getPassword().equals(x.getPassword())) + { + flag=1; + un = r.getEmail(); + session.setAttribute("un",un); + } + else if(r.getEmail().equals("admin") && r.getPassword().equals("admin")) + { + flag=2; + } + } + return flag; + } + + @RequestMapping(value="/username", method = RequestMethod.POST) + @ResponseBody + public ArrayList username(HttpSession session) + { + String uname = session.getAttribute("un").toString(); + ArrayListal=new ArrayList(); + al.add(uname); + return al; + } + +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/newshunt/menu/controller/MenuManagement.java b/Samarth_1710991710_6G-02/newshunt/menu/controller/MenuManagement.java new file mode 100644 index 0000000..80e6962 --- /dev/null +++ b/Samarth_1710991710_6G-02/newshunt/menu/controller/MenuManagement.java @@ -0,0 +1,42 @@ +package com.newshunt.menu.controller; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.newshunt.daomodel.MenuDao; +import com.newshunt.daomodel.signup; + +@Controller +public class MenuManagement +{ + @RequestMapping("/home") + public String home() + { + return "home"; + } + + @RequestMapping(value = "/userMenuList" , method = RequestMethod.POST) + @ResponseBody + public ListuserMenuList() + { + Configuration cfg = new Configuration(); + cfg.configure("hibernate.cfg.xml"); + SessionFactory sf = cfg.buildSessionFactory(); + Session ss = sf.openSession(); + Criteria cr = ss.createCriteria(MenuDao.class); + Listp=cr.list(); + if(p.isEmpty()!=true) + return p; + + return null; + } + +} \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/pom.xml b/Samarth_1710991710_6G-02/pom.xml new file mode 100644 index 0000000..46667c0 --- /dev/null +++ b/Samarth_1710991710_6G-02/pom.xml @@ -0,0 +1,129 @@ + + 4.0.0 + com + newshunt + war + 0.0.1-SNAPSHOT + newshunt Maven Webapp + http://maven.apache.org + + + it.sauronsoftware.cron4j + cron4j + 2.2.5 + + + net.java.dev.rome + rome + 1.0.0 + + + net.java.dev.rome + rome + 1.0.0 + + + it.sauronsoftware.cron4j + cron4j + 2.2.5 + + + junit + junit + 4.12 + test + + + javax.servlet + javax.servlet-api + 3.1.0 + + + javax.servlet + jstl + 1.2 + + + org.springframework + spring-core + 4.3.0.RELEASE + + + org.springframework + spring-web + 4.3.0.RELEASE + + + org.springframework + spring-webmvc + 4.3.0.RELEASE + + + org.springframework + spring-context + 4.3.0.RELEASE + + + org.springframework + spring-aop + 4.3.0.RELEASE + + + org.springframework + spring-jdbc + 4.3.0.RELEASE + + + mysql + mysql-connector-java + 5.1.47 + + + org.springframework.security + spring-security-taglibs + 4.2.6.RELEASE + + + org.springframework.security + spring-security-config + 4.2.6.RELEASE + + + org.springframework.security + spring-security-web + 4.2.6.RELEASE + + + org.hibernate + hibernate-core + 4.3.1.Final + + + + org.springframework + spring-orm + 4.3.0.RELEASE + + + javax.validation + validation-api + 1.1.0.Final + + + com.fasterxml.jackson.core + jackson-databind + 2.8.8 + + + jstl + jstl + 1.2 + + + + newshunt + + diff --git a/Samarth_1710991710_6G-02/views/accountPage.jsp b/Samarth_1710991710_6G-02/views/accountPage.jsp new file mode 100644 index 0000000..dd840a3 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/accountPage.jsp @@ -0,0 +1,183 @@ + + + + + + + + + + + + + +
+ + + +
+ +
+ +
+
+

+ EMAIL ID :   + +
+
+ NAME :   + +
+
+ PASSWORD :   + +
+
+ PHONE NO :   + +
+
+ +

+
+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/addChannels.jsp b/Samarth_1710991710_6G-02/views/addChannels.jsp new file mode 100644 index 0000000..8af9d4f --- /dev/null +++ b/Samarth_1710991710_6G-02/views/addChannels.jsp @@ -0,0 +1,183 @@ + + + + Add Channels + + + + + + + + + + + + +
+ + + +
+ +
+ +
+
+
+
+

{{x.title}}

+

{{x.description}}

+
+ +
+
+
+
+
+ +
+
+
+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/admin/addMenu.jsp b/Samarth_1710991710_6G-02/views/admin/addMenu.jsp new file mode 100644 index 0000000..de67091 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/admin/addMenu.jsp @@ -0,0 +1,130 @@ + + + Feedback List + + + + + + + + + + + +
+ + + +
+ +
+ +
+ Id :
+ Name :
+ Url :
+ +
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/admin/addUserChannel.jsp b/Samarth_1710991710_6G-02/views/admin/addUserChannel.jsp new file mode 100644 index 0000000..a7253b9 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/admin/addUserChannel.jsp @@ -0,0 +1,132 @@ + + + Feedback List + + + + + + + + + + + +
+ + + +
+ +
+ +
+ Id :
+ Title :
+ Description :
+ Url :
+ Image :
+ +
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/admin/adminHome.jsp b/Samarth_1710991710_6G-02/views/admin/adminHome.jsp new file mode 100644 index 0000000..26ca6f2 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/admin/adminHome.jsp @@ -0,0 +1,147 @@ + + + Feedback List + + + + + + + + + + + +
+ + + +
+ +
+ +
+

+ + + + + + + + + + + + + + + + + +
No of usersNo of channelsNo of suscribed channelsNo of unsuscribed channels
{{userListCount}}{{ChannelListCount}}{{SuscribedListCount}}{{ChannelListCount-SuscribedListCount}}
+

+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/admin/channelList.jsp b/Samarth_1710991710_6G-02/views/admin/channelList.jsp new file mode 100644 index 0000000..05564a9 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/admin/channelList.jsp @@ -0,0 +1,206 @@ + + + Feedback List + + + + + + + + + + + +
+ + + +
+ +
+ +
+

+ + + + + + + + + + + + + + + + + + + + + +
idtitledescriptionurlimage
{{x.id}}{{x.title}}{{x.description}}{{x.url}}{{x.image}} + + + + + + + + + +

+

+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/admin/menuList.jsp b/Samarth_1710991710_6G-02/views/admin/menuList.jsp new file mode 100644 index 0000000..a3673c7 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/admin/menuList.jsp @@ -0,0 +1,205 @@ + + + Feedback List + + + + + + + + + + + +
+ + + +
+ +
+ +
+

+ + + + + + + + + + + + + + + + + +
idnameurl
{{x.id}}{{x.name}}{{x.url}} + + + + + + + + + +

+

+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/admin/userfeedback.jsp b/Samarth_1710991710_6G-02/views/admin/userfeedback.jsp new file mode 100644 index 0000000..468a172 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/admin/userfeedback.jsp @@ -0,0 +1,149 @@ + + + Feedback List + + + + + + + + + + + +
+ + + +
+ +
+ +
+

+ + + + + + + + + + + + + + + + + +
emailsubjectmessage
{{x.email}}{{x.subject}}{{x.message}}
+ +

+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/admin/userlist.jsp b/Samarth_1710991710_6G-02/views/admin/userlist.jsp new file mode 100644 index 0000000..e1b5681 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/admin/userlist.jsp @@ -0,0 +1,214 @@ + + + Feedback List + + + + + + + + + + + +
+ + + +
+ +
+ +
+

+ + + + + + + + + + + + + + + + + + + + + + + +
email idnamephone numpasswordmychannelfavchannel
{{x.email}}{{x.name}}{{x.phone}}{{x.password}}{{x.mychannel}}{{x.favchannel}} + + + + + + + + + + +
+

+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/favChannel.jsp b/Samarth_1710991710_6G-02/views/favChannel.jsp new file mode 100644 index 0000000..2bcd948 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/favChannel.jsp @@ -0,0 +1,123 @@ + + + Feedback + + + + + + + + + + + +
+ + + +
+ +
+ +
+
+ Channel : {{x.channelName}}
+ Date : {{x.date}}
+ {{x.title}} +
+
+
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/feedbackPage.jsp b/Samarth_1710991710_6G-02/views/feedbackPage.jsp new file mode 100644 index 0000000..7b0b606 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/feedbackPage.jsp @@ -0,0 +1,136 @@ + + + Feedback + + + + + + + + + + + +
+ + + +
+ +
+ +
+

FEEDBACK FORM


+

+ +
+
+ +
+
+ +
+
+
+ +

+
+
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/home.jsp b/Samarth_1710991710_6G-02/views/home.jsp new file mode 100644 index 0000000..9cc8d23 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/home.jsp @@ -0,0 +1,122 @@ + + + Home page + + + + + + + + + + + +
+ + + +
+ +
+ +
+
+ Channel : {{x.channelName}}
+ Date : {{x.date}}
+ {{x.title}} +
+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/login.jsp b/Samarth_1710991710_6G-02/views/login.jsp new file mode 100644 index 0000000..5d5bd98 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/login.jsp @@ -0,0 +1,124 @@ +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> + + +Login + + + + + + + + + + + +
+ +
+
+

+ Login to get going ! +

+
+

+
+
+ +


+
+ +
+
+ +
+
+ + +
+
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/myChannel.jsp b/Samarth_1710991710_6G-02/views/myChannel.jsp new file mode 100644 index 0000000..79298af --- /dev/null +++ b/Samarth_1710991710_6G-02/views/myChannel.jsp @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + +
+ + + +
+ +
+ +
+
+
+
+

{{x.title}}

+

{{x.description}}

+
+
+ +
+
+
+
+
+ + +
+
+
+
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/views/signup.jsp b/Samarth_1710991710_6G-02/views/signup.jsp new file mode 100644 index 0000000..5d911a4 --- /dev/null +++ b/Samarth_1710991710_6G-02/views/signup.jsp @@ -0,0 +1,140 @@ + + + Sign up + + + + + + + + + + + +
+ +
+
+

Sign up for free !

+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + I agree to all terms and conditions +
+
+ +
+
+ +
+ +
+ + \ No newline at end of file diff --git a/Samarth_1710991710_6G-02/web.xml b/Samarth_1710991710_6G-02/web.xml new file mode 100644 index 0000000..9a84fc3 --- /dev/null +++ b/Samarth_1710991710_6G-02/web.xml @@ -0,0 +1,18 @@ + + + + dispatcher-servlet + + + org.springframework.web.servlet.DispatcherServlet + + + contextConfigLocation + /WEB-INF/dispatcher-servlet.xml + + + + dispatcher-servlet + / + + \ No newline at end of file