Start point upgrade HTML UI with Adempiere 3.5.3a
This commit is contained in:
parent
3a339af999
commit
88dd91f29d
|
@ -15,39 +15,21 @@
|
|||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
|
||||
/**
|
||||
* Display Table Information
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: DisplayTable.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
public class DisplayTable
|
||||
{
|
||||
/**
|
||||
* DisplayTable
|
||||
*/
|
||||
public DisplayTable (String tableName, String columnName)
|
||||
{
|
||||
} // DisplayTable
|
||||
|
||||
}
|
||||
public String[] getQueryLabels()
|
||||
{
|
||||
return null;
|
||||
} // getQueryNames
|
||||
|
||||
}
|
||||
public String[] getQueryFields()
|
||||
{
|
||||
return null;
|
||||
} // getQueryFields
|
||||
|
||||
}
|
||||
public String[] getResultLabels()
|
||||
{
|
||||
return null;
|
||||
} // getResultLabels
|
||||
|
||||
|
||||
|
||||
|
||||
} // DisplayTable
|
||||
}
|
||||
}
|
|
@ -16,64 +16,29 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
/**
|
||||
* Test Servlet
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: Test.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
import java.io.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.compiere.util.*;
|
||||
public class Test extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8474219907861637179L;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
*/
|
||||
public void init(ServletConfig config)
|
||||
throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
if (!WebEnv.initWeb(config))
|
||||
throw new ServletException("Test.init");
|
||||
} // init
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request
|
||||
*/
|
||||
}
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("Get Request Test");
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doGet
|
||||
|
||||
|
||||
/**
|
||||
* Process the HTTP Post request
|
||||
*/
|
||||
WebUtil.createResponse(request, response, this, null, doc, true);
|
||||
}
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("Post Request Test");
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doPost
|
||||
|
||||
} // Test
|
||||
WebUtil.createResponse(request, response, this, null, doc, true);
|
||||
}
|
||||
}
|
|
@ -16,60 +16,28 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
/**
|
||||
* Test Servlet 2
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: Test2.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
public class Test2 extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6839830507472511719L;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
*/
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
WebEnv.initWeb(config);
|
||||
} // init
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request
|
||||
*/
|
||||
}
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
RequestDispatcher dispatcher = request.getRequestDispatcher("/Test");
|
||||
dispatcher.forward(request, response);
|
||||
} // doGet
|
||||
|
||||
|
||||
/**
|
||||
* Process the HTTP Post request
|
||||
*/
|
||||
}
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("Get Request Test2");
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doPost
|
||||
WebUtil.createResponse(request, response, this, null, doc, true);
|
||||
}
|
||||
|
||||
} // Test2
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.ecs.xhtml.th;
|
|||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MField;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -42,59 +43,24 @@ import org.compiere.util.WebEnv;
|
|||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
/**
|
||||
* WAccount Servlet.
|
||||
* <p>
|
||||
* The servlet is invoked by a parent window via
|
||||
* <code>
|
||||
* WAccount?FormName=formName%ColumnName=columnName
|
||||
* </code>
|
||||
* and assumes that in the opening window/form there are two fields
|
||||
* <code>
|
||||
* opener.document.formName.columnName - The (hidden) field for the ID
|
||||
* opener.document.formName.columnName_D - The display field for the value
|
||||
* </code>
|
||||
* When selecting an entry, the window is closed and the value of the two fields set.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WAccount.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
public class WAccount extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7932467581955114222L;
|
||||
private static final String FIELD_NAME = "FieldName";
|
||||
private static final String FIELD_VALUE = "FieldValue";
|
||||
private static final String P_Command = "PCommand";
|
||||
private static final String P_FORM_NAME = "PForm";
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
*
|
||||
* @param config
|
||||
* @throws ServletException
|
||||
*/
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
if (!WebEnv.initWeb(config))
|
||||
throw new ServletException("WAccount.init");
|
||||
} // init
|
||||
|
||||
/** Logger */
|
||||
}
|
||||
private static CLogger log = CLogger.getCLogger(WAccount.class);
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request - initial Start
|
||||
* Needs to have parameters FormName and ColumnName
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
log.config("WAccount.doGet");
|
||||
log.config( "WAccount.doGet");
|
||||
WebSessionCtx wsc = WebSessionCtx.get(request);
|
||||
WWindowStatus ws = WWindowStatus.get(request);
|
||||
if (wsc == null || ws == null)
|
||||
|
@ -102,106 +68,61 @@ public class WAccount extends HttpServlet
|
|||
WebUtil.createTimeoutPage(request, response, this, null);
|
||||
return;
|
||||
}
|
||||
// Get Mandatory Parameters
|
||||
String formName = WebUtil.getParameter (request, "FormName");
|
||||
String columnName = WebUtil.getParameter (request, "ColumnName");
|
||||
//
|
||||
GridField mField = ws.curTab.getField(columnName);
|
||||
//Modified by Rob Klein 4/29/07
|
||||
log.config("FormName=" + formName + ", ColumnName=" + columnName + ", MField=" + mField.toString());
|
||||
log.config(" ColumnName=" + columnName + ", MField=" + mField.toString());
|
||||
if (mField == null || columnName == null || columnName.equals(""))
|
||||
{
|
||||
WebUtil.createTimeoutPage(request, response, this,
|
||||
Msg.getMsg(wsc.ctx, "ParameterMissing"));
|
||||
return;
|
||||
}
|
||||
// Object value = ws.curTab.getValue(columnName);
|
||||
String target = "opener.document." + formName + "." + columnName;
|
||||
String targetBase = "'" + columnName;
|
||||
//Modifeid by Rob Klein 4/229/07
|
||||
// Create Document
|
||||
WebDoc doc = WebDoc.createPopup (mField.getHeader());
|
||||
String target = "opener.document.WForm." + columnName;
|
||||
|
||||
WebDoc doc = WebDoc.create (mField.getHeader());
|
||||
body body = doc.getBody();
|
||||
body.setOnBlur("self.focus();");
|
||||
body.addElement(fillTable(ws, mField, targetBase));
|
||||
//Modified by Rob Klein 4/29/07
|
||||
// Reset, Cancel
|
||||
body.addElement(fillTable(ws, mField, target));
|
||||
|
||||
button reset = new button();
|
||||
reset.addElement("Reset"); // translate
|
||||
reset.setOnClick(targetBase + "F.value='';" + targetBase + "D.value='';self.close();");
|
||||
reset.addElement("Reset");
|
||||
reset.setOnClick(target + "D.value='';" + target + "F.value='';window.close();");
|
||||
button cancel = new button();
|
||||
cancel.addElement("Cancel"); // translate
|
||||
cancel.setOnClick("self.close();return false;");
|
||||
cancel.addElement("Cancel");
|
||||
cancel.setOnClick("window.close();");
|
||||
body.addElement(new p(AlignType.RIGHT)
|
||||
.addElement(reset)
|
||||
.addElement(" ")
|
||||
.addElement(cancel));
|
||||
//
|
||||
// log.fine( doc.toString());
|
||||
WebUtil.createResponse (request, response, this, null, doc, false);
|
||||
} // doGet
|
||||
|
||||
|
||||
/**
|
||||
* Process the HTTP Post request - perform doGet
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
WebUtil.createResponse (request, response, this, null, doc, true);
|
||||
}
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
log.config( "WAccount.doPost");
|
||||
doGet(request, response);
|
||||
} // doPost
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Fill Table (Generic)
|
||||
*
|
||||
* @param ws WindowStatus
|
||||
* @param mField the Field
|
||||
* @param target target field string
|
||||
* @return Table with selection
|
||||
*/
|
||||
}
|
||||
private table fillTable (WWindowStatus ws, GridField mField, String target)
|
||||
{
|
||||
table table = new table("1");
|
||||
//Modified by Rob klein 4/29/07
|
||||
table.setClass("table-autosort table-autostripe table-stripeclass:alternate");
|
||||
table.addElement("<thead>");
|
||||
tr line = new tr();
|
||||
line.addElement(new th(" ")).addElement(new th(Msg.translate(ws.ctx, "Name")).setClass("table-sortable:default"));
|
||||
line.addElement(new th(" ")).addElement(new th(Msg.translate(ws.ctx, "Name")));
|
||||
table.addElement(line);
|
||||
table.addElement("</thead>");
|
||||
table.addElement("<tbody>");
|
||||
|
||||
// Fill & list options
|
||||
Lookup lookup = mField.getLookup();
|
||||
lookup.fillComboBox(mField.isMandatory(false), true, true, true); // no context check
|
||||
lookup.fillComboBox(mField.isMandatory(false), true, true, true);
|
||||
int size = lookup.getSize();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
Object lValue = lookup.getElementAt(i);
|
||||
if (!(lValue != null && lValue instanceof KeyNamePair))
|
||||
continue;
|
||||
//
|
||||
// log.fine( lValue.toString());
|
||||
KeyNamePair np = (KeyNamePair)lValue;
|
||||
button button = new button();
|
||||
button.addElement(">");
|
||||
//Modified by Rob Klein 4/29/07
|
||||
StringBuffer script = new StringBuffer();
|
||||
script
|
||||
//.append("';closePopup();")
|
||||
.append("startUpdate(").append(target).append("F',")
|
||||
.append(target).append("D','").append(np.getKey()).append("',")
|
||||
.append(target).append("F','").append(np.getName())
|
||||
.append("');return false;");
|
||||
StringBuffer script = new StringBuffer(target);
|
||||
script.append("D.value='").append(np.getKey()).append("';")
|
||||
.append(target).append("F.value='").append(np.getName()).append("';window.close();");
|
||||
button.setOnClick(script.toString());
|
||||
//
|
||||
line = new tr();
|
||||
line.addElement(new td(button));
|
||||
String name = np.getName();
|
||||
|
@ -210,10 +131,7 @@ public class WAccount extends HttpServlet
|
|||
line.addElement(new td(name));
|
||||
table.addElement(line);
|
||||
}
|
||||
// Restore
|
||||
lookup.fillComboBox(true);
|
||||
table.addElement("</tbody>");
|
||||
return table;
|
||||
} // fillTable
|
||||
|
||||
} // WAccount
|
||||
}
|
||||
}
|
|
@ -16,49 +16,24 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.ecs.AlignType;
|
||||
import org.apache.ecs.xhtml.a;
|
||||
import org.apache.ecs.xhtml.br;
|
||||
import org.apache.ecs.xhtml.form;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.label;
|
||||
import org.apache.ecs.xhtml.p;
|
||||
import org.apache.ecs.xhtml.table;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.textarea;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.MAttachment;
|
||||
import org.compiere.model.MAttachmentEntry;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.FileUpload;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.ecs.*;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* HTML UI Attachment
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WAttachment.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WAttachment.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WAttachment extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4241116889907930155L;
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(WAttachment.class);
|
||||
|
||||
|
@ -77,6 +52,7 @@ public class WAttachment extends HttpServlet
|
|||
public static final String P_ATTACHMENT_INDEX = "AttachmentIndex";
|
||||
public static final String P_TEXTMSG = "TextMsg";
|
||||
|
||||
private String m_error;
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request.
|
||||
|
@ -99,20 +75,26 @@ public class WAttachment extends HttpServlet
|
|||
}
|
||||
else
|
||||
{
|
||||
String error = null;
|
||||
m_error = null;
|
||||
int AD_Attachment_ID = WebUtil.getParameterAsInt(request, P_Attachment_ID);
|
||||
if (AD_Attachment_ID != 0)
|
||||
{
|
||||
int attachmentIndex = WebUtil.getParameterAsInt(request, P_ATTACHMENT_INDEX);
|
||||
if (attachmentIndex != 0)
|
||||
{
|
||||
error = streamAttachment (AD_Attachment_ID, attachmentIndex, response, ws);
|
||||
if (error == null)
|
||||
m_error = streamAttachment (AD_Attachment_ID, attachmentIndex, response, ws);
|
||||
if (m_error == null)
|
||||
return;
|
||||
}
|
||||
}
|
||||
doc = createPage (ws.ctx, ws.curTab.getAD_AttachmentID(),
|
||||
ws.curTab.getAD_Table_ID(), ws.curTab.getRecord_ID(), error);
|
||||
|
||||
MAttachment attachment = null;
|
||||
if (AD_Attachment_ID != 0)
|
||||
attachment = new MAttachment(ws.ctx, ws.curTab.getAD_AttachmentID(), null);
|
||||
else
|
||||
attachment = new MAttachment (ws.ctx, ws.curTab.getAD_Table_ID(), ws.curTab.getRecord_ID(), null);
|
||||
|
||||
doc = createPage (ws.ctx, attachment, m_error);
|
||||
}
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
|
@ -137,9 +119,8 @@ public class WAttachment extends HttpServlet
|
|||
doc = WebDoc.create ("Help - No Context");
|
||||
else
|
||||
{
|
||||
String error = processPost (request, response, ws);
|
||||
doc = createPage (ws.ctx, ws.curTab.getAD_AttachmentID(),
|
||||
ws.curTab.getAD_Table_ID(), ws.curTab.getRecord_ID(), error);
|
||||
MAttachment attachment = processPost (request, response, ws);
|
||||
doc = createPage (ws.ctx, attachment, m_error);
|
||||
}
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
|
@ -151,11 +132,10 @@ public class WAttachment extends HttpServlet
|
|||
* @param AD_Attachment_ID id for existing attachment
|
||||
* @param AD_Table_ID table for new attachment
|
||||
* @param Record_ID record for new attachment
|
||||
* @param error optional error message
|
||||
* @param m_error optional m_error message
|
||||
* @return WebDoc
|
||||
*/
|
||||
private WebDoc createPage (Properties ctx, int AD_Attachment_ID,
|
||||
int AD_Table_ID, int Record_ID, String error)
|
||||
private WebDoc createPage (Properties ctx, MAttachment attachment, String error)
|
||||
{
|
||||
WebDoc doc = WebDoc.createPopup (Msg.translate(ctx, "AD_Attachment_ID"));
|
||||
table table = doc.getTable();
|
||||
|
@ -168,11 +148,6 @@ public class WAttachment extends HttpServlet
|
|||
new p(error, AlignType.LEFT).setClass("Cerror")))); // window.css
|
||||
}
|
||||
|
||||
MAttachment attachment = null;
|
||||
if (AD_Attachment_ID != 0)
|
||||
attachment = new MAttachment(ctx, AD_Attachment_ID, null);
|
||||
else
|
||||
attachment = new MAttachment (ctx, AD_Table_ID, Record_ID, null);
|
||||
//
|
||||
tr tr = new tr();
|
||||
td left = new td("popupCenter", AlignType.LEFT, AlignType.TOP, false,
|
||||
|
@ -182,9 +157,9 @@ public class WAttachment extends HttpServlet
|
|||
|
||||
// Text Message Update
|
||||
form textMsg = new form("WAttachment");
|
||||
textMsg.addElement(new input (input.TYPE_HIDDEN, P_Attachment_ID, AD_Attachment_ID));
|
||||
textMsg.addElement(new input (input.TYPE_HIDDEN, "AD_Table_ID", AD_Table_ID));
|
||||
textMsg.addElement(new input (input.TYPE_HIDDEN, "Record_ID", Record_ID));
|
||||
textMsg.addElement(new input (input.TYPE_HIDDEN, P_Attachment_ID, attachment.getAD_Attachment_ID()));
|
||||
textMsg.addElement(new input (input.TYPE_HIDDEN, "AD_Table_ID", attachment.getAD_Table_ID()));
|
||||
textMsg.addElement(new input (input.TYPE_HIDDEN, "Record_ID", attachment.getRecord_ID()));
|
||||
textarea msg = new textarea(P_TEXTMSG, 5, 40);
|
||||
msg.addElement(attachment.getTextMsg());
|
||||
textMsg.addElement(msg);
|
||||
|
@ -211,7 +186,7 @@ public class WAttachment extends HttpServlet
|
|||
MAttachmentEntry entry = entries[i];
|
||||
if (i > 0)
|
||||
p.addElement(" - ");
|
||||
String url = "WAttachment?" + P_Attachment_ID + "=" + AD_Attachment_ID
|
||||
String url = "WAttachment?" + P_Attachment_ID + "=" + attachment.getAD_Attachment_ID()
|
||||
+ "&" + P_ATTACHMENT_INDEX + "=" + entry.getIndex();
|
||||
p.addElement(new a(url, null, a.TARGET_BLANK, entry.getName()));
|
||||
}
|
||||
|
@ -219,9 +194,9 @@ public class WAttachment extends HttpServlet
|
|||
|
||||
// Upload
|
||||
form upload = FileUpload.createForm("WAttachment");
|
||||
upload.addElement(new input (input.TYPE_HIDDEN, P_Attachment_ID, AD_Attachment_ID));
|
||||
upload.addElement(new input (input.TYPE_HIDDEN, "AD_Table_ID", AD_Table_ID));
|
||||
upload.addElement(new input (input.TYPE_HIDDEN, "Record_ID", Record_ID));
|
||||
upload.addElement(new input (input.TYPE_HIDDEN, P_Attachment_ID, attachment.getAD_Attachment_ID()));
|
||||
upload.addElement(new input (input.TYPE_HIDDEN, "AD_Table_ID", attachment.getAD_Table_ID()));
|
||||
upload.addElement(new input (input.TYPE_HIDDEN, "Record_ID", attachment.getRecord_ID()));
|
||||
right.addElement(upload);
|
||||
//
|
||||
tr.addElement(left);
|
||||
|
@ -242,7 +217,7 @@ public class WAttachment extends HttpServlet
|
|||
* @param attachmentIndex index
|
||||
* @param response response
|
||||
* @param ws status
|
||||
* @return error message
|
||||
* @return m_error message
|
||||
*/
|
||||
private String streamAttachment (int AD_Attachment_ID, int attachmentIndex,
|
||||
HttpServletResponse response, WWindowStatus ws)
|
||||
|
@ -274,9 +249,9 @@ public class WAttachment extends HttpServlet
|
|||
* Upload Attachment Entry
|
||||
* @param request request
|
||||
* @param response response
|
||||
* @return error message
|
||||
* @return m_error message
|
||||
*/
|
||||
private String processPost (HttpServletRequest request,
|
||||
private MAttachment processPost (HttpServletRequest request,
|
||||
HttpServletResponse response, WWindowStatus ws)
|
||||
{
|
||||
int AD_Attachment_ID = 0;
|
||||
|
@ -296,11 +271,11 @@ public class WAttachment extends HttpServlet
|
|||
else
|
||||
{
|
||||
upload = new FileUpload(request);
|
||||
String error = upload.getError();
|
||||
if (error != null)
|
||||
m_error = upload.getError();
|
||||
if (m_error != null)
|
||||
{
|
||||
log.warning("pocessPost - " + error);
|
||||
return error;
|
||||
log.warning("pocessPost - " + m_error);
|
||||
return null;
|
||||
}
|
||||
AD_Attachment_ID = upload.getParameterAsInt(P_Attachment_ID);
|
||||
AD_Table_ID = upload.getParameterAsInt("AD_Table_ID");
|
||||
|
@ -312,11 +287,15 @@ public class WAttachment extends HttpServlet
|
|||
+ " - Upload=" + upload);
|
||||
|
||||
// Check if you own the attachment
|
||||
if (ws.curTab.getAD_AttachmentID() != AD_Attachment_ID)
|
||||
return "Your Attachment not found";
|
||||
if (ws.curTab.getAD_AttachmentID() != AD_Attachment_ID) {
|
||||
m_error = "Your Attachment not found";
|
||||
return null;
|
||||
}
|
||||
// Check if we can save
|
||||
if (AD_Attachment_ID != 0 && Record_ID == 0)
|
||||
return "Need to save record first";
|
||||
if (AD_Attachment_ID != 0 && Record_ID == 0) {
|
||||
m_error = "Need to save record first";
|
||||
return null;
|
||||
}
|
||||
|
||||
MAttachment attachment = null;
|
||||
if (AD_Attachment_ID == 0)
|
||||
|
@ -335,11 +314,13 @@ public class WAttachment extends HttpServlet
|
|||
// Save and update
|
||||
if (attachment.save())
|
||||
ws.curTab.loadAttachments(); // update Tab
|
||||
else
|
||||
return "Attachment not saved";
|
||||
|
||||
// OK
|
||||
else {
|
||||
m_error = "Attachment not saved";
|
||||
return null;
|
||||
}
|
||||
|
||||
return attachment;
|
||||
|
||||
} // processPost
|
||||
|
||||
|
||||
|
|
|
@ -16,13 +16,10 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
import org.apache.ecs.AlignType;
|
||||
import org.apache.ecs.Element;
|
||||
|
@ -35,27 +32,17 @@ import org.apache.ecs.xhtml.tr;
|
|||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MChat;
|
||||
import org.compiere.model.MChatEntry;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import org.compiere.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* Web (window) Chat
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WChat.java $
|
||||
* @version $Id: WChat.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WChat extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6826855534161342772L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
private MChat m_chat;
|
||||
|
|
|
@ -16,30 +16,19 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.io.*;
|
||||
|
||||
public class WError extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7940367932646085428L;
|
||||
static final private String CONTENT_TYPE = "text/html";
|
||||
static final private String DOC_TYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" +
|
||||
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
|
||||
/**Initialize global variables*/
|
||||
public void init(ServletConfig config) throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
}
|
||||
/**Process the HTTP Get request*/
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
response.setContentType(CONTENT_TYPE);
|
||||
|
@ -52,7 +41,6 @@ public class WError extends HttpServlet
|
|||
out.println("<p>The servlet has received a GET. This is the reply.</p>");
|
||||
out.println("</body></html>");
|
||||
}
|
||||
/**Process the HTTP Post request*/
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
response.setContentType(CONTENT_TYPE);
|
||||
|
@ -65,7 +53,6 @@ public class WError extends HttpServlet
|
|||
out.println("<p>The servlet has received a POST. This is the reply.</p>");
|
||||
out.println("</body></html>");
|
||||
}
|
||||
/**Clean up resources*/
|
||||
public void destroy()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,41 +16,22 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.ecs.xhtml.body;
|
||||
import org.apache.ecs.xhtml.form;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.p;
|
||||
import org.apache.ecs.xhtml.script;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Login;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Dynamic Field Updates.
|
||||
*
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WFieldUpdate.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WFieldUpdate.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WFieldUpdate extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1576213475379404148L;
|
||||
/** Static Logger */
|
||||
private static CLogger log = CLogger.getCLogger (WFieldUpdate.class);
|
||||
|
||||
|
|
|
@ -1,50 +1,32 @@
|
|||
/**********************************************************************
|
||||
* This file is part of Adempiere ERP Bazaar *
|
||||
* http://www.adempiere.org *
|
||||
* *
|
||||
* Copyright (C) 1999 - 2006 Compiere Inc. *
|
||||
* Copyright (C) Contributors *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301, USA. *
|
||||
* *
|
||||
* Contributors: *
|
||||
* - Bahman Movaqar (bmovaqar@users.sf.net) *
|
||||
**********************************************************************/
|
||||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* HTML UI Filter to do timing and list parameters
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WFilter.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WFilter.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
|
||||
public final class WFilter implements javax.servlet.Filter
|
||||
|
@ -139,12 +121,10 @@ public final class WFilter implements javax.servlet.Filter
|
|||
|
||||
// Get URI
|
||||
String uri = "";
|
||||
String urilow = "";
|
||||
if (request instanceof HttpServletRequest)
|
||||
{
|
||||
HttpServletRequest req = (HttpServletRequest)request;
|
||||
uri = req.getRequestURI();
|
||||
urilow = uri.toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,9 +153,9 @@ public final class WFilter implements javax.servlet.Filter
|
|||
else
|
||||
pass = false;
|
||||
else if (!uri.startsWith(WebEnv.DIR_BASE) // not requesting /adempiere/...
|
||||
|| urilow.endsWith(".gif") || urilow.endsWith(".jpg") || urilow.endsWith(".png")
|
||||
|| urilow.endsWith(".html") || urilow.endsWith(".css")
|
||||
|| urilow.endsWith(".js"))
|
||||
|| uri.endsWith(".gif") || uri.endsWith(".jpg") || uri.endsWith(".png")
|
||||
|| uri.endsWith(".html") || uri.endsWith(".css")
|
||||
|| uri.endsWith(".js"))
|
||||
check = false;
|
||||
else
|
||||
;
|
||||
|
|
|
@ -28,52 +28,25 @@ import org.compiere.util.WebDoc;
|
|||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
/**
|
||||
* Form
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WForm.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
public class WForm extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3168260837305771442L;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
*/
|
||||
public void init(ServletConfig config)
|
||||
throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
if (!WebEnv.initWeb(config))
|
||||
throw new ServletException("WForm.init");
|
||||
} // init
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request
|
||||
*/
|
||||
}
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("Not Implemented Yet");
|
||||
//
|
||||
WebDoc doc = WebDoc.create ("WForm - Get - Not Implemented Yet");
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doGet
|
||||
|
||||
|
||||
/**
|
||||
* Process the HTTP Post request
|
||||
*/
|
||||
}
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("Not Implemented Yet");
|
||||
//
|
||||
WebDoc doc = WebDoc.create ("WForm - Post - Not Implemented Yet");
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doPost
|
||||
|
||||
} // WForm
|
||||
}
|
||||
}
|
|
@ -25,69 +25,39 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Web (window) Help
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WHelp.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
public class WHelp extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 2586562865823315494L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
*/
|
||||
public void init(ServletConfig config)
|
||||
throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
if (!WebEnv.initWeb(config))
|
||||
throw new ServletException("WHelp.init");
|
||||
} // init
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request
|
||||
*/
|
||||
}
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
log.fine("doGet");
|
||||
WWindowStatus ws = WWindowStatus.get(request);
|
||||
//
|
||||
WebDoc doc = null;
|
||||
if (ws == null)
|
||||
{
|
||||
if (ws == null) {
|
||||
doc = WebDoc.createPopup("No Context");
|
||||
//Modified by Rob Klein 4/29/07
|
||||
doc.addPopupClose(Env.getCtx());
|
||||
}
|
||||
else
|
||||
doc.addPopupClose(ws.ctx);
|
||||
} else
|
||||
doc = ws.mWindow.getHelpDoc(false);
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doGet
|
||||
|
||||
|
||||
/**
|
||||
* Process the HTTP Post request
|
||||
*/
|
||||
}
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("Help - Post - Not Implemented");
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doPost
|
||||
|
||||
} // WHelp
|
||||
}
|
||||
}
|
|
@ -44,7 +44,6 @@ import org.compiere.model.MRegion;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
@ -64,14 +63,10 @@ import org.compiere.util.WebUtil;
|
|||
* When selecting an entry, the window is closed and the value of the two fields set.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WLocation.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WLocation.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WLocation extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 285780594700749274L;
|
||||
/** Logger */
|
||||
protected static CLogger log = CLogger.getCLogger(WLocation.class);
|
||||
|
||||
|
@ -93,6 +88,8 @@ public class WLocation extends HttpServlet
|
|||
private static final String P_C_LOCATION_ID = "C_LOCATION_ID";
|
||||
private static final String P_ADDRESS1 = "ADDRESS1";
|
||||
private static final String P_ADDRESS2 = "ADDRESS2";
|
||||
private static final String P_ADDRESS3= "ADDRESS3";
|
||||
private static final String P_ADDRESS4= "ADDRESS4";
|
||||
private static final String P_CITY = "CITY";
|
||||
private static final String P_POSTAL = "POSTAL";
|
||||
private static final String P_C_COUNTRY_ID = "C_COUNTRY_ID";
|
||||
|
@ -134,15 +131,15 @@ public class WLocation extends HttpServlet
|
|||
MLocation location = null;
|
||||
Object value = mField.getValue();
|
||||
if (value != null && value instanceof Integer)
|
||||
location = new MLocation(ws.ctx, ((Integer)value).intValue(), null);
|
||||
location = new MLocation(ws.ctx, ((Integer)value).intValue(),null);
|
||||
else
|
||||
location = new MLocation(ws.ctx, 0, null);
|
||||
location = new MLocation(ws.ctx, 0,null);
|
||||
|
||||
String targetBase = "parent.WWindow." + WWindow.FORM_NAME + "." + columnName;
|
||||
//String targetBase = "parent.WWindow." + WWindow.FORM_NAME + "." + columnName;
|
||||
String targetBase = "opener.WWindow." + WWindow.FORM_NAME + "." + columnName;
|
||||
String action = request.getRequestURI();
|
||||
// Create Document
|
||||
WebDoc doc = WebDoc.createPopup (mField.getHeader());
|
||||
//Modified by Rob klein 4/29/07
|
||||
doc.addPopupClose(ws.ctx);
|
||||
boolean hasDependents = ws.curTab.hasDependants(columnName);
|
||||
boolean hasCallout = mField.getCallout().length() > 0;
|
||||
|
@ -150,7 +147,7 @@ public class WLocation extends HttpServlet
|
|||
// Reset
|
||||
button reset = new button();
|
||||
reset.addElement("Reset"); // translate
|
||||
String script = targetBase + "F.value='';" + targetBase + "D.value='';closePopup();";
|
||||
String script = targetBase + "D.value='';" + targetBase + "F.value='';closePopup();";
|
||||
if (hasDependents || hasCallout)
|
||||
script += "startUpdate(" + targetBase + "F);";
|
||||
reset.setOnClick(script);
|
||||
|
@ -158,10 +155,10 @@ public class WLocation extends HttpServlet
|
|||
doc.getTable().addElement(new tr()
|
||||
.addElement(fillForm(ws, action, location, targetBase, hasDependents || hasCallout))
|
||||
.addElement(reset));
|
||||
//Modified by Rob Klein 4/29/07
|
||||
//
|
||||
doc.addPopupClose(ws.ctx);
|
||||
// log.trace(log.l6_Database, doc.toString());
|
||||
WebUtil.createResponse (request, response, this, null, doc, false);
|
||||
WebUtil.createResponse (request, response, this, null, doc, true);
|
||||
} // doGet
|
||||
|
||||
|
||||
|
@ -185,22 +182,23 @@ public class WLocation extends HttpServlet
|
|||
return;
|
||||
}
|
||||
int C_Location_ID = WebUtil.getParameterAsInt(request, P_C_LOCATION_ID);
|
||||
String targetBase = "parent.WWindow." + WWindow.FORM_NAME + ".C_Location_ID";
|
||||
String targetBase = "opener.WWindow." + WWindow.FORM_NAME + ".C_Location_ID";
|
||||
|
||||
// Create Location
|
||||
MLocation location = new MLocation(ws.ctx, C_Location_ID, null);
|
||||
MLocation location = new MLocation(ws.ctx, C_Location_ID,null);
|
||||
log.fine("doPost updating C_Location_ID=" + C_Location_ID + " - " + targetBase);
|
||||
|
||||
location.setAddress1 (WebUtil.getParameter(request, P_ADDRESS1));
|
||||
location.setAddress2 (WebUtil.getParameter(request, P_ADDRESS2));
|
||||
location.setAddress3(WebUtil.getParameter(request, P_ADDRESS3));
|
||||
location.setAddress4(WebUtil.getParameter(request, P_ADDRESS4));
|
||||
location.setCity (WebUtil.getParameter(request, P_CITY));
|
||||
location.setPostal (WebUtil.getParameter(request, P_POSTAL));
|
||||
location.setC_Country_ID (WebUtil.getParameterAsInt(request, P_C_COUNTRY_ID));
|
||||
location.setC_Region_ID (WebUtil.getParameterAsInt(request, P_C_REGION_ID));
|
||||
|
||||
System.out.println("location =========== "+location);
|
||||
// Document
|
||||
WebDoc doc = WebDoc.createPopup ("WLocation");
|
||||
//Modified by Rob Klein 4/29/07
|
||||
doc.addPopupClose(ws.ctx);
|
||||
|
||||
// Save Location
|
||||
|
@ -220,7 +218,25 @@ public class WLocation extends HttpServlet
|
|||
doc.getBody().addElement(script);
|
||||
log.fine("script=" + script.toString());
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
form myForm = null;
|
||||
myForm = new form ();
|
||||
table table = new table();
|
||||
table.setID("WLocation");
|
||||
button button = new button();
|
||||
button.addElement("ok");
|
||||
StringBuffer script2 = new StringBuffer();
|
||||
String targetBase2 = "opener.document.WForm.C_Location_ID";
|
||||
script2.append(targetBase2).append("D.value='").append(C_Location_ID).append("';")
|
||||
//script.append(targetBase).append("D.value='").append("';")
|
||||
.append(targetBase2).append("F.value='").append(location.toString())
|
||||
//.append(targetBase).append("F.value='")
|
||||
.append("';submit();window.close();");
|
||||
button.setOnClick(script2.toString());
|
||||
table.addElement(button);
|
||||
myForm.addElement(table);
|
||||
doc.getTable().addElement(myForm);
|
||||
|
||||
WebUtil.createResponse(request, response, this, null, doc, true);
|
||||
} // doPost
|
||||
|
||||
/**
|
||||
|
@ -256,6 +272,23 @@ public class WLocation extends HttpServlet
|
|||
myInput.setMaxlength(50).setSize(50);
|
||||
line.addElement(new td(myInput).setAlign(AlignType.LEFT).setColSpan(5));
|
||||
table.addElement(line);
|
||||
|
||||
//-- add by Dan
|
||||
line = new tr();
|
||||
line.addElement(new td(Msg.getMsg(ws.ctx, "Address")+ " 3").setAlign(AlignType.RIGHT));
|
||||
myInput = new input (input.TYPE_TEXT, P_ADDRESS3, location.getAddress3());
|
||||
myInput.setMaxlength(50).setSize(50);
|
||||
line.addElement(new td(myInput).setAlign(AlignType.LEFT).setColSpan(5));
|
||||
table.addElement(line);
|
||||
|
||||
// -- add by Dan
|
||||
line = new tr();
|
||||
line.addElement(new td(Msg.getMsg(ws.ctx, "Address")+ " 4").setAlign(AlignType.RIGHT));
|
||||
myInput = new input (input.TYPE_TEXT, P_ADDRESS4, location.getAddress4());
|
||||
myInput.setMaxlength(50).setSize(50);
|
||||
line.addElement(new td(myInput).setAlign(AlignType.LEFT).setColSpan(5));
|
||||
table.addElement(line);
|
||||
|
||||
// -- Line 3
|
||||
line = new tr();
|
||||
line.addElement(new td(Msg.getMsg(ws.ctx, "City")).setAlign(AlignType.RIGHT)); // 1
|
||||
|
@ -287,22 +320,33 @@ public class WLocation extends HttpServlet
|
|||
// -- Line 5
|
||||
line = new tr();
|
||||
// Submit
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append(targetBase).append("D.value='").append("temp").append("';")
|
||||
//script.append(targetBase).append("D.value='").append("';")
|
||||
.append(targetBase).append("F.value='").append("temp")
|
||||
//.append(targetBase).append("F.value='")
|
||||
.append("';submit();closePopup();");
|
||||
|
||||
|
||||
line.addElement(new td(" "));
|
||||
input submit = new input(input.TYPE_SUBMIT, "Submit", "Submit"); // translate
|
||||
submit.setOnClick(script.toString());
|
||||
line.addElement(new td(submit).setAlign(AlignType.RIGHT).setColSpan(5));
|
||||
table.addElement(line);
|
||||
|
||||
/**
|
||||
button button = new button();
|
||||
|
||||
/*button button = new button();
|
||||
button.addElement(">");
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append(targetBase).append("D.value='").append(np.getKey()).append("';")
|
||||
.append(targetBase).append("F.value='").append(np.getName())
|
||||
script.append(targetBase).append("D.value='").append("temp").append("';")
|
||||
//script.append(targetBase).append("D.value='").append("';")
|
||||
.append(targetBase).append("F.value='").append("temp")
|
||||
//.append(targetBase).append("F.value='")
|
||||
.append("';closePopup();");
|
||||
if (addStart)
|
||||
script.append("startUpdate(").append(targetBase).append("F);");
|
||||
button.setOnClick(script.toString());
|
||||
**/
|
||||
table.addElement(button);*/
|
||||
myForm.addElement(table);
|
||||
//
|
||||
return myForm;
|
||||
|
@ -326,7 +370,7 @@ public class WLocation extends HttpServlet
|
|||
for (int i = 0; i < countries.length; i++)
|
||||
{
|
||||
options[i] = new option (String.valueOf(countries[i].getC_Country_ID()));
|
||||
options[i].addElement(Util.maskHTML(countries[i].getName()));
|
||||
options[i].addElement(countries[i].getName());
|
||||
if (comp == countries[i].getC_Country_ID())
|
||||
options[i].setSelected(true);
|
||||
}
|
||||
|
@ -352,7 +396,7 @@ public class WLocation extends HttpServlet
|
|||
for (int i = 0; i < regions.length; i++)
|
||||
{
|
||||
options[i] = new option (String.valueOf(regions[i].getC_Region_ID()));
|
||||
options[i].addElement(Util.maskHTML(regions[i].getName()));
|
||||
options[i].addElement(regions[i].getName());
|
||||
if (comp == regions[i].getC_Region_ID())
|
||||
options[i].setSelected(true);
|
||||
}
|
||||
|
|
|
@ -16,46 +16,15 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.Principal;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.ecs.AlignType;
|
||||
import org.apache.ecs.HtmlColor;
|
||||
import org.apache.ecs.xhtml.b;
|
||||
import org.apache.ecs.xhtml.font;
|
||||
import org.apache.ecs.xhtml.form;
|
||||
import org.apache.ecs.xhtml.img;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.label;
|
||||
import org.apache.ecs.xhtml.option;
|
||||
import org.apache.ecs.xhtml.p;
|
||||
import org.apache.ecs.xhtml.script;
|
||||
import org.apache.ecs.xhtml.select;
|
||||
import org.apache.ecs.xhtml.strong;
|
||||
import org.apache.ecs.xhtml.table;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.MSession;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Login;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import java.io.*;
|
||||
import java.security.*;
|
||||
import java.util.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.ecs.*;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Web Login Page.
|
||||
|
@ -75,14 +44,10 @@ import org.compiere.util.WebUtil;
|
|||
* </pre>
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WLogin.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WLogin.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WLogin extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -407753489095758837L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
|
|
|
@ -16,37 +16,19 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
import org.apache.ecs.xhtml.button;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.table;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.th;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MProcessPara;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* WLookup Servlet.
|
||||
|
@ -57,30 +39,27 @@ import org.compiere.util.WebUtil;
|
|||
* </code>
|
||||
* and assumes that in the opening window/form there are two fields
|
||||
* <code>
|
||||
* opener.document.formName.columnName - The (hidden) field for the ID
|
||||
* opener.document.formName.columnName - The (hidden) field for thcoe ID
|
||||
* opener.document.formName.columnName_D - The display field for the value
|
||||
* </code>
|
||||
* When selecting an entry, the window is closed and the value of the two fields set.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WLookup.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WLookup.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WLookup extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1564370055815050553L;
|
||||
|
||||
/** Logger */
|
||||
protected static CLogger log = CLogger.getCLogger(WLookup.class);
|
||||
|
||||
/** The Data List */
|
||||
protected volatile ArrayList<Object> p_data = new ArrayList<Object>();
|
||||
|
||||
private static final int MAX_LINES = 5;
|
||||
private static final int MAX_LINES = 99999;
|
||||
private int m_recordCount;
|
||||
private int m_colCount;
|
||||
|
||||
private StringBuffer HeaderSelect = null;
|
||||
private StringBuffer m_HeaderSelect = null;
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
|
@ -160,46 +139,75 @@ public class WLookup extends HttpServlet
|
|||
// Create Document
|
||||
WebDoc doc = WebDoc.createPopup (para.getColumnName());
|
||||
|
||||
div panel=new div();
|
||||
panel.setStyle("height: 330px;overflow: scroll;overflow: auto;");
|
||||
panel.addElement(fillTable(wsc, para.getColumnName(), para.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase,false, page));
|
||||
|
||||
//tr tr = new tr().addElement(panel);
|
||||
|
||||
// Reset
|
||||
String text = "Reset";
|
||||
if (wsc.ctx != null)
|
||||
text = Msg.getMsg (wsc.ctx, "Reset");
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Reset");
|
||||
|
||||
input button = new input("button", text, " "+text);
|
||||
button.setID(text);
|
||||
button.setClass("resetbtn");
|
||||
input resetbtn = new input("button", text, " "+text);
|
||||
resetbtn.setID(text);
|
||||
resetbtn.setClass("resetbtn");
|
||||
String script = targetBase + "F.value='';" + targetBase + "D.value='';closePopup();";
|
||||
button.setOnClick(script);
|
||||
resetbtn.setOnClick(script);
|
||||
//
|
||||
// Next Page
|
||||
String textbtn = "Next Page";
|
||||
if (wsc.ctx != null)
|
||||
text = Msg.getMsg (wsc.ctx, "Next Page");
|
||||
input nextpgbtn = new input(input.TYPE_BUTTON, textbtn, " "+text);
|
||||
int nextpage = (page+1);
|
||||
nextpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+nextpage+");return false;");
|
||||
nextpgbtn.setID(text);
|
||||
nextpgbtn.setClass("nextpgbtn");
|
||||
//
|
||||
//First Page
|
||||
text = "First";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Next Page");
|
||||
input firstpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
|
||||
firstpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", 1);return false;");
|
||||
firstpgbtn.setID(text);
|
||||
firstpgbtn.setClass("firstpgbtn");
|
||||
|
||||
//Previous Page
|
||||
textbtn = "Prior Page";
|
||||
if (wsc.ctx != null)
|
||||
text = Msg.getMsg (wsc.ctx, "Prior Page");
|
||||
input prevpgbtn = new input(input.TYPE_BUTTON, textbtn, " "+text);
|
||||
text = "Prior";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Prior Page");
|
||||
input prevpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
int prevpage = (page == 1) ? 1 : page-1;
|
||||
prevpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+prevpage+");return false;");
|
||||
prevpgbtn.setID(text);
|
||||
prevpgbtn.setClass("prevpgbtn");
|
||||
|
||||
doc.getTable().addElement(new tr()
|
||||
.addElement(fillTable(wsc, para.getColumnName(), para.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase,false, page))
|
||||
.addElement(nextpgbtn)
|
||||
//Next Page
|
||||
text = "Next";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Next Page");
|
||||
input nextpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
int nextpage = (page+1);
|
||||
nextpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+nextpage+");return false;");
|
||||
nextpgbtn.setID(text);
|
||||
nextpgbtn.setClass("nextpgbtn");
|
||||
|
||||
//Last Page
|
||||
text = "Next";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Next Page");
|
||||
input lastpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
int lastpage = m_recordCount/MAX_LINES + 1;
|
||||
lastpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+lastpage+");return false;");
|
||||
lastpgbtn.setID(text);
|
||||
lastpgbtn.setClass("lastpgbtn");
|
||||
|
||||
int index1=(page-1)*MAX_LINES+1;
|
||||
int index2=(page)*MAX_LINES<m_recordCount?(page)*MAX_LINES:m_recordCount;
|
||||
|
||||
doc.getTable().addElement(new tr(new td(panel).setColSpan(2)));
|
||||
|
||||
doc.addPopupClose(ws.ctx)[0].addElement(" # " + index1 + "-" + index2 + " / " + m_recordCount)
|
||||
.addElement(resetbtn)
|
||||
.addElement(firstpgbtn)
|
||||
.addElement(prevpgbtn)
|
||||
.addElement(button));
|
||||
|
||||
|
||||
|
||||
doc.addPopupClose(wsc.ctx);
|
||||
.addElement(nextpgbtn)
|
||||
.addElement(lastpgbtn);
|
||||
|
||||
WebUtil.createResponse (request, response, this, null, doc, false);
|
||||
|
||||
|
@ -233,47 +241,75 @@ public class WLookup extends HttpServlet
|
|||
boolean hasDependents = ws.curTab.hasDependants(columnName);
|
||||
boolean hasCallout = mField.getCallout().length() > 0;
|
||||
|
||||
div panel=new div();
|
||||
panel.setStyle("height: 330px;overflow: scroll;overflow: auto;");
|
||||
panel.addElement(fillTable(wsc, mField.getColumnName(), mField.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase, hasDependents || hasCallout, page));
|
||||
|
||||
//tr tr = new tr().addElement(panel);
|
||||
|
||||
// Reset
|
||||
String text = "Reset";
|
||||
if (wsc.ctx != null)
|
||||
text = Msg.getMsg (wsc.ctx, "Reset");
|
||||
input restbtn = new input(input.TYPE_RESET, text, " "+text);
|
||||
restbtn.setID(text);
|
||||
restbtn.setClass("resetbtn");
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Reset");
|
||||
input resetbtn = new input(input.TYPE_RESET, text, " "+text);
|
||||
resetbtn.setID(text);
|
||||
resetbtn.setClass("resetbtn");
|
||||
|
||||
String script = targetBase + "F.value='';" + targetBase + "D.value='';self.close();";
|
||||
if (hasDependents || hasCallout)
|
||||
script += "startUpdate(" + targetBase + "F);";
|
||||
restbtn.setOnClick(script);
|
||||
resetbtn.setOnClick(script);
|
||||
|
||||
//Next Page
|
||||
String textbtn = "Next Page";
|
||||
if (wsc.ctx != null)
|
||||
text = Msg.getMsg (wsc.ctx, "Next Page");
|
||||
input nextpgbtn = new input(input.TYPE_BUTTON, textbtn, " "+text);
|
||||
int nextpage = (page+1);
|
||||
nextpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+nextpage+");return false;");
|
||||
nextpgbtn.setID(text);
|
||||
nextpgbtn.setClass("nextpgbtn");
|
||||
//First Page
|
||||
text = "First";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "First");
|
||||
input firstpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
firstpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", 1);return false;");
|
||||
firstpgbtn.setID(text);
|
||||
firstpgbtn.setClass("firstpgbtn");
|
||||
|
||||
//Previous Page
|
||||
textbtn = "Prior Page";
|
||||
if (wsc.ctx != null)
|
||||
text = Msg.getMsg (wsc.ctx, "Prior Page");
|
||||
input prevpgbtn = new input(input.TYPE_BUTTON, textbtn, " "+text);
|
||||
text = "Prior";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Prior");
|
||||
input prevpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
int prevpage = (page == 1) ? 1 : page-1;
|
||||
prevpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+prevpage+");return false;");
|
||||
prevpgbtn.setID(text);
|
||||
prevpgbtn.setClass("prevpgbtn");
|
||||
|
||||
//Next Page
|
||||
text = "Next";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Next");
|
||||
input nextpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
int nextpage = (page+1);
|
||||
nextpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+nextpage+");return false;");
|
||||
nextpgbtn.setID(text);
|
||||
nextpgbtn.setClass("nextpgbtn");
|
||||
|
||||
doc.getTable().addElement(new tr()
|
||||
.addElement(fillTable(wsc, mField.getColumnName(), mField.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase, hasDependents || hasCallout, page))
|
||||
//Last Page
|
||||
text = "Last";
|
||||
//if (wsc.ctx != null)
|
||||
// text = Msg.getMsg (wsc.ctx, "Last");
|
||||
input lastpgbtn = new input(input.TYPE_BUTTON, text, " "+text);
|
||||
int lastpage=m_recordCount/MAX_LINES + 1;
|
||||
lastpgbtn.setOnClick("startLookup('" + columnName + "', "+AD_Process_ID+", "+ lastpage +");return false;");
|
||||
lastpgbtn.setID(text);
|
||||
lastpgbtn.setClass("lastpgbtn");
|
||||
|
||||
int index1=(page-1)*MAX_LINES+1;
|
||||
int index2=(page)*MAX_LINES<m_recordCount?(page)*MAX_LINES:m_recordCount;
|
||||
|
||||
doc.getTable().addElement(new tr(new td(panel).setColSpan(2)));
|
||||
|
||||
doc.addPopupClose(ws.ctx)[0].addElement(" # " + index1 + "-" + index2 + " / " + m_recordCount)
|
||||
.addElement(resetbtn)
|
||||
.addElement(firstpgbtn)
|
||||
.addElement(prevpgbtn)
|
||||
.addElement(nextpgbtn)
|
||||
.addElement(prevpgbtn));
|
||||
//.addElement(restbtn));
|
||||
|
||||
doc.addPopupClose(ws.ctx);
|
||||
.addElement(lastpgbtn);
|
||||
|
||||
WebUtil.createResponse (request, response, this, null, doc, false);
|
||||
}
|
||||
|
@ -322,14 +358,15 @@ public class WLookup extends HttpServlet
|
|||
|
||||
|
||||
// Set Headers
|
||||
line.addElement(new th(" ")).
|
||||
addElement(new th(Msg.translate(wsc.ctx, "Key Name")).setClass("table-filterable table-filtered table-sortable:default"));
|
||||
//line.addElement(new th(" ")).
|
||||
// addElement(new th(Msg.translate(wsc.ctx, "Key Name")).setClass("table-filterable table-filtered table-sortable:default"));
|
||||
line = fillTable_Lookup_Headers(columnName, fieldRefId, line, targetBase, true, true, true, false, true);
|
||||
table.addElement(line);
|
||||
|
||||
tr line2 = new tr();
|
||||
line2.addElement(new th(" ")).addElement(new th(" "));
|
||||
//line2.addElement(new th(" ")).addElement(new th(" "));
|
||||
line2 = fillTable_Lookup_Headers( columnName, fieldRefId, line2, targetBase, true, true, true, false, false);
|
||||
table.addElement(line2);
|
||||
table.addElement(line);
|
||||
table.addElement("</thead>");
|
||||
table.addElement("<tbody>");
|
||||
|
||||
|
@ -354,116 +391,66 @@ public class WLookup extends HttpServlet
|
|||
table table1, String targetBase, boolean mandatory, boolean onlyValidated, boolean onlyActive,
|
||||
boolean temporary, int page)
|
||||
{
|
||||
ArrayList<Object> list = new ArrayList<Object>();
|
||||
StringBuffer sqlSelect = null;
|
||||
StringBuffer sqlSelectDetail = null;
|
||||
|
||||
int size = 0;
|
||||
int colCount = 0;
|
||||
|
||||
if (!mandatory)
|
||||
list.add(new KeyNamePair (-1, ""));
|
||||
|
||||
StringBuffer sql = null;
|
||||
StringBuffer sqlCount = null;
|
||||
String sql=null;
|
||||
String colKey=null;
|
||||
String colDisplay=null;
|
||||
|
||||
if (fieldRefId > 0){
|
||||
sql = new StringBuffer ("SELECT AD_Display, AD_Key, AD_Table_ID, WhereClause, OrderByClause "
|
||||
+ "FROM AD_Ref_Table WHERE AD_Reference_ID = "+fieldRefId);
|
||||
sql = "SELECT AD_Table_ID, AD_Key, AD_Display, WhereClause, OrderByClause FROM AD_Ref_Table WHERE AD_Reference_ID = " + fieldRefId;
|
||||
|
||||
int nameID = 0;
|
||||
int keyID = 0;
|
||||
int tableID = 0;
|
||||
|
||||
String whereClause = null;
|
||||
String orderBy = null;
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
size=2;
|
||||
|
||||
while (rs.next()){
|
||||
nameID = rs.getInt(1);
|
||||
keyID = rs.getInt(2);
|
||||
tableID = rs.getInt(3);
|
||||
if (rs.next()){
|
||||
tableID = rs.getInt(1);
|
||||
|
||||
whereClause = rs.getString(4);
|
||||
orderBy = rs.getString(5);
|
||||
sql="Select ColumnName FROM AD_Column Where AD_Column_ID = ? AND AD_Table_ID = ?";
|
||||
colKey = DB.getSQLValueString(null, sql, rs.getInt(2), tableID);
|
||||
colDisplay = DB.getSQLValueString(null, sql, rs.getInt(3), tableID);
|
||||
}
|
||||
|
||||
String sql1 = "Select ColumnName FROM AD_Column Where AD_Column_ID = ? AND AD_Table_ID = "+tableID;
|
||||
sql = new StringBuffer ("SELECT count(Name) FROM AD_Column WHERE AD_TABLE_ID="+tableID);
|
||||
colCount = DB.getSQLValue(null, sql.toString());
|
||||
|
||||
String name = DB.getSQLValueString(null, sql1 , nameID);
|
||||
String key = DB.getSQLValueString(null, sql1 , keyID);
|
||||
sqlSelect = new StringBuffer ("SELECT "+key+", "+name);
|
||||
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sqlSelect.toString(), e);
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
|
||||
String sql1 = "Select TableName FROM AD_Table Where AD_Table_ID = ?";
|
||||
String tableName = DB.getSQLValueString(null, sql1 , tableID);
|
||||
sqlSelect.append(" FROM " + tableName + " WHERE AD_Client_ID=?");
|
||||
sqlSelectDetail = HeaderSelect.append(" FROM " + tableName + " WHERE "+columnName+" = ?");
|
||||
sql = "Select TableName FROM AD_Table Where AD_Table_ID = ?";
|
||||
String tableName = DB.getSQLValueString(null, sql , tableID);
|
||||
sqlSelect=new StringBuffer ( "SELECT " + m_HeaderSelect + " FROM " + tableName + " WHERE AD_Client_ID=?");
|
||||
sqlCount=new StringBuffer ( "SELECT count(*) FROM " + tableName + " WHERE AD_Client_ID=?");
|
||||
|
||||
if (whereClause != null){
|
||||
sqlSelect.append(" AND " + whereClause);
|
||||
sqlSelectDetail.append(" AND " + whereClause);
|
||||
sqlCount.append(" AND " + whereClause);
|
||||
}
|
||||
|
||||
if (orderBy != null){
|
||||
if (orderBy != null)
|
||||
sqlSelect.append(" ORDER BY " + orderBy);
|
||||
sqlSelectDetail.append(" ORDER BY " + orderBy);
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
//direct select as indicated below
|
||||
sql = new StringBuffer ("SELECT AD_Table_ID "
|
||||
+ "FROM AD_Table WHERE TableName = '"+columnName.replace("_ID", "")+"'");
|
||||
int tableID = DB.getSQLValue(null, sql.toString());
|
||||
|
||||
sql = new StringBuffer ("SELECT count(Name) FROM AD_Column WHERE AD_TABLE_ID="+tableID);
|
||||
colCount = DB.getSQLValue(null, sql.toString());
|
||||
|
||||
sql = new StringBuffer ("SELECT ColumnName "
|
||||
+ "FROM AD_Column WHERE IsIdentifier = 'Y' AND "
|
||||
+ "AD_Table_ID= "+tableID
|
||||
+ " ORDER BY SeqNo");
|
||||
|
||||
sqlSelect = new StringBuffer ("SELECT "+columnName+", ");
|
||||
size=1;
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next()){
|
||||
if (size>1)
|
||||
sqlSelect.append(", ");
|
||||
sqlSelect.append(rs.getObject(1));
|
||||
size++;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sqlSelect.toString(), e);
|
||||
}
|
||||
|
||||
sqlSelect.append(" FROM " + columnName.replace("_ID", "") + " WHERE AD_Client_ID=?");
|
||||
sqlSelectDetail = HeaderSelect.append(" FROM " + columnName.replace("_ID", "") + " WHERE "+columnName+" = ?");
|
||||
|
||||
sqlSelect=new StringBuffer("SELECT " + m_HeaderSelect + " FROM " + columnName.replace("_ID", "") + " WHERE AD_Client_ID=?");
|
||||
sqlCount=new StringBuffer("SELECT count(*) FROM " + columnName.replace("_ID", "") + " WHERE AD_Client_ID=?");
|
||||
colKey=columnName;
|
||||
if (m_HeaderSelect.toString().contains("Name"))
|
||||
colDisplay="Name";
|
||||
else
|
||||
colDisplay="Description";
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
PreparedStatement pstmt = DB.prepareStatement(sqlSelect.toString(),
|
||||
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY, null);
|
||||
|
||||
|
@ -471,57 +458,38 @@ public class WLookup extends HttpServlet
|
|||
ResultSet rs = pstmt.executeQuery();
|
||||
log.info("This is the page number "+page);
|
||||
log.info("This is the MAX_LINES "+MAX_LINES);
|
||||
rs.absolute(((page-1)*MAX_LINES)+1);
|
||||
//rs.absolute(((page-1)*MAX_LINES)+1);
|
||||
|
||||
for (int j= 1; j<= MAX_LINES; j++){
|
||||
if(rs.next()){
|
||||
StringBuffer name = new StringBuffer ("");
|
||||
for (int i = 2; i <= size; i++)
|
||||
{
|
||||
if (i>2)
|
||||
name.append("_");
|
||||
name.append(rs.getObject(i));
|
||||
}
|
||||
//for (int j= 1; j<= MAX_LINES; j++){
|
||||
while(rs.next()){
|
||||
button button = new button();
|
||||
button.addElement(">");
|
||||
StringBuffer script = new StringBuffer();
|
||||
script
|
||||
.append("startLookUpdate(").append(targetBase).append("F',")
|
||||
.append(targetBase).append("D','").append(rs.getObject(1).toString()).append("',")
|
||||
.append(targetBase).append("F','").append(name.toString())
|
||||
.append(targetBase).append("D','").append(rs.getString(colKey)).append("',")
|
||||
.append(targetBase).append("F','").append(rs.getString(colDisplay))
|
||||
.append("');startUpdate(").append(targetBase).append("');return false;");
|
||||
button.setOnClick(script.toString());
|
||||
//
|
||||
tr line = new tr();
|
||||
line.addElement(new td(button));
|
||||
line.addElement(new td(name.toString()));
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt1 = DB.prepareStatement(sqlSelectDetail.toString(), null);
|
||||
pstmt1.setInt(1, rs.getInt(1));
|
||||
ResultSet rs1 = pstmt1.executeQuery();
|
||||
while (rs1.next()){
|
||||
for (int i = 1; i <= colCount; i++)
|
||||
{
|
||||
Object fieldRS = rs1.getObject(i);
|
||||
if (fieldRS == null)
|
||||
line.addElement(new td(" "));
|
||||
else
|
||||
line.addElement(new td(rs1.getObject(i).toString()));
|
||||
}
|
||||
}
|
||||
rs1.close();
|
||||
pstmt1.close();
|
||||
//line.addElement(new td(rs.getString(i)));
|
||||
|
||||
for (int i = 1; i <=m_colCount; i++)
|
||||
{
|
||||
line.addElement(new td(rs.getString(i)));
|
||||
}
|
||||
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
table1.addElement(line);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
//count
|
||||
m_recordCount = DB.getSQLValue(null, sqlCount.toString(),Env.getAD_Client_ID(wsc.ctx));
|
||||
|
||||
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
|
@ -546,58 +514,49 @@ public class WLookup extends HttpServlet
|
|||
boolean temporary, boolean firstHeaderLine)
|
||||
{
|
||||
|
||||
StringBuffer sqlSelect = null;
|
||||
int size = 0;
|
||||
StringBuffer sql = null;
|
||||
int colCount = 0;
|
||||
if (fieldRefId > 0){
|
||||
String sqlSelect = null;
|
||||
input filter = null;
|
||||
if (fieldRefId > 0)
|
||||
sqlSelect = "SELECT ColumnName, Name FROM AD_Column WHERE AD_Table_ID IN (SELECT AD_Table_ID FROM AD_Ref_Table WHERE AD_Reference_ID = " + fieldRefId + ") ORDER BY SEQNO";
|
||||
else
|
||||
sqlSelect = "SELECT ColumnName, Name FROM AD_Column WHERE AD_Table_ID IN (SELECT AD_Table_ID FROM AD_Table WHERE TableName = '" + columnName.replace("_ID", "") + "') ORDER BY SEQNO";
|
||||
|
||||
sql = new StringBuffer ("SELECT AD_Table_ID "
|
||||
+ "FROM AD_Ref_Table WHERE AD_Reference_ID = "+fieldRefId);
|
||||
int tableID = DB.getSQLValue(null, sql.toString());
|
||||
|
||||
sql = new StringBuffer ("SELECT count(Name) FROM AD_Column WHERE AD_TABLE_ID="+tableID);
|
||||
colCount = DB.getSQLValue(null, sql.toString());
|
||||
sqlSelect = new StringBuffer ("SELECT ColumnName, Name FROM AD_Column WHERE AD_Table_ID="+tableID+" ORDER BY AD_Column_ID");
|
||||
|
||||
if(firstHeaderLine) {
|
||||
line.addElement(new th());
|
||||
m_HeaderSelect = new StringBuffer(columnName);
|
||||
line.addElement(new th(columnName).setClass("table-filterable table-filtered table-sortable:default"));
|
||||
m_colCount=1;
|
||||
} else {
|
||||
line.addElement(new th("Find"));
|
||||
filter = new input (input.TYPE_TEXT, columnName+"filter", "");
|
||||
filter.setOnKeyUp("Table.filter(this,this)");
|
||||
line.addElement(new th().addElement(filter));
|
||||
}
|
||||
else{
|
||||
//direct select as indicated below
|
||||
|
||||
sql = new StringBuffer ("SELECT AD_Table_ID "
|
||||
+ "FROM AD_Table WHERE TableName = '"+columnName.replace("_ID", "")+"'");
|
||||
int tableID = DB.getSQLValue(null, sql.toString());
|
||||
sql = new StringBuffer ("SELECT count(Name) FROM AD_Column WHERE AD_TABLE_ID="+tableID);
|
||||
colCount = DB.getSQLValue(null, sql.toString());
|
||||
sqlSelect = new StringBuffer ("SELECT ColumnName, Name FROM AD_Column WHERE AD_TABLE_ID="+tableID+" ORDER BY AD_Column_ID");
|
||||
|
||||
}
|
||||
|
||||
if(firstHeaderLine)
|
||||
HeaderSelect = new StringBuffer ("Select ");
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sqlSelect.toString(), null);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
input filter = null;
|
||||
|
||||
String col;
|
||||
while (rs.next()){
|
||||
col=rs.getString(1);
|
||||
if(col.equals("Value")||col.equals("DocumentNo")||col.equals("Name")||col.equals("Description")){
|
||||
if(firstHeaderLine){
|
||||
line.addElement(new th(rs.getString(2)).setClass("table-filterable table-filtered table-sortable:default"));
|
||||
HeaderSelect.append(rs.getString(1)+",");
|
||||
m_HeaderSelect.append(",").append(col);
|
||||
m_colCount++;
|
||||
}
|
||||
else{
|
||||
th th = new th();
|
||||
filter = new input (input.TYPE_TEXT, rs.getString(2)+"filter", "");
|
||||
filter.setOnKeyUp("Table.filter(this,this)");
|
||||
th.addElement(filter);
|
||||
line.addElement(th);
|
||||
line.addElement(new th().addElement(filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(firstHeaderLine)
|
||||
HeaderSelect.setLength(HeaderSelect.length()-1);
|
||||
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
@ -605,7 +564,7 @@ public class WLookup extends HttpServlet
|
|||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
log.log(Level.SEVERE, sqlSelect.toString(), e);
|
||||
}
|
||||
return line;
|
||||
|
||||
|
|
|
@ -16,60 +16,26 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.ecs.Element;
|
||||
import org.apache.ecs.xhtml.a;
|
||||
import org.apache.ecs.xhtml.base;
|
||||
import org.apache.ecs.xhtml.body;
|
||||
import org.apache.ecs.xhtml.cite;
|
||||
import org.apache.ecs.xhtml.head;
|
||||
import org.apache.ecs.xhtml.link;
|
||||
import org.apache.ecs.xhtml.script;
|
||||
import org.apache.ecs.xhtml.table;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.MForm;
|
||||
import org.compiere.model.MTree;
|
||||
import org.compiere.model.MTreeNode;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Login;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import java.io.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.ecs.*;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Web Menu
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WMenu.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WMenu.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WMenu extends HttpServlet
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6357775290362135602L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger (getClass ());
|
||||
|
||||
|
@ -373,7 +339,7 @@ public class WMenu extends HttpServlet
|
|||
// Document
|
||||
//Modified by Rob Klein 4/29/07
|
||||
//String windowTitle = Msg.getMsg(wsc.ctx, "Menu");
|
||||
String windowTitle = "";
|
||||
String windowTitle = "Menu";
|
||||
WebDoc doc = WebDoc.create (windowTitle);
|
||||
head head = doc.getHead();
|
||||
// Target
|
||||
|
@ -381,6 +347,7 @@ public class WMenu extends HttpServlet
|
|||
// Specific Menu Script/Stylesheet
|
||||
head.addElement(new link(WebEnv.getBaseDirectory("/css/menu.css"), link.REL_STYLESHEET, link.TYPE_CSS));
|
||||
head.addElement(new script((Element)null, WebEnv.getBaseDirectory("/js/menu.js")));
|
||||
head.addElement(new script((Element)null, WebEnv.getBaseDirectory("/js/window.js")));
|
||||
//Modified by Rob Klein 4/29/07
|
||||
//head.addElement(new script((Element)null, WebEnv.getBaseDirectory("/js/mktree.js")));
|
||||
//head.addElement(new link(WebEnv.getBaseDirectory("/css/mktree.css"), link.REL_STYLESHEET, link.TYPE_CSS));
|
||||
|
@ -391,6 +358,7 @@ public class WMenu extends HttpServlet
|
|||
//Rob 12-16-2006 head.addElement(new script(scriptTxt));
|
||||
|
||||
// Body
|
||||
|
||||
body body = doc.getBody();
|
||||
body.setTitle(statusMessage);
|
||||
// Clear Window Frame
|
||||
|
@ -398,9 +366,13 @@ public class WMenu extends HttpServlet
|
|||
|
||||
// Header
|
||||
table table = doc.getTable();
|
||||
|
||||
doc.setClasses ("menuTable", "menuHeader");
|
||||
//Rob 12-16-2006 doc.getTopLeft().addElement(new cite(wsc.loginInfo));
|
||||
doc.getTopLeft().addElement(new cite(""));
|
||||
input txtSearch = new input(input.TYPE_TEXT, "txtSearch", "");
|
||||
txtSearch.setOnKeyDown("searchMenu('main',this.value,event,'" + WebEnv.TARGET_WINDOW + "')");
|
||||
doc.getTopLeft().addElement("Find: ");
|
||||
doc.getTopLeft().addElement(txtSearch);
|
||||
|
||||
// Load Menu Structure ----------------------
|
||||
int AD_Tree_ID = DB.getSQLValue(null,
|
||||
|
@ -415,7 +387,7 @@ public class WMenu extends HttpServlet
|
|||
// Trim tree
|
||||
MTreeNode root = tree.getRoot();
|
||||
Enumeration en = root.preorderEnumeration();
|
||||
while (en.hasMoreElements())
|
||||
/*while (en.hasMoreElements())
|
||||
{
|
||||
MTreeNode nd = (MTreeNode)en.nextElement();
|
||||
if (nd.isTask()
|
||||
|
@ -427,7 +399,7 @@ public class WMenu extends HttpServlet
|
|||
MTreeNode parent = (MTreeNode)nd.getParent();
|
||||
parent.remove(nd);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
tree.trimTree();
|
||||
|
||||
// Print tree
|
||||
|
@ -587,15 +559,15 @@ public class WMenu extends HttpServlet
|
|||
.append(node.getNode_ID());
|
||||
}
|
||||
// remaining a tag
|
||||
sb.append("\" onMouseOver=\"status='" + description
|
||||
+ "';\" onClick=\"showLoadingWindow('" + WebEnv.getBaseDirectory("") + "')\">")
|
||||
sb.append("\" title=\"" + description
|
||||
+ "\" onClick=\"showLoadingWindow('" + WebEnv.getBaseDirectory("") + "')\">")
|
||||
.append(name) // language set in MTree.getNodeDetails based on ctx
|
||||
.append("</a></li>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* <li class="foldHeader" onClick="changeMenu(this)">MenuEntry
|
||||
* <li class="foldHeader" onClick="changeMenu(event)">MenuEntry
|
||||
* <ul style="display:none">
|
||||
* ....
|
||||
* </ul></li>
|
||||
|
|
|
@ -16,62 +16,20 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.io.*;
|
||||
import java.math.*;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.*;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.ecs.AlignType;
|
||||
import org.apache.ecs.Element;
|
||||
import org.apache.ecs.xhtml.form;
|
||||
import org.apache.ecs.xhtml.i;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.option;
|
||||
import org.apache.ecs.xhtml.p;
|
||||
import org.apache.ecs.xhtml.select;
|
||||
import org.apache.ecs.xhtml.table;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MAllocationHdr;
|
||||
import org.compiere.model.MBankStatement;
|
||||
import org.compiere.model.MInOut;
|
||||
import org.compiere.model.MInventory;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MJournal;
|
||||
import org.compiere.model.MJournalBatch;
|
||||
import org.compiere.model.MMovement;
|
||||
import org.compiere.model.MOrder;
|
||||
import org.compiere.model.MPInstance;
|
||||
import org.compiere.model.MPInstancePara;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.model.MProcess;
|
||||
import org.compiere.model.MProcessPara;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.DocumentEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.util.ASyncProcess;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.ecs.*;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.print.*;
|
||||
import org.compiere.process.*;
|
||||
import org.compiere.util.*;
|
||||
import org.compiere.wf.MWFActivity;
|
||||
|
||||
|
||||
|
@ -79,14 +37,10 @@ import org.compiere.wf.MWFActivity;
|
|||
* HTML Process and Report UI
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WProcess.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WProcess.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WProcess extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3937980012432969521L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
//Modified by Rob Klein 4/29/07
|
||||
|
@ -269,7 +223,9 @@ public class WProcess extends HttpServlet
|
|||
center.addElement(new p(process.getHelp(), AlignType.LEFT));
|
||||
form myForm = new form ("WProcess")
|
||||
.setName("process" + process.getAD_Process_ID());
|
||||
myForm.setOnSubmit("this.Submit.disabled=true;return true;");
|
||||
|
||||
myForm.setTarget("WPopup");
|
||||
//myForm.setOnSubmit("this.Submit.disabled=true;return true;");
|
||||
myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Process_ID", process.getAD_Process_ID()));
|
||||
myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Window_ID", windowID));
|
||||
myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Table_ID", tableID));
|
||||
|
@ -321,7 +277,8 @@ public class WProcess extends HttpServlet
|
|||
//
|
||||
form myForm = new form ("WProcess")
|
||||
.setName("process" + process.getAD_Process_ID());
|
||||
myForm.setOnSubmit("this.Submit.disabled=true;return true;");
|
||||
myForm.setTarget("WPopup");
|
||||
//myForm.setOnSubmit("this.Submit.disabled=true;return true;");
|
||||
myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Process_ID", process.getAD_Process_ID()));
|
||||
myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Window_ID", windowID));
|
||||
myForm.addElement(new input(input.TYPE_HIDDEN, "AD_Table_ID", tableID));
|
||||
|
@ -378,7 +335,7 @@ public class WProcess extends HttpServlet
|
|||
input submitbtn = new input(input.TYPE_SUBMIT, text, " "+text);
|
||||
submitbtn.setID(text);
|
||||
submitbtn.setClass("submitbtn");
|
||||
|
||||
submitbtn.setOnClick("popUp('WProcess','WPopup')");
|
||||
|
||||
myTable.addElement(new tr()
|
||||
.addElement(new td(null, AlignType.RIGHT, AlignType.MIDDLE, false,
|
||||
|
@ -478,8 +435,13 @@ public class WProcess extends HttpServlet
|
|||
center.addElement(pi.getLogInfo(true));
|
||||
}
|
||||
|
||||
String jasper=process.getJasperReport();
|
||||
if (process.isJavaProcess())
|
||||
{
|
||||
if (jasper!=null) {
|
||||
pi.setPrintPreview (false);
|
||||
pi.setIsBatch(true);
|
||||
}
|
||||
Trx trx = Trx.get(Trx.createTrxName("WebPrc"), true);
|
||||
try
|
||||
{
|
||||
|
@ -497,16 +459,30 @@ public class WProcess extends HttpServlet
|
|||
center.addElement(new p("Error:" + pi.getSummary(),
|
||||
AlignType.LEFT).setClass("Cerror"));
|
||||
processOK = false;
|
||||
}
|
||||
} else {
|
||||
if(jasper!=null) {
|
||||
String error = WebUtil.streamFile(response, pi.getPDFReport());
|
||||
//String error = streamResult (request, response, pInstance.getAD_PInstance_ID(), file);
|
||||
if (error == null)
|
||||
return;
|
||||
doc = WebDoc.create(error);
|
||||
wsc.ctx.put("AD_PInstance_ID=" + pInstance.getAD_PInstance_ID(), "ok");
|
||||
} else {
|
||||
center.addElement(new p().addElement(pi.getSummary()));
|
||||
center.addElement(pi.getLogInfo(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Report
|
||||
if (process.isReport())
|
||||
//if (processOK && process.isReport())
|
||||
{
|
||||
doc = null;
|
||||
//doc = null;
|
||||
|
||||
|
||||
|
||||
if(jasper==null) {
|
||||
log.info(response.toString());
|
||||
ReportEngine re = ReportEngine.get(wsc.ctx, pi);
|
||||
if (re == null)
|
||||
|
@ -557,6 +533,7 @@ public class WProcess extends HttpServlet
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
doc.addPopupClose(wsc.ctx);
|
||||
|
||||
try {
|
||||
|
|
|
@ -16,40 +16,28 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.InvalidClassException;
|
||||
import java.lang.reflect.UndeclaredThrowableException;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.compiere.apps.Waiting;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.interfaces.Server;
|
||||
import org.compiere.model.MPInstance;
|
||||
import org.compiere.print.ReportCtl;
|
||||
import org.compiere.process.ProcessCall;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoUtil;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.wf.MWFProcess;
|
||||
import org.compiere.wf.MWorkflow;
|
||||
import org.compiere.db.*;
|
||||
import org.compiere.interfaces.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.print.*;
|
||||
import org.compiere.process.*;
|
||||
import org.compiere.util.*;
|
||||
import org.compiere.wf.*;
|
||||
|
||||
/**
|
||||
* Process Interface Controller.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: ProcessCtl.java,v 1.2 2006/07/30 00:51:27 jjanke Exp $
|
||||
* @version $Id: WProcessCtl.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WProcessCtl extends Thread
|
||||
{
|
||||
|
@ -382,7 +370,7 @@ public class WProcessCtl extends Thread
|
|||
if (server != null)
|
||||
{ // See ServerBean
|
||||
log.info("running on the server");
|
||||
m_pi = server.workflow (Env.getRemoteCallCtx(m_wscctx), m_pi, AD_Workflow_ID);
|
||||
m_pi = server.workflow (m_wscctx, m_pi, AD_Workflow_ID);
|
||||
log.finest("server => " + m_pi);
|
||||
started = true;
|
||||
}
|
||||
|
@ -428,7 +416,7 @@ public class WProcessCtl extends Thread
|
|||
{
|
||||
if (server != null)
|
||||
{ // See ServerBean
|
||||
m_pi = server.process (Env.getRemoteCallCtx(m_wscctx), m_pi);
|
||||
m_pi = server.process (m_wscctx, m_pi);
|
||||
log.finest("server => " + m_pi);
|
||||
started = true;
|
||||
}
|
||||
|
@ -450,6 +438,14 @@ public class WProcessCtl extends Thread
|
|||
+ m_pi, ex);
|
||||
started = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Throwable cause = ex.getCause();
|
||||
if (cause == null)
|
||||
cause = ex;
|
||||
log.log(Level.SEVERE, "AppsServer error - " + m_pi, cause);
|
||||
started = false;
|
||||
}
|
||||
}
|
||||
// Run locally
|
||||
if (!started && !m_IsServerProcess)
|
||||
|
@ -496,7 +492,7 @@ public class WProcessCtl extends Thread
|
|||
String sql = "{call " + ProcedureName + "(?)}";
|
||||
try
|
||||
{
|
||||
CallableStatement cstmt = DB.prepareCall(sql); // ro??
|
||||
CallableStatement cstmt = DB.prepareCall(sql, ResultSet.CONCUR_UPDATABLE,null); // ro??
|
||||
cstmt.setInt(1, m_pi.getAD_PInstance_ID());
|
||||
cstmt.executeUpdate();
|
||||
cstmt.close();
|
||||
|
|
|
@ -53,14 +53,10 @@ import org.compiere.util.WebUtil;
|
|||
* Web (window) Report
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WReport.java $
|
||||
* @version $Id: WReport.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WReport extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6281182537210181407L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
/** Current MTab */
|
||||
|
|
|
@ -16,16 +16,10 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
import java.io.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Application Start Page
|
||||
|
@ -44,16 +38,10 @@ import org.compiere.util.WebUtil;
|
|||
* +- WWindow
|
||||
* see webapps/adempiere/index.html
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WStart.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WStart.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WStart extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3520310916249390852L;
|
||||
|
||||
|
||||
/**
|
||||
* Set UI directory to Servlet init param
|
||||
*/
|
||||
|
|
|
@ -16,32 +16,19 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
import java.io.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Status Servlet
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WStatus.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WStatus.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WStatus extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6029799149174591507L;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
* This servlet is also loaded on startup to initialize the system
|
||||
|
|
|
@ -28,52 +28,25 @@ import org.compiere.util.WebDoc;
|
|||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WTask.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
public class WTask extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4088461230847084532L;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
*/
|
||||
public void init(ServletConfig config)
|
||||
throws ServletException
|
||||
{
|
||||
super.init(config);
|
||||
if (!WebEnv.initWeb(config))
|
||||
throw new ServletException("WTask.init");
|
||||
} // init
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request
|
||||
*/
|
||||
}
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("WTask - Get - Not Implemented Yet");
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doGet
|
||||
|
||||
|
||||
/**
|
||||
* Process the HTTP Post request
|
||||
*/
|
||||
}
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("WTask - Post - Not Implemented Yet");
|
||||
//
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doPost
|
||||
|
||||
} // WTask
|
||||
}
|
||||
}
|
|
@ -16,32 +16,19 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebUtil;
|
||||
import java.io.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Web (window) Help
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WHelp.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WTest.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WTest extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -669477433080711028L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(WTest.class);
|
||||
|
||||
|
|
|
@ -52,14 +52,10 @@ import org.compiere.util.WebUtil;
|
|||
* HTML Process and Report UI
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WProcess.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WValuePreference.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WValuePreference extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6283213348834944668L;
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
//Modified by Rob Klein 4/29/07
|
||||
|
|
|
@ -16,65 +16,29 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Enumeration;
|
||||
import java.util.logging.Level;
|
||||
import java.io.*;
|
||||
import java.math.*;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
import org.apache.ecs.AlignType;
|
||||
import org.apache.ecs.xhtml.a;
|
||||
import org.apache.ecs.xhtml.button;
|
||||
import org.apache.ecs.xhtml.form;
|
||||
import org.apache.ecs.xhtml.hr;
|
||||
import org.apache.ecs.xhtml.img;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.script;
|
||||
import org.apache.ecs.xhtml.small;
|
||||
import org.apache.ecs.xhtml.span;
|
||||
import org.apache.ecs.xhtml.table;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.th;
|
||||
import org.apache.ecs.xhtml.thead;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MSession;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.apache.ecs.*;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Web Window Servlet
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WWindow.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WWindow.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WWindow extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 8801734074649997374L;
|
||||
/** Logger */
|
||||
protected static CLogger log = CLogger.getCLogger(WWindow.class);
|
||||
|
||||
|
@ -128,13 +92,16 @@ public class WWindow extends HttpServlet
|
|||
/** Multi Row Lines per Screen */
|
||||
// Modified by Rob Klein 4/29/2007
|
||||
//private static final int MAX_LINES = 12;
|
||||
private static final int MAX_LINES = 1000;
|
||||
private static final int MAX_LINES = 100;
|
||||
/** Indicator for last line */
|
||||
private static final int LAST_LINE = 999999;
|
||||
private static final int LAST_LINE = 999999999;
|
||||
|
||||
/** Error Indicator */
|
||||
private static final String ERROR = " ERROR! ";
|
||||
|
||||
private String m_searchField;
|
||||
private String m_targetWindow;
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request - Initial Call.
|
||||
* <br>
|
||||
|
@ -167,7 +134,7 @@ public class WWindow extends HttpServlet
|
|||
int AD_Window_ID = WebUtil.getParameterAsInt(request, "AD_Window_ID");
|
||||
// Get Parameter: Menu_ID
|
||||
int AD_Menu_ID = WebUtil.getParameterAsInt(request, "AD_Menu_ID");
|
||||
//
|
||||
|
||||
log.info("AD_Window_ID=" + AD_Window_ID
|
||||
+ "; AD_Menu_ID=" + AD_Menu_ID);
|
||||
|
||||
|
@ -226,6 +193,7 @@ public class WWindow extends HttpServlet
|
|||
Env.clearWinContext(wsc.ctx, WindowNo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* New Window data
|
||||
*/
|
||||
|
@ -247,8 +215,7 @@ public class WWindow extends HttpServlet
|
|||
ws.mWindow.initTab(ws.curTab.getTabNo());
|
||||
ws.curTab.setQuery(MQuery.getEqualQuery(TableName + "_ID", AD_Record_ID));
|
||||
ws.curTab.query(false);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
ws.mWindow.initTab(ws.curTab.getTabNo());
|
||||
ws.curTab.query(ws.mWindow.isTransaction());
|
||||
ws.curTab.navigate(0);
|
||||
|
@ -294,6 +261,7 @@ public class WWindow extends HttpServlet
|
|||
doGet(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get Parameter: Command
|
||||
String p_cmd = WebUtil.getParameter (request, P_Command);
|
||||
String column = WebUtil.getParameter (request, P_ChangedColumn);
|
||||
|
@ -317,7 +285,6 @@ public class WWindow extends HttpServlet
|
|||
executeCommand(request, p_cmd, wsc, ws);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************
|
||||
* Build Page
|
||||
*/
|
||||
|
@ -435,7 +402,7 @@ public class WWindow extends HttpServlet
|
|||
}
|
||||
else if (p_cmd.equals("Last"))
|
||||
{
|
||||
ws.curTab.navigateRelative(999999);
|
||||
ws.curTab.navigateRelative(LAST_LINE);
|
||||
}
|
||||
/**
|
||||
* Find
|
||||
|
@ -563,6 +530,43 @@ public class WWindow extends HttpServlet
|
|||
{
|
||||
executeSave (request, wsc, ws);
|
||||
}
|
||||
|
||||
else if (p_cmd.equals("Find"))
|
||||
{
|
||||
String strSearch=WebUtil.getParameter(request, "txtSearch");
|
||||
if (strSearch!=null) {
|
||||
MQuery query=new MQuery();
|
||||
if (strSearch.length()!=0)
|
||||
query.addRestriction(m_searchField, MQuery.LIKE, strSearch);
|
||||
ws.curTab.setQuery(query);
|
||||
ws.curTab.query(false);
|
||||
ws.curTab.navigate(0);
|
||||
}
|
||||
}
|
||||
|
||||
else if (p_cmd.equals("FindAdv"))
|
||||
{
|
||||
String strSQL=WebUtil.getParameter(request, "txtSQL");
|
||||
if (strSQL!=null) {
|
||||
MQuery query=new MQuery();
|
||||
if (strSQL.equals("FIND")) {
|
||||
String value=WebUtil.getParameter(request, "txtValue");
|
||||
String docno=WebUtil.getParameter(request, "txtDocumentNo");
|
||||
String name=WebUtil.getParameter(request, "txtName");
|
||||
String desc=WebUtil.getParameter(request, "txtDescription");
|
||||
|
||||
if (value!=null && value.length()!=0) query.addRestriction("Value", MQuery.LIKE, value);
|
||||
if (docno!=null && docno.length()!=0) query.addRestriction("DocumentNo", MQuery.LIKE, docno);
|
||||
if (name!=null && name.length()!=0) query.addRestriction("Name", MQuery.LIKE, name);
|
||||
if (desc!=null && desc.length()!=0) query.addRestriction("Description", MQuery.LIKE, desc);
|
||||
} else {
|
||||
query.addRestriction(strSQL);
|
||||
}
|
||||
ws.curTab.setQuery(query);
|
||||
ws.curTab.query(false);
|
||||
ws.curTab.navigate(0);
|
||||
}
|
||||
}
|
||||
} // executeCommand
|
||||
|
||||
/**
|
||||
|
@ -644,7 +648,15 @@ public class WWindow extends HttpServlet
|
|||
// we found a writable field
|
||||
if (mField != null && mField.isEditable(true))
|
||||
{
|
||||
String value = WebUtil.getParameter(request, key);
|
||||
String oldValue = WebUtil.getParameter(request, key);
|
||||
String newValue = WebUtil.getParameter(request, key + "F");
|
||||
String value=null;
|
||||
if (newValue!=null) {
|
||||
Object val=lookupValue(newValue, mField.getLookup());
|
||||
if (val!=null) value=val.toString();
|
||||
}
|
||||
if (value==null)value=oldValue;
|
||||
|
||||
Object dbValue = mField.getValue();
|
||||
boolean fieldError = false;
|
||||
String columnName = mField.getColumnName();
|
||||
|
@ -675,7 +687,7 @@ public class WWindow extends HttpServlet
|
|||
} // for all parameteres
|
||||
|
||||
// Re-Do Changed Column to overwrite
|
||||
String columnName = WebUtil.getParameter (request, P_ChangedColumn);
|
||||
/*String columnName = WebUtil.getParameter (request, P_ChangedColumn);
|
||||
if (columnName != null && columnName.length() > 0)
|
||||
{
|
||||
GridField mField = ws.curTab.getField(columnName);
|
||||
|
@ -692,7 +704,7 @@ public class WWindow extends HttpServlet
|
|||
ws.curTab.setValue(mField, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return error;
|
||||
} // updateFields
|
||||
|
||||
|
@ -856,6 +868,7 @@ public class WWindow extends HttpServlet
|
|||
//
|
||||
tr line = new tr();
|
||||
//Modified by Rob Klein 4/29/07
|
||||
m_searchField=null;
|
||||
boolean isTabRO = ws.curTab.isReadOnly();
|
||||
if (ws.curTab.isDisplayed())
|
||||
{
|
||||
|
@ -898,6 +911,16 @@ public class WWindow extends HttpServlet
|
|||
.append(".").append(columnName)
|
||||
.append(".displayLogic='").append(dispLogic).append("';\n");
|
||||
}
|
||||
|
||||
if (m_searchField==null)
|
||||
if (columnName.equals("Description"))
|
||||
m_searchField=columnName;
|
||||
else if (columnName.equals("Name"))
|
||||
m_searchField=columnName;
|
||||
else if (columnName.equals("DocumentNo"))
|
||||
m_searchField=columnName;
|
||||
else if (columnName.equals("Value"))
|
||||
m_searchField=columnName;
|
||||
}
|
||||
} // for all fields
|
||||
} // displayed
|
||||
|
@ -906,9 +929,9 @@ public class WWindow extends HttpServlet
|
|||
|
||||
// Status Line
|
||||
int rowNo = ws.curTab.getCurrentRow();
|
||||
String statusDB = String.valueOf(rowNo+1) + " # " + ws.curTab.getRowCount();
|
||||
String statusDB = String.valueOf(rowNo+1) + " / " + ws.curTab.getRowCount();
|
||||
//
|
||||
return createLayout (action, table, wsc, ws, "", statusDB);
|
||||
return createLayout (action, table, wsc, ws, ws.curTab.getDescription(), statusDB);
|
||||
} // getSR_Form
|
||||
|
||||
|
||||
|
@ -937,16 +960,18 @@ public class WWindow extends HttpServlet
|
|||
tr line = new tr();
|
||||
// First Column
|
||||
//Modified by Rob Klein 4/29/07
|
||||
m_searchField=null;
|
||||
line.addElement(new th().addElement(" "));
|
||||
// Tab not displayed
|
||||
if (!ws.curTab.isDisplayed())
|
||||
return createLayout (action, table, wsc, ws, "", "-");
|
||||
return createLayout (action, table, wsc, ws, "The table is not displayed", "-");
|
||||
|
||||
int noFields = ws.curTab.getFieldCount();
|
||||
// for all (header) columns
|
||||
for (int colNo = 0; colNo < noFields; colNo++)
|
||||
{
|
||||
GridField field = ws.curTab.getField(colNo);
|
||||
String columnName = field.getColumnName();
|
||||
if (field.isDisplayed(false))
|
||||
{
|
||||
th th = new th();
|
||||
|
@ -955,31 +980,42 @@ public class WWindow extends HttpServlet
|
|||
//th.addElement(field.getHeader());
|
||||
th.setAbbr(field.getDescription());
|
||||
line.addElement(th);
|
||||
|
||||
if (m_searchField==null)
|
||||
if (columnName.equals("Description"))
|
||||
m_searchField=columnName;
|
||||
else if (columnName.equals("Name"))
|
||||
m_searchField=columnName;
|
||||
else if (columnName.equals("DocumentNo"))
|
||||
m_searchField=columnName;
|
||||
else if (columnName.equals("Value"))
|
||||
m_searchField=columnName;
|
||||
|
||||
}
|
||||
} // for all columns
|
||||
// Modified by Rob Klein Client Side Filter Manual Filter 6/1/07
|
||||
tr line2 = new tr();
|
||||
th th = new th();
|
||||
//tr line2 = new tr();
|
||||
//th th = new th();
|
||||
//input filter = new input (input.TYPE_TEXT, " filter", "");
|
||||
//filter.setOnKeyUp("Table.filter(this,this)");
|
||||
th.addElement(" ");
|
||||
line2.addElement(th);
|
||||
input filter = null;
|
||||
for (int colNo = 0; colNo < noFields; colNo++)
|
||||
{
|
||||
GridField field = ws.curTab.getField(colNo);
|
||||
if (field.isDisplayed(false))
|
||||
{
|
||||
th = new th();
|
||||
filter = new input (input.TYPE_TEXT, field.getHeader()+"filter", "");
|
||||
filter.setOnKeyUp("Table.filter(this,this)");
|
||||
th.addElement(filter);
|
||||
line2.addElement(th);
|
||||
//th.addElement(" ");
|
||||
//line2.addElement(th);
|
||||
//input filter = null;
|
||||
//for (int colNo = 0; colNo < noFields; colNo++)
|
||||
//{
|
||||
// GridField field = ws.curTab.getField(colNo);
|
||||
// if (field.isDisplayed(false))
|
||||
// {
|
||||
// th = new th();
|
||||
// filter = new input (input.TYPE_TEXT, field.getHeader()+"filter", "");
|
||||
// filter.setOnKeyUp("Table.filter(this,this)");
|
||||
// th.addElement(filter);
|
||||
// line2.addElement(th);
|
||||
//line.addElement(th);
|
||||
}
|
||||
} // for all columns
|
||||
// }
|
||||
//} // for all columns
|
||||
//Modified by Rob Klein 4/29/07
|
||||
table.addElement(new thead().addElement(line).addElement(line2));
|
||||
table.addElement(new thead().addElement(line));
|
||||
|
||||
//Modified by Rob Klein 4/29/07
|
||||
table.addElement("<TBODY>");
|
||||
|
@ -1070,9 +1106,9 @@ public class WWindow extends HttpServlet
|
|||
//Modified by Rob Klein 4/29/07
|
||||
table.addElement("</TBODY>");
|
||||
// Status Line
|
||||
String statusDB = String.valueOf(initRowNo+1) + "-" + String.valueOf(lastRow) + " # " + ws.curTab.getRowCount();
|
||||
String statusDB = String.valueOf(initRowNo+1) + "-" + String.valueOf(lastRow) + " / " + ws.curTab.getRowCount();
|
||||
|
||||
return createLayout (action, table, wsc, ws, "", statusDB);
|
||||
return createLayout (action, table, wsc, ws, ws.curTab.getDescription(), statusDB);
|
||||
} // getMR_Form
|
||||
|
||||
/**
|
||||
|
@ -1090,8 +1126,8 @@ public class WWindow extends HttpServlet
|
|||
{
|
||||
form myForm = null;
|
||||
myForm = new form(action);
|
||||
myForm.setTarget(WebEnv.TARGET_WINDOW);
|
||||
myForm.setID("WWindow" + ws.mWindow.getAD_Window_ID());
|
||||
myForm.setID("WForm");
|
||||
myForm.setOnSubmit("this.target=window.name");
|
||||
String AD_Language = Env.getAD_Language(ws.ctx);
|
||||
|
||||
// Window
|
||||
|
@ -1099,6 +1135,7 @@ public class WWindow extends HttpServlet
|
|||
myForm.addElement(new input("hidden", P_Command, "")); // button commands
|
||||
myForm.addElement(new input("hidden", P_MR_RowNo, "")); // RowNo
|
||||
myForm.addElement(new input("hidden", P_ChangedColumn, "")); //
|
||||
|
||||
// Set Title of main window
|
||||
String title = ws.mWindow.getName() + " - " + wsc.loginInfo;
|
||||
myForm.addElement(new script("top.document.title='" + title + "';"));
|
||||
|
@ -1124,9 +1161,18 @@ public class WWindow extends HttpServlet
|
|||
toolbar.addElement(createImageLink (AD_Language, "Attachment",
|
||||
"startPopup('WAttachment')", ws.curTab.canHaveAttachment(), ws.curTab.hasAttachment()));
|
||||
toolbar.addElement(createImageLink (AD_Language, "Multi", null, true, !ws.curTab.isSingleRow()));
|
||||
toolbar.addElement(createImageLink (AD_Language, "FindAdv","startPopup('WFindAdv')", true, false));
|
||||
|
||||
if (m_searchField!=null) {
|
||||
input txtSearch = new input(input.TYPE_TEXT, "txtSearch", "[" + m_searchField + "]");
|
||||
txtSearch.setOnChange("SubmitForm('Find', 'Submit','toolbar');return false;");
|
||||
toolbar.addElement(txtSearch);
|
||||
}
|
||||
|
||||
toolbar.addElement(" ");
|
||||
toolbar.addElement(createImageLink (AD_Language, "History",
|
||||
null, ws.mWindow.isTransaction()&&ws.curTab.getTabNo()==0, !ws.curTab.isOnlyCurrentRows()));
|
||||
toolbar.addElement(createImageLink (AD_Language, "History","startPopup('WHistory')", true, false));
|
||||
//toolbar.addElement(createImageLink (AD_Language, "History",
|
||||
// null, ws.mWindow.isTransaction()&&ws.curTab.getTabNo()==0, !ws.curTab.isOnlyCurrentRows()));
|
||||
toolbar.addElement(" ");
|
||||
boolean isFirst = ws.curTab.getCurrentRow() < 1;
|
||||
toolbar.addElement(createImageLink (AD_Language, "First", null, !isFirst, false));
|
||||
|
@ -1161,6 +1207,9 @@ public class WWindow extends HttpServlet
|
|||
if (tab.getDescription().length() > 0)
|
||||
big.setOnMouseOver("status='" + tab.getDescription() + "';return true;");
|
||||
|
||||
if (tab.isReadOnly())
|
||||
tabbar.addElement(new i().addElement(big));
|
||||
else
|
||||
tabbar.addElement(big);
|
||||
}
|
||||
|
||||
|
@ -1173,16 +1222,24 @@ public class WWindow extends HttpServlet
|
|||
myForm.addElement(topTable);
|
||||
|
||||
// Fields
|
||||
myForm.addElement(contentTable);
|
||||
|
||||
div panel=new div();
|
||||
panel.setStyle("overflow: scroll;overflow: auto;");
|
||||
panel.addElement(contentTable);
|
||||
|
||||
myForm.addElement(panel);
|
||||
|
||||
// Status Line
|
||||
table statusTable = new table ("0", "0", "0", "100%", null);
|
||||
topTable.setID("WWindow.statusLine");
|
||||
tr statusLine = new tr();
|
||||
statusLine.addElement(new td().setWidth("85%").setAlign(AlignType.LEFT)
|
||||
.addElement(statusInfo));
|
||||
.addElement(" # " + statusInfo));
|
||||
a db =new a("#");
|
||||
db.setOnClick("alert('" + ws.curTab.getKeyColumnName() + " = " + ws.curTab.getRecord_ID() + "')");
|
||||
db.addElement(statusDB);
|
||||
statusLine.addElement(new td().setWidth("10%").setAlign(AlignType.RIGHT)
|
||||
.addElement(new small(statusDB)));
|
||||
.addElement(db));
|
||||
statusLine.addElement(new td().setWidth("5%").setAlign(AlignType.RIGHT)
|
||||
//Modified by Rob Klein 4/29/07
|
||||
.addElement(createImageLink (AD_Language, "Save")));
|
||||
|
@ -1298,8 +1355,12 @@ public class WWindow extends HttpServlet
|
|||
//
|
||||
if (js_command == null)
|
||||
js_command = "'Submit'";
|
||||
if (js_command.length() > 0 && enabled)
|
||||
if (js_command.length() > 0 && enabled){
|
||||
if(js_command.startsWith("startPopup"))
|
||||
img.setOnClick(js_command);
|
||||
else
|
||||
img.setOnClick( "SubmitForm('" + name + "', " + js_command + ",'toolbar');return false;");
|
||||
}
|
||||
img.setClass("ToolbarButton");
|
||||
img.setOnMouseOver("window.status='"+name+"';return true;");
|
||||
img.setOnMouseOut("window.status='';return true;");
|
||||
|
@ -1327,7 +1388,7 @@ public class WWindow extends HttpServlet
|
|||
* @param oData original data
|
||||
* @param hasDependents has Callout function(s)
|
||||
*/
|
||||
private void addField (WebSessionCtx wsc, tr line, GridField field,
|
||||
public static void addField (WebSessionCtx wsc, tr line, GridField field,
|
||||
Object oData, boolean hasDependents, int recordID, int tableID, boolean tabRO, int fieldNumber,
|
||||
GridTab mTab, MRole role)
|
||||
{
|
||||
|
@ -1386,5 +1447,11 @@ public class WWindow extends HttpServlet
|
|||
.addElement(wField.getField(field.getLookup(), oData));
|
||||
} // addField
|
||||
|
||||
private Object lookupValue(String key, Lookup lookup) {
|
||||
if (lookup.containsKey(key))
|
||||
return lookup.get(key);
|
||||
|
||||
return DB.getSQLValueString(null, "SELECT " + lookup.getColumnName() + " FROM " + lookup.getZoomQuery().getTableName() + " WHERE " + lookup.getZoomQuery().getWhereClause() + " AND Value LIKE ?", key);
|
||||
}
|
||||
|
||||
} // WWindow
|
||||
|
|
|
@ -21,39 +21,58 @@ import java.util.Properties;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.GridWindow;
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.WebUtil;
|
||||
|
||||
|
||||
/**
|
||||
* WWindow Status Information (Value Object)
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WWindowStatus.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
|
||||
*/
|
||||
public class WWindowStatus
|
||||
{
|
||||
/**
|
||||
* Get Web Window Status.
|
||||
WWindowStatus ws = WWindowStatus.get(ctx);
|
||||
* @param request request
|
||||
* @return ctx or null
|
||||
*/
|
||||
public static WWindowStatus get (HttpServletRequest request)
|
||||
{
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session == null)
|
||||
HttpSession sess = request.getSession(false);
|
||||
if (sess == null)
|
||||
return null;
|
||||
return (WWindowStatus)session.getAttribute(NAME);
|
||||
} // get
|
||||
String wsName=WebUtil.getParameter(request,"wsName");
|
||||
System.out.println("main window wsName = "+wsName);
|
||||
String newWindow=WebUtil.getParameter(request,"blankWindow");
|
||||
WWindowStatus clientWS=(WWindowStatus)sess.getAttribute(NAME);
|
||||
if((wsName==null&&WStatusArrayList.get(request)==null)||clientWS.getStatusName().equals(wsName))
|
||||
{
|
||||
System.out.println("Run wsName==null 1");
|
||||
System.out.println("clientWS = "+clientWS);
|
||||
return clientWS;
|
||||
}
|
||||
String AD_Menu_ID=WebUtil.getParameter(request,"AD_Menu_ID");
|
||||
if(wsName==null&&WStatusArrayList.get(request)!=null&&newWindow==null&&AD_Menu_ID!=null)
|
||||
{ System.out.println("Run if(wsName == null) 2");
|
||||
WWindowStatus ws=(WWindowStatus)WStatusArrayList.get(request).getWSFromStatusArray("1");
|
||||
sess.setAttribute(WWindowStatus.NAME, ws);
|
||||
return ws;
|
||||
}
|
||||
if(wsName!=null)
|
||||
{
|
||||
System.out.println("if(wsName!=null)");
|
||||
WStatusArrayList wsl=WStatusArrayList.get(request);
|
||||
|
||||
/**************************************************************************
|
||||
* Constructor - First Tab - First Row - Single Row.
|
||||
* <br>
|
||||
* Initialize Formats
|
||||
* @param mWindowVO window VO
|
||||
*/
|
||||
if(wsl==null)
|
||||
{System.out.println("wsName!=null && wsl == null");
|
||||
return null;
|
||||
}
|
||||
|
||||
WWindowStatus serverWS=wsl.getWSFromStatusArray(wsName);
|
||||
|
||||
if(serverWS==null)
|
||||
{ System.out.println("wsName!=null && serverWS == null");
|
||||
return null;
|
||||
}
|
||||
|
||||
sess.setAttribute(WWindowStatus.NAME, serverWS);
|
||||
System.out.println("serverWS");
|
||||
return serverWS;
|
||||
|
||||
}
|
||||
return clientWS;
|
||||
}
|
||||
public WWindowStatus (GridWindowVO mWindowVO)
|
||||
{
|
||||
mWindow = new GridWindow(mWindowVO);
|
||||
|
@ -61,27 +80,37 @@ public class WWindowStatus
|
|||
curTab.setSingleRow(true);
|
||||
//
|
||||
ctx = mWindowVO.ctx;
|
||||
statusName="";
|
||||
} // WWindowStatus
|
||||
|
||||
/** Session Attribute Name */
|
||||
/* public WWindowStatus (GridWindowVO mWindowVO)
|
||||
{
|
||||
mWindow = new GridWindow(mWindowVO);
|
||||
curTab = mWindow.getTab(0);
|
||||
curTab.setSingleRow(true);
|
||||
ctx = mWindowVO.ctx;
|
||||
statusName="";
|
||||
} */
|
||||
public static final String NAME = "WWindowStatus";
|
||||
|
||||
/** The MWindow */
|
||||
protected GridWindow mWindow;
|
||||
/** The current MTab */
|
||||
protected GridTab curTab;
|
||||
private String statusName;
|
||||
|
||||
/** Window Context */
|
||||
public Properties ctx = null;
|
||||
|
||||
/**
|
||||
* String representation
|
||||
* @return String representation
|
||||
*/
|
||||
public String getStatusName()
|
||||
{
|
||||
return statusName;
|
||||
}
|
||||
public void setStatusName(String name)
|
||||
{
|
||||
statusName=name;
|
||||
}
|
||||
public int getWindowNo()
|
||||
{
|
||||
return mWindow.getWindowNo();
|
||||
}
|
||||
public String toString()
|
||||
{
|
||||
return "WWindowStatus[" + mWindow
|
||||
+ " - " + curTab + "]";
|
||||
} // toString
|
||||
|
||||
} // WWindowStatus
|
||||
}
|
||||
}
|
|
@ -17,34 +17,91 @@
|
|||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.ecs.xhtml.body;
|
||||
import org.apache.ecs.xhtml.br;
|
||||
import org.apache.ecs.xhtml.form;
|
||||
import org.apache.ecs.xhtml.h2;
|
||||
import org.apache.ecs.xhtml.h6;
|
||||
import org.apache.ecs.xhtml.head;
|
||||
import org.apache.ecs.xhtml.hr;
|
||||
import org.apache.ecs.xhtml.img;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.link;
|
||||
import org.apache.ecs.xhtml.script;
|
||||
import org.apache.ecs.xhtml.table;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.tr;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import org.compiere.wf.MWFNode;
|
||||
import org.compiere.wf.MWorkflow;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WWorkflow.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @author Jack Lam
|
||||
* @version $Id: WWorkflow.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WWorkflow extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7535552109735485229L;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize global variables
|
||||
*/
|
||||
|
||||
public static final int SIZE = 3;
|
||||
public static final int SPACE = 0;
|
||||
public static final int ARROW_FORWARD = -1;
|
||||
public static final int ARROW_BACKWARD = -3;
|
||||
public static final int ARROW_DOWN = -2;
|
||||
|
||||
public static final String WORKFLOW = "Workflow";
|
||||
public static final String NODES = "Nodes";
|
||||
public static final String NODES_ID = "Nodes_ID";
|
||||
public static final String IMAGE_MAP= "Image_Map";
|
||||
public static final String ACTIVE_NODE= "Active_Node";
|
||||
|
||||
public static final String M_Command = "MCommand"; // move command
|
||||
public static final String J_Command = "JCommand"; // jump command
|
||||
|
||||
public static final String FIRST = "Start";
|
||||
public static final String NEXT = "Next";
|
||||
public static final String BACK= "Back";
|
||||
public static final String LAST= "End";
|
||||
|
||||
private static final String FORM_NAME = "MForm";
|
||||
private static final String TARGET_WINDOW = "WWindow";
|
||||
private static final String FORM_ACTION = "/adempiere/WWorkflow";
|
||||
|
||||
|
||||
private static String AD_Language = null;
|
||||
Properties ctx = null;
|
||||
|
||||
/** Window Number Counter */
|
||||
private static int s_WindowNo = 1;
|
||||
|
||||
|
||||
public void init(ServletConfig config)
|
||||
throws ServletException
|
||||
{
|
||||
|
@ -54,26 +111,820 @@ public class WWorkflow extends HttpServlet
|
|||
} // init
|
||||
|
||||
/**
|
||||
* Process the HTTP Get request
|
||||
* Process the HTTP Get request - Initial Call.
|
||||
* <br>
|
||||
* http://localhost/adempiere/WWorkflow?AD_Menu_ID=123
|
||||
* <br>
|
||||
*
|
||||
* Find the AD_Workflow_ID
|
||||
* Load workflow and initial session atribute
|
||||
* Create output
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("WWorkflow - Get - Not Implemented Yet");
|
||||
//
|
||||
//Log.trace(Log.l1_User, "WWorkflow.doGet");
|
||||
//WUtil.debug(new String("In do get"),"");
|
||||
|
||||
|
||||
// Get Session attributes
|
||||
HttpSession sess = request.getSession();
|
||||
WebSessionCtx wsc = WebSessionCtx.get(request);
|
||||
ctx = wsc.ctx;
|
||||
//String loginInfo = (String)sess.getAttribute(WebEnv.SA_LOGININFO);
|
||||
if (ctx == null)
|
||||
{
|
||||
WebUtil.createTimeoutPage(request, response, this, null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get Parameter: Menu_ID
|
||||
int AD_Menu_ID = WebUtil.getParameterAsInt(request, "AD_Menu_ID");
|
||||
|
||||
// Get Parameter: Menu_ID
|
||||
int AD_Window_ID = WebUtil.getParameterAsInt(request, "AD_Window_ID");
|
||||
|
||||
|
||||
//set language
|
||||
AD_Language = Env.getAD_Language(ctx);
|
||||
|
||||
//load AD_Workflow_ID
|
||||
int AD_Workflow_ID = getAD_Workflow_ID(AD_Menu_ID);
|
||||
|
||||
//load workflow
|
||||
loadWorkflow(ctx, AD_Workflow_ID,sess);
|
||||
|
||||
//get session attributes
|
||||
MWorkflow wf = (MWorkflow)sess.getAttribute(WORKFLOW);
|
||||
MWFNode [] nodes = (MWFNode []) sess.getAttribute( NODES);
|
||||
ArrayList nodes_ID = (ArrayList) sess.getAttribute( NODES_ID);
|
||||
int [][] imageMap = (int [][] )sess.getAttribute( IMAGE_MAP);
|
||||
int activeNode = ((Integer) sess.getAttribute( ACTIVE_NODE)).intValue();
|
||||
|
||||
//create output
|
||||
WebDoc doc = preparePage("loginInfo");
|
||||
doc = createLayout( doc,wf,activeNode,nodes,nodes_ID,imageMap);
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doGet
|
||||
|
||||
|
||||
/**
|
||||
* Process the HTTP Post request
|
||||
* Process the HTTP Post request - Initial Call.
|
||||
*
|
||||
* Execute the received command
|
||||
* Update session attributes
|
||||
* Create output
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("WWorkflow - Post - Not Implemented Yet");
|
||||
//
|
||||
//WUtil.debug(new String("In do Post"),"");
|
||||
HttpSession sess = request.getSession();
|
||||
|
||||
WebSessionCtx wsc = WebSessionCtx.get(request);
|
||||
Properties ctx = wsc.ctx;
|
||||
if (ctx == null){
|
||||
WebUtil.createTimeoutPage(request, response, this, null);
|
||||
|
||||
return;
|
||||
}
|
||||
//String loginInfo = (String)sess.getAttribute(WEnv.SA_LOGININFO);
|
||||
|
||||
|
||||
|
||||
|
||||
//get session attributes
|
||||
MWorkflow wf = (MWorkflow)sess.getAttribute(WORKFLOW);
|
||||
MWFNode [] nodes = (MWFNode []) sess.getAttribute( NODES);
|
||||
ArrayList nodes_ID = (ArrayList) sess.getAttribute( NODES_ID);
|
||||
int [][] imageMap = (int [][] )sess.getAttribute( IMAGE_MAP);
|
||||
int activeNode = ((Integer) sess.getAttribute( ACTIVE_NODE)).intValue();
|
||||
|
||||
|
||||
|
||||
//execute commnad
|
||||
String m_command = request.getParameter(M_Command);
|
||||
int j_command = WebUtil.getParameterAsInt(request, J_Command);
|
||||
//WUtil.debug(m_command,"m_command");
|
||||
//WUtil.debug(""+j_command,"j_command");
|
||||
|
||||
|
||||
executeCommand(m_command,j_command ,wf,activeNode,nodes,nodes_ID,sess);
|
||||
|
||||
|
||||
//get updated session attributes
|
||||
wf = (MWorkflow)sess.getAttribute(WORKFLOW);
|
||||
nodes = (MWFNode []) sess.getAttribute( NODES);
|
||||
nodes_ID = (ArrayList) sess.getAttribute( NODES_ID);
|
||||
imageMap = (int [][] )sess.getAttribute( IMAGE_MAP);
|
||||
activeNode = ((Integer) sess.getAttribute( ACTIVE_NODE)).intValue();
|
||||
|
||||
|
||||
//create layout
|
||||
WebDoc doc = preparePage ("loginInfo");
|
||||
doc = createLayout(doc,wf,activeNode,nodes,nodes_ID,imageMap);
|
||||
WebUtil.createResponse(request, response, this, null, doc, false);
|
||||
} // doPost
|
||||
|
||||
|
||||
/**********************************************************************************************/
|
||||
|
||||
/**
|
||||
* Generate image map array.
|
||||
* - Generate the orientation of workflow automatically
|
||||
*
|
||||
* @param nodes
|
||||
* @return int [][]
|
||||
*/
|
||||
private int [][] generateImageMap(ArrayList nodes_ID){
|
||||
|
||||
// number of nodes
|
||||
int numOfNode = nodes_ID.size();
|
||||
|
||||
int rowNode_count = (int) Math.ceil( (float)numOfNode/SIZE ) ;
|
||||
|
||||
int rowTotal_count = 2*rowNode_count -1 ;
|
||||
|
||||
int ROW = rowTotal_count;
|
||||
int COL = 2*SIZE-1;
|
||||
|
||||
|
||||
int [][] imageMap = new int [ROW][COL];
|
||||
//
|
||||
boolean isEmptyRow_Right = true;
|
||||
boolean isForwardRow = true;
|
||||
int row_Last = ROW - 1;
|
||||
//indexs
|
||||
int index_Row =0;
|
||||
int index_Node =0;
|
||||
int i,j;
|
||||
|
||||
|
||||
//operate on every row
|
||||
for (index_Row=0;index_Row < ROW ;index_Row++)
|
||||
{
|
||||
//odd row
|
||||
if ( (index_Row % 2) != 0)
|
||||
{
|
||||
if(isEmptyRow_Right){
|
||||
imageMap[index_Row][COL-1] = ARROW_DOWN;
|
||||
isEmptyRow_Right = false;
|
||||
}
|
||||
else {
|
||||
imageMap[index_Row][0]= ARROW_DOWN;
|
||||
isEmptyRow_Right = true;
|
||||
}
|
||||
}//odd row
|
||||
|
||||
|
||||
//even row
|
||||
if ( (index_Row % 2) == 0)
|
||||
{
|
||||
if (isForwardRow)
|
||||
{
|
||||
isForwardRow = false;
|
||||
|
||||
// Last row
|
||||
if (index_Row == row_Last)
|
||||
{
|
||||
j=0;
|
||||
for (i=index_Node;i<numOfNode;i++)
|
||||
{
|
||||
imageMap[index_Row][j++] = ((Integer) nodes_ID.get(i)).intValue();
|
||||
if(i != numOfNode-1 )
|
||||
imageMap[index_Row][j++] = ARROW_FORWARD;
|
||||
}
|
||||
|
||||
}// Last row-end
|
||||
|
||||
//not last row
|
||||
else{
|
||||
|
||||
for (i=0;i<COL;i++)
|
||||
imageMap[index_Row][i] = ( (i%2 == 0)? ((Integer) nodes_ID.get(index_Node++)).intValue() : ARROW_FORWARD);
|
||||
|
||||
|
||||
|
||||
}// not last row
|
||||
}// Forward row - end
|
||||
|
||||
else{
|
||||
|
||||
|
||||
|
||||
isForwardRow = true;
|
||||
|
||||
// Backward-Last row
|
||||
if (index_Row == row_Last)
|
||||
{
|
||||
j=0;
|
||||
for (i=index_Node;i<numOfNode;i++)
|
||||
{
|
||||
imageMap[index_Row][COL-1-j++] = ((Integer) nodes_ID.get(i)).intValue();
|
||||
if (i != numOfNode-1)
|
||||
imageMap[index_Row][COL-1-j++] = ARROW_BACKWARD;
|
||||
}
|
||||
|
||||
}// Backward-Last row -end
|
||||
|
||||
// Backward-Not last row
|
||||
else{
|
||||
j=0;
|
||||
for (i=0;i<COL;i++)
|
||||
{
|
||||
imageMap[index_Row][COL-1-i] = (i%2 == 0)? ((Integer) nodes_ID.get(index_Node++)).intValue() : ARROW_BACKWARD ;
|
||||
}
|
||||
|
||||
}// Backward-Not last row- end
|
||||
|
||||
|
||||
}// Backward row
|
||||
|
||||
}//even row
|
||||
}//for every row
|
||||
|
||||
|
||||
return imageMap;
|
||||
|
||||
}//generateImageMap
|
||||
|
||||
/**
|
||||
* Print the workflow.
|
||||
* - Use the image map array to create the visual layout of workflow
|
||||
*
|
||||
* @param activeNode
|
||||
* @param wf
|
||||
* @param nodes
|
||||
* @param nodes_ID
|
||||
* @param imageMap
|
||||
|
||||
*
|
||||
* @return table
|
||||
*/
|
||||
private table printWorkflow(int activeNode, MWorkflow wf, MWFNode [] nodes, ArrayList nodes_ID,int [][] imageMap){
|
||||
|
||||
//create a new table
|
||||
table imageTable = new table();
|
||||
//find the dimension for the table
|
||||
final int ROW = imageMap.length;
|
||||
final int COL = imageMap[0].length;
|
||||
|
||||
//process every row
|
||||
for (int i=0;i<ROW;i++ )
|
||||
{
|
||||
//create a new row
|
||||
tr aRow =new tr();
|
||||
|
||||
for(int j=0;j<COL;j++){
|
||||
//create a new grid
|
||||
td grid = new td();
|
||||
grid.setAlign("center");
|
||||
//not node images
|
||||
img spaceImage = createWorkflowImage("Spacer", 0, null, true);
|
||||
img arrowForwardImage = createWorkflowImage( "ArrowFW_",0, null, true);
|
||||
img arrowBackwardImage = createWorkflowImage( "ArrowBW_", 0,null, true);
|
||||
img arrowDownImage =createWorkflowImage( "ArrowDown_", 0 ,null, true);
|
||||
//node images
|
||||
|
||||
img normalNodeImage = null;
|
||||
img activeNodeImage = null;
|
||||
|
||||
|
||||
//not node images
|
||||
if (imageMap[i][j] <= 0){
|
||||
|
||||
if (imageMap[i][j] == ARROW_FORWARD) grid.addElement(arrowForwardImage);
|
||||
|
||||
if (imageMap[i][j] == ARROW_BACKWARD) grid.addElement(arrowBackwardImage);
|
||||
|
||||
if (imageMap[i][j] == ARROW_DOWN) grid.addElement(arrowDownImage);
|
||||
|
||||
if (imageMap[i][j] == SPACE) grid.addElement(spaceImage);
|
||||
|
||||
|
||||
}//not node images
|
||||
|
||||
else{
|
||||
|
||||
//Initialize variable
|
||||
int AD_Window_ID=0;
|
||||
String url = "";
|
||||
String Target_Window = "";
|
||||
String parameters = "";
|
||||
String js_command = "";
|
||||
|
||||
if(imageMap[i][j] == activeNode){
|
||||
//Create image
|
||||
|
||||
AD_Window_ID = nodes[getIndex(imageMap[i][j],nodes_ID)].getAD_Window_ID();
|
||||
// url = "'WWindow?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
|
||||
url = "'WWindow?AD_Window_ID="+AD_Window_ID;
|
||||
Target_Window = "'WWindow"+AD_Window_ID+"'";
|
||||
///url=WebEnv.getBaseDirectory("WWindow")+ "?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
|
||||
// Target_Window = "'win_"+AD_Window_ID+"'";
|
||||
System.out.println("WorkFlow if(true)======"+url);
|
||||
|
||||
parameters = url+ "',"+Target_Window;
|
||||
js_command = "popUp("+parameters+");submit()";
|
||||
activeNodeImage = createWorkflowImage("mWorkFlow_",imageMap[i][j] ,js_command, true);
|
||||
|
||||
grid.addElement(activeNodeImage);
|
||||
grid.addElement(new br());
|
||||
grid.addElement(""+imageMap[i][j]);
|
||||
grid.addElement(new br());
|
||||
grid.addElement("<font color=blue>"+nodes[getIndex(imageMap[i][j],nodes_ID)].getName()+"</font>");
|
||||
}//active node
|
||||
|
||||
else {
|
||||
//Create image
|
||||
AD_Window_ID = nodes[getIndex(imageMap[i][j],nodes_ID)].getAD_Window_ID();
|
||||
// url = "'WWindow?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
|
||||
url = "'WWindow?AD_Window_ID="+AD_Window_ID;
|
||||
|
||||
//url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+AD_Window_ID+"&Target_Window=win_"+AD_Window_ID+"'";
|
||||
Target_Window = "'WWindow"+AD_Window_ID+"'";
|
||||
|
||||
System.out.println("WorkFlow else======"+url);
|
||||
parameters = url+ "',"+Target_Window;
|
||||
js_command = "popUp("+parameters+");submit()";
|
||||
normalNodeImage = createWorkflowImage("mWorkFlow_", imageMap[i][j],js_command, false);
|
||||
|
||||
grid.addElement(normalNodeImage);
|
||||
grid.addElement(new br());
|
||||
grid.addElement(""+imageMap[i][j]);
|
||||
grid.addElement(new br());
|
||||
grid.addElement(nodes[getIndex(imageMap[i][j],nodes_ID)].getName());
|
||||
}//inactive node
|
||||
}
|
||||
aRow.addElement(grid);
|
||||
}//process every gird
|
||||
|
||||
imageTable.addElement(aRow);
|
||||
}//every row
|
||||
|
||||
|
||||
|
||||
return imageTable;
|
||||
}//printWorkflow
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Print the description for a workflow or a node.
|
||||
*
|
||||
*
|
||||
* @param activeNode
|
||||
* @param wf
|
||||
* @param nodes
|
||||
* @param nodes_ID
|
||||
*
|
||||
* @return table
|
||||
*/
|
||||
private table printDescription(int activeNode, MWorkflow wf, MWFNode [] nodes, ArrayList nodes_ID){
|
||||
//create new table
|
||||
table desTable = new table();
|
||||
|
||||
String WFName="";
|
||||
String WFDescription ="";
|
||||
|
||||
//not started yet
|
||||
if(activeNode < 0 ){
|
||||
WFName =wf.getName();
|
||||
WFDescription=wf.getHelp();
|
||||
}
|
||||
|
||||
//started
|
||||
else{
|
||||
WFName =nodes[getIndex(activeNode,nodes_ID)].getName();
|
||||
WFDescription=nodes[getIndex(activeNode,nodes_ID)].getHelp();
|
||||
}
|
||||
|
||||
//add info to the desciption table
|
||||
tr aRow = new tr();
|
||||
td aGrid = new td();
|
||||
aGrid.addElement (new h6(WFName));
|
||||
aGrid.addElement (new br());
|
||||
aGrid.addElement (WFDescription);
|
||||
desTable.addElement(aRow.addElement(aGrid));
|
||||
|
||||
return desTable;
|
||||
}// printDescription
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Find the index at which the WFNode ID is positioned.
|
||||
*
|
||||
*
|
||||
* @param node_ID
|
||||
* @param nodes_ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private int getIndex(int node_ID, ArrayList nodes_ID){
|
||||
|
||||
int index = 0;
|
||||
|
||||
for(int i =0;i<nodes_ID.size();i++){
|
||||
int element_ID = ((Integer) nodes_ID.get(i)).intValue();
|
||||
if ( element_ID == node_ID)
|
||||
index = i;
|
||||
|
||||
}//for
|
||||
|
||||
return index;
|
||||
}//getIndex
|
||||
|
||||
/**
|
||||
* Print the control panel.
|
||||
*
|
||||
*
|
||||
* @param activeNode
|
||||
* @param wf
|
||||
* @param nodes
|
||||
* @param nodes_ID
|
||||
*
|
||||
* @return form
|
||||
*/
|
||||
private form printControlPanel(int activeNode, MWorkflow wf, MWFNode [] nodes, ArrayList nodes_ID){
|
||||
//create a new form
|
||||
form myForm = new form(FORM_ACTION, form.METHOD_POST, form.ENC_DEFAULT);
|
||||
myForm.addElement(new input("hidden", M_Command, ""));
|
||||
myForm.addElement(new input("hidden", J_Command, ""));
|
||||
myForm.setTarget(TARGET_WINDOW);
|
||||
myForm.setName(FORM_NAME);
|
||||
|
||||
//test fist or last node
|
||||
|
||||
boolean isFirst = wf.isFirst(activeNode,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
boolean isLast = wf.isLast(activeNode,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
|
||||
//get AD_Window_ID for the first and last node
|
||||
int First_Window_ID = wf.getFirstNode().getAD_Window_ID();
|
||||
int Last_Window_ID = nodes[nodes.length-1].getAD_Window_ID();
|
||||
|
||||
int Back_Window_ID=0;
|
||||
int Next_Window_ID=0;
|
||||
int index=0;
|
||||
|
||||
//WUtil.debug(""+activeNode,"activeNode");
|
||||
if(!isFirst){
|
||||
index = activeNode >=0 ? getIndex(activeNode,nodes_ID)-1 : 0 ;
|
||||
//WUtil.debug(""+index,"index");
|
||||
Back_Window_ID= nodes[index].getAD_Window_ID();
|
||||
}
|
||||
if(!isLast){
|
||||
index = activeNode >=0 ? getIndex(activeNode,nodes_ID)+1 : 0 ;
|
||||
Next_Window_ID= nodes[index].getAD_Window_ID();
|
||||
}
|
||||
boolean enableFirst = true;
|
||||
boolean enableBack = true;
|
||||
boolean enableNext = true;
|
||||
boolean enableLast = true;
|
||||
|
||||
if(isFirst) {
|
||||
enableBack = false;
|
||||
enableFirst = false;
|
||||
}
|
||||
if(isLast) {
|
||||
enableNext = false;
|
||||
enableLast = false;
|
||||
}
|
||||
|
||||
td firstImage = new td();
|
||||
td backImage = new td();
|
||||
td nextImage = new td();
|
||||
td lastImage = new td();
|
||||
|
||||
//first
|
||||
String url = "'WWindow?AD_Window_ID="+First_Window_ID +"'";
|
||||
//String url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+First_Window_ID+"&Target_Window=win_"+First_Window_ID+"'";
|
||||
String Target_Window = "'WWindow"+First_Window_ID+"'";
|
||||
String parameters = url+ ","+Target_Window;
|
||||
String js_command = "popUp("+parameters+");submit()";
|
||||
firstImage.addElement(createControlButtonImage("Start", js_command, enableFirst));
|
||||
//back
|
||||
url = "'WWindow?AD_Window_ID="+Back_Window_ID + "'";
|
||||
// url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+Back_Window_ID+"&Target_Window=win_"+Back_Window_ID+"'";
|
||||
Target_Window = "'WWindow"+Back_Window_ID+"'";
|
||||
parameters = url+ ","+Target_Window;
|
||||
js_command = "popUp("+parameters+");submit()";
|
||||
backImage.addElement(createControlButtonImage("Back", js_command, enableBack));
|
||||
|
||||
//next
|
||||
url = "'WWindow?AD_Window_ID="+Next_Window_ID+"'";
|
||||
//url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+Next_Window_ID+"&Target_Window=win_"+Next_Window_ID+"'";
|
||||
Target_Window = "'WWindow"+Next_Window_ID+"'";
|
||||
parameters = url+ ","+Target_Window;
|
||||
js_command = "popUp("+parameters+");submit()";
|
||||
nextImage.addElement(createControlButtonImage("Next", js_command, enableNext));
|
||||
|
||||
//last
|
||||
url = "'WWindow?AD_Window_ID="+Last_Window_ID+"'";
|
||||
// url=WebEnv.getBaseDirectory("WWindow")+"?AD_Window_ID="+Last_Window_ID+"&Target_Window=win_"+Last_Window_ID+"'";
|
||||
Target_Window = "'WWindow"+Last_Window_ID+"'";
|
||||
parameters = url+ ","+Target_Window;
|
||||
js_command = "popUp("+parameters+");submit()";
|
||||
lastImage.addElement(createControlButtonImage("End", js_command, enableLast));
|
||||
|
||||
|
||||
tr aRow = new tr();
|
||||
aRow.addElement(firstImage);
|
||||
aRow.addElement(backImage);
|
||||
aRow.addElement(nextImage);
|
||||
aRow.addElement(lastImage);
|
||||
|
||||
//add the table to the form
|
||||
myForm.addElement(new table().addElement(aRow));
|
||||
|
||||
return myForm;
|
||||
}//printControlPanel
|
||||
|
||||
|
||||
/**
|
||||
* Create Image with name, id of button_name and set M_Command onClick
|
||||
*
|
||||
*
|
||||
* @param name Name of the Image used also for Name24.gif
|
||||
* @param js_command Java script command, null results in 'submit();', an empty string disables OnClick
|
||||
* @param enabled Enable the immage button, if not uses the "D" image
|
||||
|
||||
* @return Image
|
||||
*/
|
||||
private static img createControlButtonImage (String name, String js_command, boolean enabled)
|
||||
{
|
||||
StringBuffer imgName = new StringBuffer("wf" + name);
|
||||
|
||||
if (!enabled)
|
||||
imgName.append("D");
|
||||
|
||||
imgName.append("24.gif");
|
||||
//
|
||||
img img = new img (WebEnv.getImageDirectory(imgName.toString()), name);
|
||||
if (enabled)
|
||||
img.setAlt(Msg.getMsg(AD_Language, name)); // Translate ToolTip
|
||||
|
||||
img.setID("imgButton"); // css
|
||||
|
||||
//append js command only to enabled image
|
||||
if ( js_command != null && js_command.length() > 0 && enabled){
|
||||
img.setOnClick("document." + FORM_NAME + "." + M_Command + ".value='" + name + "';" + js_command);
|
||||
}
|
||||
//
|
||||
return img;
|
||||
} // createImage
|
||||
|
||||
/**
|
||||
* Create Image with name, id of button_name and set M_Command onClick
|
||||
*
|
||||
*
|
||||
* @param name Name of the Image used also for Name24.gif
|
||||
* @param js_command Java script command, null results in 'submit();', an empty string disables OnClick
|
||||
* @param enabled Enable the immage button, if not uses the "D" image
|
||||
|
||||
* @return Image
|
||||
*/
|
||||
private static img createWorkflowImage (String name, int activeNode , String js_command, boolean pressed)
|
||||
{
|
||||
StringBuffer imgName = new StringBuffer(name);
|
||||
imgName.append("WF");
|
||||
|
||||
imgName.append(".gif");
|
||||
//
|
||||
img img = new img (WebEnv.getImageDirectory(imgName.toString()), name);
|
||||
|
||||
|
||||
|
||||
if ( !(imgName.toString()).startsWith("Spacer") && !(imgName.toString()).startsWith("Arrow")){
|
||||
if(!pressed)
|
||||
img.setID("imgButton"); // css
|
||||
else
|
||||
img.setID("imgButtonPressed");
|
||||
}
|
||||
|
||||
//append js command only to enabled image
|
||||
if ( js_command != null && js_command.length() > 0 && activeNode != 0){
|
||||
String js_command_front = "document." + FORM_NAME + "." + J_Command + ".value='" + activeNode + "'; " ;
|
||||
js_command_front= js_command_front + "document." + FORM_NAME + ".submit();";
|
||||
img.setOnClick(js_command_front + js_command );
|
||||
}
|
||||
//
|
||||
return img;
|
||||
} // createImage
|
||||
|
||||
|
||||
/**
|
||||
* Print the entire layout .
|
||||
*
|
||||
*
|
||||
* @param activeNode
|
||||
* @param wf
|
||||
* @param nodes
|
||||
* @param nodes_ID
|
||||
* @param imageMap
|
||||
*
|
||||
* @return WReportEngine
|
||||
*/
|
||||
private WebDoc createLayout(WebDoc doc , MWorkflow wf,int activeNode,MWFNode [] nodes, ArrayList nodes_ID, int [][] imageMap){
|
||||
body b= doc.getBody();
|
||||
|
||||
b.addElement(printWorkflow(activeNode, wf, nodes, nodes_ID, imageMap));
|
||||
b.addElement(new hr());
|
||||
b.addElement(printDescription(activeNode, wf, nodes, nodes_ID));
|
||||
b.addElement(new br());
|
||||
b.addElement(printControlPanel(activeNode, wf, nodes, nodes_ID));
|
||||
|
||||
return doc;
|
||||
}//createLayout
|
||||
|
||||
/**
|
||||
* Load workflw and initialize the session attributes.
|
||||
*
|
||||
*
|
||||
* @param ctx
|
||||
* @param AD_Workflow_ID
|
||||
* @param sess
|
||||
*
|
||||
*/
|
||||
private void loadWorkflow(Properties ctx, int AD_Workflow_ID, HttpSession sess) {
|
||||
|
||||
|
||||
MWorkflow wf = new MWorkflow (ctx, AD_Workflow_ID,null);
|
||||
//get the MWFNode in order
|
||||
MWFNode[] nodes = wf.getNodes(true,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
MWFNode wfn=null;
|
||||
ArrayList nodes_ID = new ArrayList();
|
||||
for (int i = 0; i < nodes.length; i++)
|
||||
{
|
||||
wfn= nodes[i];
|
||||
nodes_ID.add (new Integer(wfn.getAD_WF_Node_ID()));
|
||||
}//for
|
||||
int imageMap [][] = generateImageMap(nodes_ID);
|
||||
//printMap(imageMap);
|
||||
//set session attribtes
|
||||
sess.setAttribute( WORKFLOW,wf);
|
||||
sess.setAttribute( NODES,nodes);
|
||||
sess.setAttribute( NODES_ID,nodes_ID);
|
||||
sess.setAttribute( IMAGE_MAP,imageMap);
|
||||
sess.setAttribute( ACTIVE_NODE,new Integer(-999));
|
||||
|
||||
}//loadWorkflow
|
||||
|
||||
/**
|
||||
* Execute the M_Command and update the .
|
||||
*
|
||||
*
|
||||
* @param m_command
|
||||
* @param wf
|
||||
* @param activeNode
|
||||
* @param nodes
|
||||
* @param nodes_ID
|
||||
* @param sess
|
||||
*
|
||||
*/
|
||||
private void executeCommand(String m_command, int j_command , MWorkflow wf,int activeNode, MWFNode [] nodes,ArrayList nodes_ID, HttpSession sess){
|
||||
if (j_command != 0 )
|
||||
{
|
||||
sess.setAttribute(ACTIVE_NODE, new Integer(j_command));
|
||||
return;
|
||||
}
|
||||
|
||||
debug(m_command,"m_command in executeCommand");
|
||||
//check first or last node
|
||||
boolean isFirst = wf.isFirst(activeNode,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
boolean isLast = wf.isLast(activeNode,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
|
||||
boolean notReady = false;
|
||||
int updatedActiveNode = activeNode;
|
||||
|
||||
if (activeNode < 0 ) notReady = true;
|
||||
|
||||
if (notReady){
|
||||
updatedActiveNode = ((Integer) nodes_ID.get(0)).intValue();
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
if(m_command.equals(NEXT)){
|
||||
if(notReady)
|
||||
updatedActiveNode = ((Integer) nodes_ID.get(0)).intValue();
|
||||
else
|
||||
updatedActiveNode= wf.getNext(activeNode,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
|
||||
}//next
|
||||
if(m_command.equals(BACK)) {
|
||||
if(notReady)
|
||||
updatedActiveNode = ((Integer) nodes_ID.get(0)).intValue();
|
||||
else
|
||||
updatedActiveNode= wf.getPrevious(activeNode,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
}//back
|
||||
if(m_command.equals(FIRST))
|
||||
updatedActiveNode= ((Integer) nodes_ID.get(0)).intValue();
|
||||
|
||||
if(m_command.equals(LAST)) updatedActiveNode= wf.getLast(0,Env.getContextAsInt(ctx, "#AD_Client_ID"));
|
||||
}//ready
|
||||
|
||||
//update
|
||||
sess.setAttribute(ACTIVE_NODE,new Integer(updatedActiveNode));
|
||||
}//executeCommand
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the AD_Workflow_ID from database using AD_Menu_ID.
|
||||
*
|
||||
*
|
||||
* @param AD_Menu_ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private int getAD_Workflow_ID(int AD_Menu_ID){
|
||||
|
||||
int AD_Workflow_ID=0;
|
||||
String sql = "SELECT AD_Workflow_ID FROM AD_Menu "
|
||||
+ "WHERE AD_Menu_ID=? AND Action='F'";
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql);
|
||||
pstmt.setInt(1, AD_Menu_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
AD_Workflow_ID= rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AD_Workflow_ID;
|
||||
}//getAD_Workflow_ID
|
||||
|
||||
|
||||
/**
|
||||
* Prepare Page.
|
||||
* - Set Header
|
||||
*
|
||||
* @param loginInfo
|
||||
*
|
||||
* @return WReportEngine page
|
||||
*/
|
||||
private WebDoc preparePage(String loginInfo)
|
||||
{
|
||||
WebDoc doc = WebDoc.create ("Workflow");
|
||||
head header = doc.getHead();
|
||||
body b=doc.getBody();
|
||||
// add window.js & .css
|
||||
header.addElement(new script("", WebEnv.getBaseDirectory("/js/window.js")));
|
||||
header.addElement(new link().setRel("stylesheet").setHref(WebEnv.getBaseDirectory("/css/window.css")));
|
||||
//
|
||||
//
|
||||
String title ="Workflow"+" - " + loginInfo;
|
||||
b.addElement(new script("top.document.title='" + title + "';"));
|
||||
return doc;
|
||||
} // preparePage
|
||||
|
||||
/**
|
||||
* Debugger.
|
||||
* - Display the name and value set
|
||||
*
|
||||
* @param variable
|
||||
* @param name
|
||||
*
|
||||
* @return WReportEngine page
|
||||
*/
|
||||
private void debug(Object variable , String name){
|
||||
if (variable!=null)
|
||||
{
|
||||
System.out.println("*************"+name+"="+variable);
|
||||
}
|
||||
else
|
||||
System.out.println("*************"+name+" is null");
|
||||
}//debug
|
||||
private void printMap(int [][] map){
|
||||
final int ROW = map.length;
|
||||
final int COL = map[0].length;
|
||||
|
||||
for(int row=0;row<ROW;row++){
|
||||
for(int col=0;col<COL;col++){
|
||||
System.out.print(" "+map[row][col]+" ");
|
||||
}
|
||||
System.out.println(" ");
|
||||
}
|
||||
|
||||
|
||||
}// printMap
|
||||
|
||||
} // WWorkflow
|
||||
|
|
|
@ -16,44 +16,28 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.WebDoc;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.compiere.util.WebUtil;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* HTML Zoom Window
|
||||
*
|
||||
* @author Rob Klein
|
||||
* @version $Id: WZoom.java $
|
||||
* @version $Id: WZoom.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WZoom extends HttpServlet
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7075820778158654964L;
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(WAttachment.class);
|
||||
|
||||
|
|
|
@ -16,38 +16,16 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.www;
|
||||
|
||||
import org.apache.ecs.AlignType;
|
||||
import org.apache.ecs.Element;
|
||||
import org.apache.ecs.xhtml.a;
|
||||
import org.apache.ecs.xhtml.div;
|
||||
import org.apache.ecs.xhtml.img;
|
||||
import org.apache.ecs.xhtml.input;
|
||||
import org.apache.ecs.xhtml.label;
|
||||
import org.apache.ecs.xhtml.option;
|
||||
import org.apache.ecs.xhtml.select;
|
||||
import org.apache.ecs.xhtml.td;
|
||||
import org.apache.ecs.xhtml.textarea;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MLocator;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.compiere.util.Util;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
import org.compiere.util.WebEnv;
|
||||
import org.compiere.util.WebSessionCtx;
|
||||
import org.apache.ecs.*;
|
||||
import org.apache.ecs.xhtml.*;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
|
||||
/**
|
||||
* Web Field.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: WebField.java,v 1.2 2006/07/30 00:53:21 jjanke Exp $
|
||||
* @version $Id: WebField.java,v 1.1 2009/04/15 11:27:15 vinhpt Exp $
|
||||
*/
|
||||
public class WebField
|
||||
{
|
||||
|
@ -150,6 +128,8 @@ public class WebField
|
|||
private Object m_dataDisplay;
|
||||
//Modified by Rob Klein 4/29/07
|
||||
|
||||
private Lookup m_lookup;
|
||||
|
||||
/**
|
||||
* Get the field Label
|
||||
* @return label
|
||||
|
@ -196,7 +176,7 @@ public class WebField
|
|||
*/
|
||||
public td getField (Lookup lookup, Object data)
|
||||
{
|
||||
|
||||
m_lookup=lookup;
|
||||
String dataValue = (data == null) ? "" : data.toString();
|
||||
//
|
||||
if (m_displayType == DisplayType.Search
|
||||
|
@ -461,10 +441,10 @@ public class WebField
|
|||
input display = null;
|
||||
m_dataDisplay = null;
|
||||
// The display field Name=columnName, ID=FcolumnName
|
||||
display = new input(input.TYPE_TEXT, m_columnName, Util.maskHTML(dataDisplay));
|
||||
display = new input(input.TYPE_TEXT, m_columnName + "F", Util.maskHTML(dataDisplay));
|
||||
m_dataDisplay = dataDisplay;
|
||||
display.setID(m_columnName + "F");
|
||||
display.setReadOnly(true);
|
||||
display.setReadOnly(m_readOnly);
|
||||
|
||||
//Modified by Rob Klein 4/29/07
|
||||
// The button Name=columnName, ID=BcolumnName
|
||||
|
@ -514,7 +494,7 @@ public class WebField
|
|||
display.setClass(C_MANDATORY);
|
||||
//
|
||||
if (m_hasDependents || m_hasCallout){
|
||||
display.setOnBlur("startUpdate("+m_columnName + "D);");
|
||||
display.setOnChange("startUpdate(this)");
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -571,7 +551,7 @@ public class WebField
|
|||
}
|
||||
display = new input(input.TYPE_TEXT, m_columnName, formattedData);
|
||||
display.setID(m_columnName + "F"+m_fieldNumber);
|
||||
display.setReadOnly(true);
|
||||
display.setReadOnly(m_readOnly);
|
||||
// The button Name=columnName, ID=BcolumnName
|
||||
input button = new input (input.TYPE_IMAGE, m_columnName+ "B", "x");
|
||||
button.setID(m_columnName + "B");
|
||||
|
@ -820,4 +800,33 @@ public class WebField
|
|||
return menu;
|
||||
} // getpopUpMenu
|
||||
|
||||
public String getColumnName()
|
||||
{
|
||||
return m_columnName;
|
||||
}
|
||||
public String getFieldName()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
public boolean isHasDependents()
|
||||
{
|
||||
return m_hasDependents;
|
||||
}
|
||||
|
||||
public boolean isHasCallout()
|
||||
{
|
||||
return m_hasCallout;
|
||||
}
|
||||
//public Lookup getLookup()
|
||||
//{
|
||||
// return m_lookup;
|
||||
//}
|
||||
public boolean isMandatory()
|
||||
{
|
||||
return m_mandatory;
|
||||
}
|
||||
public Lookup getLookup()
|
||||
{
|
||||
return m_lookup;
|
||||
}
|
||||
} // WebField
|
||||
|
|
Loading…
Reference in New Issue