Updated readme.txt and and added upgrade script
authorDavid Baz Fayos <david.baz@openbravo.com>
Wed, 07 Mar 2012 12:26:36 +0100
changeset 28 f83f74ab180c
parent 27 5a6d7394de89
child 29 1a62e79f1bcc
Updated readme.txt and and added upgrade script
.hgignore
locations.template
readme.txt
upgrade.sh
web/org.openbravo.userinterface.smartclient/isomorphic/copyright.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Wed Mar 07 12:26:36 2012 +0100
@@ -0,0 +1,3 @@
+syntax: glob
+
+locations
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locations.template	Wed Mar 07 12:26:36 2012 +0100
@@ -0,0 +1,23 @@
+#
+# *************************************************************************
+# * 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) 2012 Openbravo SLU 
+# * All Rights Reserved. 
+# * Contributor(s):  ______________________________________.
+# ************************************************************************
+#
+
+sc.source.zip=http://www.smartclient.com/builds/SmartClient/8.x/LGPL/2011-11-04/SmartClient_SC_SNAPSHOT-2011-11-04_LGPL.zip
+org.openbravo.userinterface.smartclient=../org.openbravo.userinterface.smartclient
+
+#EOF
\ No newline at end of file
--- a/readme.txt	Mon Mar 05 20:45:16 2012 +0100
+++ b/readme.txt	Wed Mar 07 12:26:36 2012 +0100
@@ -1,77 +1,46 @@
-This README describes how to install a new smartclient version into the system. 
+This README describes how to install a new smartclient version into the system.
 
-Start by downloading smartclient from here:
-http://www.smartclient.com/builds/SmartClient/8.x/LGPL
+All processes here described can be automatically done using upgrade.sh script.
+Depending on many factors (SO, installed software, ...) it could not work, so use it at your own risk.
 
-after downloading unzip/untar you will see 2 subfolders in the created folder:
+
+STEP A: Upgrade this module (org.openbravo.userinterface.smartclient.dev)
+
+1) Download new sources
+Go here:
+http://www.smartclient.com/builds/SmartClient/
+And then inside the desired version, then inside the LGPL directory and finally the desired nightly build revision
+Download the zip file
+
+After downloading unzip/untar the file and you will see 2 subfolders in the created folder:
 smartclientRuntime
 smartclientSDK
 
-the first will be used to get the runtime javascript from (to build the ISC_Combined.js file).
+the first one (smartclientRuntime) will be used to get the runtime javascript from (to build the ISC_Combined.js file).
 
-1) copy the following files/directories to the org.openbravo.userinterface.smartclient.dev module
+2) Copy/Move the following files/directories to the org.openbravo.userinterface.smartclient.dev module
+smartclientRuntime/isomorphic --> web/org.openbravo.userinterface.smartclient/isomorphic (note see remove not-needed skins step below)
+smartclientSDK/source/client --> web/org.openbravo.userinterface.smartclient/isomorphic
+smartclientSDK/source/copyright.txt --> web/org.openbravo.userinterface.smartclient/isomorphic
+smartclientSDK/isomorphic/system/reference --> web/org.openbravo.userinterface.smartclient/isomorphic/system/reference
 smartclientSDK/docs --> docs
-smartclientSDK/source/client --> web/org.openbravo.userinterface.smartclient/isomorphic/client
-smartclientSDK/source/copyright.txt --> sources
-smartclientRuntime/isomorphic --> web/org.openbravo.userinterface.smartclient/isomorphic (note see remove not-needed skins step below)
-smartclientSDK/isomorphic/system/reference --> web/org.openbravo.userinterface.smartclient/isomorphic/system/reference
 smartclientSDK/tools/selenium --> selenium
 
-2) the copy of the isomorphic directory will also copy many not needed skins, 
-remove all skins directories except for the following ones (from isomorphic/skins):
+3) Remove unneeded skins except:
 -Enterprise
 -Smartclient
 -Standard
+from web/org.openbravo.userinterface.smartclient/isomorphic/skins
 
-3) build the combined and history file and copies to the org.openbravo.userinterface.smartclient module:
-go into the org.openbravo.userinterface.smartclient.dev in
-a console and execute: ant
-A new ISC_Combined.js will be created, and it (and the ISC_History.js) are copied to the 
-org.openbravo.userinterface.smartclient module.
+4) Prevent build errors:
+The SmartClient reference contains java examples which our build system will try to compile (with errors of course),
+therefore remove not needed java files by removing the following directories
+web/org.openbravo.userinterface.smartclient/isomorphic/system/reference/inlineExamples/serverExamples
+web/org.openbravo.userinterface.smartclient/isomorphic/system/reference/inlineExamples/dataIntegration
 
