You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by bu...@apache.org on 2013/08/11 19:27:06 UTC
svn commit: r874213 - in /websites/staging/ooo-site/trunk: cgi-bin/ content/
content/download/download.js
Author: buildbot
Date: Sun Aug 11 17:27:06 2013
New Revision: 874213
Log:
Staging update by buildbot for ooo-site
Modified:
websites/staging/ooo-site/trunk/cgi-bin/ (props changed)
websites/staging/ooo-site/trunk/content/ (props changed)
websites/staging/ooo-site/trunk/content/download/download.js
Propchange: websites/staging/ooo-site/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Aug 11 17:27:06 2013
@@ -1 +1 @@
-1512973
+1512975
Propchange: websites/staging/ooo-site/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Aug 11 17:27:06 2013
@@ -1 +1 @@
-1512973
+1512975
Modified: websites/staging/ooo-site/trunk/content/download/download.js
==============================================================================
--- websites/staging/ooo-site/trunk/content/download/download.js (original)
+++ websites/staging/ooo-site/trunk/content/download/download.js Sun Aug 11 17:27:06 2013
@@ -11,9 +11,32 @@
/*
* Define global variables
*/
+var LANG_ISO = "";
+var LANG_ARRAY = "";
+var LANG_NAME = "";
+var RELEASE_MATRIX_PLATFORM_POS = -1;
+var RELEASE_MATRIX_PLATFORM = "";
+var UI_PLATFORM = "";
+var URL_PLATFORM = "";
+var FILENAME = "";
+var FILESIZE = 0;
+var EXTENSION = "";
+var LINK = "";
+var CHECKSUM_KEYS = "";
+var CHECKSUM_ASC = "";
+var CHECKSUM_MD5 = "";
+var CHECKSUM_SHA256 = "";
+var ERROR = false;
-var LANG_ISO, LANG_ARRAY, PLATFORM, UI_PLATFORM, FILENAME, EXTENSION, CHECKSUM_KEYS, CHECKSUM_ASC, CHECKSUM_MD5,
- CHECKSUM_SHA256 = "";
+/*
+ * Initialize the download script and set all global variables with data
+ */
+function initializeDL() {
+ getLanguage();
+ getPlatform();
+ getFilesize();
+ getLink();
+}
/*
* Get array and ISO code for language
@@ -28,24 +51,26 @@ function getLanguage() {
language = navigator.language;
else if ( navigator.userLanguage )
language = navigator.userLanguage;
+ else if ( navigator.browserLanguage )
+ language = navigator.browserLanguage;
else if ( navigator.systemLanguage )
language = navigator.systemLanguage;
- // Convert "en" to "en-US" as well since en-US build is the canonical translation, and thus better tested.
+ // Convert "en" to "en-US" as well as setting it as fall-back language
if ( !language || language == "" || language == "null" || language == "en" )
language = "en-US";
if ( language == "pt" )
language = "pt-PT";
- // Konqueror uses '_' where other browsers use '-'.
+ // Konqueror uses '_' where other browsers use '-'
if ( language.indexOf( "_" ) != -1 )
language = language.split( "_" ).join( "-" );
language = language.toLowerCase();
var languageCode = language.split( "-" )[ 0 ];
var regionCode = language.split( "-" )[ 1 ];
-
var thisLanguageSet = languages[ languageCode ];
+
if ( thisLanguageSet == null ) {
// Language code not found inside array
language = "en-US";
@@ -92,177 +117,241 @@ function getLanguage() {
* Depends on array-list
*/
function hasMirrorLink() {
- // if ( PLATFORM == "unknown" )
- // return false;
-
// Check the flag in "languages.js", 'y' -> provide download link, 'n' -> redirect to alternative webpage
if ( LANG_ARRAY[ 3 ] == 'y' )
return true;
else
+ ERROR = true;
return false;
}
/*
- * Get link to mirror system for download-set and checksum file
+ * Get link to mirror system for download file and checksum file
* Depends on array-list
*/
function getLink() {
- var file_link = "";
- var chk_link = "";
+ var chk_link = "";
getLanguage();
getPlatform();
+ getFilesize();
if ( NL_LANGUAGE == "" )
NL_LANGUAGE = LANG_ISO;
- // Trim timestamp from version, required for RC
- // if ( version.indexOf( "_" ) > -1 )
- // version = version.split( "_" )[0];
+ /*
+ Trim timestamp from version, required for RC
+ if ( version.indexOf( "_" ) > -1 )
+ version = version.split( "_" )[0];
+ */
if ( hasMirrorLink() ) {
- if ( PLATFORM == "" ) {
+ if ( URL_PLATFORM == "" ) {
+ // If no platform was recognized, set the "other.html" webpage as alternative download URL
if ( UI_PLATFORM == "" ) {
- UI_PLATFORM = "(OS unknown)";
+ UI_PLATFORM = "an unknown platform/OS";
}
- file_link = "http://www.openoffice.org/download/other.html";
- return file_link;
- }
-
- file_link = SOURCEFORGE_BASE_URL + NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION + "_" + PLATFORM;
- file_link = file_link + "_" + NL_LANGUAGE + EXTENSION;
-
- FILENAME = "Apache_OpenOffice_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+ LINK = "http://www.openoffice.org/download/other.html";
+ ERROR = true;
+ return LINK;
+ } else {
+ // If platform was recognized, get the download filename and checksum filename
- chk_link = APACHE_DIST_BASE_URL + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION;
- chk_link = chk_link + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+ // FILENAME = "Apache_OpenOffice_" + VERSION + "_" + URL_PLATFORM + "_" + NL_LANGUAGE;
+ // FILENAME = FILENAME + EXTENSION;
- CHECKSUM_KEYS = "http://www.apache.org/dist/openoffice/KEYS";
- CHECKSUM_ASC = chk_link + ".asc";
- CHECKSUM_MD5 = chk_link + ".md5";
- CHECKSUM_SHA256 = chk_link + ".sha256";
+ // Assign the file name (column 3) from the release matrix of language and platform
+ FILENAME = release_aoo400_matrix[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ][ 3 ];
- return file_link + "/download";
+ // LINK = SOURCEFORGE_BASE_URL + NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION + "_";
+ // LINK = LINK + URL_PLATFORM + "_" + NL_LANGUAGE + EXTENSION + "/download";
+ LINK = SOURCEFORGE_BASE_URL + NL_LANGUAGE + "/" + FILENAME + "/download";
+
+ // chk_link = APACHE_DIST_BASE_URL + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_";
+ // chk_link = chk_link + VERSION + "_" + URL_PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+ chk_link = APACHE_DIST_BASE_URL + "/binaries/" + NL_LANGUAGE + "/" + FILENAME;
+
+ CHECKSUM_KEYS = "http://www.apache.org/dist/openoffice/KEYS";
+ CHECKSUM_ASC = chk_link + ".asc";
+ CHECKSUM_MD5 = chk_link + ".md5";
+ CHECKSUM_SHA256 = chk_link + ".sha256";
+ }
+ return LINK;
/*
- * Used for debugging
-
- file_link = PEOPLE_BASE_URL + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_";
- file_link = file_link + "/Apache_OpenOffice_" + "_" + NL_LANGUAGE + EXTENSION;
+ Used for debugging
+ LINK = PEOPLE_BASE_URL + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_";
+ LINK = LINK + "/Apache_OpenOffice_" + "_" + NL_LANGUAGE + EXTENSION;
chk_link = PEOPLE_BASE_URL + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION;
- chk_link = chk_link + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
- return file_link;
-
+ chk_link = chk_link + "_" + URL_PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+ return LINK;
*/
} else {
- FILENAME = "";
- CHECKSUM_ASC = "";
- CHECKSUM_MD5 = "";
- CHECKSUM_SHA256 = "";
+ ERROR = true;
return false;
}
}
/*
* Get platform of browser
- * Depending on what is recognized from browser's data for platform and user-agent
+ * Depending on internal browser data
*/
function getPlatform() {
// For more help or data see: "http://www.useragentstring.com"
- if ( navigator.platform != "" ) {
- if ( navigator.platform.toLowerCase().indexOf( "windows" ) != -1 ||
- navigator.platform.toLowerCase().indexOf( "win" ) != -1 ) {
- UI_PLATFORM = "Windows (EXE)";
- PLATFORM = "Win_x86_install";
- EXTENSION = ".exe";
- if ( navigator.userAgent.toLowerCase().indexOf( "phone" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "mobile" ) != -1 ) {
- UI_PLATFORM = "Windows mobile device";
- PLATFORM = "";
- EXTENSION = "";
- }
- } else if ( navigator.platform.toLowerCase().indexOf( "linux" ) != -1 ) {
- if ( navigator.platform.indexOf( "64" ) != -1 ) {
- UI_PLATFORM = "Linux 64-bit (RPM)";
- PLATFORM = "Linux_x86-64_install-rpm";
- EXTENSION = ".tar.gz";
- // UI_PLATFORM = "Linux 64-bit (RPM/DEB ?)";
- // PLATFORM = "unknown";
- // EXTENSION = ".tar.gz";
- if ( navigator.userAgent.toLowerCase().indexOf( "debian" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "ubuntu" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "iceweasel" ) != -1 ) {
- UI_PLATFORM = "Linux Debian 64-bit (DEB)";
- PLATFORM = "Linux_x86-64_install-deb";
- EXTENSION = ".tar.gz";
- }
- } else {
- UI_PLATFORM = "Linux 32-Bit (RPM)";
- PLATFORM = "Linux_x86_install-rpm";
- EXTENSION = ".tar.gz";
- // UI_PLATFORM = "Linux 32-Bit (RPM/DEB ?)";
- // PLATFORM = "unknown";
- // EXTENSION = ".tar.gz";
- if ( navigator.userAgent.toLowerCase().indexOf( "debian" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "ubuntu" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "iceweasel" ) != -1 ) {
- UI_PLATFORM = "Linux Debian 32-Bit (DEB)";
- PLATFORM = "Linux_x86_install-deb";
- EXTENSION = ".tar.gz";
- }
- }
- } else if ( navigator.platform.toLowerCase().indexOf( "mac" ) != -1 ) {
- UI_PLATFORM = "Mac OS Intel (DMG)";
- PLATFORM = "MacOS_x86_install";
- EXTENSION = ".dmg";
- if ( navigator.userAgent.toLowerCase().indexOf( "ppc" ) != -1 ) {
- UI_PLATFORM = "Mac OS PPC (DMG)";
- PLATFORM = "";
- EXTENSION = "";
- }
- } else if ( navigator.platform.toLowerCase().indexOf( "sunos" ) != -1 ) {
- UI_PLATFORM = "Solaris x86 (PKG)";
- PLATFORM = "";
- EXTENSION = "";
- if ( navigator.userAgent.toLowerCase().indexOf( "sun4u" ) != -1 ) {
- UI_PLATFORM = "Solaris SPARC (PKG)";
- PLATFORM = "";
- EXTENSION = "";
- }
- } else if ( navigator.platform.toLowerCase().indexOf( "freebsd" ) != -1 ) {
- UI_PLATFORM = "FreeBSD (PKG)";
- PLATFORM = "";
- EXTENSION = "";
- } else if ( navigator.platform.toLowerCase().indexOf( "os/2" ) != -1 ) {
- UI_PLATFORM = "OS/2";
- PLATFORM = "";
- EXTENSION = "";
- } else if ( navigator.userAgent.toLowerCase().indexOf( "iphone" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "ipad" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "ipod" ) != -1 ) {
- UI_PLATFORM = "Apple mobile device (iPhone/iPad/iPod)";
- PLATFORM = "";
- EXTENSION = "";
- } else if ( navigator.userAgent.toLowerCase().indexOf( "android" ) != -1 ) {
- UI_PLATFORM = "Android mobile device";
- PLATFORM = "";
- EXTENSION = "";
- } else if ( navigator.userAgent.toLowerCase().indexOf( "blackberry" ) != -1 ) {
- UI_PLATFORM = "Blackberry mobile device";
- PLATFORM = "";
- EXTENSION = "";
- } else if ( navigator.userAgent.toLowerCase().indexOf( "symbian" ) != -1 ) {
- UI_PLATFORM = "Symbian mobile device";
- PLATFORM = "";
- EXTENSION = "";
- }
+ var os = navigator.platform.toLowerCase();
+ var ua = navigator.userAgent.toLowerCase();
+ var av = navigator.appVersion.toLowerCase();
+
+ if ( os ) {
+
+ // Recognized but not supported platforms / OS, set $UI_PLATFORM to show it to the user
+ if ( os.indexOf( "sunos" ) != -1 ) { UI_PLATFORM = "Solaris x86 (PKG)";
+ if ( ua.indexOf( "sun4u" ) != -1 ) UI_PLATFORM = "Solaris SPARC (PKG)";
+ }
+ if ( os.indexOf( "freebsd" ) != -1 ) UI_PLATFORM = "FreeBSD (PKG)";
+ if ( os.indexOf( "os/2" ) != -1 ) UI_PLATFORM = "OS/2";
+ if ( os.indexOf( "freebsd" ) != -1 ) UI_PLATFORM = "FreeBSD";
+ if ( os.indexOf( "openbsd" ) != -1 ) UI_PLATFORM = "OpenBSD";
+ if ( os.indexOf( "netbsd" ) != -1 ) UI_PLATFORM = "NetBSD";
+ if ( os.indexOf( "pcbsd" ) != -1 ) UI_PLATFORM = "PC-BSD";
+ if ( os.indexOf( "dragonfly" ) != -1 ) UI_PLATFORM = "DragonFly BSD";
+ if ( os.indexOf( "amiga" ) != -1 ) UI_PLATFORM = "AmigaOS";
+ if ( os.indexOf( "darwin" ) != -1 ) UI_PLATFORM = "Darwin";
+ if ( os.indexOf( "aix" ) != -1 ) UI_PLATFORM = "IBM AIX";
+ if ( os.indexOf( "irix" ) != -1 ) UI_PLATFORM = "IRIX";
+ if ( os.indexOf( "vms" ) != -1 ) UI_PLATFORM = "OpenVMS";
+ if ( os.indexOf( "alphaserver" ) != -1 ) UI_PLATFORM = "AlphaServer";
+ if ( os.indexOf( "qnx" ) != -1 ) UI_PLATFORM = "QNX";
+ if ( os.indexOf( "x11" ) != -1 ) UI_PLATFORM = "an unknown OS with X11 support";
+
+ if ( os.indexOf( "arm" ) != -1 ) UI_PLATFORM = "ARM mobile/tablet devices";
+
+ if ( ua.indexOf( "ppc" ) != -1 ||
+ ua.indexOf( "power_pc" ) != -1 ) UI_PLATFORM = "Mac OS PPC (DMG)";
+ if ( ua.indexOf( "iphone" ) != -1 ||
+ ua.indexOf( "ipad" ) != -1 ||
+ ua.indexOf( "ipod" ) != -1 ) UI_PLATFORM = "Apple mobile devices (iPhone/iPad/iPod)";
+ if ( ua.indexOf( "android" ) != -1 ||
+ av.indexOf( "android" ) != -1 ) UI_PLATFORM = "Android mobile/tablet devices";
+ if ( ua.indexOf( "blackberry" ) != -1 ) UI_PLATFORM = "Blackberry smartphones";
+ if ( ua.indexOf( "nokia" ) != -1 ) UI_PLATFORM = "Nokia mobile devices";
+ if ( ua.indexOf( "symbian" ) != -1 ) UI_PLATFORM = "mobile phones with Symbian OS";
+ if ( ua.indexOf( "symbos" ) != -1 ) UI_PLATFORM = "mobile phones with Symbian OS";
+ if ( ua.indexOf( "s60" ) != -1 ) UI_PLATFORM = "mobile phones with Series60/S60 support";
+ if ( ua.indexOf( "series60" ) != -1 ) UI_PLATFORM = "mobile phones with Series60/S60 support";
+ if ( ua.indexOf( "palm" ) != -1 ) UI_PLATFORM = "mobile phones with Palm OS";
+ if ( ua.indexOf( "webos" ) != -1 ) UI_PLATFORM = "mobile phones with Palm webOS";
+ if ( ua.indexOf( "pike" ) != -1 ) UI_PLATFORM = "mobile phones with Pike support";
+ if ( ua.indexOf( "ce.net" ) != -1 ) UI_PLATFORM = "mobile phones with Windows CE";
+ if ( ua.indexOf( "widerweb" ) != -1 ) UI_PLATFORM = "mobile phones with WiderWeb support";
+ if ( ua.indexOf( "brew" ) != -1 ) UI_PLATFORM = "smartphones with BREW support";
+ if ( ua.indexOf( "hiptop" ) != -1 ) UI_PLATFORM = "smartphones with Hiptop support";
+
+ if ( ua.indexOf( "playstation" ) != -1 ) UI_PLATFORM = "Sony Playstation";
+ if ( ua.indexOf( "psp" ) != -1 ) UI_PLATFORM = "Sony Playstation Portable";
+ if ( ua.indexOf( "nintendo" ) != -1 ) UI_PLATFORM = "Nintendo game console";
+ if ( ua.indexOf( "wii" ) != -1 ) UI_PLATFORM = "Wii game console";
+
+ // If variable is already filled, then something was recognized and no more work is need
+ if ( UI_PLATFORM ) {
+ return;
+ }
+
+ // Windows, x86 or mobile?
+ if ( os.indexOf( "windows" ) != -1 ||
+ os.indexOf( "win" ) != -1 ) { UI_PLATFORM = "Windows (EXE)";
+ URL_PLATFORM = "Win_x86_install";
+ EXTENSION = ".exe";
+ if ( ua.indexOf( "phone" ) != -1 ||
+ ua.indexOf( "mobile" ) != -1 ) UI_PLATFORM = "Windows Mobile device";
+ }
+
+ // Linux, x86 or x86_64, DEB or RPM?
+ if ( os.indexOf( "linux" ) != -1 ) {
+ if ( os.indexOf( "x86" ) != -1 ||
+ os.indexOf( "i686" ) != -1 ) { UI_PLATFORM = "Linux 32-bit (RPM)";
+ // UI_PLATFORM = "Linux 32-bit (RPM/DEB ?)";
+ URL_PLATFORM = "Linux_x86_install-rpm";
+ EXTENSION = ".tar.gz";
+ if ( ua.indexOf( "debian" ) != -1 ||
+ ua.indexOf( "ubuntu" ) != -1 ||
+ ua.indexOf( "iceweasel" ) != -1 ) { UI_PLATFORM = "Linux Debian 32-Bit (DEB)";
+ URL_PLATFORM = "Linux_x86_install-deb";
+ EXTENSION = ".tar.gz";
+ }
+ }
+ if ( os.indexOf( "_64" ) != -1 ||
+ os.indexOf( "-64" ) != -1 ) { UI_PLATFORM = "Linux 64-bit (RPM)";
+ // UI_PLATFORM = "Linux 64-bit (RPM/DEB ?)";
+ URL_PLATFORM = "Linux_x86-64_install-rpm";
+ EXTENSION = ".tar.gz";
+ if ( ua.indexOf( "debian" ) != -1 ||
+ ua.indexOf( "ubuntu" ) != -1 ||
+ ua.indexOf( "iceweasel" ) != -1 ) { UI_PLATFORM = "Linux Debian 64-bit (DEB)";
+ URL_PLATFORM = "Linux_x86-64_install-deb";
+ EXTENSION = ".tar.gz";
+ }
+ }
+ }
+
+ // Mac OS x86
+ if ( os.indexOf( "mac" ) != -1 ) { UI_PLATFORM = "Mac OS 32-bit Intel (DMG)";
+ URL_PLATFORM = "Mac_x86_install";
+ EXTENSION = ".dmg";
+ }
+ }
+
+ // If variable is not filled until now, then nothing was recognized, set $UI_PLATFORM to show it to the user
+ if ( ! UI_PLATFORM ) {
+ ERROR = true;
+ UI_PLATFORM = "an unknown platform/OS";
+ }
+ return;
+}
+
+/*
+ * Get file size for download file
+ * Depends on array-list
+ */
+function getFilesize() {
+ // Depending on URL_PLATFORM assign the platform position of the release matrix
+ 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_install-deb":
+ RELEASE_MATRIX_PLATFORM_POS = 4;
+ break;
+ case "Linux_x86_install-rpm":
+ RELEASE_MATRIX_PLATFORM_POS = 5;
+ break;
+ case "Mac_x86_install":
+ RELEASE_MATRIX_PLATFORM_POS = 8;
+ break;
+ case "Win_x86_install":
+ RELEASE_MATRIX_PLATFORM_POS = 10;
+ break;
+ default:
+ RELEASE_MATRIX_PLATFORM_POS = -1;
+ }
+
+ // If a platform was found, assign the array data and filesize from the release matrix
+ if ( RELEASE_MATRIX_PLATFORM_POS > -1 ) {
+ // Assign all values from the release matrix of language and platform
+ RELEASE_MATRIX_PLATFORM = release_aoo400_matrix[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ];
+
+ // Assign the file size (column 2) from the release matrix of language and platform
+ FILESIZE = release_aoo400_matrix[ LANG_ISO ][ RELEASE_MATRIX_PLATFORM_POS ][ 2 ];
} else {
- // No platform / OS was recognized
- UI_PLATFORM = "";
- PLATFORM = "";
- EXTENSION = "";
+ ERROR = true;
+ FILESIZE = 0;
}
+
+ return FILESIZE;
}
/*
@@ -272,4 +361,5 @@ function openItem( itemid, uri ) {
var thisDocument = document.getElementById( "downloadextendedtext" );
var thisDocument = document.getElementById( itemid );
document.location = uri;
-};
+}
+