Author: marcus
Date: Sun May  4 14:31:20 2014
New Revision: 1592352

URL: http://svn.apache.org/r1592352
Log:
Several different updates

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

Modified: openoffice/ooo-site/trunk/content/download/test/download_droplist.js
URL: 
http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/download/test/download_droplist.js?rev=1592352&r1=1592351&r2=1592352&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download_droplist.js 
(original)
+++ openoffice/ooo-site/trunk/content/download/test/download_droplist.js Sun 
May  4 14:31:20 2014
@@ -27,12 +27,17 @@
  */
 function init() {
        // Fill the OS, language and version drop-down box.
+
+       // Set global variables.
+       initVars();
+
+       // Set the select elements with values (defined browser data).
        fillOSSel()
        fillLangSel();
        fillVerSel();
 
-       // Set global variables.
-       initVars();
+       // Get the download link from the selected elements.
+       getLinkSel( 1 );
 }
 
 /*
@@ -50,6 +55,8 @@ function initVars() {
        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
+       LANG_SEL                                = "";    // The selected 
language as ISO code from drop-down-box
+       PLATFORM_SEL                            = "";    // The selected 
platform from drop-down-box
        VERSION_SEL                             = "";    // 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)
@@ -71,47 +78,57 @@ function initVars() {
        OTHER                                   = false; // Does the download 
URL points to 'other.html'?
        ARCHIVE                                 = false; // Does the download 
URL points to the ASF archive?
        ERROR                                   = false; // Is the download URL 
in general correct (false) or not (true)?
+
+       return;
 }
 
 /*
  * Output values of variables for debugging
  */
