You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ma...@apache.org on 2014/05/02 18:48:11 UTC

svn commit: r1591969 - /openoffice/ooo-site/trunk/content/download/test/download.js

Author: marcus
Date: Fri May  2 16:48:10 2014
New Revision: 1591969

URL: http://svn.apache.org/r1591969
Log:
New 'initVars()' function, update on variables

Modified:
    openoffice/ooo-site/trunk/content/download/test/download.js

Modified: openoffice/ooo-site/trunk/content/download/test/download.js
URL: http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/download/test/download.js?rev=1591969&r1=1591968&r2=1591969&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download.js Fri May  2 16:48:10 2014
@@ -13,26 +13,40 @@
 /*
  * Define global variables
  */
-var LANG_ISO			= "";	 // The language as ISO code
-var LANG_ARRAY			= "";	 // This array contains all language specific data
-var RELEASE_MATRIX_PLATFORM_POS	= -1;	 // The position of the platform in the release matrix array
-var RELEASE_MATRIX_PLATFORM	= "";	 // The platform in the release matrix array
-var RELEASE_MATRIX_LANG		= "";	 // This array contains all language specific data for the language specific data
-var UI_PLATFORM			= "";	 // The platform as readable string
-var URL_PLATFORM		= "";	 // The platform as part of the download URL
-var OLD_PLATFORM		= false; // The browser platform is old (true) or not (false)
-var FILENAME			= "";	 // The complete filename of the download URL
-var FILESIZE			= 0;	 // The filesize of the download file
-var EXTENSION			= "";	 // The file extension of the download URL
-var LINK			= "";	 // The complete download URL
-var CHECKSUM_KEYS		= "";	 // The KEYS file as download URL
-var CHECKSUM_ASC		= "";	 // The ASC file as download URL
-var CHECKSUM_MD5		= "";	 // The MD5 file as download URL
-var CHECKSUM_SHA256		= "";	 // The SHA256 file as download URL
-var SOURCEFORGE			= false; // The download URL points to Soureforge
-var OTHER			= false; // The download URL points to 'other.html'
-var ARCHIVE			= false; // The download URL points to the ASF archive
-var ERROR			= false; // The download URL is correct (false) or not (true)?
+function initVars() {
+	// Define variables without "var" to make them globally available
+
+	LANG_ISO				= "";	 // The language as ISO code
+	LANG_ARRAY				= "";	 // This array contains all language specific data
+	UI_PLATFORM				= "";	 // The platform as readable string
+	URL_PLATFORM				= "";	 // The platform as part of the download URL
+	OLD_PLATFORM				= false; // The browser platform is old (true) or not (false)
+	RELEASE_MATRIX_PLATFORM_POS_FULL	= 0;	 // The position of the platform in the release matrix array
+	RELEASE_MATRIX_PLATFORM_POS_LP		= 0;	 // The position of the platform in the release matrix array
+	RELEASE_MATRIX_PLATFORM			= "";	 // The platform in the release matrix array
+	RELEASE_MATRIX_LANG			= "";	 // The language specific data depending on LANG_ISO
+	VERSION_ALT				= "";	 // The selected version from drop-down-box
+	FILENAME_FULL				= "";	 // The complete filename of the download URL (for full installation)
+	FILENAME_LP				= "";	 // The complete filename of the download URL (for language pack)
+	FILESIZE_FULL				= 0;	 // The filesize of the download file (for full installation)
+	FILESIZE_LP				= 0;	 // The filesize of the download file (for language pack)
+	EXTENSION				= "";	 // The file extension of the download URL
+//	TYPE					= "";	 // The installation type
+	LINK					= "";	 // The complete download URL
+	LINK_FULL				= "";	 // The complete download URL (for full installation)
+	LINK_LP					= "";	 // The complete download URL (for language pack)
+	CHECKSUM_KEYS				= "";	 // The KEYS file as download URL
+	CHECKSUM_ASC_FULL			= "";	 // The ASC file as download URL (for full installation)
+	CHECKSUM_MD5_FULL			= "";	 // The MD5 file as download URL (for full installation)
+	CHECKSUM_SHA256_FULL			= "";	 // The SHA256 file as download URL (for full installation)
+	CHECKSUM_ASC_LP				= "";	 // The ASC file as download URL (for language pack)
+	CHECKSUM_MD5_LP				= "";	 // The MD5 file as download URL (for language pack)
+	CHECKSUM_SHA256_LP			= "";	 // The SHA256 file as download URL (for language pack)
+	SOURCEFORGE				= false; // The download URL points to Soureforge
+	OTHER					= false; // The download URL points to 'other.html'
+	ARCHIVE					= false; // The download URL points to the ASF archive
+	ERROR					= false; // The download URL is correct (false) or not (true)?
+}
 
 /*
  * Output values of variables for debugging
@@ -132,11 +146,11 @@ function getLanguage() {
 		thisLanguage = thisLanguageSet[ "-" ];
 	}
 
-	LANG_ISO   = language;
-	LANG_ARRAY = thisLanguage;
+	LANG_ISO			= language;
+	LANG_ARRAY			= thisLanguage;
 
-	var thisReleaseMatrixSet = release_matrix_410[ LANG_ISO ];
-	RELEASE_MATRIX_LANG      = thisReleaseMatrixSet[ 0 ];
+	var thisReleaseMatrixSet	= release_matrix_410[ LANG_ISO ];
+	RELEASE_MATRIX_LANG		= thisReleaseMatrixSet[ 0 ];
 
 	return LANG_ISO;
 }
@@ -163,7 +177,10 @@ function hasMirrorLink() {
  * Depends on array-list
  */
 function getLink( rel_mode ) {
-	// If no release mode was given, assume it's about the stable release.
+	// Reset all global variables.
+	initVars();
+
+	// If no release mode was given, assume it is about the stable release.
 	if ( rel_mode == undefined )
 		rel_mode = 1;
 
@@ -177,7 +194,7 @@ function getLink( rel_mode ) {
 	if ( hasMirrorLink() ) {
 		// If platform is too old, provide a general download link to the archive.
 		if ( OLD_PLATFORM ) {
-			// If platform is Mac OS X <=10.6, provide a download link with previous AOO version.
+			// If platform is 'Mac OS X <= 10.6', provide a download link with previous AOO version.
 			if ( UI_PLATFORM == "Mac OS X (10.6 or older)" ) {
 				LINK		= SOURCEFORGE_PREVIOUS_URL + LANG_ISO + "/" + getFilename( PRE_VERSION ) + "/download";
 
@@ -238,8 +255,8 @@ function getLink( rel_mode ) {
 			ERROR		= true;
 
 			return LINK;
-
 		}
+
 		// If language is supported and platform was recognized, assemble the filenames for download and checksums.
 		LINK		= SOURCEFORGE_BASE_URL + LANG_ISO + "/" + getFilename( VERSION ) + "/download";
 
@@ -257,8 +274,8 @@ function getLink( rel_mode ) {
 
 	} else {
 		// If language is not supported, provide an alternative download link.
-		// Release mode
 		if ( rel_mode == 1 ) {
+			// Release mode
 			// Provide the link from the Native Language (NL) group.
 //			LINK = LANG_ARRAY[ 4 ];
 			LINK = "http://www.openoffice.org/" + RELEASE_MATRIX_LANG[ 3 ];
@@ -494,8 +511,8 @@ function getFilesize() {
 		// Assign the file size (column 2) from the release matrix of language and platform.
 		FILESIZE		= release_matrix_410[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ][ 2 ];
 	} else {
-		ERROR	 = true;
-		FILESIZE = 0;
+		ERROR			= true;
+		FILESIZE		= 0;
 	}
 
 	return FILESIZE;