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/06/14 13:44:27 UTC

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

Author: marcus
Date: Sat Jun 14 11:44:27 2014
New Revision: 1602581

URL: http://svn.apache.org/r1602581
Log:
Re-worked the exception handling, deleted no longer needed 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=1602581&r1=1602580&r2=1602581&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download.js Sat Jun 14 11:44:27 2014
@@ -116,10 +116,8 @@ function initVars( init_all ) {
 	LINK_CHK_ASC_LP				= "";	 // The ASC file as download URL (langpack).
 	LINK_CHK_MD5_LP				= "";	 // The MD5 file as download URL (langpack).
 	LINK_CHK_SHA256_LP			= "";	 // The SHA256 file as download URL (langpack).
-	SF					= false; // Does the download URL points to Soureforge?
-	OTHER					= false; // Does the download URL points to the porting webpage?
-	ARCHIVE					= false; // Does the download URL points to the ASF archive?
-	ERROR					= true;	 // Is the download URL in general correct (false) or not (true)?
+	SUPPORTED				= false; // Are the selected options supported in general (true) or not (false)?
+	ERROR					= false; // Is the download URL in general correct (true) or not (false)?
 
 	return;
 }
@@ -485,8 +483,6 @@ function showErrorMessage( error_text ) 
 	document.getElementById( "dl_lp_link"	 ).innerHTML		= l10n_download_langpack_link_error_text;
 	document.getElementById( "dl_lp_link"	 ).title		= l10n_download_langpack_link_error_title;
 
-	document.getElementById( "sub_green_box" ).className		= "sub-green-sel_error";
-
 	document.getElementById( "dl_err_img"    ).src			= FILE_ERROR_IMG;
 	document.getElementById( "dl_err_img"    ).title		= l10n_download_error_problem_img_title;
 	document.getElementById( "dl_err_img"    ).alt			= l10n_download_error_problem_img_alt;
@@ -496,9 +492,13 @@ function showErrorMessage( error_text ) 
 	document.getElementById( "dl_err"	 ).style.cursor		= "default";
 	document.getElementById( "dl_err"	 ).style.display	= "inline-block";
 
+	document.getElementById( "sub_green_box" ).className		= "sub-green-sel_error";
+	document.getElementById( "sub_green_box" ).style.display	= "block";
+
 	// Delete previously set string to get the possibility back to choose a different platform
 	// and then to assemble a new download link.
 	UI_PLATFORM_NO_SUP = "";
+	SUPPORTED	   = false;
 	ERROR		   = true;
 	return ERROR;
 }
