DL.getLinkSelection = function()

in assets/download/download.js [824:1061]


DL.getLinkSelection = function() {
	// Reset all variables that could have been set until now.
	DL.initVariables( 0 );

	// Get the selected data from the select boxes.
	DL.getOSSelection();
	DL.getLanguageSelection();
	DL.getVersionSelection();

	// First check for expections that do not lead to real download links.
	DL.checkForLinkExceptions();

	// If the selected options lead to no download URL, should the sub-box shown anyway?
	// Yes when SHOW_SUB_BOX = "true" and ERROR = "false".
	if( DL.SHOW_SUB_BOX && ! DL.ERROR ) {
		// Assemble the filenames and text for download and checksums.

		DL.getReleaseMatrixPosition();
		DL.getFileData();

		// Assign the base links: Base link + version.
		DL.SF_BASE_URL		= DL.SF       + DL.VERSION_SEL + "/binaries/";
		DL.ASF_DIST_BASE_URL	= DL.ASF_DIST + DL.VERSION_SEL;
		DL.ASF_ARC_BASE_URL	= DL.ASF_ARC  + DL.VERSION_SEL;

		// Assign the download links: Base link + language + file name.
		DL.LINK_FULL		= DL.SF_BASE_URL		     + DL.LANG_SEL + "/" + DL.FILENAME_FULL + "/download";
		DL.LINK_LP		= DL.SF_BASE_URL		     + DL.LANG_SEL + "/" + DL.FILENAME_LP   + "/download";

		// If the selected version is the current release, match the checksum files from ASF Dist, otherwise from the ASF Archive.
		if( DL.VERSION_SEL === DL.VERSION ) {
			DL.LINK_CHK_BASE_URL = DL.ASF_DIST_BASE_URL;
		} else {
			DL.LINK_CHK_BASE_URL = DL.ASF_ARC_BASE_URL;
		}

		// Assign the checksum links: Base link + language + file name.
		DL.LINK_CHK_KEYS	= DL.ASF_DIST + "KEYS";
		DL.LINK_CHK_ASC_FULL    = DL.LINK_CHK_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_FULL + ".asc";
		DL.LINK_CHK_SHA256_FULL = DL.LINK_CHK_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_FULL + ".sha256";
		DL.LINK_CHK_SHA512_FULL = DL.LINK_CHK_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_FULL + ".sha512";

		DL.LINK_CHK_ASC_LP	= DL.LINK_CHK_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_LP   + ".asc";
		DL.LINK_CHK_SHA256_LP	= DL.LINK_CHK_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_LP   + ".sha256";
		DL.LINK_CHK_SHA512_LP	= DL.LINK_CHK_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_LP   + ".sha512";

		// Indicate that a download will successfull.
		DL.SHOW_SUB_BOX		= true;
		DL.ERROR		= false;

/*
		// If a Windows file is selected and a respective text is existing, then set the values for the Windows info link.
		if( DL.INSTALL_EXTENSION === "EXE" & l10n.dl_win_info_title != null ) {
			document.getElementById( "platform_info" ).style.cursor	= "help";
			document.getElementById( "platform_info" ).title	= l10n.dl_win_info_title;
			document.getElementById( "platform_info" ).text		= l10n.dl_win_info_text;
			document.getElementById( "platform_info" ).style.display= "inline";

		// If a Mac file is selected and a respective text is existing, then set the values for the Mac info link.
		} else if( DL.INSTALL_EXTENSION === "DMG" & l10n.dl_mac_info_title != null ) {
			document.getElementById( "platform_info" ).style.cursor	= "help";
			document.getElementById( "platform_info" ).title	= l10n.dl_mac_info_title;
			document.getElementById( "platform_info" ).text		= l10n.dl_mac_info_text;
			document.getElementById( "platform_info" ).style.display= "inline";

		// If a Linux file is selected and a respective text is existing, then set the values for the Linux info link.
		} else if( DL.INSTALL_EXTENSION === "RPM" || DL.INSTALL_EXTENSION === "DEB" & l10n.dl_linux_info_title != null ) {
			document.getElementById( "platform_info" ).style.cursor	= "help";
			document.getElementById( "platform_info" ).title	= l10n.dl_linux_info_title;
			document.getElementById( "platform_info" ).text		= l10n.dl_linux_info_text;
			document.getElementById( "platform_info" ).style.display= "inline";

		// Otherwise no text and make the element invisible.
		} else {
			document.getElementById( "platform_info" ).style.cursor	= "default";
			document.getElementById( "platform_info" ).title	= "";
			document.getElementById( "platform_info" ).text		= "";
			document.getElementById( "platform_info" ).style.display = "none";
		}
*/

		// Show a link to get hints for the choosen platform.
		document.getElementById( "platform_info" ).style.cursor	= "pointer";
		document.getElementById( "platform_info" ).href		= l10n.dl_platform_info_link;
		document.getElementById( "platform_info" ).title	= l10n.dl_platform_info_title + DL.UI_PLATFORM;
		document.getElementById( "platform_info" ).text		= l10n.dl_platform_info_text + DL.UI_PLATFORM;
		document.getElementById( "platform_info" ).style.display= "inline";

		// Set the values for both download text buttons and set the focus to the "full install".
		document.getElementById( "dl_f_link"	    ).href	= DL.LINK_FULL;
		document.getElementById( "dl_f_link"	    ).innerHTML	= l10n.dl_full_link_text;
		document.getElementById( "dl_f_link"	    ).title	= l10n.dl_full_link_title + DL.FILENAME_FULL;
		document.getElementById( "dl_f_link"	    ).focus()
		document.getElementById( "dl_lp_link"	    ).href	= DL.LINK_LP;
		document.getElementById( "dl_lp_link"	    ).innerHTML	= l10n.dl_langpack_link_text;
		document.getElementById( "dl_lp_link"	    ).title	= l10n.dl_langpack_link_title + DL.FILENAME_LP;

		// Set the values in the sub-box for the 4 text lines.
		// #1 Release data and link to release notes.
		document.getElementById( "dl_rel_info"      ).innerHTML	= "<b>" + l10n.dl_rel_info_headline_text
									+ "</b> " + DL.RELEASE_TEXT + " | ";
		document.getElementById( "dl_rel_notes"	    ).href	= DL.RELEASE_NOTES;
		document.getElementById( "dl_rel_notes"	    ).innerHTML	= l10n.dl_rel_notes_text;
		document.getElementById( "dl_rel_notes"	    ).title	= l10n.dl_rel_notes_title + DL.VERSION_SEL;

		// #2 Full install: Data and links
		document.getElementById( "dl_f_info"	    ).innerHTML = "<b>" + l10n.dl_headline_full_text + "</b>"
									+ l10n.dl_filesize_text + DL.FILESIZE_FULL
									+ l10n.dl_megabyte_text + " | "
									+ l10n.dl_checksum_headline_text;
		document.getElementById( "dl_f_chk_keys"    ).href	= DL.LINK_CHK_KEYS;
		document.getElementById( "dl_f_chk_keys"    ).innerHTML	= l10n.dl_checksum_keys_text;
		document.getElementById( "dl_f_chk_keys"    ).title	= l10n.dl_checksum_keys_title;
		document.getElementById( "space1"	    ).innerHTML	= " , ";
		document.getElementById( "dl_f_chk_asc"	    ).href	= DL.LINK_CHK_ASC_FULL;
		document.getElementById( "dl_f_chk_asc"	    ).innerHTML	= l10n.dl_checksum_asc_text;
		document.getElementById( "dl_f_chk_asc"	    ).title	= l10n.dl_checksum_asc_title + DL.FILENAME_FULL;
		document.getElementById( "space2"	    ).innerHTML	= " , ";
		document.getElementById( "dl_f_chk_sha256"  ).href	= DL.LINK_CHK_SHA256_FULL;
		document.getElementById( "dl_f_chk_sha256"  ).innerHTML	= l10n.dl_checksum_sha256_text;
		document.getElementById( "dl_f_chk_sha256"  ).title	= l10n.dl_checksum_sha256_title + DL.FILENAME_FULL;
		document.getElementById( "space3"	    ).innerHTML	= " , ";
		document.getElementById( "dl_f_chk_sha512"  ).href	= DL.LINK_CHK_SHA512_FULL;
		document.getElementById( "dl_f_chk_sha512"  ).innerHTML	= l10n.dl_checksum_sha512_text;
		document.getElementById( "dl_f_chk_sha512"  ).title	= l10n.dl_checksum_sha512_title + DL.FILENAME_FULL;

		// #3 Langpack: Data and links
		document.getElementById( "dl_lp_info"	    ).innerHTML	= "<b>" + l10n.dl_headline_langpack_text
									+ "</b>" + l10n.dl_filesize_text
									+ DL.FILESIZE_LP + l10n.dl_megabyte_text
									+ " | " + l10n.dl_checksum_headline_text;
		document.getElementById( "dl_lp_chk_keys"   ).href	= DL.LINK_CHK_KEYS;
		document.getElementById( "dl_lp_chk_keys"   ).innerHTML	= l10n.dl_checksum_keys_text;
		document.getElementById( "dl_lp_chk_keys"   ).title	= l10n.dl_checksum_keys_title;
		document.getElementById( "space5"	    ).innerHTML	= " , ";
		document.getElementById( "dl_lp_chk_asc"    ).href	= DL.LINK_CHK_ASC_LP;
		document.getElementById( "dl_lp_chk_asc"    ).innerHTML	= l10n.dl_checksum_asc_text;
		document.getElementById( "dl_lp_chk_asc"    ).title	= l10n.dl_checksum_asc_title + DL.FILENAME_LP;
		document.getElementById( "space6"	    ).innerHTML	= " , ";
		document.getElementById( "dl_lp_chk_sha256" ).href	= DL.LINK_CHK_SHA256_LP;
		document.getElementById( "dl_lp_chk_sha256" ).innerHTML	= l10n.dl_checksum_sha256_text;
		document.getElementById( "dl_lp_chk_sha256" ).title	= l10n.dl_checksum_sha256_title + DL.FILENAME_LP;
		document.getElementById( "space7"	    ).innerHTML	= " , ";
		document.getElementById( "dl_lp_chk_sha512" ).href	= DL.LINK_CHK_SHA512_LP;
		document.getElementById( "dl_lp_chk_sha512" ).innerHTML	= l10n.dl_checksum_sha512_text;
		document.getElementById( "dl_lp_chk_sha512" ).title	= l10n.dl_checksum_sha512_title + DL.FILENAME_LP;

		// #4 Links: Full vs. lp + verify checksums + report broken link.
		document.getElementById( "dl_hlp_img"	    ).src	= l10n.dl_help_img_src;
		document.getElementById( "dl_hlp_img"	    ).title	= l10n.dl_help_img_title;
		document.getElementById( "dl_hlp_img"	    ).alt	= l10n.dl_help_img_alt;
		document.getElementById( "dl_hlp"	    ).href	= l10n.dl_help_link;
		document.getElementById( "dl_hlp"	    ).innerHTML	= l10n.dl_help_text;
		document.getElementById( "dl_hlp"	    ).title	= l10n.dl_help_title;
		document.getElementById( "dl_chk_img"	    ).src	= l10n.dl_checksum_img_src;
		document.getElementById( "dl_chk_img"	    ).title	= l10n.dl_checksum_img_title;
		document.getElementById( "dl_chk_img"	    ).alt	= l10n.dl_checksum_img_alt;
		document.getElementById( "dl_chk"	    ).href	= l10n.dl_checksum_link;
		document.getElementById( "dl_chk"	    ).innerHTML	= l10n.dl_checksum_text;
		document.getElementById( "dl_chk"	    ).title	= l10n.dl_checksum_title;
		document.getElementById( "dl_rpt_img"	    ).src	= l10n.dl_report_img_src;
		document.getElementById( "dl_rpt_img"	    ).title	= l10n.dl_report_img_title;
		document.getElementById( "dl_rpt_img"	    ).alt	= l10n.dl_report_img_alt;
		document.getElementById( "dl_rpt"	    ).href	= l10n.dl_report_link;
		document.getElementById( "dl_rpt"	    ).innerHTML	= l10n.dl_report_text;
		document.getElementById( "dl_rpt"	    ).title	= l10n.dl_report_title;

		// New Apache release policy since March 2018: Do not provide any MD5 checksums anymore as it is understood as too insecure.
		if( ( DL.VERSION_SEL === "4.1.14" || DL.VERSION_SEL === "4.1.13" || DL.VERSION_SEL === "4.1.12" || DL.VERSION_SEL === "4.1.11" || DL.VERSION_SEL === "4.1.10" || DL.VERSION_SEL === "4.1.9" || DL.VERSION_SEL === "4.1.8" || DL.VERSION_SEL === "4.1.7" || DL.VERSION_SEL === "4.1.6" || DL.VERSION_SEL === "4.2.0" ) ) {
			// If version is '4.1.6' (or newer), do not show any MD5 checksum file links.
			document.getElementById( "space4"	    ).innerHTML	= "";
			document.getElementById( "dl_f_chk_md5"	    ).href	= "";
			document.getElementById( "dl_f_chk_md5"	    ).innerHTML	= "";
			document.getElementById( "dl_f_chk_md5"	    ).title	= "";

			document.getElementById( "space8"	    ).innerHTML	= "";
			document.getElementById( "dl_lp_chk_md5"    ).href	= "";
			document.getElementById( "dl_lp_chk_md5"    ).innerHTML	= "";
			document.getElementById( "dl_lp_chk_md5"    ).title	= "";
		} else {
			// If version is '4.1.5' (or older), it's OK to show the MD5 checksum file links.
			DL.LINK_CHK_MD5_FULL = DL.ASF_ARC_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_FULL + ".md5";
			DL.LINK_CHK_MD5_LP   = DL.ASF_ARC_BASE_URL + "/binaries/" + DL.LANG_SEL + "/" + DL.FILENAME_LP   + ".md5";

			document.getElementById( "space3"	    ).innerHTML	= "";
			document.getElementById( "dl_f_chk_sha512"  ).href	= "";
			document.getElementById( "dl_f_chk_sha512"  ).innerHTML	= "";
			document.getElementById( "dl_f_chk_sha512"  ).title	= "";

			document.getElementById( "space7"	    ).innerHTML	= "";
			document.getElementById( "dl_lp_chk_sha512" ).href	= "";
			document.getElementById( "dl_lp_chk_sha512" ).innerHTML	= "";
			document.getElementById( "dl_lp_chk_sha512" ).title	= "";

			document.getElementById( "space4"	    ).innerHTML	= " , ";
			document.getElementById( "dl_f_chk_md5"	    ).href	= DL.LINK_CHK_MD5_FULL;
			document.getElementById( "dl_f_chk_md5"	    ).innerHTML	= l10n.dl_checksum_md5_text;
			document.getElementById( "dl_f_chk_md5"	    ).title	= l10n.dl_checksum_md5_title + DL.FILENAME_FULL;

			document.getElementById( "space8"	    ).innerHTML	= " , ";
			document.getElementById( "dl_lp_chk_md5"    ).href	= DL.LINK_CHK_MD5_LP;
			document.getElementById( "dl_lp_chk_md5"    ).innerHTML	= l10n.dl_checksum_md5_text;
			document.getElementById( "dl_lp_chk_md5"    ).title	= l10n.dl_checksum_md5_title + DL.FILENAME_LP;
		}

		// Show the CSS style for the normal sub-box and hide all elements for error text.
		document.getElementById( "sub_box"	    ).className	    = "sub-green-sel";
		document.getElementById( "dl_err_img"	    ).style.display = "none";
		document.getElementById( "dl_err"	    ).style.display = "none";

		// Show all elements with ID in the box and sub-box.
		// Set the cursor style for elements to default and make the elements visible.
		for( var i = 0, j = DL.ID_SUB_BOX.length; i < j; i++ ) {
			document.getElementById( DL.ID_SUB_BOX[ i ] ).style.display = "inline";
			document.getElementById( DL.ID_SUB_BOX[ i ] ).style.cursor  = "default";
		}

		// Show all elements with link in the box and sub-box.
		// Set the cursor style for elements with links to pointer and make the elements visible.
		for( var i = 0, j = DL.ID_LINKS.length; i < j; i++ ) {
			document.getElementById( DL.ID_LINKS[ i ] ).style.display   = "inline";
			document.getElementById( DL.ID_LINKS[ i ] ).style.cursor    = "pointer";
		}

		// Set the cursor style for the 3 links with icon to a help sign.
		document.getElementById( "dl_hlp_img"	    ).style.cursor  = "help";
		document.getElementById( "dl_hlp"	    ).style.cursor  = "help";
		document.getElementById( "dl_chk_img"	    ).style.cursor  = "help";
		document.getElementById( "dl_chk"	    ).style.cursor  = "help";
		document.getElementById( "dl_rpt_img"	    ).style.cursor  = "help";
		document.getElementById( "dl_rpt"	    ).style.cursor  = "help";

		// Make the sub-box and therefore all elements visible.
		document.getElementById( "sub_box"	    ).style.display = "block";
	}

	return;
}