Index: win_installer/src/LanguagePack.xml
===================================================================
diff -u -r9d5528c7193c316993ce208ef2838464af0d720a -rb774997180e1f25228b59a70714036cdc22c3ae6
--- win_installer/src/LanguagePack.xml (.../LanguagePack.xml) (revision 9d5528c7193c316993ce208ef2838464af0d720a)
+++ win_installer/src/LanguagePack.xml (.../LanguagePack.xml) (revision b774997180e1f25228b59a70714036cdc22c3ae6)
@@ -10,9 +10,9 @@
url="jdbc:mysql://localhost/${DB_NAME}?characterEncoding=UTF-8"
userid="${DB_USER}"
password="${DB_PASS}"
- encoding="utf8">
-
+ encoding="utf8"
+ >
+
-
\ No newline at end of file
Index: win_installer/src/language-pack.nsi
===================================================================
diff -u -rce901ab7ed1f16ed2995f1bd477d1f8c40a3aa10 -rb774997180e1f25228b59a70714036cdc22c3ae6
--- win_installer/src/language-pack.nsi (.../language-pack.nsi) (revision ce901ab7ed1f16ed2995f1bd477d1f8c40a3aa10)
+++ win_installer/src/language-pack.nsi (.../language-pack.nsi) (revision b774997180e1f25228b59a70714036cdc22c3ae6)
@@ -563,103 +563,25 @@
Exch $R0 ;first
FunctionEnd
+;checks if the languages in the language pack exist
+;inserts rows into lams_supported_locale iff the languages dont exist
Function updateDatabase
- SetOutPath $INSTDIR
- file /a "languages.txt"
-
- Fileopen $R0 "$INSTDIR\languages.txt" r
- Fileread $R0 $R1
- ${while} $R1 != ""
-
- push "-"
- push $R1
- call SplitFirstStrPart
- pop $0
- pop $R1
-
- push "-"
- push $R1
- call SplitFirstStrPart
- pop $1
- pop $R1
-
- push "-"
- push $R1
- call SplitFirstStrPart
- pop $2
- pop $R1
-
- push "-"
- push $R1
- call SplitFirstStrPart
- pop $3
- pop $R1
-
- Fileread $R0 $R1
- strlen $8 R1
- ${if} $8 > 3
- strcpy $3 $3 -2
- ${endif}
-
- strcpy $9 'select count(*) from lams_supported_locale where language_iso_code = \"$0\" and country_iso_code = \"$1\"'
- strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -s -i -B "$DB_NAME" -e "$9"'
- nsExec::ExecToStack $SQL_QUERY
-
- pop $4
- pop $5
- strcpy $5 $5 -2
-
- Detailprint "RESULT: $4"
- Detailprint "OUTPUT: $5"
- Detailprint 'TEXT: $0 - $1 - $2 - $3 '
- Detailprint 'QUERY: $SQL_QUERY'
- ${if} $5 == 0
- Detailprint "INSERTING ROWS!"
- strcpy $9 "insert into lams_supported_locale(language_iso_code, country_iso_code, description, direction) values ($\'$0$\',$\'$1$\',$\'$2$\',$\'$3$\')"
- strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -s -i -B "$DB_NAME" -e "$9"'
- nsExec::ExecToStack $SQL_QUERY
- pop $7
- pop $8
- Detailprint 'QUERY: $SQL_QUERY'
- Detailprint "INSERT RESULT: $7"
- Detailprint "INSERT OUTPUT: $8"
- ${endif}
- ${endwhile}
-
-
- /*
; get the procedure scripts required
setoutpath "$INSTDIR"
- File /a insertlocale.sql
+ File /a updateLocales.sql
File /a LanguagePack.xml
File /r "..\apache-ant-1.6.5"
#File /a "..\apache-ant-1.6.5\bin\ant.bat"
#File /a "..\apache-ant-1.6.5\lib\ant.jar"
-
; update locals must be stored as a procedure first
; nsExec wont let me do "mysql < insertLocale.sql" so i had to use ant
- /*
- detailprint "Attempting to store procedure"
- strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -B $DB_NAME \< "$INSTDIR\sqlscripts\insertLocale.sql"'
- detailprint $SQL_QUERY
- nsExec::ExecToStack $SQL_QUERY
- pop $0
- pop $1
- ${If} $0 == 0
- DetailPrint "Procedure successfully stored in database"
- ${Else}
- DetailPrint "ERROR: DB001 - Unable to store procedure: $1"
- ${EndIf}
- */
-
- /*
; create installer.properties
ClearErrors
FileOpen $0 $TEMP\installer.properties w
IfErrors 0 +2
goto error
-
+
# convert '\' to '/' for Ant's benefit
Push $TEMP
Push "\"
@@ -672,7 +594,6 @@
Call StrSlash
Pop $2
FileWrite $0 "INSTDIR=$2/$\r$\n"
- ;FileWrite $0 "URL=http://$LAMS_DOMAIN:$LAMS_PORT/lams/$\r$\n"
FileWrite $0 "DB_NAME=$DB_NAME$\r$\n"
FileWrite $0 "DB_USER=$DB_USER$\r$\n"
FileWrite $0 "DB_PASS=$DB_PASS$\r$\n"
@@ -682,65 +603,20 @@
Pop $2
FileWrite $0 "EARDIR=$2/jboss-4.0.2/server/default/deploy/lams.ear$\r$\n"
- ; For debugging purposes
copyfiles "$TEMP\installer.properties" $INSTDIR
- SetOutPath $TEMP
+ SetOutPath $INSTDIR
File /a "LanguagePack.xml"
-
-
+
; update locals must be stored as a procedure first
; use ANT to store procedures
DetailPrint '$INSTDIR\apache-ant-1.6.5\bin\ant.bat insertLocale-db'
- nsExec::ExecToStack '$INSTDIR\apache-ant-1.6.5\bin\ant.bat -buildfile $TEMP\LanguagePack.xml execute-sql'
+ nsExec::ExecToStack '$INSTDIR\apache-ant-1.6.5\bin\ant.bat -buildfile $INSTDIR\LanguagePack.xml insertLocale-db'
Pop $0 ; return code, 0=success, error=fail
Pop $1 ; console output
DetailPrint "Database insert status: $0"
DetailPrint "Database insert output: $1"
-
-
- ; execute the procedures
- detailprint "Attempting to execute database procedure"
- strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -s -i -B "$DB_NAME" -e "call updateLocale()"'
- detailprint $SQL_QUERY
- Execwait $SQL_QUERY
- pop $0
- pop $1
- ${If} $0 == 0
- DetailPrint "Procedure successfully exectuted"
- ${Else}
- DetailPrint "ERROR: DB002 - Unable to execute procedure: $1"
- ${EndIf}
-
- ; remove the procedures
- detailprint "Attempting to remove the procedure from the Database"
- strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -s -i -B "$DB_NAME" -e "DROP PROCEDURE IF EXISTS updateLocales"'
- detailprint $SQL_QUERY
- nsExec::ExecToStack $SQL_QUERY
- pop $0
- pop $1
- ${If} $0 == 0
- DetailPrint "Procedure successfully removed from database"
- ${Else}
- DetailPrint "ERROR: DB003 - Unable to remove procedure: $1"
- ${EndIf}
-
- ; remove the procedures
- detailprint "Attempting to remove the procedure from the Database"
- strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -s -i -B "$DB_NAME" -e "DROP PROCEDURE IF EXISTS insertlocale"'
- detailprint $SQL_QUERY
- nsExec::ExecToStack $SQL_QUERY
- pop $0
- pop $1
- ${If} $0 == 0
- DetailPrint "Procedure successfully removed from database"
- ${Else}
- DetailPrint "ERROR: DB003 - Unable to remove procedure: $1"
- ${EndIf}
-
-
-
goto done
error:
DetailPrint "Ant configure-deploy failed."
@@ -749,11 +625,12 @@
done:
; remove the sql scripts
- delete "$INSTDIR\insertlocale.sql"
- delete "LanguagePack.xml"
+ delete "$INSTDIR\updateLocales.sql"
+ delete "$INSTDIR\LanguagePack.xml"
+ delete "$INSTDIR\installer.properties"
rmdir /r $TEMP
rmdir /r "$INSTDIR\apache-ant-1.6.5"
- */
+
FunctionEnd
Index: win_installer/src/updateLocales.sql
===================================================================
diff -u
--- win_installer/src/updateLocales.sql (revision 0)
+++ win_installer/src/updateLocales.sql (revision b774997180e1f25228b59a70714036cdc22c3ae6)
@@ -0,0 +1,47 @@
+-- SQL script for language-pack.sql
+-- checks if the languages in the language pack exist
+-- inserts rows into lams_supported_locale iff the languages dont exist
+
+drop table if exists locale_temp;
+
+create table locale_temp (
+ language_iso_code VARCHAR(2) NOT NULL
+ , country_iso_code VARCHAR(2)
+ , description VARCHAR(255) NOT NULL
+ , direction VARCHAR(3) NOT NULL
+ , combined VARCHAR(5) NOT NULL
+)TYPE=InnoDB;
+
+-- the combined column must be 'language_iso_code,country_iso_code' or 'language_iso_code'. It must match the value
+-- given by SELECT CONCAT_WS(',',l.language_iso_code,l.country_iso_code) FROM lams_supported_locale l
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('en','AU','English (Australia)','LTR','en,AU');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('es','ES','Español','LTR','es,ES');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('mi','NZ','Māori','LTR','mi,NZ');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('de','DE','Deutsch','LTR','de,DE');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('zh','CN','简体中文','LTR','zh,CN');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('fr','FR','Français','LTR','fr,FR');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('it','IT','Italiano','LTR','it,IT');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('no','NO','Norsk','LTR','no,NO');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('sv','SE','Svenska','LTR','sv,SE');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('ko','KR','한국어','LTR','ko,KR');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('pl','PL','Polski','LTR','pl,PL');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('pt','BR','Português (Brasil)','LTR','pt,BR');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('hu','HU','Magyar','LTR','hu,HU');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('bg','BG','Български','LTR','bg,BG');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('cy','GB','Cymraeg (Cymru)','LTR','cy,GB');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('th','TH','Thai','LTR','th,TH');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('el','GR','Ελληνικά','LTR','el,GR');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('nl','BE','Nederlands (België)','LTR','nl,BE');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('ar','JO','عربي','RTL','ar,JO');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('da','DK','Dansk','LTR','da,DK');
+--INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('ru','RU','Русский','LTR','ru,RU');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('vi','VN','Tiếng Việt','LTR','vi,VN');
+INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('zh','TW','Chinese (Taiwan)','LTR','zh,TW');
+
+
+INSERT INTO lams_supported_locale (language_iso_code, country_iso_code, description, direction)
+(SELECT t.language_iso_code, t.country_iso_code, t.description, t.direction
+FROM locale_temp t WHERE t.combined NOT IN
+(SELECT CONCAT_WS(',',l.language_iso_code,l.country_iso_code) FROM lams_supported_locale l));
+
+drop table if exists locale_temp;