Update for defect #'s

1746823  Password reset does not work on WebUI
 1746832  Lookup fields to do not fire callouts
 1746833  Copyright label is wrong on the index page
 1746837  Report and Process does not open up until a window is opened
 1746877  Zoom does not always opens a window
 1746878  Correct Button format on Attachment Window
This commit is contained in:
rob_k 2007-07-05 04:05:35 +00:00
parent 6a76c5c4ba
commit 92fb2dd27e
15 changed files with 1044 additions and 169 deletions

View File

@ -37,6 +37,11 @@
<description>Adempiere Chat</description>
<servlet-class>org.compiere.www.WChat</servlet-class>
</servlet>
<servlet>
<servlet-name>WValuePreference</servlet-name>
<description>Adempiere Value Preference</description>
<servlet-class>org.compiere.www.WValuePreference</servlet-class>
</servlet>
<servlet>
<servlet-name>WZoom</servlet-name>
<description>Adempiere Zoom</description>
@ -140,6 +145,10 @@
<servlet-name>WChat</servlet-name>
<url-pattern>/WChat</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WValuePreference</servlet-name>
<url-pattern>/WValuePreference</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WZoom</servlet-name>
<url-pattern>/WZoom</url-pattern>

View File

@ -150,7 +150,7 @@ public class WAttachment extends HttpServlet
attachment = new MAttachment (ctx, AD_Table_ID, Record_ID, null);
//
tr tr = new tr();
td left = new td("popupCenter", AlignType.RIGHT, AlignType.TOP, false,
td left = new td("popupCenter", AlignType.LEFT, AlignType.TOP, false,
new label("TextMsg", "T", Msg.translate(ctx, "TextMsg")));
//
td right = new td("popupCenter", AlignType.LEFT, AlignType.TOP, false);
@ -164,9 +164,20 @@ public class WAttachment extends HttpServlet
msg.addElement(attachment.getTextMsg());
textMsg.addElement(msg);
textMsg.addElement(new br());
textMsg.addElement(new input (input.TYPE_SUBMIT, "submit", "Submit"));
//textMsg.addElement(new input (input.TYPE_SUBMIT, "submit", "Submit"));
//Submit Button
//String textbtn = "Submit";
//String text = null;
//if (ctx != null)
//text = Msg.getMsg (ctx, "Submit");
//input submitbtn = new input(input.TYPE_SUBMIT, textbtn, " "+text);
//submitbtn.setID(text);
//submitbtn.setClass("submitbtn");
//textMsg.addElement(submitbtn);
right.addElement(textMsg);
// Existing Links
p p = new p();
MAttachmentEntry[] entries = attachment.getEntries();

View File

@ -59,6 +59,7 @@ public class WFieldUpdate extends HttpServlet
private static final String FIELD_FORM = "formName";
private static final String FIELD_NAME = "fieldName";
private static final String FIELD_VALUE = "fieldValue";
private static final String LOCATION_VALUE = "location";
/**
* Process the HTTP Get request
@ -94,11 +95,12 @@ public class WFieldUpdate extends HttpServlet
String formName = WebUtil.getParameter (request, FIELD_FORM);
String fieldName = WebUtil.getParameter (request, FIELD_NAME);
String fieldValue = WebUtil.getParameter (request, FIELD_VALUE);
log.info("doPost - Form=" + formName + " - Field=" + fieldName + " - Value=" + fieldValue);
String locationValue = WebUtil.getParameter (request, LOCATION_VALUE);
log.info("doPost - Form=" + formName + " - Field=" + fieldName + " - Value=" + fieldValue+ " - Location=" + locationValue);
// Document
WebDoc doc = createPage (wsc, ws, formName, fieldName, fieldValue);
WebDoc doc = createPage (wsc, ws, formName, fieldName, fieldValue, locationValue);
// The Form
form fu = new form(request.getRequestURI());
@ -106,6 +108,7 @@ public class WFieldUpdate extends HttpServlet
fu.addElement(new input(input.TYPE_HIDDEN, FIELD_FORM, "y"));
fu.addElement(new input(input.TYPE_HIDDEN, FIELD_NAME, "y"));
fu.addElement(new input(input.TYPE_HIDDEN, FIELD_VALUE, "y"));
fu.addElement(new input(input.TYPE_HIDDEN, LOCATION_VALUE, locationValue));
doc.getBody().addElement(fu);
// log.trace(log.l1_User, "WFieldUpdate=" + doc.toString());
@ -125,16 +128,17 @@ public class WFieldUpdate extends HttpServlet
* @param fieldValue
*/
private static WebDoc createPage (WebSessionCtx wsc, WWindowStatus ws,
String formName, String fieldName, String fieldValue)
String formName, String fieldName, String fieldValue, String locationValue)
{
WebDoc doc = WebDoc.create (true); // plain
body body = doc.getBody();
log.info("Location-createpage: "+locationValue);
// Info
StringBuffer sb = new StringBuffer("FieldUpdate - ")
.append(FIELD_FORM).append("=").append(formName).append(", ")
.append(FIELD_NAME).append("=").append(fieldName).append(", ")
.append(FIELD_VALUE).append("=").append(fieldValue);
.append(FIELD_VALUE).append("=").append(fieldValue)
.append(LOCATION_VALUE).append("=").append(locationValue);
body.addElement(new p()
.addElement(sb.toString()));
@ -143,13 +147,13 @@ public class WFieldUpdate extends HttpServlet
;
//
else if (formName.equals("Login2") && fieldName.equals(WLogin.P_ROLE))
reply_Login2_Role (body, wsc, formName, fieldValue);
reply_Login2_Role (body, wsc, formName, fieldValue, locationValue);
//
else if (formName.equals("Login2") && fieldName.equals(WLogin.P_CLIENT))
reply_Login2_Client (body, wsc, formName, fieldValue);
reply_Login2_Client (body, wsc, formName, fieldValue, locationValue);
//
else if (formName.equals("Login2") && fieldName.equals(WLogin.P_ORG))
reply_Login2_Org (body, wsc, ws, formName, fieldValue);
reply_Login2_Org (body, wsc, ws, formName, fieldValue, locationValue);
//
return doc;
} // getReply
@ -164,10 +168,18 @@ public class WFieldUpdate extends HttpServlet
* @param fieldValue
*/
private static void reply_Login2_Role (body body, WebSessionCtx wsc,
String formName, String fieldValue)
String formName, String fieldValue, String locationValue)
{
// Formname
String form = "top." + WebEnv.TARGET_WINDOW + ".document.forms." + formName + ".";
String form = null;
log.info("Location-Role: "+locationValue);
//if (locationValue!=null)
form = locationValue + WebEnv.TARGET_WINDOW + ".document.forms." + formName + ".";
//else
//form = "top." + WebEnv.TARGET_WINDOW + ".document.forms." + formName + ".";
//log.info("form_role->"+form);
Login login = new Login(wsc.ctx);
// Get Data
KeyNamePair[] clients = login.getClients (
@ -256,12 +268,18 @@ public class WFieldUpdate extends HttpServlet
* @param fieldValue value
*/
private static void reply_Login2_Client (body body, WebSessionCtx wsc,
String formName, String fieldValue)
String formName, String fieldValue, String locationValue)
{
log.info("Location-Client: "+locationValue);
// Formname
String form = "top." + WebEnv.TARGET_WINDOW + ".document." + formName + ".";
String form = null;
//if (locationValue!=null)
form = locationValue + WebEnv.TARGET_WINDOW + ".document." + formName + ".";
//else
//form = "top." + WebEnv.TARGET_WINDOW + ".document." + formName + ".";
StringBuffer script = new StringBuffer ();
//log.info("form_client->"+form);
// Set Organization ----
// var A=top.WWindow.document.formName.selectName.options;
@ -322,10 +340,17 @@ public class WFieldUpdate extends HttpServlet
* @param fieldValue
*/
private static void reply_Login2_Org (body body, WebSessionCtx wsc, WWindowStatus ws,
String formName, String fieldValue)
String formName, String fieldValue, String locationValue)
{
// Formname
String form = "top." + WebEnv.TARGET_WINDOW + ".document." + formName + ".";
String form = null;
log.info("Location-Org: "+locationValue);
//if (locationValue!=null)
form = locationValue + WebEnv.TARGET_WINDOW + ".document." + formName + ".";
//else
//form = "top." + WebEnv.TARGET_WINDOW + ".document." + formName + ".";
//log.info("form_org->"+form);
StringBuffer script = new StringBuffer ();
// Set Warehouse ----

View File

@ -90,29 +90,29 @@ public class WLookup extends HttpServlet
//Modified by Rob Klein 4/29/07
//
WebSessionCtx wsc = WebSessionCtx.get(request);
WWindowStatus ws = WWindowStatus.get(request);
WWindowStatus ws = WWindowStatus.get(request);
if (ws == null)
if (wsc == null)
{
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
// Get Mandatory Parameters
String columnName = WebUtil.getParameter (request, "ColumnName");
GridField mField = ws.curTab.getField(columnName);
//Lookup called from a process
//Modified by Rob Klein 4/29/07
int AD_Process_ID = WebUtil.getParameterAsInt(request, "AD_Process_ID");
int AD_Process_ID = WebUtil.getParameterAsInt(request, "AD_Process_ID");
if (mField == null)
{
if (AD_Process_ID > 0)
{
AD_Process_ID = WebUtil.getParameterAsInt(request, "AD_Process_ID");
if (AD_Process_ID < 1 || columnName == null
|| columnName.equals(""))
{
WebUtil.createErrorPage(request, response, this,
Msg.getMsg(ws.ctx, "ParameterMissing"));
Msg.getMsg(wsc.ctx, "ParameterMissing"));
return;
}
String targetBase = "'" + columnName;
@ -147,15 +147,22 @@ public class WLookup extends HttpServlet
//
doc.getTable().addElement(new tr()
.addElement(fillTable(wsc, ws, para.getColumnName(), para.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase,false))
.addElement(fillTable(wsc, para.getColumnName(), para.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase,false))
.addElement(button));
//
doc.addPopupClose(ws.ctx);
doc.addPopupClose(wsc.ctx);
// log.trace(log.l6_Database, doc.toString());
WebUtil.createResponse (request, response, this, null, doc, false);
}
//Lookup called from a window
else{
// Modified by Rob Klein 7/01/07
if (ws == null)
{
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
GridField mField = ws.curTab.getField(columnName);
log.config("ColumnName=" + columnName
+ ", MField=" + mField);
@ -192,7 +199,7 @@ public class WLookup extends HttpServlet
//
doc.getTable().addElement(new tr()
.addElement(fillTable(wsc, ws, mField.getColumnName(), mField.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase, hasDependents || hasCallout))
.addElement(fillTable(wsc, mField.getColumnName(), mField.getAD_Reference_Value_ID(), request.getRequestURI(),targetBase, hasDependents || hasCallout))
.addElement(restbtn));
//
doc.addPopupClose(ws.ctx);
@ -226,7 +233,7 @@ public class WLookup extends HttpServlet
* @param addStart add startUpdate
* @return Table with selection
*/
private table fillTable (WebSessionCtx wsc, WWindowStatus ws, String columnName, int fieldRefId,
private table fillTable (WebSessionCtx wsc, String columnName, int fieldRefId,
String action,String targetBase, boolean addStart)
{
/**
@ -245,18 +252,18 @@ public class WLookup extends HttpServlet
// Set Headers
line.addElement(new th("&nbsp")).
addElement(new th(Msg.translate(ws.ctx, "Key Name")).setClass("table-filterable table-filtered table-sortable:default"));
line = fillTable_Lookup_Headers(ws, columnName, fieldRefId, line, targetBase, true, true, true, false, true);
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("&nbsp")).addElement(new th("&nbsp"));
line2 = fillTable_Lookup_Headers(ws, columnName, fieldRefId, line2, targetBase, true, true, true, false, false);
line2 = fillTable_Lookup_Headers( columnName, fieldRefId, line2, targetBase, true, true, true, false, false);
table.addElement(line2);
table.addElement("</thead>");
table.addElement("<tbody>");
// Fillout rows
table = fillTable_Lookup_Rows(ws, columnName, fieldRefId, table, targetBase, true, true, true, false);
table = fillTable_Lookup_Rows(wsc, columnName, fieldRefId, table, targetBase, true, true, true, false);
table.addElement("</tbody>");
// Restore
@ -272,7 +279,7 @@ public class WLookup extends HttpServlet
* @param targetBase target field string
* @return Lookup Rows in List Format
*/
private table fillTable_Lookup_Rows (WWindowStatus ws, String columnName, int fieldRefId,
private table fillTable_Lookup_Rows (WebSessionCtx wsc, String columnName, int fieldRefId,
table table1, String targetBase, boolean mandatory, boolean onlyValidated, boolean onlyActive,
boolean temporary)
{
@ -386,7 +393,7 @@ public class WLookup extends HttpServlet
try
{
PreparedStatement pstmt = DB.prepareStatement(sqlSelect.toString(), null);
pstmt.setInt(1, Env.getAD_Client_ID(ws.ctx));
pstmt.setInt(1, Env.getAD_Client_ID(wsc.ctx));
ResultSet rs = pstmt.executeQuery();
while (rs.next()){
@ -455,7 +462,7 @@ public class WLookup extends HttpServlet
* @param targetBase target field string
* @return Table with selection
*/
private tr fillTable_Lookup_Headers (WWindowStatus ws, String columnName, int fieldRefId,
private tr fillTable_Lookup_Headers ( String columnName, int fieldRefId,
tr line, String targetBase, boolean mandatory, boolean onlyValidated, boolean onlyActive,
boolean temporary, boolean firstHeaderLine)
{

View File

@ -88,13 +88,6 @@ public class WProcess extends HttpServlet
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
//Modified by Rob Klein 4/29/07
if (ws == null)
{
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
WebDoc doc = null;
// Get Parameter: Menu_ID
@ -204,6 +197,13 @@ public class WProcess extends HttpServlet
WebDoc doc = WebDoc.createWindow(process.getName());
if (process.isWorkflow())
{
//Modified by Rob Klein 7/01/07
if (mTab == null)
{
doc = WebDoc.createWindow("No Tab found");
return doc;
}
// Pop up Document Action (Workflow)
if (columnName.toString().equals("DocAction")) {
@ -220,7 +220,7 @@ public class WProcess extends HttpServlet
17, 22, 22, false,
// not r/o, ., not error, not dependent
false, false, false, false, false, processId,
0,0,0,0, null,null, null,null);
0, 0, 0, 0, null, null, null, null, null);
if (process.getDescription() != null)
center.addElement(new p(new i(process.getDescription())));
@ -298,7 +298,7 @@ public class WProcess extends HttpServlet
para.getAD_Reference_ID(), para.getFieldLength(), para.getFieldLength(), false,
// not r/o, ., not error, not dependent
false, para.isMandatory(), false, false, false, para.getAD_Process_ID(),
0,0,0,i, null,null, null,null);
0,0,0,i, null,null, null,null, null);
WebField wFieldforRange = null;
@ -308,7 +308,8 @@ public class WProcess extends HttpServlet
// no display length
para.getAD_Reference_ID(), para.getFieldLength(), para.getFieldLength(), false,
// not r/o, ., not error, not dependent
false, para.isMandatory(), false, false, false, para.getAD_Process_ID(),0,0,0,i+1, null,null, null,null);
false, para.isMandatory(), false, false, false, para.getAD_Process_ID(),0,0,0,i+1,
null,null, null,null, null);
td toField = para.isRange()
? wFieldforRange.getField(para.getLookup(), para.getDefaultValue2())
@ -362,6 +363,12 @@ public class WProcess extends HttpServlet
{
WebSessionCtx wsc = WebSessionCtx.get (request);
MProcess process = MProcess.get (wsc.ctx, AD_Process_ID);
log.info("PI table id "+process.get_Table_ID());
log.info("PI table name id "+process.get_TableName());
log.info("PI table client id "+process.getAD_Client_ID());
log.info("PI table process id "+process.getAD_Process_ID());
log.info("PI process class name "+process.getClassname());
// need to check if Role can access
WebDoc doc = null;
if (process == null)
@ -387,7 +394,8 @@ public class WProcess extends HttpServlet
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID(), AD_Table_ID, AD_Record_ID);
pi.setAD_User_ID(Env.getAD_User_ID(wsc.ctx));
pi.setAD_Client_ID(Env.getAD_Client_ID(wsc.ctx));
pi.setAD_Client_ID(Env.getAD_Client_ID(wsc.ctx));
pi.setClassName(process.getClassname());
log.info("PI client id "+pi.getAD_Client_ID());
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());

View File

@ -0,0 +1,505 @@
/******************************************************************************
* 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.*;
import java.math.*;
import java.net.*;
import java.sql.*;
import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.ecs.*;
import org.apache.ecs.xhtml.*;
import org.compiere.apps.ADialog;
//import org.compiere.apps.WProcessCtl;
import org.compiere.grid.ed.VDocAction;
import org.compiere.model.*;
import org.compiere.print.*;
import org.compiere.process.*;
import org.compiere.util.*;
import org.compiere.wf.MWFActivity;
import org.compiere.wf.MWFResponsible;
/**
* HTML Process and Report UI
*
* @author Jorg Janke
* @version $Id: WProcess.java,v 1.3 2006/07/30 00:53:21 jjanke Exp $
*/
public class WValuePreference extends HttpServlet
{
/** Logger */
protected CLogger log = CLogger.getCLogger(getClass());
//Modified by Rob Klein 4/29/07
private String errorMessage = null;
private Properties m_ctx;
//private int m_WindowNo;
private int m_AD_Client_ID;
private int m_AD_Org_ID;
private int m_AD_User_ID;
private int m_AD_Window_ID;
private String m_Attribute;
private String m_DisplayAttribute;
private String m_Value;
private String m_DisplayValue;
private int m_DisplayType;
private MRole m_role;
private String m_Explination;
private Boolean m_Client;
private Boolean m_User;
private Boolean m_Window;
private Boolean m_Org;
/**
* Initialize global variables
* @param config
* @throws ServletException
*/
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
if (!WebEnv.initWeb(config))
throw new ServletException("WValuePreference.init");
} // init
/**
* Process the HTTP Get request.
* Initial Call
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
// Get Session attributes
WebSessionCtx wsc = WebSessionCtx.get(request);
WWindowStatus ws = WWindowStatus.get(request);
if (wsc == null)
{
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
if (ws == null)
{
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
String m_UpdateResult = "";
WebDoc doc = null;
//Get/Set Parameter
m_ctx = wsc.ctx;
m_AD_Window_ID = WebUtil.getParameterAsInt(request, "AD_Window_ID");
m_AD_Client_ID = WebUtil.getParameterAsInt(request, "AD_Client_ID");
m_AD_Org_ID = WebUtil.getParameterAsInt(request, "AD_Org_ID");
m_AD_User_ID = WebUtil.getParameterAsInt(request, "AD_User_ID");
m_Attribute = WebUtil.getParameter(request, "Attribute");
m_DisplayAttribute = WebUtil.getParameter(request, "DisplayAtrribute");
m_Value = WebUtil.getParameter(request, "Value");
m_DisplayValue = WebUtil.getParameter(request, "DisplayValue");
m_DisplayType = WebUtil.getParameterAsInt(request, "DisplayType");
m_role = MRole.getDefault (wsc.ctx, false);
m_Client = false;
m_User = false;
m_Window = false;
m_Org = false;
doc = createParameterPage(ws, wsc, request, m_UpdateResult);
WebUtil.createResponse(request, response, this, null, doc, false);
} // doGet
/**
* Process the HTTP Post request.
* Get Parameters and Process
* @param request
* @param response
* @throws ServletException
* @throws IOException
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
WebDoc doc = null;
// Get Session attributes
WebSessionCtx wsc = WebSessionCtx.get(request);
WWindowStatus ws = WWindowStatus.get(request);
String m_UpdateResult = "";
if (wsc == null)
{
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
log.info("This is #1");
m_Client = WebUtil.getParameterAsBoolean(request, "Client");
m_User = WebUtil.getParameterAsBoolean(request, "User");
m_Window = WebUtil.getParameterAsBoolean(request, "Window");
m_Org = WebUtil.getParameterAsBoolean(request, "Org");
log.info("This is #2");
String m_Action = WebUtil.getParameter(request, "PostAction");
setExplanation();
log.info("This is the m_Action"+m_Action);
if (m_Action.equals("Delete"))
m_UpdateResult = delete( m_Client, m_User, m_Window, m_Org);
else if (m_Action.equals("Add"))
m_UpdateResult = insert( m_Client, m_User, m_Window, m_Org);
log.info("This is the call");
doc = createParameterPage(ws, wsc, request, m_UpdateResult);
WebUtil.createResponse(request, response, this, null, doc, false);
return;
//Modified by Rob Klein 6/01/07
//WebDoc doc = createProcessPage(request, AD_Process_ID, AD_Window_ID);
//createProcessPage(request, response, AD_Process_ID, AD_Window_ID);
//
} // doPost
//Modified by Rob Klein 4/29/07
/**************************************************************************
* Create Parameter Page
* @param wsc web session context
* @param AD_Menu_ID Menu
* @return Page
*/
private WebDoc createParameterPage (WWindowStatus ws, WebSessionCtx wsc, HttpServletRequest request,
String m_UpdateResult)
{
form myForm = null;
myForm = new form("WValuePreference")
.setName("valuepreference");
table table = new table("0", "0", "5", "100%", null);
table.setID("WValuePrefTable");
tr line = new tr();
line.addElement(new td("&nbsp;").setRowSpan(6));
table.addElement(line);
//Attribute Field
line
.addElement(getLabel(Msg.translate(m_ctx,"Attribute")))
.addElement(new td(new input(input.TYPE_TEXT, "DisplayAttribute", m_DisplayAttribute)));
table.addElement(line);
//Key Field
line = new tr();
line
.addElement(getLabel(Msg.translate(m_ctx,"Key")))
.addElement(new td(new input(input.TYPE_TEXT, "DisplayAttribute", m_DisplayValue)));
table.addElement(line);
line = new tr();
line.addElement(new td("&nbsp;").setRowSpan(6));
//Checkboxs Field
table tablecheckbox = new table("0", "0", "5", "80%", null);
line = new tr();
input checkbox1 = new input(input.TYPE_CHECKBOX, "Client", m_AD_Client_ID);
checkbox1.setChecked(m_Client);
checkbox1.setOnClick("updateValuePref('Update');");
checkbox1.setTagText(Msg.translate(m_ctx,"AD_Client_ID"));
input checkbox2 = new input(input.TYPE_CHECKBOX, "Org", m_AD_Org_ID);
checkbox2.setChecked(m_Org);
checkbox2.setOnClick("updateValuePref('Update');");
checkbox2.setTagText(Msg.translate(m_ctx,"AD_Org_ID"));
input checkbox3 = new input(input.TYPE_CHECKBOX, "User", m_AD_User_ID);
checkbox3.setChecked(m_User);
checkbox3.setOnClick("updateValuePref('Update');");
checkbox3.setTagText(Msg.translate(m_ctx,"AD_User_ID"));
input checkbox4 = new input(input.TYPE_CHECKBOX, "Window", m_AD_Window_ID);
checkbox4.setChecked(m_Window);
checkbox4.setOnClick("updateValuePref('Update');");
checkbox4.setTagText(Msg.translate(m_ctx,"AD_Window_ID"));
line
.addElement(new td(checkbox1).setWidth("25%"))
.addElement(new td(checkbox2).setWidth("25%"))
.addElement(new td(checkbox3).setWidth("25%"))
.addElement(new td(checkbox4).setWidth("25%"));
tablecheckbox.addElement(line);
table.addElement(tablecheckbox);
line = new tr();
line.addElement(new td("&nbsp;").setRowSpan(6));
//Explination
table tableexplination = new table("0", "0", "5", "80%", null);
setExplanation();
line.addElement(new td(Msg.translate(m_ctx,m_Explination)).setAlign(AlignType.CENTER));
tableexplination.addElement(line);
table.addElement(tableexplination);
line = new tr();
line.addElement(new td("&nbsp;").setRowSpan(6));
//Update Results
table tableresult = new table("0", "0", "5", "80%", null);
line.addElement(new td(Msg.translate(m_ctx,m_UpdateResult)).setAlign(AlignType.CENTER));
tableresult.addElement(line);
table.addElement(tableresult);
line = new tr();
line.addElement(new td("&nbsp;").setRowSpan(6));
// Reset
String textbtn = "Delete";
if (wsc.ctx != null)
textbtn = Msg.getMsg (wsc.ctx, "Delete");
input restbtn = new input(input.TYPE_BUTTON, textbtn, " "+textbtn);
restbtn.setID(textbtn);
restbtn.setOnClick("updateValuePref('Delete')");
restbtn.setClass("deletebtn");
// Submit
textbtn = "Submit";
if (wsc.ctx != null)
textbtn = Msg.getMsg (wsc.ctx, "Submit");
input submitbtn = new input(input.TYPE_BUTTON, textbtn, " "+textbtn);
submitbtn.setID(textbtn);
submitbtn.setOnClick("updateValuePref('Add')");
submitbtn.setClass("submitbtn");
// Close
textbtn = "Close";
if (wsc.ctx != null)
textbtn = Msg.getMsg (wsc.ctx, "Close");
input closebtn = new input(input.TYPE_SUBMIT, textbtn, " "+textbtn);
closebtn.setID(textbtn);
closebtn.setClass("closebtn");
closebtn.setOnClick ("self.close();return false;");
table tablebuttons = new table("0", "0", "5", "100%", null);
tablebuttons.addElement(new tr()
.addElement(new td(null, AlignType.CENTER, AlignType.MIDDLE, false,
restbtn))
.addElement(new td(null, AlignType.CENTER, AlignType.MIDDLE, false,
submitbtn))
.addElement(new td(null, AlignType.CENTER, AlignType.MIDDLE, false,
closebtn)));
table.addElement(tablebuttons);
myForm.addElement(table);
WebDoc doc = WebDoc.createPopup ("Set Value Preference");
td center = doc.addWindowCenter(false);
myForm
.addElement(new input(input.TYPE_HIDDEN, "PostAction", ""))
.addElement(table);
center.addElement(myForm);
return doc;
} // createParameterPage
/**
* Get Select Field
* @param lookup lookup
* @param dataValue default value
* @return selction td
*/
private td createSelectField (String m_columnName, option[] options)
{
select sel = new select(m_columnName, options);
sel.setID(m_columnName);
sel.setDisabled(false);
sel.setClass("Cmandatory");
//
return createTD(sel);
} // getSelectField
/**
* Create Left Top aligned TD
* @param element element
* @return td table data
*/
private td createTD (Element element)
{
td td = new td()
.addElement(element)
.setAlign(AlignType.LEFT)
.setVAlign(AlignType.TOP);
return td;
} // createTD
/**
* Get the field Label
* @return label
*/
public td getLabel(String mLabel)
{
//
label myLabel = new label(mLabel + "F", null, Util.maskHTML(mLabel));
myLabel.setID(mLabel + "L");
//
td td = new td()
.addElement(myLabel)
.setAlign(AlignType.RIGHT)
.setVAlign(AlignType.TOP);
return td;
} // getLabel
/**
* Set Explanation
*/
private void setExplanation()
{
/** @todo translation */
StringBuffer expl = new StringBuffer("For ");
if (m_Client && m_Org)
expl.append("this Client and Organization");
else if (m_Client && !m_Org)
expl.append("all Organizations of this Client");
else if (!m_Client && m_Org)
{
m_Org = false;
expl.append("entire System");
}
else
expl.append("entire System");
//
if (m_User)
expl.append(", this User");
else
expl.append(", all Users");
//
if (m_Window)
expl.append(" and this Window");
else
expl.append(" and all Windows");
//
if (Env.getLanguage(m_ctx).isBaseLanguage())
{
m_Explination = expl.toString ();
}
} // setExplanation
/**
* Delete Preference
* @return number of rows deleted
*/
public String delete(Boolean m_Client,Boolean m_User, Boolean m_Window, Boolean m_Org)
{
log.info("");
String m_UpdateResult;
StringBuffer sql = new StringBuffer ("DELETE FROM AD_Preference WHERE ");
sql.append("AD_Client_ID=").append(m_Client ? m_AD_Client_ID : 0);
sql.append(" AND AD_Org_ID=").append(m_Org ? m_AD_Org_ID : 0);
if (m_User)
sql.append(" AND AD_User_ID=").append(m_AD_User_ID);
else
sql.append(" AND AD_User_ID IS NULL");
if (m_Window)
sql.append(" AND AD_Window_ID=").append(m_AD_Window_ID);
else
sql.append(" AND AD_Window_ID IS NULL");
sql.append(" AND Attribute='").append(m_Attribute).append("'");
//
log.fine( sql.toString());
int no = DB.executeUpdate(sql.toString(), null);
if (no > 0){
Env.setContext(m_ctx, getContextKey(m_Window), (String)null);
m_UpdateResult = no+" Record Deleted";
}
else
m_UpdateResult = "Record not found for deletion";
return m_UpdateResult;
} // delete
/**
* Get Context Key
* @return Context Key
*/
private String getContextKey(Boolean m_Window)
{
if (m_Window)
return "P" + m_AD_Window_ID + "|" + m_Attribute;
else
return "P|" + m_Attribute;
} // getContextKey
/**
* Save to Disk
*/
public String insert(Boolean m_Client,Boolean m_User, Boolean m_Window, Boolean m_Org)
{
log.info("");
String m_UpdateResult;
int no=0;
// --- Delete first
m_UpdateResult = delete(m_Client, m_User, m_Window, m_Org);
// Handle NULL
if (m_Value == null || m_Value.length() == 0)
{
if (DisplayType.isLookup(m_DisplayType))
m_Value = "-1"; // -1 may cause problems (BPartner - M_DiscountSchema
else if (DisplayType.isDate(m_DisplayType))
m_Value = " ";
else
{
m_UpdateResult = m_UpdateResult+" Can not update record";
return m_UpdateResult;
}
}
// --- Inserting
int Client_ID = m_Client ? m_AD_Client_ID : 0;
int Org_ID = m_Org ? m_AD_Org_ID : 0;
int AD_Preference_ID = DB.getNextID(m_ctx, "AD_Preference", null);
//
StringBuffer sql = new StringBuffer ("INSERT INTO AD_Preference ("
+ "AD_Preference_ID, AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy,Updated,UpdatedBy,"
+ "AD_Window_ID, AD_User_ID, Attribute, Value) VALUES (");
sql.append(AD_Preference_ID).append(",").append(Client_ID).append(",").append(Org_ID)
.append(", 'Y',SysDate,").append(m_AD_User_ID).append(",SysDate,").append(m_AD_User_ID).append(", ");
if (m_Window)
sql.append(m_AD_Window_ID).append(",");
else
sql.append("NULL,") ;
if (m_User)
sql.append(m_AD_User_ID).append(",");
else
sql.append("NULL,");
//
sql.append(DB.TO_STRING(m_Attribute)).append(",").append(DB.TO_STRING(m_Value)).append(")");
//
log.fine( sql.toString());
no = DB.executeUpdate(sql.toString(), null);
if (no >0)
m_UpdateResult = no+" Record Inserted";
else
m_UpdateResult = "Record not Inserted";
return m_UpdateResult;
} // insert
} // WValuePrefernce

View File

@ -818,6 +818,7 @@ public class WWindow extends HttpServlet
table table = new table();
table.setClass("centerTable");
StringBuffer scriptSrc = new StringBuffer();
MRole role = MRole.getDefault(wsc.ctx, false);
//
tr line = new tr();
//Modified by Rob Klein 4/29/07
@ -851,7 +852,7 @@ public class WWindow extends HttpServlet
//
boolean hasDependents = ws.curTab.hasDependants(columnName);
//Modified by Rob Klein 4/29/07
addField(wsc, line, field, oData, hasDependents, recordID, tableID, isTabRO, i, ws.curTab);
addField(wsc, line, field, oData, hasDependents, recordID, tableID, isTabRO, i, ws.curTab,role);
//addField(wsc, line, field, oData, hasDependents);
table.addElement(line);
// Additional Values
@ -1156,10 +1157,11 @@ public class WWindow extends HttpServlet
myForm.addElement(statusTable);
//Beg Modified by Rob Klein
//div calpopdiv = new div();
//calpopdiv.setStyle("visibility:hidden;background-color:white;layer-background-color:white;");
//calpopdiv.setID("cal1div");
//myForm.addElement(calpopdiv);
//div menupop = new div();
//menupop.setOnMouseOver("clearhidemenu()");
//menupop.setOnMouseOut("dynamichide(event)");
//menupop.setID("popitmenu");
//myForm.addElement(menupop);
//End Modified by Rob Klein
// fini
@ -1294,7 +1296,7 @@ public class WWindow extends HttpServlet
*/
private void addField (WebSessionCtx wsc, tr line, GridField field,
Object oData, boolean hasDependents, int recordID, int tableID, boolean tabRO, int fieldNumber,
GridTab mTab)
GridTab mTab, MRole role)
{
String columnName = field.getColumnName();
// Any Error?
@ -1345,7 +1347,7 @@ public class WWindow extends HttpServlet
fieldRO, field.isMandatory(false), error,
hasDependents, hasCallout,field.getAD_Process_ID(),field.getAD_Window_ID(),
recordID, tableID, fieldNumber, field.getDefault(), field.getCallout(),
mTab, field );
mTab, field, role );
line
.addElement(wField.getLabel())
.addElement(wField.getField(field.getLookup(), oData));

View File

@ -54,7 +54,7 @@ public class WebField
boolean readOnly, boolean mandatory, boolean error,
boolean hasDependents, boolean hasCallout, int AD_Process_ID,
int AD_Window_ID, int AD_Record_ID, int AD_Table_ID, int fieldNumber, Object defaultvalue,
String callOut, GridTab mTab, GridField mField )
String callOut, GridTab mTab, GridField mField, MRole mRole)
{
super ();
m_wsc = wsc;
@ -87,6 +87,7 @@ public class WebField
m_fieldNumber = fieldNumber;
m_Tab = mTab;
m_Field = mField;
m_Role = mRole;
//
@ -106,6 +107,7 @@ public class WebField
private String m_callOut;
private GridTab m_Tab;
private GridField m_Field;
private MRole m_Role;
//
private Object m_defaultObject;
private int m_displayType;
@ -123,6 +125,7 @@ public class WebField
private boolean m_hasDependents;
private boolean m_hasCallout;
private int m_fieldNumber;
private Object m_dataDisplay;
//Modified by Rob Klein 4/29/07
/**
@ -232,7 +235,19 @@ public class WebField
*/
private td getStringField (String data)
{
input string = new input(input.TYPE_TEXT, m_columnName, Util.maskHTML(data));
input string = null;
Boolean isEncrypted = false;
if(m_Field != null)
isEncrypted = m_Field.isEncryptedField();
if(isEncrypted)
string = new input(input.TYPE_PASSWORD, m_columnName, Util.maskHTML(data));
else
string = new input(input.TYPE_TEXT, m_columnName, Util.maskHTML(data));
string.setID(m_columnName + "F");
string.setSize(m_displayLength);
if (m_fieldLength > 0)
@ -339,7 +354,7 @@ public class WebField
*/
private td getNumberField (Object data)
{
String formattedData = "";
String formattedData = "";
//Modified by Rob Klein 4/29/07
if (data == null)
if (m_displayType == DisplayType.Amount )
@ -351,13 +366,13 @@ public class WebField
formattedData = m_wsc.integerFormat.format(0);
else
formattedData = "0";
else if (m_displayType == DisplayType.Amount)
formattedData = m_wsc.amountFormat.format(data);
else if (m_displayType == DisplayType.Number
|| m_displayType == DisplayType.CostPrice)
formattedData = m_wsc.numberFormat.format(data);
//else if (m_displayType == DisplayType.Quantity)
// formattedData = m_wsc.quantityFormat.format(data);
//else if (m_displayType == DisplayType.Amount)
//formattedData = m_wsc.amountFormat.format(data);
//else if (m_displayType == DisplayType.Number
//|| m_displayType == DisplayType.CostPrice)
//formattedData = m_wsc.numberFormat.format(data);
else if (m_displayType == DisplayType.Quantity)
formattedData = m_wsc.quantityFormat.format(data);
else if (m_displayType == DisplayType.Integer)
formattedData = m_wsc.integerFormat.format(data);
else
@ -416,13 +431,16 @@ public class WebField
*/
private td getPopupField (String dataDisplay, String dataValue)
{
log.info("0");
// The hidden data field Name=columnName
input hidden = new input (input.TYPE_HIDDEN, m_columnName, dataValue);
hidden.setID(m_columnName + "D");
//Modified by Rob Klein 4/29/07
input display = null;
m_dataDisplay = null;
// The display field Name=columnName, ID=FcolumnName
display = new input(input.TYPE_TEXT, m_columnName, Util.maskHTML(dataDisplay));
m_dataDisplay = dataDisplay;
display.setID(m_columnName + "F");
display.setReadOnly(true);
@ -445,45 +463,54 @@ public class WebField
if (m_displayType == DisplayType.Location)
button.setOnClick("startLocation('" + m_columnName + "');return false;");
else if (m_displayType == DisplayType.Account)
// modified by rob klein 4/29/07
//modified by rob klein 4/29/07
button.setOnClick("startLookup('" + m_columnName + "', "+m_processID+");return false;");
else
//modified by rob klein 4/29/07
button.setOnClick("startLookup('" + m_columnName + "', "+m_processID+");return false;");
//Set Zoom
//Add by Rob Klein 6/6/2007
input buttonZoom = null;
//Start Popup Menu
//Add by Rob Klein 6/6/2007
a buttonFlyout = null;
String menu = null;
if(m_Field != null)
{
buttonZoom = new input (input.TYPE_IMAGE, m_columnName+ "Z", "x");
buttonZoom.setID(m_columnName + "Z");
buttonZoom.setSrc(WebEnv.getImageDirectory("Zoom10.gif"));
buttonZoom.setBorder(1);
StringBuffer sql = null;
int refID = m_Field.getAD_Reference_Value_ID();
if (refID > 0)
sql = new StringBuffer ("SELECT AD_Table_ID"
+ "FROM AD_Ref_Table WHERE AD_Reference_ID = "+refID);
else
sql = new StringBuffer ("SELECT AD_Table_ID "
+ "FROM AD_Table WHERE TableName = '"+m_columnName.replace("_ID", "")+"'");
int tableID = DB.getSQLValue(null, sql.toString());
buttonZoom.setOnClick("startZoom('" + tableID + "', "+m_Field.getValue()+");return false;");
menu = getpopUpMenu ();
// Popmenu
if(menu!=null){
buttonFlyout = new a("#", "");
buttonFlyout.addElement(new img(WebEnv.getImageDirectory("menufly10.gif")).setBorder(0));
buttonFlyout.setID(m_columnName + "PV");
buttonFlyout.setOnMouseOver("dropdownmenu(this, event, menu1["+m_fieldNumber+"], '165px')");
buttonFlyout.setOnMouseOut("delayhidemenu()");
}
}
//
if (m_error)
display.setClass(C_ERROR);
else if (m_mandatory)
display.setClass(C_MANDATORY);
//
if (m_hasDependents || m_hasCallout)
display.setOnChange("startUpdate(this);");
if (m_hasDependents || m_hasCallout){
display.setOnBlur("startUpdate("+m_columnName + "D);");
}
//
return createTD(hidden)
if(m_Field != null)
{
return createTD(hidden)
.addElement(display)
.addElement(button)
.addElement(buttonZoom);
.addElement(buttonFlyout)
.addElement(new script(menu));
}
else
{
return createTD(hidden)
.addElement(display)
.addElement(button);
}
} // getPopupField
@ -523,21 +550,15 @@ public class WebField
display.setReadOnly(true);
// The button Name=columnName, ID=BcolumnName
input button = new input (input.TYPE_IMAGE, m_columnName+ "B", "x");
button.setID(m_columnName + "B");
String gif = "PickOpen10.gif";
if (m_displayType == DisplayType.Date)
gif = "Calendar10.gif";
else if (m_displayType == DisplayType.DateTime)
gif = "Calendar10.gif";
button.setID(m_columnName + "B");
button.setSrc(WebEnv.getImageDirectory("Calendar10.gif"));
button.setSrc(WebEnv.getImageDirectory(gif));
button.setBorder(1);
if (m_displayType == DisplayType.Date){
button.setOnClick("showCalendar('"+m_columnName+ "F"+m_fieldNumber+"', '%m/%d/%Y');return false;");
button.setOnClick("return showCalendar('"+m_columnName+ "F"+m_fieldNumber+"', '%m/%d/%Y');");
}
else if (m_displayType == DisplayType.DateTime){
button.setOnClick("showCalendar('"+m_columnName+ "F"+m_fieldNumber+"', '%b %d, %Y %H:%M:%S %p', '24', true);return false;");
button.setOnClick("showCalendar('"+m_columnName+ "F"+m_fieldNumber+"', '%b %d, %Y %H:%M:%S %p', '24');return false;");
}
//
if (m_error)
@ -550,7 +571,7 @@ public class WebField
//
return createTD(hidden)
.addElement(display)
.addElement(button);
.addElement(button.setBorder(0));
} // getPopupField
/**
@ -565,9 +586,14 @@ public class WebField
if (dataValue.length()<1 && m_defaultObject != null) {
dataValue = m_defaultObject.toString();
}
select sel = new select(m_columnName, getOptions(lookup, dataValue));
}
String dataDisplay = "";
if (lookup != null && dataValue != null && dataValue.length() > 0)
dataDisplay = lookup.getDisplay(dataValue);
option[] ops = getOptions(lookup, dataValue);
select sel = new select(m_columnName, ops);
sel.setID(m_columnName);
sel.setDisabled(m_readOnly);
@ -579,43 +605,25 @@ public class WebField
if (m_hasDependents || m_hasCallout)
sel.setOnChange("startUpdate(this);");
//Set Zoom
//Start Setting up popUpMenu
//Add by Rob Klein 6/6/2007
input buttonZoom = null;
int refID = 0;
Object recordID =0;
if(m_Field != null && !m_readOnly)
{
buttonZoom = new input (input.TYPE_IMAGE, m_columnName+ "Z", "x");
buttonZoom.setID(m_columnName + "Z");
buttonZoom.setSrc(WebEnv.getImageDirectory("Zoom10.gif"));
buttonZoom.setBorder(1);
StringBuffer sql = null;
refID = m_Field.getAD_Reference_Value_ID();
if (m_displayType == DisplayType.List ){
sql = new StringBuffer ("SELECT AD_Table_ID "
+ "FROM AD_Table WHERE TableName = 'AD_Reference'");
recordID = refID;
}
else if (refID > 0 ){
sql = new StringBuffer ("SELECT AD_Table_ID "
+ "FROM AD_Ref_Table WHERE AD_Reference_ID = "+refID);
recordID =m_Field.getValue();
}
else{
sql = new StringBuffer ("SELECT AD_Table_ID "
+ "FROM AD_Table WHERE TableName = '"+m_columnName.replace("_ID", "")+"'");
recordID =m_Field.getValue();
}
int tableID = DB.getSQLValue(null, sql.toString());
buttonZoom.setOnClick("startZoom('" + tableID + "', '"+recordID+"');return false;");
a buttonFlyout = null;
String menu = null;
if(m_Field != null && !m_readOnly)
{
// Popmenu create
menu = getpopUpMenu ();
if(menu!=null){
buttonFlyout = new a("#", "");
buttonFlyout.addElement(new img(WebEnv.getImageDirectory("menufly10.gif")).setBorder(0));
buttonFlyout.setID(m_columnName + "PV");
buttonFlyout.setOnMouseOver("dropdownmenu(this, event, menu1["+m_fieldNumber+"], '165px')");
buttonFlyout.setOnMouseOut("delayhidemenu()");}
}
//
return createTD(sel).addElement(buttonZoom);
return createTD(sel).addElement(buttonFlyout).addElement(new script(menu));
} // getSelectField
/**
@ -645,11 +653,13 @@ public class WebField
if (dataValue.length()<1){
options[0] = new option("-1").addElement("&nbsp;").setSelected(true);
options[1] = new option(value.getID()).addElement(value.getName());
m_dataDisplay =value.getName();
}
else
{
options[0] = new option("-1").addElement("&nbsp;");
options[1] = new option(value.getID()).addElement(value.getName()).setSelected(true);
m_dataDisplay =value.getName();
}
}
return options;
@ -664,8 +674,9 @@ public class WebField
MLocator loc = (MLocator)list[i];
key = String.valueOf(loc.getM_Locator_ID());
String name = Util.maskHTML(loc.getValue());
if (dataValue.equals(key))
if (dataValue.equals(key)){
options[i] = new option(key).addElement(name).setSelected(true);
m_dataDisplay = name;}
else
options[i] = new option(key).addElement(name);
}
@ -674,8 +685,9 @@ public class WebField
KeyNamePair p = (KeyNamePair)list[i];
key = String.valueOf(p.getKey());
String name = Util.maskHTML(p.getName());
if (dataValue.equals(key))
if (dataValue.equals(key)){
options[i] = new option(key).addElement(name).setSelected(true);
m_dataDisplay =name;}
else
options[i] = new option(key).addElement(name);
}
@ -689,8 +701,9 @@ public class WebField
if (name == null || name.length() == 0)
name = "???";
name = Util.maskHTML(name);
if (dataValue.equals(key))
if (dataValue.equals(key)){
options[i] = new option(key).addElement(name).setSelected(true);
m_dataDisplay =name;}
else
options[i] = new option(key).addElement(name);
}
@ -718,4 +731,66 @@ public class WebField
.setAlign(AlignType.LEFT); // overwrite
} // getButtonField
/**
* Get Popup Menu
* @return Menu String
*/
private String getpopUpMenu ()
{
//Start Popup Menu
//Add by Rob Klein 6/6/2007
a buttonZoom = null;
a buttonValuePref = null;
String menu = null;
Boolean tableAccess =false;
if(m_dataDisplay!=null){
// Set ValuePreference
// Add by Rob Klein 6/6/2007
buttonValuePref = new a("#", (new img(WebEnv.getImageDirectory("vPreference10.gif")).setBorder(0))+" Preference");
buttonValuePref.setID(m_columnName + "PV");
buttonValuePref.setOnClick("startValuePref('" + m_displayType + "', '"+Util.maskHTML(m_dataDisplay.toString())+ "', '"
+ m_Field.getValue()+ "', '"+m_Field.getHeader()+ "', '"+m_Field.getColumnName()+ "', '"
+ Env.getAD_User_ID(m_wsc.ctx)+ "', '" + Env.getAD_Org_ID(m_wsc.ctx) + "', '"+Env.getAD_Client_ID(m_wsc.ctx)
+ "', '"+m_Field.getAD_Window_ID()+"');return false;");
menu = "menu1["+m_fieldNumber+"]="+buttonValuePref+";\n";
}
//Set Zoom
StringBuffer sql = null;
int refID = m_Field.getAD_Reference_Value_ID();
Object recordID =0;
if (m_displayType == DisplayType.List ){
sql = new StringBuffer ("SELECT AD_Table_ID "
+ "FROM AD_Table WHERE TableName = 'AD_Reference'");
recordID = refID;
}
else if (refID > 0){
sql = new StringBuffer ("SELECT AD_Table_ID "
+ "FROM AD_Ref_Table WHERE AD_Reference_ID = "+refID);
recordID =m_Field.getValue();
}
else{
sql = new StringBuffer ("SELECT AD_Table_ID "
+ "FROM AD_Table WHERE TableName = '"+m_columnName.replace("_ID", "")+"'");
recordID =m_Field.getValue();
}
int tableID = DB.getSQLValue(null, sql.toString());
tableAccess = m_Role.isTableAccess(tableID, false);
if(tableAccess==true){
buttonZoom = new a("#", (new img(WebEnv.getImageDirectory("Zoom10.gif")).setBorder(0))+" Zoom");
buttonZoom.setID(m_columnName + "Z");
buttonZoom.setOnClick("startZoom('" + tableID + "', "+recordID+");return false;");
if(m_dataDisplay!=null)
menu = menu + "menu1["+m_fieldNumber+"]+="+buttonZoom+";\n";
else
menu = "menu1["+m_fieldNumber+"]="+buttonZoom+";\n";
}
return menu;
} // getpopUpMenu
} // WebField

View File

@ -110,6 +110,11 @@
<display-name>Adempiere Chat</display-name>
<servlet-class>org.compiere.www.WChat</servlet-class>
</servlet>
<servlet>
<servlet-name>WValuePreference</servlet-name>
<display-name>Adempiere Value Preference</display-name>
<servlet-class>org.compiere.www.WValuePreference</servlet-class>
</servlet>
<servlet>
<servlet-name>WZoom</servlet-name>
<display-name>Adempiere Zoom</display-name>
@ -201,6 +206,10 @@
<servlet-name>WChat</servlet-name>
<url-pattern>/WChat</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WValuePreference</servlet-name>
<url-pattern>/WValuePreference</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>WZoom</servlet-name>
<url-pattern>/WZoom</url-pattern>

View File

@ -92,7 +92,13 @@ td {
background-color:#ffffff;
}
.deletebtn {
cursor:pointer;
margin-top:5px;
border:outset 2px #ccc;
background:url(/adempiere/images/Delete16.gif) no-repeat left;
background-color:#ffffff;
}
.Cerror {
background: #FF4A4A;
}
@ -182,3 +188,24 @@ td.toolbar {
border-bottom: 1px solid #000000;
}
#dropmenudiv{
position: absolute;
background-color: white;
border:1px solid #003FAF;
font: normal 10px Verdana;
line-height: 14px;
z-index: 100;
visibility: hidden;
}
#dropmenudiv a{
text-decoration: none;
padding-left: 6px;
color: black;
display: block;
}
#dropmenudiv a:hover{ /*hover background color*/
background-color: #C9D9F5;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

View File

@ -8,8 +8,15 @@
//Start of Calendar
function resizeFrame(value){
var frame = top.document;
function resizeFrame(value){
if (!top.WCmd) // no cmd frame
var frame = top.myiframe.document;
else
var frame = top.document;
//var frame = top.document;
var frameset = frame.getElementById("framesetMenuWindow");
if (!frameset) return false;
@ -23,7 +30,7 @@ function resizeFrame(value){
<meta http-equiv="pragma" content="no-cache">
</head>
<frameset id="framesetOuter" cols="*" rows="0,*" title="&copy; ADempiere">
<frame src="cmd.html" name="WCmd" noresize>
<frame src="cmd.html" name="WCmd">
<frameset id="framesetMenuWindow" cols="0,*" rows="*">
<frame src="menu.html" name="WMenu">
<frame src="window.html" name="WWindow">

View File

@ -9,24 +9,42 @@
* Text constants
*/
var deleteText = "ConfirmDelete";
/****************************************************************************
* Popup Menu variables
*/
/****************************************************************************
* Field Update
***************************************************************************/
function fieldUpdate(e)
{
if (!top.WCmd) // no cmd frame
return;
if (!e) e = window.event;
// alert('FieldUpdate ' + e.name + '=' + e.value);
if (!top.WCmd){ // no cmd frame
if (!top.myiframe.WCmd){
return;
}
else{
var d = top.myiframe.WCmd.document;
var path = "top.myiframe.";
}
}
else{
var d = top.WCmd.document;
var path = "top.";
}
//if (!e) e = window.event;
// update info and submit
top.WCmd.document.fieldUpdate.formName.value = e.form.name; //e.document.forms[0].name;
top.WCmd.document.fieldUpdate.fieldName.value = e.name;
top.WCmd.document.fieldUpdate.fieldValue.value = e.value;
top.WCmd.document.fieldUpdate.submit();
//var d = top.WCmd.document;
//alert("field Name "+e.name+" Field Value "+e.value);
d.fieldUpdate.formName.value = e.form.name; //e.document.forms[0].name;
d.fieldUpdate.fieldName.value = e.name;
d.fieldUpdate.fieldValue.value = e.value;
d.fieldUpdate.location.value = path;
d.fieldUpdate.submit();
} // fieldUpdate
/**
@ -34,15 +52,28 @@ function fieldUpdate(e)
*/
function createWCmd()
{
if (!top.WCmd) // no cmd frame
return;
if (!top.WCmd){ // no cmd frame
if (!top.myiframe.WCmd){
return;
}
else{
var d = top.myiframe.WCmd.document;
var path = "top.myiframe.";
}
}
else{
var d = top.WCmd.document;
var path = "top.";
}
// write to the command window.
var d = top.WCmd.document;
d.open();
d.writeln('<form name="fieldUpdate" method="post" action="/adempiere/WFieldUpdate">');
d.writeln('<input type="hidden" name="formName" value="x">');
d.writeln('<input type="hidden" name="fieldName" value="x">');
d.writeln('<input type="hidden" name="fieldValue" value="x">');
d.writeln('<input type="hidden" name="location" value=path>');
d.writeln('</form>');
d.close();
} // createWCmd
@ -166,19 +197,22 @@ function getRealValue (myValue)
/****************************************************************************
* Open PopUp with Attachment Info
*/
function popUp(URL) {
function popUp(URL,name) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=300,left = 212,top = 234');");
eval("page" + id + " = window.open(URL, '" + name + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=300,left = 212,top = 234');");
}
/****************************************************************************
* Start PopUp
*/
function startPopup (targetCmd)
{
var url = targetCmd;
return popUp(url);
return popUp(url,targetCmd);
} // startPopup
/**
/****************************************************************************
* Close PopUp
*/
function closePopup ()
@ -186,15 +220,15 @@ function closePopup ()
parent.document.getElementById("framesetWindow").rows="0,*";
return true; // do submit page
} // closePopUp
/**
/****************************************************************************
* Lookup - get FormName and ColumnName and submit to WLookup
*/
function startLookup (columnName, processid)
{
var url = "WLookup?ColumnName=" + columnName+"&AD_Process_ID="+processid;
return popUp(url);
return popUp(url,columnName);
} // startLookup
/**
/****************************************************************************
* Lookup - get FormName and ColumnName and submit to WLookup
*/
function startZoom (TableID, RecordID)
@ -204,22 +238,22 @@ function startZoom (TableID, RecordID)
return false; // do not submit page
} // startZoom
/**
/****************************************************************************
* Account - get FormName and ColumnName and submit to WAccount
*/
function startAccount (columnName)
{
var url = "WAccount?ColumnName=" + columnName;
return popUp(url);
return popUp(url,columnName);
} // startAccount
/**
/****************************************************************************
* Location - get FormName and ColumnName and submit to WLocation
*/
function startLocation (columnName)
{
var url = "WLocation?ColumnName=" + columnName;
return popUp(url);
return popUp(url,columnName);
} // startLocation
/****************************************************************************
@ -227,6 +261,7 @@ function startLocation (columnName)
*/
function startUpdate (column)
{
//alert(column);
column.form.ChangedColumn.value=column.name;
column.form.submit();
} // startUpdate
@ -238,9 +273,10 @@ function startLookUpdate(column, name1, value1, name2, value2)
{
window.close();
opener.document.getElementById(name2).focus();
opener.document.getElementById(name1).value =value1;
opener.document.getElementById(name2).value =value2;
} // startUpdate
} // startLookUpdate
/****************************************************************************
@ -250,10 +286,36 @@ function startButton (processID, windowID, recordID, tableID, columnName)
{
var url = "WProcess?AD_Process_ID=" + processID + "&AD_Window_ID="+windowID+
"&AD_Record_ID="+recordID+"&AD_Table_ID="+tableID+"&columnName="+columnName;
return popUp(url);
return popUp(url,columnName);
} // startButton
/****************************************************************************
* start Value Preference Button
*/
function startValuePref(displayType, displayData, value, attributedisplay, attribute,
userID, orgID, clientID, windowID)
{
var url = "WValuePreference?DisplayType=" + displayType + "&DisplayValue="+displayData+
"&Value="+value+"&DisplayAtrribute="+attributedisplay+"&Attribute="+attribute+
"&AD_User_ID="+userID+"&AD_Org_ID="+orgID+"&AD_Client_ID="+clientID+"&AD_Window_ID="+windowID;
//alert(url);
return popUp(url,attributedisplay);
} // startValuePref
/****************************************************************************
* Update Value Preference Button
*/
function updateValuePref(action)
{
Form = document.forms[0];
//alert(action);
document.valuepreference.PostAction.value=action;
Form.submit();
} // startValuePref
/****************************************************************************
* Process Toolbar Button
*/
@ -331,7 +393,7 @@ function showCalendar(id, format, showsTime, showsOtherMonths) {
var cal = new Calendar(1, null, selected, closeHandler);
// uncomment the following line to hide the week numbers
// cal.weekNumbers = false;
cal.singleClick = true;
if (typeof showsTime == "string") {
cal.showsTime = true;
cal.time24 = (showsTime == "24");
@ -358,4 +420,132 @@ function showCalendar(id, format, showsTime, showsOtherMonths) {
var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;
var WEEK = 7 * DAY;
/***********************************************
* AnyLink Vertical Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
//Contents for menu 1
var menu1=new Array()
var disappeardelay=200 //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)
/////No further editting needed
var ie4=document.all
var ns6=document.getElementById&&!document.all
if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}
function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what
}
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}
return clickreturnvalue()
}
function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}
function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}
function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}
function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}