1 package com.genimen.djeneric.web.controller; 2 3 import java.io.IOException ; 4 5 import javax.servlet.ServletException ; 6 import javax.servlet.http.HttpServletRequest ; 7 import javax.servlet.http.HttpServletResponse ; 8 9 import org.w3c.dom.Document ; 10 11 import com.genimen.djeneric.language.Messages; 12 import com.genimen.djeneric.repository.exceptions.DjenericException; 13 import com.genimen.djeneric.web.renderers.DialogRenderer; 14 import com.genimen.djeneric.web.util.DjenericSessionManager; 15 import com.genimen.djeneric.web.util.DjenericXSLTransform; 16 17 public class DialogCommand 18 { 19 DialogRenderer _renderer = new DialogRenderer(); 20 21 public void get(DjenericSessionManager sessionManager, HttpServletRequest request, HttpServletResponse response) 22 throws IOException , ServletException , DjenericException 23 { 24 try 25 { 26 response.setContentType("text/html; charset=UTF-8"); 27 28 DjenericXSLTransform xsl = sessionManager.getTransformer(); 29 30 String title = (String ) request.getParameter("title"); 31 String titleid = (String ) request.getParameter("titleid"); 32 33 String t1 = (String ) request.getParameter("t1"); 34 String t2 = (String ) request.getParameter("t2"); 35 String t3 = (String ) request.getParameter("t3"); 36 String t4 = (String ) request.getParameter("t4"); 37 String t5 = (String ) request.getParameter("t5"); 38 39 if(title == null && titleid != null) title = Messages.getString(titleid, t1, t2, t3, t4, t5); 40 41 String msg = (String ) request.getParameter("msg"); 42 String msgid = (String ) request.getParameter("msgid"); 43 44 String m1 = (String ) request.getParameter("m1"); 45 String m2 = (String ) request.getParameter("m2"); 46 String m3 = (String ) request.getParameter("m3"); 47 String m4 = (String ) request.getParameter("m4"); 48 String m5 = (String ) request.getParameter("m5"); 49 50 if(msg == null && msgid != null) msg = Messages.getString(msgid, m1, m2, m3, m4, m5); 51 52 String buttons = (String ) request.getParameter("buttons"); 53 54 boolean escape = "true".equalsIgnoreCase(request.getParameter("escape")) ||"yes".equalsIgnoreCase(request.getParameter("escape")); 55 56 int width = 0; 57 int height = 0; 58 59 if(request.getParameter("width") != null) width = Integer.parseInt(request.getParameter("width")); 60 if(request.getParameter("height") != null) height = Integer.parseInt(request.getParameter("height")); 61 62 Document doc = _renderer.asXml(title, msg, buttons, width, height, escape); 63 64 String page = xsl.transform(doc, "dialogs/dialog.xsl"); 65 response.getWriter().print(page); 66 } 67 catch (Exception e) 68 { 69 throw new ServletException (e); 70 } 71 } 72 73 public void post(DjenericSessionManager sessionManager, HttpServletRequest request, HttpServletResponse response) 74 { 75 76 } 77 } 78 | Popular Tags |