Author: marcus Date: Thu Jun 12 19:53:01 2014 New Revision: 1602278 URL: http://svn.apache.org/r1602278 Log: Created new function 'checkLinkExceptions()' to check if currently selected items would lead to an error and not to a download link
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=1602278&r1=1602277&r2=1602278&view=diff ============================================================================== --- openoffice/ooo-site/trunk/content/download/test/download.js (original) +++ openoffice/ooo-site/trunk/content/download/test/download.js Thu Jun 12 19:53:01 2014 @@ -17,7 +17,7 @@ * function showWindow ( target_url ) * function showErrorMessage ( error_text ) * function isLangSupported () - * function getLink ( rel_mode ) + * function checkLinkExceptions () * function getLinkSel () * function getPlatform () * function getReleaseMatrixPos () @@ -527,28 +527,17 @@ function isLangSupported() { ERROR = false; return true; } else { - NOT_AVAILABLE = RELEASE_LANG[ 1 ] + " is not available"; + NOT_AVAILABLE = RELEASE_LANG[ 1 ] + " (" + RELEASE_LANG[ 2 ] + ") (" + LANG_SEL + ") is not available"; ERROR = true; return false; } } /* - * Get link to mirror system for download file and checksum file - * Depends on chosen OS, language and type + * Check links that should be assembled in getLinkSel() for expections that do not lead to real download links + * Depends on chosen OS, language and version */ -function getLinkSel() { - // Reset all variables that could have been set until now. - initVars( 0 ); - - // If no mode was given, assume it is the release mode (stable release). - if( R_MODE === undefined ) - R_MODE = 1; - - // Get the selected data from the select boxes. - getOSSel(); - getLangSel(); - getVerSel(); +function checkLinkExceptions() { // If recognized platform is not Windows, Linux or Mac, show the none-availability to the user. if( UI_PLATFORM_NO_SUP !== "" ) { @@ -559,7 +548,7 @@ function getLinkSel() { + l10n_download_error_please_select_3_text; showErrorMessage( error_text ); - return false; + 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. @@ -571,7 +560,7 @@ function getLinkSel() { + l10n_download_error_please_select_1_text; showErrorMessage( error_text ); - return false; + 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. @@ -583,7 +572,7 @@ function getLinkSel() { + l10n_download_error_please_select_2_text; showErrorMessage( error_text ); - return false; + ERROR = true; } // If platform is 'other', create a download link that leads to the Porting webpage. @@ -603,7 +592,6 @@ function getLinkSel() { OTHER = true; ERROR = false; - return LINK_FULL; } // If version is 'older', create a download link that leads to the archive webpage. @@ -623,24 +611,10 @@ function getLinkSel() { ARCHIVE = true; ERROR = false; - return LINK_FULL; } // If language is not supported, show the none-availability to the user. if( ! isLangSupported() ) { - if( R_MODE === 1 ) { - // Release mode. - // Provide the link from the Native Language (NL) group. - LINK_FULL = "http://www.openoffice.org/" + RELEASE_LANG[ 4 ]; - LINK_LP = LINK_LP; - FILESIZE_FULL = 0; - FILESIZE_LP = 0; - } else { - // Beta release mode. - // Provide the "all_beta.html" as download link. - LINK_FULL = "http://www.openoffice.org/download/all_beta.html"; - LINK_LP = LINK_LP; - } // 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 ] + " (" @@ -649,10 +623,40 @@ function getLinkSel() { + l10n_download_error_please_select_4_text; showErrorMessage( error_text ); - return false; + ERROR = true; } else { - // If language is supported, assemble the filenames and text for download and checksums. + // If language is supported, assemble the filenames and text for download and checksums. + // Go on in "getLinkSel(). + + ERROR = false; + } + + return ERROR; +} + +/* + * Get link to mirror system for download file and checksum file + * Depends on chosen OS, language and version + */ +function getLinkSel() { + // Reset all variables that could have been set until now. + initVars( 0 ); + + // If no mode was given, assume it is the release mode (stable release). + if( R_MODE === undefined ) + R_MODE = 1; + + // Get the selected data from the select boxes. + getOSSel(); + getLangSel(); + getVerSel(); + + // 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 ) { + // Assemble the filenames and text for download and checksums. getReleaseMatrixPos(); getFileData( VERSION_SEL );