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/03/29 13:22:35 UTC
svn commit: r1582994 -
/openoffice/ooo-site/trunk/content/download/test/download_droplist.js
Author: marcus
Date: Sat Mar 29 12:22:35 2014
New Revision: 1582994
URL: http://svn.apache.org/r1582994
Log:
New JS file to support the droplist boxes
Added:
openoffice/ooo-site/trunk/content/download/test/download_droplist.js (with props)
Added: 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=1582994&view=auto
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download_droplist.js (added)
+++ openoffice/ooo-site/trunk/content/download/test/download_droplist.js Sat Mar 29 12:22:35 2014
@@ -0,0 +1,283 @@
+/*
+ * Overview of all functions defined below
+ * ---------------------------------------
+ * function getLanguage ()
+ * function hasMirrorLink ( rel_mode )
+ * function getLink ( rel_mode )
+ * function getPlatform ( rel_mode )
+ * function openItem ( itemid, uri )
+ */
+
+/*
+ * Define global variables
+ */
+var LANG_ISO = ""; // The language as ISO code
+var LANG_ARRAY = ""; // This array contains all language specific data
+var RELEASE_MATRIX_PLATFORM_POS = -1; // The position of the platform in the release matrix array
+var RELEASE_MATRIX_PLATFORM = ""; // The platform in the release matrix array
+var UI_PLATFORM = ""; // The platform as readable string
+var URL_PLATFORM = ""; // The platform as part of the download URL
+var OLD_PLATFORM = false; // The browser platform is old (true) or not (false)
+var FILENAME = ""; // The complete filename of the download URL
+var FILESIZE = 0; // The filesize of the download file
+var EXTENSION = ""; // The file extension of the download URL
+var LINK = ""; // The complete download URL
+var CHECKSUM_KEYS = ""; // The KEYS file as download URL
+var CHECKSUM_ASC = ""; // The ASC file as download URL
+var CHECKSUM_MD5 = ""; // The MD5 file as download URL
+var CHECKSUM_SHA256 = ""; // The SHA256 file as download URL
+var SOURCEFORGE = false; // The download URL points to Soureforge
+var OTHER = false; // The download URL points to 'other.html'
+var ARCHIVE = false; // The download URL points to the ASF archive
+var ERROR = false; // The download URL is correct (false) or not (true)?
+
+function get_os() {
+ var os_value = document.download.os.options[document.download.os.selectedIndex].value;
+ switch ( os_value ) {
+ case "win32":
+ UI_PLATFORM = "Windows (EXE)";
+ URL_PLATFORM = "Win_x86_install";
+ EXTENSION = ".exe";
+ break;
+ case "lnx32r":
+ UI_PLATFORM = "Linux 32-bit (RPM)";
+ URL_PLATFORM = "Linux_x86_install-rpm";
+ EXTENSION = ".tar.gz";
+ break;
+ case "lnx32d":
+ UI_PLATFORM = "Linux Debian 32-bit (DEB)";
+ URL_PLATFORM = "Linux_x86_install-deb";
+ EXTENSION = ".tar.gz";
+ break;
+ case "lnx64r":
+ UI_PLATFORM = "Linux 64-bit (RPM)";
+ URL_PLATFORM = "Linux_x86-64_install-rpm";
+ EXTENSION = ".tar.gz";
+ break;
+ case "lnx64d":
+ UI_PLATFORM = "Linux Debian 64-bit (DEB)";
+ URL_PLATFORM = "Linux_x86-64_install-deb";
+ EXTENSION = ".tar.gz";
+ break;
+ case "mac32":
+ UI_PLATFORM = "OS X 64-bit Intel (DMG)";
+ URL_PLATFORM = "MacOSx86_install";
+ EXTENSION = ".dmg";
+ break;
+ case "mac64":
+ UI_PLATFORM = "OS X 64-bit Intel (DMG)";
+ URL_PLATFORM = "MacOS_x86-64_install";
+ EXTENSION = ".dmg";
+ break;
+ default:
+ UI_PLATFORM = "";
+ URL_PLATFORM = "";
+ EXTENSION = "";
+ }
+ return;
+}
+
+function get_lang() {
+ var lang_value = document.download.lang.options[document.download.lang.selectedIndex].value;
+ switch ( lang_value ) {
+ case "en-US":
+ LANG_ISO = "en-US";
+ break;
+ case "de":
+ LANG_ISO = "de";
+ break;
+ case "fr":
+ LANG_ISO = "fr";
+ break;
+ case "it":
+ LANG_ISO = "it";
+ break;
+ case "es":
+ LANG_ISO = "es";
+ break;
+ case "nl":
+ LANG_ISO = "nl";
+ break;
+ default:
+ LANG_ISO = "";
+ }
+ return;
+}
+
+function get_type() {
+ var type_value = document.download.type.options[document.download.type.selectedIndex].value;
+ switch ( type_value ) {
+ case "full":
+ TYPE = "install";
+ // If install type == 'install', then exchange it in the 'URL_PLATFORM' variable
+ URL_PLATFORM = URL_PLATFORM.replace(/langpack/g, TYPE);
+ break;
+ case "lp":
+ TYPE = "langpack";
+ // If install type == 'langpack', then exchange it in the 'URL_PLATFORM' variable
+ URL_PLATFORM = URL_PLATFORM.replace(/install/g, TYPE);
+ break;
+ default:
+ TYPE = "";
+ }
+
+ getFilesize( 0 );
+ getLink();
+
+ alert ( ""
+ + "LANG_ISO: " + "\t\t\t\t\t" + LANG_ISO + "\n"
+ + "UI_PLATFORM: " + "\t\t\t\t\t" + UI_PLATFORM + "\n"
+ + "URL_PLATFORM: " + "\t\t\t\t\t" + URL_PLATFORM + "\n"
+ + "EXTENSION: " + "\t\t\t\t\t" + EXTENSION + "\n"
+ + "TYPE: " + "\t\t\t\t\t\t" + TYPE + "\n"
+ + "RELEASE_MATRIX_PLATFORM_POS: " + "\t" + RELEASE_MATRIX_PLATFORM_POS + "\n"
+ + "FILENAME: " + "\t\t\t\t\t\t" + FILENAME + "\n"
+ + "BASE_URL: " + "\t\t\t\t\t" + SOURCEFORGE_BASE_URL + "\n"
+ + "LINK: " + "\t\t\t\t\t\t" + LINK + "\n"
+ + "" );
+
+ return;
+}
+
+/*
+ * Get link to mirror system for download file and checksum file
+ * Depends on array-list
+ */
+function getLink() {
+ var chk_link = "";
+
+ if ( LANG_ISO != "" && RELEASE_MATRIX_PLATFORM_POS != "" ) {
+
+ // If platform was recognized, assemble the filenames for download and checksums
+
+ // FILENAME = "Apache_OpenOffice_" + VERSION + "_" + URL_PLATFORM + "_" + LANG_ISO;
+ // FILENAME = FILENAME + EXTENSION;
+
+ // Assign the file name (column 3) from the release matrix of language and platform
+ FILENAME = release_matrix[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ][ 3 ];
+
+ // LINK = SOURCEFORGE_BASE_URL + LANG_ISO + "/Apache_OpenOffice_" + VERSION + "_";
+ // LINK = LINK + URL_PLATFORM + "_" + LANG_ISO + EXTENSION + "/download";
+ LINK = SOURCEFORGE_BASE_URL + LANG_ISO + "/" + FILENAME + "/download";
+
+ // chk_link = APACHE_DIST_BASE_URL + "/binaries/" + LANG_ISO + "/Apache_OpenOffice_";
+ // chk_link = chk_link + VERSION + "_" + URL_PLATFORM + "_" + LANG_ISO + EXTENSION;
+ chk_link = APACHE_DIST_BASE_URL + "/binaries/" + LANG_ISO + "/" + FILENAME;
+
+ CHECKSUM_KEYS = "https://people.apache.org/keys/group/openoffice.asc";
+ CHECKSUM_ASC = chk_link + ".asc";
+ CHECKSUM_MD5 = chk_link + ".md5";
+ CHECKSUM_SHA256 = chk_link + ".sha256";
+
+ /*
+ // Used for debugging
+ LINK = PEOPLE_BASE_URL + "/binaries/" + LANG_ISO + "/Apache_OpenOffice_";
+ LINK = LINK + "/Apache_OpenOffice_" + "_" + LANG_ISO + EXTENSION;
+ chk_link = PEOPLE_BASE_URL + "/binaries/" + LANG_ISO + "/Apache_OpenOffice_" + VERSION;
+ chk_link = chk_link + "_" + URL_PLATFORM + "_" + LANG_ISO + EXTENSION;
+ */
+
+ SOURCEFORGE = true;
+ OTHER = false;
+ ARCHIVE = false;
+ ERROR = false;
+ }
+
+ return LINK;
+}
+
+function getLinkAlt() {
+ // Assign the file name (column 3) from the release matrix of language and platform
+
+// alert ( "FILENAME: " + FILENAME + "\n" + "LANG_ISO: " + LANG_ISO + "\n" + "RELEASE_MATRIX_PLATFORM_POS: "
+// + RELEASE_MATRIX_PLATFORM_POS + "\n" + "release_matrix: " + release_matrix );
+
+ if ( LANG_ISO != "" && RELEASE_MATRIX_PLATFORM_POS != "" ) {
+ FILENAME = release_matrix[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ][ 3 ];
+ LINK = SOURCEFORGE_BASE_URL + LANG_ISO + "/" + FILENAME + "/download";
+ }
+ return LINK;
+}
+
+/*
+ * Get file size for download file
+ * Depends on array-list
+ */
+function getFilesize( rel_mode ) {
+ // Depending on $URL_PLATFORM assign the platform position of the release matrix
+
+// alert ( "URL_PLATFORM: " + URL_PLATFORM );
+
+ switch ( URL_PLATFORM ) {
+ case "Linux_x86-64_install-deb":
+ RELEASE_MATRIX_PLATFORM_POS = 0;
+ break;
+ case "Linux_x86-64_install-rpm":
+ RELEASE_MATRIX_PLATFORM_POS = 1;
+ break;
+ case "Linux_x86-64_langpack-deb":
+ RELEASE_MATRIX_PLATFORM_POS = 2;
+ break;
+ case "Linux_x86-64_langpack-rpm":
+ RELEASE_MATRIX_PLATFORM_POS = 3;
+ break;
+ case "Linux_x86_install-deb":
+ RELEASE_MATRIX_PLATFORM_POS = 4;
+ break;
+ case "Linux_x86_install-rpm":
+ RELEASE_MATRIX_PLATFORM_POS = 5;
+ break;
+ case "Linux_x86_langpack-deb":
+ RELEASE_MATRIX_PLATFORM_POS = 6;
+ break;
+ case "Linux_x86_langpack-rpm":
+ RELEASE_MATRIX_PLATFORM_POS = 7;
+ break;
+ case "MacOS_x86_install":
+ RELEASE_MATRIX_PLATFORM_POS = 8;
+ break;
+ case "MacOS_x86_langpack":
+ RELEASE_MATRIX_PLATFORM_POS = 9;
+ break;
+ case "Win_x86_install":
+ RELEASE_MATRIX_PLATFORM_POS = 10;
+ break;
+ case "Win_x86_langpack":
+ RELEASE_MATRIX_PLATFORM_POS = 11;
+ break;
+ default:
+ RELEASE_MATRIX_PLATFORM_POS = -1;
+ }
+
+ // If a platform was found and no error occurred, assign the array data and filesize from the release matrix
+ if ( RELEASE_MATRIX_PLATFORM_POS > -1 && !ERROR ) {
+ if ( rel_mode == 0 ) {
+ // Release mode
+ // Assign all values from the release matrix of language and platform
+ RELEASE_MATRIX_PLATFORM = release_matrix[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ];
+ // Assign the file size (column 2) from the release matrix of language and platform
+ FILESIZE = release_matrix[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ][ 2 ];
+ } else {
+ // Beta release mode
+ // Assign all values from the release matrix of language and platform
+ RELEASE_MATRIX_PLATFORM = release_matrix_beta[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ];
+ // Assign the file size (column 2) from the release matrix of language and platform
+ FILESIZE = release_matrix_beta[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ][ 2 ];
+ }
+ } else {
+ ERROR = true;
+ FILESIZE = 0;
+ }
+
+ return FILESIZE;
+}
+
+/*
+ * Set document.location to start the download
+ */
+function openItem( itemid, uri ) {
+ var thisDocument = document.getElementById( "downloadextendedtext" );
+ var thisDocument = document.getElementById( itemid );
+ document.location = uri;
+}
+
Propchange: openoffice/ooo-site/trunk/content/download/test/download_droplist.js
------------------------------------------------------------------------------
svn:eol-style = native