@@ -526,7 +526,7 @@ function isLangSupported() {
 			break;
 		default:
 			RELEASE_LANG = "";
-			ERROR = true;
+			ERROR	     = true;
 	}
 
 	if( RELEASE_LANG[ 3 ] === 'y' ) {
@@ -543,8 +543,25 @@ function isLangSupported() {
  * Depends on chosen OS, language and version
  */
 function checkLinkExceptions() {
-
 	// If recognized platform is not Windows, Linux or Mac, show the none-availability to the user.
+
+	var error_text = "";
+
+	// If language is not supported, show the none-availability to the user.
+	if( ! isLangSupported() ) {
+		// Show an error message that the chosen items do not lead to a download.
+		error_text = "<b>" + l10n_download_error_problem_text + "</b>" + l10n_download_error_aoo_text + VERSION_SEL
+			     + l10n_download_error_not_available_for_text + "<b>" + RELEASE_LANG[ 1 ] + " ("
+			     + RELEASE_LANG[ 2 ] + ") (" + LANG_SEL + ")</b>."
+			     + "<br /><b>" + l10n_download_error_solution_text + "</b>"
+			     + l10n_download_error_please_select_4_text;
+
+		showErrorMessage( error_text );
+	} else {
+		// If language is supported, assemble the filenames and text for download and checksums.
+		// Go on in "getLinkSel().
+	}
+
 	if( UI_PLATFORM_NO_SUP !== "" ) {
 		// Show an error message that the chosen items do not lead to a download.
 		error_text = "<b>" + l10n_download_error_problem_text + "</b>" + l10n_download_error_aoo_text + VERSION_SEL
@@ -553,7 +570,6 @@ function checkLinkExceptions() {
 			     + l10n_download_error_please_select_3_text;
 
 		showErrorMessage( error_text );
-		ERROR = true;
 	}
 
 	// If version is '4.1.0' (or newer) and platform is 'Mac OS X <= 10.6', show the none-availability to the user.
@@ -565,7 +581,6 @@ function checkLinkExceptions() {
 			     + l10n_download_error_please_select_1_text;
 
 		showErrorMessage( error_text );
-		ERROR = true;
 	}
 
 	// If version is '4.0.1' (or older) and platform is 'Mac OS X >= 10.7', show the none-availability to the user.
@@ -577,7 +592,6 @@ function checkLinkExceptions() {
 			     + l10n_download_error_please_select_2_text;
 
 		showErrorMessage( error_text );
-		ERROR = true;
 	}
 
 	// If platform is 'other', create a download link that leads to the Porting webpage.
@@ -595,8 +609,8 @@ function checkLinkExceptions() {
 		document.getElementById( "dl_lp_link"	 ).style.display = "none";
 		document.getElementById( "sub_green_box" ).style.display = "none";
 
-		OTHER = true;
-		ERROR = false;
+		SUPPORTED = true;
+		ERROR	  = false;
 	}
 
 	// If version is 'older', create a download link that leads to the archive webpage.
@@ -614,27 +628,15 @@ function checkLinkExceptions() {
 		document.getElementById( "dl_lp_link"	 ).style.display = "none";
 		document.getElementById( "sub_green_box" ).style.display = "none";
 
-		ARCHIVE = true;
-		ERROR   = false;
+		SUPPORTED = true;
+		ERROR	  = false;
 	}
 
-	// If language is not supported, show the none-availability to the user.
-	if( ! isLangSupported() ) {
-		// Show an error message that the chosen items do not lead to a download.
-		error_text = "<b>" + l10n_download_error_problem_text + "</b>" + l10n_download_error_aoo_text + VERSION_SEL
-			     + l10n_download_error_not_available_for_text + "<b>" + RELEASE_LANG[ 1 ] + " ("
-			     + RELEASE_LANG[ 2 ] + ") (" + LANG_SEL + ")</b>."
-			     + "<br /><b>" + l10n_download_error_solution_text + "</b>"
-			     + l10n_download_error_please_select_4_text;
-
-		showErrorMessage( error_text );
-		ERROR = true;
-	} else {
-		// If language is supported, assemble the filenames and text for download and checksums.
-		// Go on in "getLinkSel().
-
-		ERROR = false;
-	}
+	// If until now an error occurred then assume that the selected options are not supported.
+	if( ERROR )
+		SUPPORTED = false;
+	else
+		SUPPORTED = true;
 
 	return ERROR;
 }
@@ -655,8 +657,9 @@ function getLinkSel() {
 	// First check for expections that do not lead to real download links.
 	checkLinkExceptions();
 
-	// No exceptions so far when download link does not lead to SF and OTHER and ARCHIVE.
-	if( ! SF && ! OTHER && ! ARCHIVE ) {
+	// If selected options lead to an exception (VERSION_SEL = "older" OR SUPPORTED = FALSE)
+	// then do not overwrite current download links.
+	if( VERSION_SEL !== "older" && SUPPORTED && ! ERROR ) {
 		// Assemble the filenames and text for download and checksums.
 		getReleaseMatrixPos();
 		getFileData( VERSION_SEL );
@@ -677,7 +680,7 @@ function getLinkSel() {
 		LINK_CHK_MD5_LP	     = ASF_ARC_BASE_URL  + "/binaries/"   + LANG_SEL + "/" + FILENAME_LP   + ".md5";
 		LINK_CHK_SHA256_LP   = ASF_ARC_BASE_URL  + "/binaries/"   + LANG_SEL + "/" + FILENAME_LP   + ".sha256";
 
-		SF		     = true;
+		SUPPORTED	     = true;
 		ERROR		     = false;
 
 		// Set the values for both download text buttons and set the focus to the "full install".
@@ -1145,7 +1148,7 @@ function alertDbg( location ) {
 	+ "RELEASE_PLATFORM: "			+ "\t\t\t\t\t"		+ RELEASE_PLATFORM			+ "\n"
 	+ "RELEASE_LANG: "			+ "\t\t\t\t\t\t"	+ RELEASE_LANG				+ "\n"
 	+ "REL_TEXT: "				+ "\t\t\t\t\t\t\t"	+ REL_TEXT				+ "\n"
-	+ "REL_NOTES: "				+ "\t\t\t\t\t\t\t"	+ REL_NOTES				+ "\n"
+	+ "REL_NOTES: "				+ "\t\t\t\t\t\t"	+ REL_NOTES				+ "\n"
 	+ "VERSION_SEL: "			+ "\t\t\t\t\t\t"	+ VERSION_SEL				+ "\n"
 	+ "FILENAME_FULL: "			+ "\t\t\t\t\t"		+ FILENAME_FULL				+ "\n"
 	+ "FILENAME_LP: "			+ "\t\t\t\t\t\t"	+ FILENAME_LP				+ "\n"
@@ -1160,9 +1163,7 @@ function alertDbg( location ) {
 	+ "LINK_CHK_ASC_LP: "			+ "\t\t\t\t\t"		+ LINK_CHK_ASC_LP			+ "\n"
 	+ "LINK_CHK_MD5_LP: "			+ "\t\t\t\t\t"		+ LINK_CHK_MD5_LP			+ "\n"
 	+ "LINK_CHK_SHA256_LP: "		+ "\t\t\t\t"		+ LINK_CHK_SHA256_LP			+ "\n"
-	+ "SF: "				+ "\t\t\t\t\t\t\t\t"	+ SF					+ "\n"
-	+ "OTHER: "				+ "\t\t\t\t\t\t\t"	+ OTHER					+ "\n"
-	+ "ARCHIVE: "				+ "\t\t\t\t\t\t\t"	+ ARCHIVE				+ "\n"
+	+ "SUPPORTED: "				+ "\t\t\t\t\t\t"	+ SUPPORTED				+ "\n"
 	+ "ERROR: "				+ "\t\t\t\t\t\t\t"	+ ERROR					+ "\n"
 	+ "" );