incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r1386586 - /incubator/ooo/ooo-site/trunk/content/download/test/new/download.js
Date Mon, 17 Sep 2012 12:43:28 GMT
Author: marcus
Date: Mon Sep 17 12:43:28 2012
New Revision: 1386586

URL: http://svn.apache.org/viewvc?rev=1386586&view=rev
Log:
Reworked code to support new directory structure

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

Modified: incubator/ooo/ooo-site/trunk/content/download/test/new/download.js
URL: http://svn.apache.org/viewvc/incubator/ooo/ooo-site/trunk/content/download/test/new/download.js?rev=1386586&r1=1386585&r2=1386586&view=diff
==============================================================================
--- incubator/ooo/ooo-site/trunk/content/download/test/new/download.js (original)
+++ incubator/ooo/ooo-site/trunk/content/download/test/new/download.js Mon Sep 17 12:43:28
2012
@@ -1,5 +1,6 @@
 /*
  * Overview of all functions defined below
+ * ---------------------------------------
  * function getLanguage   ()
  * function hasMirrorLink ()
  * function getLink       ()
@@ -8,21 +9,22 @@
  */
 
 /*
- * define global variables
+ * Define global variables
  */
 
 var LANG_ISO		= "";
 var LANG_ARRAY		= "";
 var PLATFORM		= "";
 var UI_PLATFORM		= "";
+var FILENAME		= "";
 var EXTENSION		= "";
 var CHECKSUM_ASC	= "";
 var CHECKSUM_MD5	= "";
 var CHECKSUM_SHA256	= "";
 
 /*
- * get array and ISO code for language
- * depends on nl_language
+ * Get array and ISO code for language
+ * Depends on nl_language
  */
 function getLanguage() {
 	var language = "";
@@ -36,8 +38,7 @@ function getLanguage() {
 	else if ( navigator.systemLanguage )
 		language = navigator.systemLanguage;
 
-	// Convert "en" to "en-US" as well since en-US build is the canonical
-	// translation, and thus better tested.
+	// Convert "en" to "en-US" as well since en-US build is the canonical translation, and thus
better tested.
 	if ( !language || language == "" || language == "null" || language == "en" )
 		language = "en-US";
 	if ( language == "pt" )
@@ -53,7 +54,7 @@ function getLanguage() {
 
 	var thisLanguageSet  = languages[ languageCode ];
 	if ( thisLanguageSet == null ) {
-		// language code not found inside array
+		// Language code not found inside array
 		language	= "en-US";
 		languageCode	= "en";
 		regionCode	= "us";
@@ -61,20 +62,20 @@ function getLanguage() {
 	}
 
 	if ( regionCode != null ) {
-		// fix for Port. pt-PT downloads named only pt without region code!
+		// Fix for Portuguese pt-PT downloads named only pt without region code!
 		if ( regionCode == "pt" && languageCode == "pt" )
 			language = languageCode;
 
-		// found additional region code
+		// If an additional region code was found
 		if ( thisLanguageSet[ regionCode ] != null ) {
-			// choose langCode-regionCode
+			// Then choose langCode-regionCode
 			language     = languageCode + "-" + regionCode.toUpperCase();
 			thisLanguage = thisLanguageSet[ regionCode ];
 		} else {
-			// choose default
+			// Choose the default langCode
 			thisLanguage = thisLanguageSet[ "-" ];
 			if ( languageCode == "en" ) {
-				// special case, default is en-US for en-XX
+				// Special case, default is en-US for en-XX
 				language	= "en-US";
 				regionCode	= "us";
 				thisLanguageSet	= languages[ languageCode ];
@@ -84,19 +85,18 @@ function getLanguage() {
 			}
 		}
 	} else {
-		// choose default for none given region code
+		// Choose the default for none given region code
 		thisLanguage = thisLanguageSet[ "-" ];
 	}
 
 	LANG_ISO	= language;
 	LANG_ARRAY	= thisLanguage;
 	NATIVE_LANG	= thisLanguage[ 2 ];
-	// return thisLanguage;
 }
 
 /*
- * get flag for mirror link
- * depends on array-list
+ * Get flag for mirror link
+ * Depends on array-list
  */
 function hasMirrorLink() {
 	if ( PLATFORM == "no_mirror_platform" )
@@ -110,8 +110,8 @@ function hasMirrorLink() {
 }
 
 /*
- * get link to mirror system for download-set and checksum file
- * depends on array-list
+ * Get link to mirror system for download-set and checksum file
+ * Depends on array-list
  */
 function getLink() {
 	var file_link = "";
@@ -123,21 +123,29 @@ function getLink() {
 	if ( NL_LANGUAGE == "" )
 		NL_LANGUAGE = LANG_ISO;
 
-	// trim timestamp from version, required for RC
+	// Trim timestamp from version, required for RC
 	// if ( version.indexOf( "_" ) > -1 )
 	//	version = version.split( "_" )[0];
 
 	if ( hasMirrorLink() ) {
+		file_link = PEOPLE_BASE_URL + VERSION + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_incubating_"
+                file_link = file_link + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+		FILENAME  = "Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE
+ EXTENSION;
+
 		if ( NL_LANGUAGE == "en-US" ) {
-			file_link = SOURCEFORGE_BASE_URL + "files/stable/"                        + VERSION +
"/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION
+ "/download";
-			chk_link  = APACHE_DIST_BASE_URL + "files/stable/"                        + VERSION +
"/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+			chk_link = APACHE_DIST_BASE_URL + "files/stable/"                        + VERSION
+			chk_link = chk_link + "/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_"
+			chk_link = chk_link + NL_LANGUAGE + EXTENSION;
 		} else {
-			file_link = SOURCEFORGE_BASE_URL + "files/localized/" + NL_LANGUAGE + "/" + VERSION +
"/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION
+ "/download";
-			chk_link  = APACHE_DIST_BASE_URL + "files/localized/" + LANG_ISO    + "/" + VERSION +
"/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+			chk_link = APACHE_DIST_BASE_URL + "files/localized/" + NL_LANGUAGE + "/" + VERSION
+			chk_link = chk_link + "/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_"
+			chk_link = chk_link + NL_LANGUAGE + EXTENSION;
 		}
+
 		CHECKSUM_ASC    = chk_link + ".asc";
 		CHECKSUM_MD5    = chk_link + ".md5";
 		CHECKSUM_SHA256 = chk_link + ".sha256";
+		// return file_link + "/download";
 		return file_link;
 	} else {
 		CHECKSUM_ASC    = "no_checksum";
@@ -148,13 +156,11 @@ function getLink() {
 }
 
 /*
- * get platform of browser
- * depending on what is recognized from browser's user-agent data
+ * Get platform of browser
+ * Depending on what is recognized from browser's data for platform and user-agent
  */
 function getPlatform() {
-	// assume a not recognizable platform first and apply respective values
-
-	// if you need help or more data: "http://www.useragentstring.com"
+	// For more help or data see: "http://www.useragentstring.com"
 
 	if ( navigator.platform != "" ) {
 		if ( navigator.platform.toLowerCase().indexOf( "windows" ) != -1 ) {
@@ -245,7 +251,7 @@ function getPlatform() {
 }
 
 /*
- * set document.location to start the download
+ * Set document.location to start the download
  */
 function openItem( itemid, uri ) {
 	var thisDocument  = document.getElementById( "downloadextendedtext" );



Mime
View raw message