->>>> NOTE: using Smartclient Sources <<<<<<
-If you want to have the Smartclient source code at runtime then instead execute
-the following ant task:
-ant source
-
-This will build and collect the source files and copy them to the output directory.
-
-4) copy ISC_History.js to web/org.openbravo.userinterface.smartclient/isomorphic,
-the ISC_History.js can be found in 
-org.openbravo.userinterface.smartclient.dev/isomorphic/system/modules
-
-5) copy the Enterprise skin to our skin directory:
-org.openbravo.userinterface.smartclient.dev/isomorphic/skins/Enterprise --> 
-org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/smartclient
-
-Remove the .js.gz files and make the following changes to the load_skin.js (don't forget 
-the step B below):
-A) changes in the top (note see that loadStylesheets is commented out):
-   // must be relative to your application file or isomorphicDir
- //   isc.Page.setSkinDir("[ISOMORPHIC]/skins/Enterprise/")
-  isc.Page.setSkinDir("[ISOMORPHIC]/../openbravo/skins/Default/smartclient/");  
-
-
-//----------------------------------------
-// Load skin style sheet(s)
-//----------------------------------------
-  //  isc.Page.loadStyleSheet("[SKIN]/skin_styles.css", theWindow)
-
-B) add a ; at the end to:
-isc.loadSkin();
-
-(needs to be reported to isomorphic).
-
-6) Prevent build errors, the smartclient reference contains java examples which our build 
-system will try to compile (with errors ofcourse), therefore remove not needed java files
-remove the following directories from org.openbravo.userinterface.smartclient.dev:
-isomorphic/system/reference/inlineExamples/serverExamples
-isomorphic/system/reference/inlineExamples/dataIntegration
-
-7) prevent 404 in source mode, to this source file:
-web/org.openbravo.userinterface.smartclient/isomorphic/client/modules/ISC_DataBinding.js
-
-and comment out the lines which load the ds.xml files:
+5) Prevent 404 error in source mode
+Inside web/org.openbravo.userinterface.smartclient/isomorphic/client/modules/ISC_DataBinding.js
+comment out the lines which load the ds.xml files:
 //        "schema/DataSource.ds.xml",
 //        "schema/DataSourceField.ds.xml",
 //        "schema/Validator.ds.xml",
@@ -84,4 +53,59 @@
 //        "schema/WebServiceOperation.ds.xml",
 //        "schema/WSOperationHeader.ds.xml",
 
+
+STEP B: Upgrade Openbravo org.openbravo.userinterface.smartclient module
+
+1) Create a combined file with name ISC_Combined.js with these files:
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_Core.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_Foundation.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_Containers.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_Grids.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_Forms.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_DataBinding.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_Calendar.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_PluginBridges.js
+web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_RichTextEditor.js
+You can use the following ant task to generate it: ant combine
+
+2) Copy ISC_Combined.js to modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/isomorphic
+ISC_Combined.js can be found in org.openbravo.userinterface.smartclient.dev/
+
+3) Copy ISC_History.js to modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/isomorphic
+ISC_History.js can be found in org.openbravo.userinterface.smartclient.dev/web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/
+
+Note: If you already have this module (org.openbravo.userinterface.smartclient.dev) inside your Openbravo modules folder
+you can use the following command to generate ISC_Combined.js and copy it and ISC_History.js to its target path: ant
+
+4) Copy the Enterprise skin to our skin directory:
+org.openbravo.userinterface.smartclient.dev/isomorphic/skins/Enterprise --> 
+modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient
+
+5) Remove the .js.gz files of
+modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient/Enterprise
+
+6) Make the following changes to 
+modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient/Enterprise/load_skin.js
+6.1) changes in the top (note see that loadStylesheets is commented out):
+   // must be relative to your application file or isomorphicDir
+ //   isc.Page.setSkinDir("[ISOMORPHIC]/skins/Enterprise/")
+  isc.Page.setSkinDir("[ISOMORPHIC]/../openbravo/skins/Default/smartclient/");  
+
+
+//----------------------------------------
+// Load skin style sheet(s)
+//----------------------------------------
+  //  isc.Page.loadStyleSheet("[SKIN]/skin_styles.css", theWindow)
+
+6.2) add a ; at the end to:
+isc.loadSkin();
+
+(needs to be reported to isomorphic).
+
+
 Now build Openbravo.
