details: /erp/devel/pi/rev/074e7f4053db changeset: 9367:074e7f4053db user: Gorka Ion Damián <gorkaion.damian <at> openbravo.com> date: Thu Dec 23 17:47:55 2010 +0100 summary: [OBCQL] Remove unneeded returns on initWidget functions.
details: /erp/devel/pi/rev/30567d64dc85 changeset: 9368:30567d64dc85 user: Gorka Ion Damián <gorkaion.damian <at> openbravo.com> date: Thu Dec 23 17:48:25 2010 +0100 summary: [OBCQL] Format date to standard xml schema format. details: /erp/devel/pi/rev/021c26128b24 changeset: 9369:021c26128b24 user: Gorka Ion Damián <gorkaion.damian <at> openbravo.com> date: Thu Dec 23 18:11:36 2010 +0100 summary: [OBCQL] Remove unused ActionHandler. details: /erp/devel/pi/rev/8168f7cc966b changeset: 9370:8168f7cc966b user: Gorka Ion Damián <gorkaion.damian <at> openbravo.com> date: Thu Dec 23 18:12:01 2010 +0100 summary: [OBCQL] Set IsMandatory flag on Client parameter of TabList. diffstat: modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml | 2 +- modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListActionHandler.java | 60 ---------- modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java | 16 ++- modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js | 18 +-- 4 files changed, 17 insertions(+), 79 deletions(-) diffs (166 lines): diff -r 4c920481c95f -r 8168f7cc966b modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml --- a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml Thu Dec 23 17:50:53 2010 +0100 +++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml Thu Dec 23 18:12:01 2010 +0100 @@ -260,7 +260,7 @@ <!--AAF45F634C164AF2AED1B57FAF0CF124--> <COLUMNNAME><![CDATA[client]]></COLUMNNAME> <!--AAF45F634C164AF2AED1B57FAF0CF124--> <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED> <!--AAF45F634C164AF2AED1B57FAF0CF124--> <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH> -<!--AAF45F634C164AF2AED1B57FAF0CF124--> <ISMANDATORY><![CDATA[N]]></ISMANDATORY> +<!--AAF45F634C164AF2AED1B57FAF0CF124--> <ISMANDATORY><![CDATA[Y]]></ISMANDATORY> <!--AAF45F634C164AF2AED1B57FAF0CF124--> <ISFIXED><![CDATA[Y]]></ISFIXED> <!--AAF45F634C164AF2AED1B57FAF0CF124--> <FIXEDVALUE><![CDATA[OB.getContext().getCurrentClient().id]]></FIXEDVALUE> <!--AAF45F634C164AF2AED1B57FAF0CF124--> <EVALUATEFIXEDVALUE><![CDATA[Y]]></EVALUATEFIXEDVALUE> diff -r 4c920481c95f -r 8168f7cc966b modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListActionHandler.java --- a/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListActionHandler.java Thu Dec 23 17:50:53 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - ************************************************************************* - * The contents of this file are subject to the Openbravo Public License - * Version 1.1 (the "License"), being the Mozilla Public License - * Version 1.1 with a permitted attribution clause; you may not use this - * file except in compliance with the License. You may obtain a copy of - * the License at http://www.openbravo.com/legal/license.html - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * The Original Code is Openbravo ERP. - * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010 Openbravo SLU - * All Rights Reserved. - * Contributor(s): ______________________________________. - ************************************************************************ - */ -package org.openbravo.client.querylist; - -import java.util.Map; - -import org.apache.log4j.Logger; -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; -import org.openbravo.client.kernel.BaseActionHandler; -import org.openbravo.client.myob.WidgetClass; -import org.openbravo.client.querylist.QueryListUtils.IncludeIn; -import org.openbravo.dal.core.OBContext; -import org.openbravo.dal.service.OBDal; - -public class QueryListActionHandler extends BaseActionHandler { - private static final Logger log = Logger.getLogger(QueryListActionHandler.class); - private static final String GET_FIELDS = "GET_FIELDS"; - - @Override - protected JSONObject execute(Map<String, Object> parameters, String content) { - OBContext.setAdminMode(); - try { - // Retrieve content values - JSONObject o = new JSONObject(content); - final String strEventType = o.getString("eventType"); - final String strViewMode = o.getString("viewMode"); - final String strWidgetClass = o.getString("widgetId"); - WidgetClass widgetClass = OBDal.getInstance().get(WidgetClass.class, strWidgetClass); - log.debug("=== New action, eventType: " + strEventType + " ==="); - - if (GET_FIELDS.equals(strEventType)) { - IncludeIn includeIn = IncludeIn.getIncludeIn(strViewMode); - o.put("fields", QueryListUtils.getWidgetClassFields(widgetClass, includeIn)); - } - return o; - } catch (JSONException e) { - log.error("Error executing action: " + e.getMessage(), e); - } finally { - OBContext.restorePreviousMode(); - } - return new JSONObject(); - } -} diff -r 4c920481c95f -r 8168f7cc966b modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java --- a/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java Thu Dec 23 17:50:53 2010 +0100 +++ b/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java Thu Dec 23 18:12:01 2010 +0100 @@ -18,7 +18,10 @@ */ package org.openbravo.client.querylist; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,6 +35,7 @@ import org.openbravo.dal.core.OBContext; import org.openbravo.dal.service.OBDal; import org.openbravo.service.datasource.ReadOnlyDataSourceService; +import org.openbravo.service.json.JsonUtils; /** * Reads the tabs which the user is allowed to see. @@ -40,6 +44,9 @@ */ public class QueryListDataSource extends ReadOnlyDataSourceService { + private final SimpleDateFormat xmlDateFormat = JsonUtils.createDateFormat(); + private final SimpleDateFormat xmlDateTimeFormat = JsonUtils.createDateTimeFormat(); + /** * Returns the count of objects based on the passed parameters. * @@ -115,7 +122,14 @@ for (int i = 0; i < queryAliases.length; i++) { if (queryAliases[i].equals(column.getDisplayExpression()) || (!isExport && queryAliases[i].equals(column.getLinkExpression()))) { - data.put(queryAliases[i], resultList[i]); + Object value = resultList[i]; + if (value instanceof Date) { + value = xmlDateFormat.format(value); + } + if (value instanceof Timestamp) { + value = xmlDateTimeFormat.format(value); + } + data.put(queryAliases[i], value); } } } diff -r 4c920481c95f -r 8168f7cc966b modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js --- a/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js Thu Dec 23 17:50:53 2010 +0100 +++ b/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js Thu Dec 23 18:12:01 2010 +0100 @@ -44,8 +44,6 @@ this.setHeight(headerHeight + newGridHeight + 13); //this.body.setHeight(newBodyHeight); - - return this; }, createWindowContents: function(){ @@ -65,20 +63,6 @@ }, refresh: function(){ - var post = { - 'ID': this.ID, - 'widgetId': this.widgetId, - 'eventType': 'GET_FIELDS', - 'viewMode': this.viewMode - }; - var clientContext = {widget: this}; - - OB.RemoteCallManager.call(this.actionHandler, post, {}, function(rpcResponse, data, rpcRequest){ - rpcResponse.clientContext.widget.reloadGrid(rpcResponse, data, rpcRequest); - }, clientContext); - }, - - reloadGrid: function(rpcResponse, data, rpcRequest) { this.grid.invalidateCache(); this.grid.filterData(); }, @@ -127,7 +111,7 @@ initWidget: function(){ OB.Datasource.get('DD17275427E94026AD721067C3C91C18', this); - return this.Super('initWidget', arguments); + this.Super('initWidget', arguments); }, setDataSource: function(ds){ ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits