carlos@0
|
1 |
/*
|
carlos@0
|
2 |
*************************************************************************
|
carlos@0
|
3 |
* The contents of this file are subject to the Openbravo Public License
|
priya@9072
|
4 |
* Version 1.1 (the "License"), being the Mozilla Public License
|
carlos@0
|
5 |
* Version 1.1 with a permitted attribution clause; you may not use this
|
carlos@0
|
6 |
* file except in compliance with the License. You may obtain a copy of
|
carlos@0
|
7 |
* the License at http://www.openbravo.com/legal/license.html
|
carlos@0
|
8 |
* Software distributed under the License is distributed on an "AS IS"
|
carlos@0
|
9 |
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
carlos@0
|
10 |
* License for the specific language governing rights and limitations
|
carlos@0
|
11 |
* under the License.
|
carlos@0
|
12 |
* The Original Code is Openbravo ERP.
|
ggi@6701
|
13 |
* The Initial Developer of the Original Code is Openbravo SLU
|
ggi@6701
|
14 |
* All portions are Copyright (C) 2001-2009 Openbravo SLU
|
carlos@0
|
15 |
* All Rights Reserved.
|
carlos@0
|
16 |
* Contributor(s): ______________________________________.
|
carlos@0
|
17 |
************************************************************************
|
martin@2462
|
18 |
*/
|
carlos@0
|
19 |
package org.openbravo.erpCommon.ad_callouts;
|
carlos@0
|
20 |
|
martin@2598
|
21 |
import java.io.IOException;
|
martin@2598
|
22 |
import java.io.PrintWriter;
|
martin@2598
|
23 |
|
martin@2598
|
24 |
import javax.servlet.ServletConfig;
|
martin@2598
|
25 |
import javax.servlet.ServletException;
|
martin@2598
|
26 |
import javax.servlet.http.HttpServletRequest;
|
martin@2598
|
27 |
import javax.servlet.http.HttpServletResponse;
|
martin@2598
|
28 |
|
carlos@0
|
29 |
import org.openbravo.base.secureApp.HttpSecureAppServlet;
|
carlos@0
|
30 |
import org.openbravo.base.secureApp.VariablesSecureApp;
|
martin@2598
|
31 |
import org.openbravo.utils.FormatUtilities;
|
carlos@0
|
32 |
import org.openbravo.xmlEngine.XmlDocument;
|
carlos@0
|
33 |
|
martin@2462
|
34 |
public class SE_Request_CopyText extends HttpSecureAppServlet {
|
martin@2868
|
35 |
private static final long serialVersionUID = 1L;
|
carlos@0
|
36 |
|
martin@2868
|
37 |
public void init(ServletConfig config) {
|
martin@2868
|
38 |
super.init(config);
|
martin@2868
|
39 |
boolHist = false;
|
martin@2868
|
40 |
}
|
martin@2868
|
41 |
|
martin@2868
|
42 |
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException,
|
martin@2868
|
43 |
ServletException {
|
martin@2868
|
44 |
VariablesSecureApp vars = new VariablesSecureApp(request);
|
martin@2868
|
45 |
if (vars.commandIn("DEFAULT")) {
|
martin@2868
|
46 |
String strRMailTextId = vars.getStringParameter("inprMailtextId");
|
martin@2868
|
47 |
String strTabId = vars.getStringParameter("inpTabId");
|
martin@2868
|
48 |
|
martin@2868
|
49 |
try {
|
martin@2868
|
50 |
printPage(response, vars, strRMailTextId, strTabId);
|
martin@2868
|
51 |
} catch (ServletException ex) {
|
martin@2868
|
52 |
pageErrorCallOut(response);
|
martin@2868
|
53 |
}
|
martin@2868
|
54 |
} else
|
martin@2868
|
55 |
pageError(response);
|
martin@2868
|
56 |
}
|
martin@2868
|
57 |
|
stefan@3960
|
58 |
private void printPage(HttpServletResponse response, VariablesSecureApp vars,
|
stefan@3960
|
59 |
String strRMailTextId, String strTabId) throws IOException, ServletException {
|
martin@2868
|
60 |
if (log4j.isDebugEnabled())
|
martin@2868
|
61 |
log4j.debug("Output: dataSheet");
|
martin@2868
|
62 |
XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
|
martin@2868
|
63 |
"org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument();
|
martin@2868
|
64 |
|
martin@2868
|
65 |
StringBuffer resultado = new StringBuffer();
|
martin@2868
|
66 |
resultado.append("var calloutName='SE_Request_CopyText';\n\n");
|
martin@2868
|
67 |
resultado.append("var respuesta = new Array(");
|
martin@2868
|
68 |
|
martin@2868
|
69 |
SERequestCopyTextData[] data = SERequestCopyTextData.select(this, strRMailTextId);
|
martin@2868
|
70 |
|
martin@2868
|
71 |
if (data != null && data.length != 0) {
|
martin@2868
|
72 |
resultado.append("new Array(\"inpmailsubject\", \""
|
martin@2868
|
73 |
+ FormatUtilities.replaceJS(data[0].mailheader) + "\"),");
|
martin@2868
|
74 |
resultado.append("new Array(\"inpmailtext\", \""
|
martin@2868
|
75 |
+ FormatUtilities.replaceJS(data[0].mailtext) + "\")");
|
carlos@0
|
76 |
}
|
carlos@0
|
77 |
|
martin@2868
|
78 |
resultado.append(");");
|
martin@2868
|
79 |
xmlDocument.setParameter("array", resultado.toString());
|
martin@2868
|
80 |
xmlDocument.setParameter("frameName", "appFrame");
|
martin@2868
|
81 |
response.setContentType("text/html; charset=UTF-8");
|
martin@2868
|
82 |
PrintWriter out = response.getWriter();
|
martin@2868
|
83 |
out.println(xmlDocument.print());
|
martin@2868
|
84 |
out.close();
|
martin@2868
|
85 |
}
|
carlos@0
|
86 |
}
|