+
+
+Final considerations: If you want to have the Smartclient source code at runtime execute
+the following ant task: ant source
+For more details, please read: http://wiki.openbravo.com/wiki/Client_Side_Development_and_API#Using_non-obfuscated_Smartclient_code
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upgrade.sh	Wed Mar 07 12:26:36 2012 +0100
@@ -0,0 +1,190 @@
+#!/bin/sh
+
+#
+# *************************************************************************
+# * 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) 2012 Openbravo SLU 
+# * All Rights Reserved. 
+# * Contributor(s):  ______________________________________.
+# ************************************************************************
+#
+
+clear
+
+if [ ! -f locations ]; then
+  cp locations.template locations
+fi
+
+while read myline
+do
+  if [ `expr "$myline" : "^sc\.source\.zip"` = "13" ]; then
+    srcPath=$(echo $myline | sed 's,^sc\.source\.zip\=,,')
+  elif [ `expr "$myline" : "^org\.openbravo\.userinterface\.smartclient"` = "39" ]; then
+    obScModuleDir=$(echo $myline | sed 's,^org\.openbravo\.userinterface\.smartclient\=,,')
+  fi
+done < locations
+
+firstParam="0"
+if [ $1 ]; then
+  firstParam=$1
+  if [ $firstParam = "this" ] && [ $2 ]; then
+    srcPath=$2
+  elif [ $firstParam = "pi" ] && [ $2 ]; then
+    obScModuleDir=$2
+  fi
+fi
+
+#STEP A
+if [ $firstParam = "this" ]; then
+
+  #1)
+  srcFile=$(echo $srcPath | sed 's,.*/,,')
+  srcDir=$(echo $srcFile | sed 's,_LGPL.zip$,,')
+  currentDir=$PWD
+
+  if [ `expr "$srcPath" : ".*http"` = "4" ] || [ `expr "$srcPath" : ".*ftp"` = "3" ]; then
+    wget $srcPath
+  else
+    cp $srcPath .
+  fi
+
+  if [ -f "$srcFile" ]; then
+    unzip -o $srcFile
+    rm -rf $srcFile
+
+    if [ -d "$srcDir" ]; then
+
+      #2)
+      isomorphicDir=web/org.openbravo.userinterface.smartclient/isomorphic
+      rm -rf $isomorphicDir
+      mv $srcDir/smartclientRuntime/isomorphic $isomorphicDir
+      rm -rf docs
+      mv $srcDir/smartclientSDK/docs .
+      mv $srcDir/smartclientSDK/source/client $isomorphicDir
+      mv $srcDir/smartclientSDK/source/copyright.txt $isomorphicDir
+      mv $srcDir/smartclientSDK/isomorphic/system/reference $isomorphicDir/system/reference
+      rm -rf selenium
+      mv $srcDir/smartclientSDK/tools/selenium selenium
+
+      #3)
+      cd $isomorphicDir/skins
+      rm -rf $(ls | grep -v Enterprise$ | grep -v SmartClient$ | grep -v standard$)
+      cd $currentDir
+
+      #4)
+      rm -rf $isomorphicDir/system/reference/inlineExamples/serverExamples
+      rm -rf $isomorphicDir/system/reference/inlineExamples/dataIntegration
+
+      #5)
+      sed 's/.*ds.xml.*/\/\/&/' $isomorphicDir/client/modules/ISC_DataBinding.js > $isomorphicDir/client/modules/ISC_DataBinding.js2
+      rm -rf $isomorphicDir/client/modules/ISC_DataBinding.js
+      mv $isomorphicDir/client/modules/ISC_DataBinding.js2 $isomorphicDir/client/modules/ISC_DataBinding.js
+
+      #We are finish, just change permissions and remove the remaining not used content in the unziped SmartClient_*** folder
+      rm -rf $srcDir
+      find . -type f | grep -v '\.hg' | sed 's/ /\\ /g' | xargs chmod a-x
+      chmod a+x upgrade.sh
+
+
+    else
+      echo "\033[41m-------------------------------------------------------------------\033[0m"
+      echo "\033[1;41mERROR:\033[0m $srcFile was expected to be unziped to $srcDir, but it isn't \033[0m"
+      echo "\033[41m-------------------------------------------------------------------\033[0m"
+      echo ""
+    fi
+
+  else
+    echo "\033[41m-------------------------------------------------------------------\033[0m"
+    echo "\033[1;41mERROR:\033[0m Can not get file $srcPath \033[0m"
+    echo "\033[41m-------------------------------------------------------------------\033[0m"
+    echo ""
+  fi
+
+#STEP B
+elif [ $firstParam = "obmodule" ]; then
+  obScModuleDir=$(echo $obScModuleDir | sed 's,/$,,')
+
+  if [ -d "$obScModuleDir" ]; then
+
+    #1)
+    ant combine
+
+    #2)
+    cp ISC_Combined.js $obScModuleDir/web/org.openbravo.userinterface.smartclient/isomorphic
+
+    #3)
+    cp web/org.openbravo.userinterface.smartclient/isomorphic/system/modules/ISC_History.js $obScModuleDir/web/org.openbravo.userinterface.smartclient/isomorphic
+
+    #4)
+    rm -rf $obScModuleDir/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient
+
+    #5)
+    cp -r web/org.openbravo.userinterface.smartclient/isomorphic/skins/Enterprise $obScModuleDir/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient
+    find $obScModuleDir/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient -type f -name "*.gz" -exec rm -rf {} \;
+
+    #6.1)
+    tmp_fileNameA=$obScModuleDir/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient/load_skin.js
+    tmp_fileNameB=$obScModuleDir/web/org.openbravo.userinterface.smartclient/openbravo/skins/Default/smartclient/load_skin.js2
+    sed 's/isc\.Page\.setSkinDir/\/\/ isc.Page.setSkinDir/' $tmp_fileNameA > $tmp_fileNameB
+    rm -rf $tmp_fileNameA
+    mv $tmp_fileNameB $tmp_fileNameA
+    sed 's/isc\.Page\.loadStyleSheet/\/\/ isc.Page.loadStyleSheet/' $tmp_fileNameA > $tmp_fileNameB
+    rm -rf $tmp_fileNameA
+    mv $tmp_fileNameB $tmp_fileNameA
+
+    tmp_lineNo=$(awk '/isc.Page.setSkinDir/ {print NR}' $tmp_fileNameA)
+    tmp_newLineNo=$(($tmp_lineNo+1))
+    sed ''$tmp_newLineNo'i\ \ \ \ isc.Page.setSkinDir("[ISOMORPHIC]/../openbravo/skins/Default/smartclient/");' $tmp_fileNameA > $tmp_fileNameB
+    rm -rf $tmp_fileNameA
+    mv $tmp_fileNameB $tmp_fileNameA
+
+    #6.2)
+    sed 's/isc\.loadSkin()/isc.loadSkin();/' $tmp_fileNameA > $tmp_fileNameB
+    rm -rf $tmp_fileNameA
+    mv $tmp_fileNameB $tmp_fileNameA
+    sed 's/isc\.loadSkin();;/isc.loadSkin();/' $tmp_fileNameA > $tmp_fileNameB
+    rm -rf $tmp_fileNameA
+    mv $tmp_fileNameB $tmp_fileNameA
+
+    rm -rf ISC_Combined.js
+
+  else
+    echo "\033[41m-------------------------------------------------------------------\033[0m"
+    echo "\033[1;41mERROR:\033[0m Target directory doesn't exist: $obScModuleDir \033[0m"
+    echo "\033[41m-------------------------------------------------------------------\033[0m"
+    echo ""
+  fi
+
+else
+
+    echo "\033[1;32m-------------------------------------------------------------------\033[0m"
+    echo "\033[1;30mThis is an unsupported tool for automatic upgrade this module and"
+    echo "\033[1;01morg.openbravo.userinterface.smartclient. Use it at your own risk."
+    echo "\033[1;32m-------------------------------------------------------------------\033[0m"
+    echo "\033[1;01mYou must pass at least one argument"
+    echo "\033[1;32m-------------------------------------------------------------------\033[0m"
+    echo ""
+    echo "  sh upgrade.sh this            <-- it upgrades this module"
+    echo "                                    with this file $srcPath"
+    echo ""
+    echo "  sh upgrade.sh this <file>     <-- it upgrades this module"
+    echo "                                    with the <file> given as second argument"
+    echo ""
+    echo "  sh upgrade.sh obmodule        <-- it upgrades org.openbravo.userinterface.smartclient module"
+    echo "                                    placed at $obScModuleDir"
+    echo ""
+    echo "  sh upgrade.sh obmodule <dir>  <-- it upgrades org.openbravo.userinterface.smartclient module"
+    echo "                                    placed at the <dir> path given as second argument"
+    echo ""
+
+fi
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/org.openbravo.userinterface.smartclient/isomorphic/copyright.txt	Wed Mar 07 12:26:36 2012 +0100
@@ -0,0 +1,10 @@
+/*
+ * Isomorphic SmartClient
+ * Version SC_SNAPSHOT-2011-11-04 (2011-11-04)
+ * Copyright(c) 1998 and beyond Isomorphic Software, Inc. All rights reserved.
+ * "SmartClient" is a trademark of Isomorphic Software, Inc.
+ *
+ * licensing@smartclient.com
+ *
+ * http://smartclient.com/license
+ */