Index: win_installer/Language-Pack-BUILD.txt =================================================================== diff -u --- win_installer/Language-Pack-BUILD.txt (revision 0) +++ win_installer/Language-Pack-BUILD.txt (revision 9d6fcf6e3965c390f8c55f79623a33fb673a4906) @@ -0,0 +1,17 @@ +BUILDING language-pack.nsi +-------------------------- + +- Builds to win_installer\build + +1) Make sure you have all the latest language files in your lams workspace, you + can do this by simply synchronising with the CVS repository +2) Put the date that you want for the install at this line (around line 35): + !define VERSION "2006-20-12" (example) + Make sure it is in the form "yyyy-mm-dd" +3) In updateLocales.sql, you must alter it to insert the required rows in the + database. Update updateLocales.sql, so that every language to be supported by + the current version is in the list + An example line is below: + INSERT INTO locale_temp (language_iso_code, country_iso_code, description, direction, combined) VALUES ('pt','BR','Portugu�s (Brasil)','LTR','pt,BR'); +4) Compile language-pack.nsi +5) Run win_installer\build\LAMSLanguagePack-[DATE] \ No newline at end of file Index: win_installer/src/Functions.nsh =================================================================== diff -u -r1c44bb49957cacc6ab070a0e27f7e26bb726e66f -r9d6fcf6e3965c390f8c55f79623a33fb673a4906 --- win_installer/src/Functions.nsh (.../Functions.nsh) (revision 1c44bb49957cacc6ab070a0e27f7e26bb726e66f) +++ win_installer/src/Functions.nsh (.../Functions.nsh) (revision 9d6fcf6e3965c390f8c55f79623a33fb673a4906) @@ -200,3 +200,154 @@ Pop $1 Exch $0 FunctionEnd + +!define StrTok "!insertmacro StrTok" + +!macro StrTok ResultVar String Separators ResultPart SkipEmptyParts + Push "${String}" + Push "${Separators}" + Push "${ResultPart}" + Push "${SkipEmptyParts}" + Call StrTok + Pop "${ResultVar}" +!macroend + +Function StrTok +/*After this point: + ------------------------------------------ + $0 = SkipEmptyParts (input) + $1 = ResultPart (input) + $2 = Separators (input) + $3 = String (input) + $4 = SeparatorsLen (temp) + $5 = StrLen (temp) + $6 = StartCharPos (temp) + $7 = TempStr (temp) + $8 = CurrentLoop + $9 = CurrentSepChar + $R0 = CurrentSepCharNum + */ + + ;Get input from user + Exch $0 + Exch + Exch $1 + Exch + Exch 2 + Exch $2 + Exch 2 + Exch 3 + Exch $3 + Exch 3 + Push $4 + Push $5 + Push $6 + Push $7 + Push $8 + Push $9 + Push $R0 + + ;Parameter defaults + ${IfThen} $2 == `` ${|} StrCpy $2 `|` ${|} + ${IfThen} $1 == `` ${|} StrCpy $1 `L` ${|} + ${IfThen} $0 == `` ${|} StrCpy $0 `0` ${|} + + ;Get "String" and "Separators" length + StrLen $4 $2 + StrLen $5 $3 + ;Start "StartCharPos" and "ResultPart" counters + StrCpy $6 0 + StrCpy $8 -1 + + ;Loop until "ResultPart" is met, "Separators" is found or + ;"String" reaches its end + ResultPartLoop: ;"CurrentLoop" Loop + + ;Increase "CurrentLoop" counter + IntOp $8 $8 + 1 + + StrSearchLoop: + ${Do} ;"String" Loop + ;Remove everything before and after the searched part ("TempStr") + StrCpy $7 $3 1 $6 + + ;Verify if it's the "String" end + ${If} $6 >= $5 + ;If "CurrentLoop" is what the user wants, remove the part + ;after "TempStr" and itself and get out of here + ${If} $8 == $1 + ${OrIf} $1 == `L` + StrCpy $3 $3 $6 + ${Else} ;If not, empty "String" and get out of here + StrCpy $3 `` + ${EndIf} + StrCpy $R0 `End` + ${ExitDo} + ${EndIf} + + ;Start "CurrentSepCharNum" counter (for "Separators" Loop) + StrCpy $R0 0 + + ${Do} ;"Separators" Loop + ;Use one "Separators" character at a time + ${If} $R0 <> 0 + StrCpy $9 $2 1 $R0 + ${Else} + StrCpy $9 $2 1 + ${EndIf} + + ;Go to the next "String" char if it's "Separators" end + ${IfThen} $R0 >= $4 ${|} ${ExitDo} ${|} + + ;Or, if "TempStr" equals "CurrentSepChar", then... + ${If} $7 == $9 + StrCpy $7 $3 $6 + + ;If "String" is empty because this result part doesn't + ;contain data, verify if "SkipEmptyParts" is activated, + ;so we don't return the output to user yet + + ${If} $7 == `` + ${AndIf} $0 = 1 ;${TRUE} + IntOp $6 $6 + 1 + StrCpy $3 $3 `` $6 + StrCpy $6 0 + Goto StrSearchLoop + ${ElseIf} $8 == $1 + StrCpy $3 $3 $6 + StrCpy $R0 "End" + ${ExitDo} + ${EndIf} ;If not, go to the next result part + IntOp $6 $6 + 1 + StrCpy $3 $3 `` $6 + StrCpy $6 0 + Goto ResultPartLoop + ${EndIf} + + ;Increase "CurrentSepCharNum" counter + IntOp $R0 $R0 + 1 + ${Loop} + ${IfThen} $R0 == "End" ${|} ${ExitDo} ${|} + + ;Increase "StartCharPos" counter + IntOp $6 $6 + 1 + ${Loop} + +/*After this point: + ------------------------------------------ + $3 = ResultVar (output)*/ + + ;Return output to user + + Pop $R0 + Pop $9 + Pop $8 + Pop $7 + Pop $6 + Pop $5 + Pop $4 + Pop $0 + Pop $1 + Pop $2 + Exch $3 +FunctionEnd Index: win_installer/src/language-pack.nsi =================================================================== diff -u -rb774997180e1f25228b59a70714036cdc22c3ae6 -r9d6fcf6e3965c390f8c55f79623a33fb673a4906 --- win_installer/src/language-pack.nsi (.../language-pack.nsi) (revision b774997180e1f25228b59a70714036cdc22c3ae6) +++ win_installer/src/language-pack.nsi (.../language-pack.nsi) (revision 9d6fcf6e3965c390f8c55f79623a33fb673a4906) @@ -32,10 +32,19 @@ # constants -!define VERSION "2006-12-12" ; DATE of language pack in fromat YYYYMMDD +!define VERSION "2006-20-12" ; DATE of language pack in fromat YYYYMMDD !define SOURCE_JBOSS_HOME "D:\jboss-4.0.2" ; location of jboss where lams was deployed !define REG_HEAD "Software\LAMS Foundation\LAMSv2" +# display finish page stuff +!define MUI_FINISHPAGE_RUN $LAMS_DIR\lams-start.exe +!define MUI_FINISHPAGE_RUN_TEXT "Start LAMS now" +;!define MUI_FINISHPAGE_TEXT "The LAMS Server has been successfully installed on your computer." +!define MUI_FINISHPAGE_SHOWREADME $LAMS_DIR\readme.txt +!define MUI_FINISHPAGE_SHOWREADME_TEXT "Open the readme file" +!define MUI_FINISHPAGE_LINK "Visit LAMS Community" +!define MUI_FINISHPAGE_LINK_LOCATION "http://www.lamscommunity.org" + # installer settings !define MUI_ICON "..\graphics\lams2.ico" @@ -77,16 +86,6 @@ !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_UNFINISHPAGE_NOAUTOCLOSE -# display finish page stuff -!define MUI_FINISHPAGE_RUN $INSTDIR\lams-start.exe -!define MUI_FINISHPAGE_RUN_TEXT "Start LAMS now" -!define MUI_FINISHPAGE_TEXT "The LAMS Server has been successfully installed on your computer." -!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\readme.txt -;!define MUI_FINISHPAGE_SHOWREADME_TEXT "Open the readme file" -!define MUI_FINISHPAGE_LINK "Visit LAMS Community" -!define MUI_FINISHPAGE_LINK_LOCATION "http://www.lamscommunity.org" - - # installer screen pages ;-------------------------------- !insertmacro MUI_PAGE_WELCOME @@ -163,6 +162,7 @@ Var FLASHXML_DIR Var SQL_QUERY Var FOLDER_FLAG +Var OLD_VERSION ${Array} RF_FOLDERS ${Array} CS_FOLDERS ${Array} FS_FOLDERS @@ -235,7 +235,9 @@ MessageBox MB_OK|MB_ICONSTOP "Your current language pack is a newer version than this version: LAMS-LanguagePack-$0" Abort ${EndIf} + strcpy $OLD_VERSION $0 + # Abort if there is no version of LAMS2 installed ReadRegStr $0 HKLM "${REG_HEAD}" "version" ${If} $0 = "" @@ -255,6 +257,17 @@ RMDir /r "$EXEDIR\build" FunctionEnd +Function .onInstFailed + WriteRegStr HKLM "${REG_HEAD}" "language_pack" $OLD_VERSION + RMDir /r "$EXEDIR\zip" + RMDir /r "$EXEDIR\build" + delete "$INSTDIR\updateLocales.sql" + delete "$INSTDIR\LanguagePack.xml" + delete "$INSTDIR\installer.properties" + rmdir /r $TEMP + rmdir /r "$INSTDIR\apache-ant-1.6.5" +FunctionEnd + ;backup existing language files ;zip to $INSTDIR\jboss-4.0.2\server\default\deploy\lams.ear\lams-dictionary.jar\lams-dictionary-bak.zip Function zipLanguages @@ -420,23 +433,23 @@ strcpy $FOLDER_FLAG "0" call executeSQLScript pop $0 - detailprint "SQL script result for Chat and Scribe: $\n$0" + #detailprint "SQL script result for Chat and Scribe: $\n$0" ; getting the rows for Forum and Scribe strcpy $SQL_QUERY '"SELECT learning_library_id FROM lams_learning_library WHERE title = $\'Forum and Scribe$\';"' strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -s -i -B $DB_NAME -e $SQL_QUERY' strcpy $FOLDER_FLAG "1" call executeSQLScript pop $0 - detailprint "SQL script result for Forum and Scribe: $\n$0" + #detailprint "SQL script result for Forum and Scribe: $\n$0" ; getting the rows for Resources and Forum strcpy $SQL_QUERY '"SELECT learning_library_id FROM lams_learning_library WHERE title = $\'Resources and Forum$\';"' strcpy $SQL_QUERY '"$MYSQL_DIRbin\mysql.exe" -u"$DB_USER" -p"$DB_PASS" -s -i -B $DB_NAME -e $SQL_QUERY' strcpy $FOLDER_FLAG "2" call executeSQLScript pop $0 - detailprint "SQL script result for Resource and Forum: $\n$0" + #detailprint "SQL script result for Resource and Forum: $\n$0" ; copy all the folders for llid Chat and Scribe IntOp $R0 "$CS_FOLDERS_UBound" + 1 @@ -513,8 +526,6 @@ ${endif} ${endwhile} - - #check for errors and write result to install window ${if} $0 != 0 goto Errors @@ -530,37 +541,37 @@ FunctionEnd Function SplitFirstStrPart - Exch $R0 - Exch - Exch $R1 - Push $R2 - Push $R3 - StrCpy $R3 $R1 - StrLen $R1 $R0 - IntOp $R1 $R1 + 1 - loop: - IntOp $R1 $R1 - 1 - StrCpy $R2 $R0 1 -$R1 - StrCmp $R1 0 exit0 - StrCmp $R2 $R3 exit1 loop - exit0: - StrCpy $R1 "" - Goto exit2 - exit1: - IntOp $R1 $R1 - 1 - StrCmp $R1 0 0 +3 - StrCpy $R2 "" - Goto +2 - StrCpy $R2 $R0 "" -$R1 + Exch $R0 + Exch + Exch $R1 + Push $R2 + Push $R3 + StrCpy $R3 $R1 + StrLen $R1 $R0 IntOp $R1 $R1 + 1 - StrCpy $R0 $R0 -$R1 - StrCpy $R1 $R2 - exit2: - Pop $R3 - Pop $R2 - Exch $R1 ;rest - Exch - Exch $R0 ;first + loop: + IntOp $R1 $R1 - 1 + StrCpy $R2 $R0 1 -$R1 + StrCmp $R1 0 exit0 + StrCmp $R2 $R3 exit1 loop + exit0: + StrCpy $R1 "" + Goto exit2 + exit1: + IntOp $R1 $R1 - 1 + StrCmp $R1 0 0 +3 + StrCpy $R2 "" + Goto +2 + StrCpy $R2 $R0 "" -$R1 + IntOp $R1 $R1 + 1 + StrCpy $R0 $R0 -$R1 + StrCpy $R1 $R2 + exit2: + Pop $R3 + Pop $R2 + Exch $R1 ;rest + Exch + Exch $R0 ;first FunctionEnd ;checks if the languages in the language pack exist @@ -621,7 +632,7 @@ error: DetailPrint "Ant configure-deploy failed." MessageBox MB_OK|MB_ICONSTOP "LAMS configuration failed. Please check your LAMS configuration and try again.$\r$\nError:$\r$\n$\r$\n$1" - #Abort "LAMS configuration failed." + Abort "LAMS configuration failed." done: ; remove the sql scripts @@ -630,7 +641,7 @@ delete "$INSTDIR\installer.properties" rmdir /r $TEMP rmdir /r "$INSTDIR\apache-ant-1.6.5" - + FunctionEnd