1 40 package org.dspace.app.webui.servlet.admin; 41 42 import java.io.IOException ; 43 import java.sql.SQLException ; 44 45 import javax.servlet.ServletException ; 46 import javax.servlet.http.HttpServletRequest ; 47 import javax.servlet.http.HttpServletResponse ; 48 49 import org.apache.log4j.Logger; 50 import org.dspace.app.webui.servlet.DSpaceServlet; 51 import org.dspace.app.webui.util.JSPManager; 52 import org.dspace.app.webui.util.UIUtil; 53 import org.dspace.authorize.AuthorizeException; 54 import org.dspace.core.ConfigurationManager; 55 import org.dspace.core.Context; 56 57 62 public class NewsEditServlet extends DSpaceServlet 63 { 64 private static Logger log = Logger.getLogger(NewsEditServlet.class); 65 66 protected void doDSGet(Context c, HttpServletRequest request, 67 HttpServletResponse response) throws ServletException , IOException , 68 SQLException , AuthorizeException 69 { 70 JSPManager.showJSP(request, response, "/dspace-admin/news-main.jsp"); 72 } 73 74 protected void doDSPost(Context c, HttpServletRequest request, 75 HttpServletResponse response) throws ServletException , IOException , 76 SQLException , AuthorizeException 77 { 78 String button = UIUtil.getSubmitButton(request, "submit"); 80 81 String news = ""; 82 83 int position = UIUtil.getIntParameter(request, "position"); 85 86 if (button.equals("submit_edit")) 87 { 88 news = ConfigurationManager.readNewsFile(position); 90 91 request.setAttribute("position", new Integer (position)); 93 94 request.setAttribute("news", news); 96 97 JSPManager 99 .showJSP(request, response, "/dspace-admin/news-edit.jsp"); 100 } 101 else if (button.equals("submit_save")) 102 { 103 news = (String ) request.getParameter("news"); 105 106 ConfigurationManager.writeNewsFile(position, news); 108 109 JSPManager 110 .showJSP(request, response, "/dspace-admin/news-main.jsp"); 111 } 112 else 113 { 114 JSPManager 116 .showJSP(request, response, "/dspace-admin/news-main.jsp"); 117 } 118 119 c.complete(); 120 } 121 } 122 | Popular Tags |