-function alertDbg( function_name ) {
+function alertDbg( location ) {
+
+       if( location == "" )
+               location = "No location named!";
+
        alert ( ""
-       + function_name                                                         
                                + "\n"
-       + "NL_LANG: "                           + "\t\t\t\t\t"          + 
NL_LANG                               + "\n"
-       + "LANG_ISO: "                          + "\t\t\t\t\t"          + 
LANG_ISO                              + "\n"
-       + "LANG_ARRAY: "                        + "\t\t\t\t\t"          + 
LANG_ARRAY                            + "\n"
+       + location                                                              
                                + "\n"
+       + "NL_LANG: "                           + "\t\t\t\t\t\t\t"      + 
NL_LANG                               + "\n"
+       + "LANG_ISO: "                          + "\t\t\t\t\t\t"        + 
LANG_ISO                              + "\n"
+       + "LANG_ARRAY: "                        + "\t\t\t\t\t\t"        + 
LANG_ARRAY                            + "\n"
        + "RELEASE_MATRIX_PLATFORM_POS_FULL: "  + "\t"                  + 
RELEASE_MATRIX_PLATFORM_POS_FULL      + "\n"
-       + "RELEASE_MATRIX_PLATFORM_POS_LP: "    + "\t"                  + 
RELEASE_MATRIX_PLATFORM_POS_LP        + "\n"
-       + "RELEASE_MATRIX_PLATFORM: "           + "\t\t"                + 
RELEASE_MATRIX_PLATFORM               + "\n"
-       + "RELEASE_MATRIX_LANG: "               + "\t\t\t"              + 
RELEASE_MATRIX_LANG                   + "\n"
-       + "isLangSupported(): "                 + "\t\t\t"              + 
isLangSupported()                     + "\n"
-       + "UI_PLATFORM: "                       + "\t\t\t\t\t"          + 
UI_PLATFORM                           + "\n"
-       + "URL_PLATFORM: "                      + "\t\t\t\t\t"          + 
URL_PLATFORM                          + "\n"
-       + "OLD_PLATFORM: "                      + "\t\t\t\t"            + 
OLD_PLATFORM                          + "\n"
-       + "VERSION_SEL: "                       + "\t\t\t\t\t"          + 
VERSION_SEL                           + "\n"
-       + "FILENAME_FULL: "                     + "\t\t\t\t"            + 
FILENAME_FULL                         + "\n"
-       + "FILENAME_LP: "                       + "\t\t\t\t\t"          + 
FILENAME_LP                           + "\n"
-       + "FILESIZE_FULL: "                     + "\t\t\t\t\t"          + 
FILESIZE_FULL                         + "\n"
-       + "FILESIZE_LP: "                       + "\t\t\t\t\t"          + 
FILESIZE_LP                           + "\n"
-       + "EXTENSION: "                         + "\t\t\t\t\t"          + 
EXTENSION                             + "\n"
+       + "RELEASE_MATRIX_PLATFORM_POS_LP: "    + "\t\t"                + 
RELEASE_MATRIX_PLATFORM_POS_LP        + "\n"
+       + "RELEASE_MATRIX_PLATFORM: "           + "\t\t\t"              + 
RELEASE_MATRIX_PLATFORM               + "\n"
+       + "RELEASE_MATRIX_LANG: "               + "\t\t\t\t"            + 
RELEASE_MATRIX_LANG                   + "\n"
+       + "isLangSupported(): "                 + "\t\t\t\t\t"          + 
isLangSupported()                     + "\n"
+       + "UI_PLATFORM: "                       + "\t\t\t\t\t\t"        + 
UI_PLATFORM                           + "\n"
+       + "URL_PLATFORM: "                      + "\t\t\t\t\t\t"        + 
URL_PLATFORM                          + "\n"
+       + "OLD_PLATFORM: "                      + "\t\t\t\t\t"          + 
OLD_PLATFORM                          + "\n"
+       + "LANG_SEL: "                          + "\t\t\t\t\t\t"        + 
LANG_SEL                              + "\n"
+       + "PLATFORM_SEL: "                      + "\t\t\t\t\t\t"        + 
PLATFORM_SEL                          + "\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"
+       + "FILESIZE_FULL: "                     + "\t\t\t\t\t\t"        + 
FILESIZE_FULL                         + "\n"
+       + "FILESIZE_LP: "                       + "\t\t\t\t\t\t"        + 
FILESIZE_LP                           + "\n"
+       + "EXTENSION: "                         + "\t\t\t\t\t\t"        + 
EXTENSION                             + "\n"
 //     + "TYPE: "                              + "\t\t\t\t\t\t"        + TYPE  
                                + "\n"
        + "SOURCEFORGE_BASE_URL: "              + "\t\t\t"              + 
SOURCEFORGE_BASE_URL                  + "\n"
 //     + "LINK: "                              + "\t\t\t\t\t\t"        + LINK  
                                + "\n"
-       + "LINK_FULL: "                         + "\t\t\t\t\t"          + 
LINK_FULL                             + "\n"
-       + "LINK_LP: "                           + "\t\t\t\t\t\t"        + 
LINK_LP                               + "\n"
-       + "LINK_CHECKSUM_ASC_FULL: "            + "\t\t\t\t"            + 
LINK_CHECKSUM_ASC_FULL                + "\n"
-       + "LINK_CHECKSUM_MD5_FULL: "            + "\t\t\t\t"            + 
LINK_CHECKSUM_MD5_FULL                + "\n"
-       + "LINK_CHECKSUM_SHA256_FULL: "         + "\t\t\t\t"            + 
LINK_CHECKSUM_SHA256_FULL             + "\n"
+       + "LINK_FULL: "                         + "\t\t\t\t\t\t"        + 
LINK_FULL                             + "\n"
+       + "LINK_LP: "                           + "\t\t\t\t\t\t\t"      + 
LINK_LP                               + "\n"
+       + "LINK_CHECKSUM_ASC_FULL: "            + "\t\t\t"              + 
LINK_CHECKSUM_ASC_FULL                + "\n"
+       + "LINK_CHECKSUM_MD5_FULL: "            + "\t\t\t"              + 
LINK_CHECKSUM_MD5_FULL                + "\n"
+       + "LINK_CHECKSUM_SHA256_FULL: "         + "\t\t\t"              + 
LINK_CHECKSUM_SHA256_FULL             + "\n"
        + "LINK_CHECKSUM_ASC_LP: "              + "\t\t\t\t"            + 
LINK_CHECKSUM_ASC_LP                  + "\n"
        + "LINK_CHECKSUM_MD5_LP: "              + "\t\t\t\t"            + 
LINK_CHECKSUM_MD5_LP                  + "\n"
-       + "LINK_CHECKSUM_SHA256_LP: "           + "\t\t\t\t"            + 
LINK_CHECKSUM_SHA256_LP               + "\n"
-       + "SOURCEFORGE: "                       + "\t\t\t\t\t"          + 
SOURCEFORGE                           + "\n"
-       + "OTHER: "                             + "\t\t\t\t\t\t"        + OTHER 
                                + "\n"
-       + "ARCHIVE: "                           + "\t\t\t\t\t\t"        + 
ARCHIVE                               + "\n"
-       + "ERROR: "                             + "\t\t\t\t\t\t"        + ERROR 
                                + "\n"
+       + "LINK_CHECKSUM_SHA256_LP: "           + "\t\t\t"              + 
LINK_CHECKSUM_SHA256_LP               + "\n"
+       + "SOURCEFORGE: "                       + "\t\t\t\t\t\t"        + 
SOURCEFORGE                           + "\n"
+       + "OTHER: "                             + "\t\t\t\t\t\t\t"      + OTHER 
                                + "\n"
+       + "ARCHIVE: "                           + "\t\t\t\t\t\t\t"      + 
ARCHIVE                               + "\n"
+       + "ERROR: "                             + "\t\t\t\t\t\t\t"      + ERROR 
                                + "\n"
        + "" );
+
+       return;
 }
 
 /*
@@ -121,9 +138,21 @@ function alertDbg( function_name ) {
 function getLanguage() {
        var language = "";
 
-       // Manual set ISO code (see "index.html") that overrides $LANG_ISO.
+//     alertDbg( "getLanguage()" );
+/*     alert( ""
+       + "getLanguage() : Begin" + "\n\n"
+       + "language: " + language + "\n\n"
+       + "NL_LANG: "  + NL_LANG  + "\n\n"
+       + "LANG_ISO: " + LANG_ISO + "\n\n"
+       + "LANG_SEL: " + LANG_SEL + "\n\n"
+       + "" );
+*/
+       // If available, use the manual set ISO code (see "index.html") that 
overrides $LANG_ISO.
        if ( NL_LANG != "" )
                language = NL_LANG;
+       // If available, use the selected language form drop-down-box.
+       if ( LANG_SEL != "" )
+               language = LANG_SEL;
        else if ( navigator.language )
                language = navigator.language;
        else if ( navigator.userLanguage )
@@ -189,7 +218,15 @@ function getLanguage() {
 
        var thisReleaseMatrixSet        = release_matrix_410[ LANG_ISO ];
        RELEASE_MATRIX_LANG             = thisReleaseMatrixSet[ 0 ];
-
+/*
+       alert( ""
+       + "getLanguage() : End"   + "\n\n"
+       + "language: " + language + "\n\n"
+       + "NL_LANG: "  + NL_LANG  + "\n\n"
+       + "LANG_ISO: " + LANG_ISO + "\n\n"
+       + "LANG_SEL: " + LANG_SEL + "\n\n"
+       + "" );
+*/
        return LANG_ISO;
 }
 
@@ -203,16 +240,19 @@ function fillOSSel() {
        var option = "";
 
        // Fill the <select> element until all OS's are used.
-       for( i = 0; i < SEL_OS.length; i = i + 4 ) {
+       for( i = 0; i < SEL_OS.length; i = i + 3 ) {
                option       = document.createElement( "option" );
-               // Assign the OS abbreviation as index value.
+               // Assign the platform abbreviation as index value.
                option.value = SEL_OS[ i ];
-               // Assign the UI name.
+               // Assign the UI platform name.
                option.text  = SEL_OS[ i + 1 ];
                sel_os.appendChild( option );
        }
-       // Set the first option as default.
-       sel_os.selectedIndex = 0;
+
+       // Get the platform from the browser data.
+       getPlatform();
+       // Set the recognized platform as default.
+       setOSSel();
 
        return;
 }
@@ -235,9 +275,11 @@ function fillLangSel() {
                option.text  = SEL_LANG[ i + 1 ];
                sel_lang.appendChild( option );
        }
-       // Set the first option as default.
-       sel_lang.selectedIndex = 0;
 
+       // Get the language from the browser data.
+       getLanguage();
+       // Set the recognized language as default.
+       setLangSel();
 /*
        alert( languages[0]["ast"] + " " + SEL_LANG.length );
 
@@ -250,8 +292,6 @@ function fillLangSel() {
                option.text  = languages[ i + 1 ] + " (" + languages[ i + 2 ] + 
")";
                sel_lang.appendChild( option );
        }
-       // Set the first option as default.
-       sel_lang.selectedIndex = 0;
 */
        return;
 }
@@ -274,37 +314,346 @@ function fillVerSel() {
                option.text  = SEL_VER[ i + 1 ];
                sel_ver.appendChild( option );
        }
-       // Set the first option as default.
-       sel_ver.selectedIndex = 0;
+
+       // Set the version from the $VERSION variable as default.
+       setVerSel();
 
        return;
 }
 
 /*
+ * Set value in the <select> element for OS (drop-down-box)
+ * Depends on OS data from browser
+ */
+function setOSSel() {
+       // Depending on $URL_PLATFORM assign the platform string of the release 
matrix.
+       var sel_os = document.getElementById( "os" );
+//     var sel_os_text = 
document.download.os.options[document.download.os.selectedIndex].text;
+//     PLATFORM_SEL = sel_os.value;
+
+/*
+       alert( ""
+       + "setOSSel() : Before switch"                                          
+ "\n\n"
+       + "URL_PLATFORM: "              + "\t\t\t"      + URL_PLATFORM          
+ "\n"
+       + "sel_os.selectedIndex: "      + "\t"          + sel_os.selectedIndex  
+ "\n"
+       + "sel_os.value: "              + "\t\t\t"      + sel_os.value          
+ "\n"
+       + "sel_os_text: "               + "\t\t\t"      + sel_os_text           
+ "\n"
+       + "PLATFORM_SEL: "              + "\t\t\t"      + PLATFORM_SEL          
+ "\n"
+       + "\n\n"
+       + "" );
+*/
+
+//     URL_PLATFORM = "";
+
+       // Set the recognized browser platform as default for the drop-down-box.
+//     alert( "SEL_OS.length: " + SEL_OS.length / 3 );
+//     alert( "URL_PLATFORM: " + URL_PLATFORM );
+//     alert( "sel_os.selectedIndex: " + sel_os.selectedIndex );
+       for( var i = 0; i < SEL_OS.length; i = i + 3 ) {
+               // If the platform was found, assign the found index to the 
drop-down-box.
+//             alert( "i: " + i / 2 + "\n" + "SEL_OS[ i ]: " + SEL_OS[ i ] );
+               if ( SEL_OS[ i ] == URL_PLATFORM ) {
+                       sel_os.selectedIndex = i / 3;
+//                     alert( "Assigned: " + i / 3 );
+                       break;
+               }
+       }
+
+       // If no selected platform for was set in the drop-down-box because it 
was not recognized from browser data,
+       // assign "Windows" as default.
+//     alert( "sel_os.selectedIndex: " + sel_os.selectedIndex );
+       if( sel_os.selectedIndex == 0 ) {
+               // Default: Assign "Windows".
+//             alert( "SEL_OS.length: " + SEL_OS.length / 3 );
+               for( var i = 0; i < SEL_OS.length; i = i + 3 ) {
+                       // If the platform was found, assign the found index to 
the drop-down-box.
+//                     alert( "i: " + i / 2 + "\n" + "SEL_OS[ i ]: " + SEL_OS[ 
i ] );
+                       if ( SEL_OS[ i ] == "Win_x86_install" ) {
+                               sel_os.selectedIndex = i / 3;
+//                             alert( "Assigned: " + i / 3 );
+                               break;
+                       }
+               }
+       }
+/*
+       switch ( URL_PLATFORM ) {
+               case "Linux_x86-64_install-deb":
+                       sel_os.selectedIndex = 3;
+                       break;
+               case "Linux_x86-64_install-rpm":
+                       sel_os.selectedIndex = 4;
+                       break;
+               case "Linux_x86_install-deb":
+                       sel_os.selectedIndex = 5;
+                       break;
+               case "Linux_x86_install-rpm":
+                       sel_os.selectedIndex = 6;
+                       break;
+               case "MacOS_x86-64_install":
+                       sel_os.selectedIndex = 7;
+                       break;
+               case "MacOS_x86_install":
+                       sel_os.selectedIndex = 8;
+                       break;
+               case "Win_x86_install":
+                       sel_os.selectedIndex = 2;
+                       break;
+               default:
+                       // Default: Assign Windows.
+                       for( var i = 0; i < SEL_OS.length; i = i + 3 ) {
+                               // If the platform was found, assign the found 
index to the drop-down-box.
+                               if ( SEL_OS[ i ] == "Win_x86_install" ) {
+                                       sel_os.selectedIndex = i/3;
+                                       break;
+                               }
+                       }
+                       // Assign the platform of the index value.
+                       // sel_os.selectedIndex = 2;
+       }
+*/
+//     sel_os_text = 
document.download.os.options[document.download.os.selectedIndex].text;
+       PLATFORM_SEL = sel_os.value;
+/*
+       alert( ""
+       + "setOSSel() : After switch"                                           
+ "\n\n"
+       + "URL_PLATFORM: "              + "\t\t\t"      + URL_PLATFORM          
+ "\n"
+       + "sel_os.selectedIndex: "      + "\t"          + sel_os.selectedIndex  
+ "\n"
+       + "sel_os.value: "              + "\t\t\t"      + sel_os.value          
+ "\n"
+       + "sel_os_text: "               + "\t\t\t"      + sel_os_text           
+ "\n"
+       + "PLATFORM_SEL: "              + "\t\t\t"      + PLATFORM_SEL          
+ "\n"
+       + "\n\n"
+       + "" );
+*/
+       return PLATFORM_SEL;
+}
+
+/*
+ * Set value in the <select> element for language (drop-down-box)
+ * Depends on language data from browser
+ */
+function setLangSel() {
+       // Depending on $LANG_ISO assign the language position of the release 
matrix.
+       var sel_lang = document.getElementById( "lang" );
+//     var sel_lang_text = 
document.download.lang.options[document.download.lang.selectedIndex].text;
+//     LANG_SEL = sel_lang.value;
+/*
+       alert( ""
+       + "setLangSel() : Before switch"                                        
        + "\n\n"
+       + "LANG_ISO: "                  + "\t\t\t"      + LANG_ISO              
        + "\n"
+       + "sel_lang.selectedIndex: "    + "\t"          + 
sel_lang.selectedIndex        + "\n"
+       + "sel_lang.value: "            + "\t\t\t"      + sel_lang.value        
        + "\n"
+       + "sel_lang_text: "             + "\t\t\t"      + sel_lang_text         
        + "\n"
+       + "LANG_SEL: "                  + "\t\t\t"      + LANG_SEL              
        + "\n"
+       + "\n\n"
+       + "" );
+*/
+
+//     LANG_ISO = "";
+
+       // Set the recognized browser language as default for the drop-down-box.
+//     alert( "SEL_LANG.length: " + SEL_LANG.length / 2 );
+//     alert( "LANG_ISO: " + LANG_ISO );
+//     alert( "sel_lang.selectedIndex: " + sel_lang.selectedIndex );
+       for( var i = 0; i < SEL_LANG.length; i = i + 2 ) {
+               // If the language was found, assign the found index to the 
drop-down-box.
+//             alert( "i: " + i / 2 + "\n" + "SEL_LANG[ i ]: " + SEL_LANG[ i ] 
);
+               if ( SEL_LANG[ i ] == LANG_ISO ) {
+                       sel_lang.selectedIndex = i / 2;
+//                     alert( "Assigned: " + i / 2 );
+                       break;
+               }
+       }
+
+       // If no selected language was set in the drop-down-box because it was 
not recognized from browser data,
+       // assign "en-US" as default.
+//     alert( "sel_lang.selectedIndex: " + sel_lang.selectedIndex );
+       if( sel_lang.selectedIndex == 0 ) {
+               // Default: Assign "en-US".
+//             alert( "SEL_LANG.length: " + SEL_LANG.length / 2 );
+               for( var i = 0; i < SEL_LANG.length; i = i + 2 ) {
+                       // If the language was found, assign the found index to 
the drop-down-box.
+//                     alert( "i: " + i / 2 + "\n" + "SEL_LANG[ i ]: " + 
SEL_LANG[ i ] );
+                       if ( SEL_LANG[ i ] == "en-US" ) {
+                               sel_lang.selectedIndex = i / 2;
+//                             alert( "Assigned: " + i / 2 );
+                               break;
+                       }
+               }
+       }
+/*
+       switch ( LANG_ISO ) {
+               case "ast":
+                       sel_lang.selectedIndex = 2;
+                       break;
+               case "de":
+                       sel_lang.selectedIndex = 15;
+                       break;
+               default:
+                       // Default: Assign en-US.
+                       for( var i = 0; i < SEL_LANG.length; i = i + 2 ) {
+                               // If the language was found, assign the found 
index to the drop-down-box.
+                               if ( SEL_LANG[ i ] == "en-US" ) {
+                                       sel_lang.selectedIndex = i/2;
+                                       break;
+                               }
+                       }
+                       // Assign the language of the index value.
+                       // sel_lang.selectedIndex = 11;
+       }
+*/
+//     sel_lang_text = 
document.download.lang.options[document.download.lang.selectedIndex].text;
+       LANG_SEL = sel_lang.value;
+/*
+       alert( ""
+       + "setLangSel() : After switch"                                         
        + "\n\n"
+       + "LANG_ISO: "                  + "\t\t\t"      + LANG_ISO              
        + "\n"
+       + "sel_lang.selectedIndex: "    + "\t"          + 
sel_lang.selectedIndex        + "\n"
+       + "sel_lang.value: "            + "\t\t\t"      + sel_lang.value        
        + "\n"
+       + "sel_lang_text: "             + "\t\t\t"      + sel_lang_text         
        + "\n"
+       + "LANG_SEL: "                  + "\t\t\t"      + LANG_SEL              
        + "\n"
+       + "\n\n"
+       + "" );
+*/
+       return LANG_SEL;
+}
+
+/*
+ * Set value in the <select> element for version (drop-down-box)
+ * Depends on nothing
+ */
+function setVerSel() {
+       // Depending on $VERSION assign the version.
+       var sel_ver = document.getElementById( "ver" );
+//     var sel_ver_text = 
document.download.ver.options[document.download.ver.selectedIndex].text;
+//     VERSION_SEL = sel_ver.value;
+
+//     VERSION = "";
+
+       // Set the value of $VERSION as default for the drop-down-box.
+//     alert( "SEL_VER.length: " + SEL_VER.length / 2 );
+//     alert( "VERSION: " + VERSION );
+//     alert( "sel_ver.selectedIndex: " + sel_ver.selectedIndex );
+       for( var i = 0; i < SEL_VER.length; i = i + 2 ) {
+               // If the version was found, assign the found index to the 
drop-down-box.
+//             alert( "i: " + i / 2 );
+               if ( SEL_VER[ i ] == VERSION ) {
+                       sel_ver.selectedIndex = i/2;
+//                     alert( "Assigned: " + i / 2 );
+                       break;
+               }
+       }
+
+       // If no version was set as global variable,
+       // assign the most recent version as default.
+//     alert( "sel_lang.selectedIndex: " + sel_lang.selectedIndex );
+       if( sel_ver.selectedIndex == 0 ) {
+               // Default: Assign "4.1.0".
+//             alert( "SEL_VER.length: " + SEL_VER.length / 2 );
+               for( var i = 0; i < SEL_VER.length; i = i + 2 ) {
+                       // If the version was found, assign the found index to 
the drop-down-box.
+//                     alert( "i: " + i / 2 + "\n" + "SEL_VER[ i ]: " + 
SEL_VER[ i ] );
+                       if ( SEL_VER[ i ] == "4.1.0" ) {
+                               sel_ver.selectedIndex = i / 2;
+//                             alert( "Assigned: " + i / 2 );
+                               break;
+                       }
+               }
+       }
+/*
+       switch ( VERSION ) {
+               case "4.1.0":
+                       sel_ver.selectedIndex = 2;
+                       break;
+               case "4.0.1":
+                       sel_ver.selectedIndex = 3;
+                       break;
+               case "4.0.0":
+                       sel_ver.selectedIndex = 4;
+                       break;
+               case "3.4.1":
+                       sel_ver.selectedIndex = 5;
+                       break;
+               default:
+                       // Default: Assign the most recent version.
+                       // Search for the index value of the most recent 
version.
+                       for( var i = 0; i < SEL_VER.length; i = i + 2 ) {
+                               // If the version was found, assign the found 
index to the drop-down-box.
+                               if ( SEL_VER[ i ] == "4.1.0 ) {
+                                       sel_ver.selectedIndex = i/2;
+                                       break;
+                               }
+                       }
+                       // Assign the version of the index value.
+                       // sel_ver.selectedIndex = 2;
+       }
+*/
+//     sel_ver_text = 
document.download.ver.options[document.download.ver.selectedIndex].text;
+       VERSION_SEL = sel_ver.value;
+
+       return VERSION_SEL;
+}
+
+/*
  * Get values from the <select> element for OS (drop-down-box)
  * Depends on chosen OS
  */
 function getOSSel() {
+       var sel_os   = document.getElementById( "os" );
        var os_value = 
document.download.os.options[document.download.os.selectedIndex].value;
        var i        = 0;
+/*
+       alert( ""
+       + "getOSSel() : Before if + for"                                        
+ "\n\n"
+       + "os_value: "                          + "\t\t\t"      + os_value      
+ "\n"
+       + "\n\n"
+       + "" );
+*/
+//     alertDbg( "getOSSel() : Before if + for" );
 
        // If one of the first 2 <select> elements was chosen, let the user 
chose again.
-       if ( os_value == "e1" || os_value == "e2" ) {
+       if ( os_value == "e0" || os_value == "e1" ) {
+               PLATFORM_SEL    = "";
                UI_PLATFORM     = "";
                URL_PLATFORM    = "";
                EXTENSION       = "";
+               sel_os.selectedIndex = 0;
+               resetSel();
                return;
        }
        // Search through the <select> element until the chosen OS is found.
-       for( i = 0; i < SEL_OS.length; i = i + 4 ) {
+       for( i = 0; i < SEL_OS.length; i = i + 3 ) {
                if ( SEL_OS[ i ] == os_value ) {
+                       PLATFORM_SEL    = SEL_OS[ i ];
                        UI_PLATFORM     = SEL_OS[ i + 1 ];
-                       URL_PLATFORM    = SEL_OS[ i + 2 ];
-                       EXTENSION       = SEL_OS[ i + 3 ];
+                       EXTENSION       = SEL_OS[ i + 2 ];
+/*
+       alert( ""
+       + "getOSSel() : Within 'for'"                                           
+ "\n\n"
+       + "i: "                                 + "\t\t\t\t\t"  + i             
+ "\n"
+       + "os_value: "                          + "\t\t\t"      + os_value      
+ "\n"
+       + "SEL_OS[ i ]: "                       + "\t\t"        + SEL_OS[ i ]   
+ "\n"
+       + "SEL_OS[ i + 1 ]: "                   + "\t\t"        + SEL_OS[ i + 1 
]       + "\n"
+       + "SEL_OS[ i + 2 ]: "                   + "\t\t"        + SEL_OS[ i + 2 
]       + "\n"
+       + "PLATFORM_SEL: "                      + "\t\t"        + PLATFORM_SEL  
+ "\n"
+       + "UI_PLATFORM: "                       + "\t\t"        + UI_PLATFORM   
+ "\n"
+       + "EXTENSION: "                         + "\t\t\t"      + EXTENSION     
+ "\n"
+       + "\n\n"
+       + "" );
+*/
                        break;
                }
        }
 
+       URL_PLATFORM = PLATFORM_SEL;
+
+//     alertDbg( "getOSSel() : After if + for" );
+/*
+       alert( ""
+       + "getOSSel() : After if + for"                                 + "\n\n"
+       + "os_value: "                  + "\t\t\t"      + os_value      + "\n"
+       + "\n\n"
+       + "" );
+*/
        return;
 }
 
@@ -313,22 +662,58 @@ function getOSSel() {
  * Depends on chosen language
  */
 function getLangSel() {
+       var sel_lang   = document.getElementById( "lang" );
        var lang_value = 
document.download.lang.options[document.download.lang.selectedIndex].value;
        var i          = 0;
 
+//     alert( "getLangSel() : Before if + for" + "\n\n" + "LANG_ISO: " + 
LANG_ISO + "\n" + "LANG_SEL: " + LANG_SEL );
+
+/*
+       alert( ""
+       + "getLangSel() : Before if + for"                                      
        + "\n\n"
+       + "lang_value: "                        + "\t\t\t"      + lang_value    
        + "\n"
+       + "\n\n"
+       + "" );
+*/
+//     alertDbg( "getLangSel() : Before if + for" );
+
        // If one of the first 2 <select> elements was chosen, let the user 
chose again.
-       if ( lang_value == "e1" || lang_value == "e2" ) {
-               LANG_ISO = "";
+       if ( lang_value == "e0" || lang_value == "e1" ) {
+               LANG_SEL = "";
+               sel_lang.selectedIndex = 0;
+               resetSel();
                return;
        }
        // Search through the <select> element until the chosen language is 
found.
        for( i = 0; i < SEL_LANG.length; i = i + 2 ) {
                if ( SEL_LANG[ i ] == lang_value ) {
-                       LANG_ISO = lang_value;
+                       LANG_SEL = lang_value;
+/*
+       alert( ""
+       + "getLangSel() : Within 'for'"                                 + "\n\n"
+       + "i: "                         + "\t\t\t\t\t"  + i             + "\n"
+       + "lang_value: "                + "\t\t\t"      + lang_value    + "\n"
+       + "SEL_LANG[ i ]: "             + "\t\t"        + SEL_LANG[ i ] + "\n"
+       + "LANG_SEL: "                  + "\t\t"        + LANG_SEL      + "\n"
+       + "\n\n"
+       + "" );
+*/
                        break;
                }
        }
 
+       LANG_ISO = LANG_SEL;
+       getLanguage();
+//     alert( "getLangSel() : End" + "\n\n" + "LANG_ISO: " + LANG_ISO + "\n" + 
"LANG_SEL: " + LANG_SEL );
+
+//     alertDbg( "getLangSel() : After if + for" );
+/*
+       alert( ""
+       + "getLangSel() : After if + for"                                       
        + "\n\n"
+       + "lang_value: "                        + "\t\t\t"      + lang_value    
        + "\n"
+       + "\n\n"
+       + "" );
+*/
        return;
 }
 
@@ -337,12 +722,15 @@ function getLangSel() {
  * Depends on chosen version
  */
 function getVerSel() {
+       var sel_ver   = document.getElementById( "ver" );
        var ver_value = 
document.download.ver.options[document.download.ver.selectedIndex].value;
        var i         = 0;
 
        // If one of the first 2 <select> elements was chosen, let the user 
chose again.
-       if ( ver_value == "e1" || ver_value == "e2" ) {
+       if ( ver_value == "e0" || ver_value == "e1" ) {
                VERSION_SEL = "";
+               sel_ver.selectedIndex = 0;
+               resetSel();
                return;
        }
        // Search through the <select> element until the chosen version is 
found.
@@ -388,11 +776,11 @@ function resetSel() {
        var elements = document.getElementsByTagName( "select" );
 
        // Set the first option as default for all <select> elements.
-       for ( var i = 0; i < elements.length; i++ ) {
-               elements[i].selectedIndex = 0;
-       }
+       // for ( var i = 0; i < elements.length; i++ ) {
+       //      elements[i].selectedIndex = 0;
+       // }
 
-       // Set the text and URLs beow the <selects> elements-
+       // Emtpy the text and URLs below the <selects> elements.
        document.getElementById( "dl_full_link" ).href          = "";
        document.getElementById( "dl_full_link" ).text          = "";
        document.getElementById( "dl_full_link" ).title         = "";
@@ -405,8 +793,17 @@ function resetSel() {
        document.getElementById( "dl_help_img" ).alt            = "";
        document.getElementById( "dl_help_img" ).text           = "";
        document.getElementById( "dl_help_img" ).title          = "";
+       document.getElementById( "dl_report1" ).href            = "";
+       document.getElementById( "dl_report1" ).title           = "";
+       document.getElementById( "dl_report2" ).href            = "";
+       document.getElementById( "dl_report2" ).text            = "";
+       document.getElementById( "dl_report2" ).title           = "";
+       document.getElementById( "dl_report_img" ).src          = "";
+       document.getElementById( "dl_report_img" ).alt          = "";
+//     document.getElementById( "dl_rel_data" ).text           = "";
+//     document.getElementById( "dl_rel_data" ).title          = "";
+       document.getElementById( "dl_rel_data_hl" ).text        = "Release 
data: ";
        document.getElementById( "dl_rel_data" ).text           = "";
-       document.getElementById( "dl_rel_data" ).title          = "";
        document.getElementById( "dl_full_hl" ).text            = "Full 
installation: ";
        document.getElementById( "dl_full_size_hl" ).text       = "";
        document.getElementById( "dl_full_size" ).text          = "";
@@ -457,10 +854,16 @@ function resetSel() {
  * Open a popup window
  * Depends on received target link
  */
-function showPopup( target_url ) {
-       // Open a popup window to show the file from the "target_url".
-       popupWindow = window.open( target_url, "", "location=no", "width=600, 
height=500, left=100, top=200");
-       popupWindow.focus();
+function showWindow( target_link ) {
+       // Open a popup window to show the file from the "target_link".
+       window = window.open( target_link, "", "location=no", "width=600, 
height=500, left=100, top=200");
+       window.focus();
+/*
+       alert( ""
+       + "showWindow( " + type + ", " + target_link + " ): " + "\n"
+       + type + " is not supported. Allowed are 1 = popup and 2 = window."
+       + "" );
+*/
 }
 
 /*
@@ -472,7 +875,7 @@ function isLangSupported() {
        // Check the flag in "languages.js", 'y' -> provide download link, 'n' 
-> redirect to alternative webpage.
        // Check the flag in "release_matrix.js", 'y' -> provide download link, 
'n' -> redirect to alternative webpage.
 //     if ( LANG_ARRAY[ 3 ] == 'y' ) {
-       if ( RELEASE_MATRIX_LANG[ 1 ] == 'y' ) {
+       if ( RELEASE_MATRIX_LANG[ 3 ] == 'y' ) {
                return true;
        } else {
                ERROR = true;
@@ -605,54 +1008,57 @@ function getLink( rel_mode ) {
  * Depends on chosen OS, language and type
  */
 function getLinkSel( rel_mode ) {
-       var a, b, c, d = "";
-
-       // Delete any previously set strings
-       LINK_CHECKSUM_ASC_FULL    = "";
-       LINK_CHECKSUM_MD5_FULL    = "";
-       LINK_CHECKSUM_SHA256_FULL = "";
-
-       // reset all global variables
-       initVars();
+       var rel_data = "";
 
        // If no release mode was given, assume it is about the stable release.
        if ( rel_mode == undefined )
                rel_mode = 1;
 
+       // Get the selected data from the drop-down-boxes.
        getOSSel();
        getLangSel();
        getVerSel();
 
+//     alert( "getLinkSel()" + "\n\n" + "NL_LANG: " + NL_LANG );
+/*     alert( ""
+       + "getLinkSel() : Begin" + "\n\n"
+       + "NL_LANG: "  + NL_LANG  + "\n\n"
+       + "LANG_ISO: " + LANG_ISO + "\n\n"
+       + "LANG_SEL: " + LANG_SEL + "\n\n"
+       + "" );
+*/
 //     if ( URL_PLATFORM == "" || LANG_ISO == "" ) {
-       if ( URL_PLATFORM == "" || LANG_ISO == "" || VERSION_SEL == "" ) {
+//     if ( URL_PLATFORM == "" || LANG_ISO == "" || VERSION_SEL == "" ) {
+       if ( PLATFORM_SEL == "" || LANG_SEL == "" || VERSION_SEL == "" ) {
                // When OS or language was not chosen, let the user choose 
again.
                // When OS, language or version was not chosen, let the user 
choose again.
-//             resetSel();
+               // resetSel();
 
                return;
        }
 
        getFilesize();
-       getFilename( VERSION );
+       getFilename( VERSION_SEL );
 
 //     if ( URL_PLATFORM != "" && LANG_ISO != "" ) {
-       if ( URL_PLATFORM != "" && LANG_ISO != "" && VERSION_SEL != "" ) {
+//     if ( URL_PLATFORM != "" && LANG_ISO != "" && VERSION_SEL != "" ) {
+       if ( PLATFORM_SEL != "" && LANG_SEL != "" && VERSION_SEL != "" ) {
 
-               if ( LANG_ISO != "" && RELEASE_MATRIX_PLATFORM_POS_FULL > -1 ) {
+               if ( LANG_SEL != "" && RELEASE_MATRIX_PLATFORM_POS_FULL > -1 ) {
                        // If language and platform are recognized, assemble 
the filenames for download and checksums.
 
                        // Assign the file name (column 3) from the release 
matrix of language and platform.
-                       LINK_FULL                 = SOURCEFORGE_BASE_URL + 
LANG_ISO + "/" + FILENAME_FULL + "/download";
-                       LINK_LP                   = SOURCEFORGE_BASE_URL + 
LANG_ISO + "/" + FILENAME_LP   + "/download";
+                       LINK_FULL                 = SOURCEFORGE_BASE_URL + 
LANG_SEL + "/" + FILENAME_FULL + "/download";
+                       LINK_LP                   = SOURCEFORGE_BASE_URL + 
LANG_SEL + "/" + FILENAME_LP   + "/download";
 
                        LINK_CHECKSUM_KEYS        = 
"https://people.apache.org/keys/group/openoffice.asc";;
-                       LINK_CHECKSUM_ASC_FULL    = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_ISO + "/" + FILENAME_FULL + ".asc";
-                       LINK_CHECKSUM_MD5_FULL    = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_ISO + "/" + FILENAME_FULL + ".md5";
-                       LINK_CHECKSUM_SHA256_FULL = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_ISO + "/" + FILENAME_FULL + ".sha256";
-
-                       LINK_CHECKSUM_ASC_LP      = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_ISO + "/" + FILENAME_LP + ".asc";
-                       LINK_CHECKSUM_MD5_LP      = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_ISO + "/" + FILENAME_LP + ".md5";
-                       LINK_CHECKSUM_SHA256_LP   = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_ISO + "/" + FILENAME_LP + ".sha256";
+                       LINK_CHECKSUM_ASC_FULL    = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_SEL + "/" + FILENAME_FULL + ".asc";
+                       LINK_CHECKSUM_MD5_FULL    = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_SEL + "/" + FILENAME_FULL + ".md5";
+                       LINK_CHECKSUM_SHA256_FULL = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_SEL + "/" + FILENAME_FULL + ".sha256";
+
+                       LINK_CHECKSUM_ASC_LP      = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_SEL + "/" + FILENAME_LP + ".asc";
+                       LINK_CHECKSUM_MD5_LP      = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_SEL + "/" + FILENAME_LP + ".md5";
+                       LINK_CHECKSUM_SHA256_LP   = APACHE_DIST_BASE_URL + 
"/binaries/" + LANG_SEL + "/" + FILENAME_LP + ".sha256";
 
                        SOURCEFORGE             = true;
                        OTHER                   = false;
@@ -660,29 +1066,36 @@ function getLinkSel( rel_mode ) {
                        ERROR                   = false;
                }
 
-               a = "Milestone " + MILESTONE + " | Build ID " + BUILD + " | SVN 
" + SVN_REV + " | Released: " + REL_DATE;
-               b = "Milestone " + MILESTONE + " | Build ID " + BUILD + " | SVN 
" + SVN_REV + " | Released: " + REL_DATE;
-               c = FILESIZE_FULL + " MByte";
-               d = FILESIZE_LP   + " MByte";
+               rel_data = "Milestone " + MILESTONE + " | Build ID " + BUILD + 
" | SVN " + SVN_REV + " | Released: " + REL_DATE;
 
+               // Set the text and URLs below the <selects> elements.
                document.getElementById( "dl_full_link" ).href          = 
LINK_FULL;
-               document.getElementById( "dl_full_link" ).text          = 
"Download full install";
+               document.getElementById( "dl_full_link" ).text          = 
"Download install";
                document.getElementById( "dl_full_link" ).title         = 
"Click to download: " + FILENAME_FULL;
                document.getElementById( "dl_lp_link" ).href            = 
LINK_LP;
-               document.getElementById( "dl_lp_link" ).text            = 
"Download language pack";
+               document.getElementById( "dl_lp_link" ).text            = 
"Download langpack";
                document.getElementById( "dl_lp_link" ).title           = 
"Click to download: " + FILENAME_LP;
                document.getElementById( "dl_help" ).href               = 
"full_vs_lp.html";
                document.getElementById( "dl_help" ).title              = "What 
is the difference between full installation and language pack?";
-               document.getElementById( "dl_help_img" ).src            = 
"../cachedimages/help-icon.png";
+               document.getElementById( "dl_help_img" ).src            = 
"../cachedimages/help-information-icon.png";
                document.getElementById( "dl_help_img" ).alt            = "Help 
icon";
-               document.getElementById( "dl_help_img" ).text           = "What 
is the difference between full install and language pack?";
-               document.getElementById( "dl_help_img" ).title          = "What 
is the difference between full install and language pack?";
-               document.getElementById( "dl_rel_data" ).text           = a;
-               document.getElementById( "dl_rel_data" ).title          = b;
+               document.getElementById( "dl_report1" ).href            = 
"analyze.html";
+               document.getElementById( "dl_report1" ).title           = 
"Broken download link? Click here to report.";
+               document.getElementById( "dl_report2" ).href            = 
"analyze.html";
+               document.getElementById( "dl_report2" ).text            = 
"Report broken link";
+               document.getElementById( "dl_report2" ).title           = 
"Broken download link? Click here to report.";
+               document.getElementById( "dl_report_img" ).src          = 
"../cachedimages/help-report-broken-link-icon.png";
+               document.getElementById( "dl_report_img" ).alt          = 
"Broken link icon";
+               document.getElementById( "dl_help" ).href               = 
"full_vs_lp.html";
+               document.getElementById( "dl_help" ).title              = "What 
is the difference between full installation and language pack?";
+//             document.getElementById( "dl_rel_data" ).text           = 
rel_data;
+//             document.getElementById( "dl_rel_data" ).title          = 
rel_data;
 
+               document.getElementById( "dl_rel_data_hl" ).text        = 
"Release data: ";
+               document.getElementById( "dl_rel_data" ).text           = 
rel_data;
                document.getElementById( "dl_full_hl" ).text            = "Full 
installation: ";
                document.getElementById( "dl_full_size_hl" ).text       = 
"Filesize ~ ";
-               document.getElementById( "dl_full_size" ).text          = c;
+               document.getElementById( "dl_full_size" ).text          = 
FILESIZE_FULL + " MByte";
                document.getElementById( "space1" ).text                = " | ";
                document.getElementById( "dl_full_chk_hl" ).text        = 
"Signatures and hashes: ";
                document.getElementById( "dl_full_chk_keys" ).href      = 
LINK_CHECKSUM_KEYS;
@@ -706,7 +1119,7 @@ function getLinkSel( rel_mode ) {
                document.getElementById( "dl_chk_verify" ).title        = "How 
to verify the download with checksums?";
                document.getElementById( "dl_lp_hl" ).text              = 
"Language pack: ";
                document.getElementById( "dl_lp_size_hl" ).text         = 
"Filesize ~ ";
-               document.getElementById( "dl_lp_size" ).text            = d;
+               document.getElementById( "dl_lp_size" ).text            = 
FILESIZE_LP   + " MByte";
                document.getElementById( "space6" ).text                = " | ";
                document.getElementById( "dl_lp_chk_hl" ).text          = 
"Signatures and hashes: ";
                document.getElementById( "dl_lp_chk_keys" ).href        = 
LINK_CHECKSUM_KEYS;
@@ -726,6 +1139,8 @@ function getLinkSel( rel_mode ) {
                document.getElementById( "dl_lp_chk_sha256" ).title     = 
"SHA256 hash for: " + FILENAME_LP;
        }
 
+//     alertDbg( "getLinkSel()" );
+
        return;
 }
 
@@ -900,6 +1315,7 @@ function getPlatform() {
  */
 function getFilename( ver ) {
        // Assemble the filename for download from the release matrix of 
language and platform (column 0).
+       // Product name + version + platform as URL part + language ISO + file 
extension.
        FILENAME_FULL   = "Apache_OpenOffice_" + ver + "_" + 
release_matrix_410[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS_FULL ][ 0 ] + "_" + 
LANG_ISO + EXTENSION;
        FILENAME_LP     = "Apache_OpenOffice_" + ver + "_" + 
release_matrix_410[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS_LP   ][ 0 ] + "_" + 
LANG_ISO + EXTENSION;
 


Reply via email to