details: /erp/devel/pi/rev/ebc52736f3de
changeset: 12353:ebc52736f3de
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Mon May 23 15:18:12 2011 +0200
summary: [upgr] When upgrading, use 250to300 skin if the one in use was 2.50
Default one
details: /erp/devel/pi/rev/ebb0601149a4
changeset: 12354:ebb0601149a4
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Mon May 23 16:14:30 2011 +0200
summary: fixed bug 17313: Process message is shown in the tab that defines it
in case child tab is maximized both are set to 50%.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
| 14 +-
modules/org.openbravo.userinterface.skin.250to300Comp/build/classes/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin.class
| 0
modules/org.openbravo.userinterface.skin.250to300Comp/build/classes/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkinData.class
| 0
modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin.java
| 46 +++
modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin_data.xsql
| 47 +++
modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkinData.java
| 131 ++++++++++
6 files changed, 234 insertions(+), 4 deletions(-)
diffs (268 lines):
diff -r edcf5bb01beb -r ebb0601149a4
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
Mon May 23 16:09:00 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-action-button.js
Mon May 23 16:14:30 2011 +0200
@@ -93,14 +93,20 @@
var contextView = OB.ActionButton.executingProcess.contextView,
currentView = this.view,
afterRefresh = function(){
- // Refresh current view, taking the message set in the process'
context view
- currentView.getTabMessage(contextView.tabId);
+ // Refresh context view
+ contextView.getTabMessage();
currentView.toolBar.refreshCustomButtons();
-
+
+ if (contextView !== currentView && currentView.state ===
isc.OBStandardView.STATE_TOP_MAX) {
+ // Executing an action defined in parent tab, current tab is
maximized,
+ // let's set half for each in order to see the message
+ contextView.setHalfSplit();
+ }
+
// Refresh in order to show possible new records
currentView.refresh();
};
-
+
if (currentView.viewGrid.getSelectedRecord()) {
// There is a record selected, refresh it and its parent
currentView.refreshCurrentRecord(afterRefresh);
diff -r edcf5bb01beb -r ebb0601149a4
modules/org.openbravo.userinterface.skin.250to300Comp/build/classes/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin.class
Binary file
modules/org.openbravo.userinterface.skin.250to300Comp/build/classes/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin.class
has changed
diff -r edcf5bb01beb -r ebb0601149a4
modules/org.openbravo.userinterface.skin.250to300Comp/build/classes/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkinData.class
Binary file
modules/org.openbravo.userinterface.skin.250to300Comp/build/classes/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkinData.class
has changed
diff -r edcf5bb01beb -r ebb0601149a4
modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++
b/modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin.java
Mon May 23 16:14:30 2011 +0200
@@ -0,0 +1,46 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.0 (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) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ *************************************************************************
+ */
+package org.openbravo.userinterface.skin.s250to300Comp.modulescript;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.modulescript.ModuleScript;
+
+public class DefaultSkin extends ModuleScript {
+
+ @Override
+ public void execute() {
+ try {
+ ConnectionProvider cp = getConnectionProvider();
+
+ // Change skin to this one in case of installing (not updating) and the
+ // used skin is 'Default' one.
+
+ if (!DefaultSkinData.isUpdating(cp)){
+ String currentSkin = DefaultSkinData.selectCurrentSkin(cp);
+ if ("Default".equals(currentSkin)){
+ DefaultSkinData.setSkin(cp,
"org.openbravo.userinterface.skin.250to300Comp/250to300Comp");
+ }
+ }
+ } catch (Exception e) {
+ handleError(e);
+ }
+ }
+}
diff -r edcf5bb01beb -r ebb0601149a4
modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin_data.xsql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++
b/modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkin_data.xsql
Mon May 23 16:14:30 2011 +0200
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.0 (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) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ *************************************************************************
+-->
+<SqlClass name="DefaultSkinData"
package="org.openbravo.userinterface.skin.s250to300Comp.modulescript">
+ <SqlMethod name="isUpdating" type="preparedStatement" return="boolean">
+ <Sql>
+ <![CDATA[
+ select count(*) as t
+ from ad_module_dependency
+ where ad_module_id = '96998CBC42744B3DBEE28AC8095C9335'
+ ]]>
+ </Sql>
+ </SqlMethod>
+
+ <SqlMethod name="selectCurrentSkin" type="preparedStatement" return="string">
+ <Sql><![CDATA[
+ SELECT tad_theme as t
+ FROM AD_system
+ ]]>
+ </Sql>
+ </SqlMethod>
+
+ <SqlMethod name="setSkin" type="preparedStatement" return="rowcount">
+ <Sql><![CDATA[
+ update ad_system
+ set tad_thme = ?
+ ]]></Sql>
+ <Parameter name="skin"/>
+ </SqlMethod>
+
+</SqlClass>
diff -r edcf5bb01beb -r ebb0601149a4
modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkinData.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++
b/modules/org.openbravo.userinterface.skin.250to300Comp/src-util/modulescript/src/src/org/openbravo/userinterface/skin/s250to300Comp/modulescript/DefaultSkinData.java
Mon May 23 16:14:30 2011 +0200
@@ -0,0 +1,131 @@
+//Sqlc generated V1.O00-1
+package org.openbravo.userinterface.skin.s250to300Comp.modulescript;
+
+import java.sql.*;
+
+import org.apache.log4j.Logger;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.data.FieldProvider;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.data.UtilSql;
+
+class DefaultSkinData implements FieldProvider {
+static Logger log4j = Logger.getLogger(DefaultSkinData.class);
+ private String InitRecordNumber="0";
+ public String t;
+
+ public String getInitRecordNumber() {
+ return InitRecordNumber;
+ }
+
+ public String getField(String fieldName) {
+ if (fieldName.equalsIgnoreCase("T"))
+ return t;
+ else {
+ log4j.debug("Field does not exist: " + fieldName);
+ return null;
+ }
+ }
+
+ public static boolean isUpdating(ConnectionProvider connectionProvider)
throws ServletException {
+ String strSql = "";
+ strSql = strSql +
+ " select count(*) as t" +
+ " from ad_module_dependency" +
+ " where ad_module_id = '96998CBC42744B3DBEE28AC8095C9335'";
+
+ ResultSet result;
+ boolean boolReturn = false;
+ PreparedStatement st = null;
+
+ try {
+ st = connectionProvider.getPreparedStatement(strSql);
+
+ result = st.executeQuery();
+ if(result.next()) {
+ boolReturn = !UtilSql.getValue(result, "T").equals("0");
+ }
+ result.close();
+ } catch(SQLException e){
+ log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
+ throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode())
+ "@" + e.getMessage());
+ } catch(Exception ex){
+ log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
+ throw new ServletException("@CODE=@" + ex.getMessage());
+ } finally {
+ try {
+ connectionProvider.releasePreparedStatement(st);
+ } catch(Exception ignore){
+ ignore.printStackTrace();
+ }
+ }
+ return(boolReturn);
+ }
+
+ public static String selectCurrentSkin(ConnectionProvider
connectionProvider) throws ServletException {
+ String strSql = "";
+ strSql = strSql +
+ " SELECT tad_theme as t" +
+ " FROM AD_system";
+
+ ResultSet result;
+ String strReturn = null;
+ PreparedStatement st = null;
+
+ try {
+ st = connectionProvider.getPreparedStatement(strSql);
+
+ result = st.executeQuery();
+ if(result.next()) {
+ strReturn = UtilSql.getValue(result, "T");
+ }
+ result.close();
+ } catch(SQLException e){
+ log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
+ throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode())
+ "@" + e.getMessage());
+ } catch(Exception ex){
+ log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
+ throw new ServletException("@CODE=@" + ex.getMessage());
+ } finally {
+ try {
+ connectionProvider.releasePreparedStatement(st);
+ } catch(Exception ignore){
+ ignore.printStackTrace();
+ }
+ }
+ return(strReturn);
+ }
+
+ public static int setSkin(ConnectionProvider connectionProvider, String
skin) throws ServletException {
+ String strSql = "";
+ strSql = strSql +
+ " update ad_system " +
+ " set tad_thme = ?";
+
+ int updateCount = 0;
+ PreparedStatement st = null;
+
+ int iParameter = 0;
+ try {
+ st = connectionProvider.getPreparedStatement(strSql);
+ iParameter++; UtilSql.setValue(st, iParameter, 12, null, skin);
+
+ updateCount = st.executeUpdate();
+ } catch(SQLException e){
+ log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
+ throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode())
+ "@" + e.getMessage());
+ } catch(Exception ex){
+ log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
+ throw new ServletException("@CODE=@" + ex.getMessage());
+ } finally {
+ try {
+ connectionProvider.releasePreparedStatement(st);
+ } catch(Exception ignore){
+ ignore.printStackTrace();
+ }
+ }
+ return(updateCount);
+ }
+}
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its
next-generation tools to help Windows* and Linux* C/C++ and Fortran
developers boost performance applications - including clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits