Author: marcus
Date: Sat Jul 27 09:29:47 2013
New Revision: 1507614
URL: http://svn.apache.org/r1507614
Log:
Recognize unknown platforms/OS better and show this in the green download box,
then offer the 'other.html' webpage with alternative download links
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=1507614&r1=1507613&r2=1507614&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download.js Sat Jul 27
09:29:47 2013
@@ -11,9 +11,17 @@
/*
* Define global variables
*/
-
-var LANG_ISO, LANG_ARRAY, PLATFORM, UI_PLATFORM, FILENAME, EXTENSION,
CHECKSUM_KEYS, CHECKSUM_ASC, CHECKSUM_MD5,
- CHECKSUM_SHA256 = "";
+var LANG_ISO = "";
+var LANG_ARRAY = "";
+var LANG_NAME = "";
+var UI_PLATFORM = "";
+var URL_PLATFORM = "";
+var FILENAME = "";
+var EXTENSION = "";
+var CHECKSUM_KEYS = "";
+var CHECKSUM_ASC = "";
+var CHECKSUM_MD5 = "";
+var CHECKSUM_SHA256 = "";
/*
* Get array and ISO code for language
@@ -92,7 +100,7 @@ function getLanguage() {
* Depends on array-list
*/
function hasMirrorLink() {
- // if ( PLATFORM == "unknown" )
+ // if ( URL_PLATFORM == "" )
// return false;
// Check the flag in "languages.js", 'y' -> provide download link, 'n'
-> redirect to alternative webpage
@@ -116,49 +124,44 @@ function getLink() {
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 ( UI_PLATFORM == "" ) {
+ if ( URL_PLATFORM == "" ) {
+ if ( UI_PLATFORM == "" )
UI_PLATFORM = "(OS unknown)";
- }
- file_link =
"http://www.openoffice.org/download/other.html";
+ 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;
+ file_link = SOURCEFORGE_BASE_URL + NL_LANGUAGE +
"/Apache_OpenOffice_" + VERSION + "_" + URL_PLATFORM;
+ file_link = file_link + "_" + NL_LANGUAGE + EXTENSION +
"/download";
- FILENAME = "Apache_OpenOffice_" + VERSION + "_" +
PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+ FILENAME = "Apache_OpenOffice_" + VERSION + "_" +
URL_PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
- chk_link = APACHE_DIST_BASE_URL + "/binaries/" +
NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION
- chk_link = chk_link + "_" + PLATFORM + "_" + NL_LANGUAGE
+ EXTENSION;
+ chk_link = APACHE_DIST_BASE_URL + "/binaries/" +
NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION;
+ chk_link = chk_link + "_" + URL_PLATFORM + "_" +
NL_LANGUAGE + 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";
- return file_link + "/download";
+ return file_link;
/*
- * Used for debugging
-
+ Used for debugging
file_link = PEOPLE_BASE_URL + "/binaries/" + NL_LANGUAGE
+ "/Apache_OpenOffice_";
file_link = file_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;
+ chk_link = chk_link + "_" + URL_PLATFORM + "_" +
NL_LANGUAGE + EXTENSION;
return file_link;
-
*/
} else {
- FILENAME = "";
- CHECKSUM_ASC = "";
- CHECKSUM_MD5 = "";
- CHECKSUM_SHA256 = "";
return false;
}
}
@@ -174,94 +177,81 @@ function getPlatform() {
if ( navigator.platform.toLowerCase().indexOf( "windows" ) !=
-1 ||
navigator.platform.toLowerCase().indexOf( "win" ) !=
-1 ) {
UI_PLATFORM = "Windows (EXE)";
- PLATFORM = "Win_x86_install";
+ URL_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";
+ URL_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";
+ URL_PLATFORM =
"Linux_x86-64_install-deb";
EXTENSION = ".tar.gz";
}
} else {
UI_PLATFORM = "Linux 32-Bit (RPM)";
- PLATFORM = "Linux_x86_install-rpm";
+ URL_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";
+ URL_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";
+ UI_PLATFORM = "Mac OS Intel (DMG)";
+ URL_PLATFORM = "MacOS_x86_install";
+ EXTENSION = ".dmg";
if ( navigator.userAgent.toLowerCase().indexOf( "ppc" )
!= -1 ) {
- UI_PLATFORM = "Mac OS PPC (DMG)";
- PLATFORM = "";
- EXTENSION = "";
+ UI_PLATFORM = "Mac OS PPC (DMG)";
+ URL_PLATFORM = "";
+ EXTENSION = "";
}
} else if ( navigator.platform.toLowerCase().indexOf( "sunos" )
!= -1 ) {
- UI_PLATFORM = "Solaris x86 (PKG)";
- PLATFORM = "";
- EXTENSION = "";
+ UI_PLATFORM = "Solaris x86 (PKG)";
if ( navigator.userAgent.toLowerCase().indexOf( "sun4u"
) != -1 ) {
- UI_PLATFORM = "Solaris SPARC (PKG)";
- PLATFORM = "";
- EXTENSION = "";
+ UI_PLATFORM = "Solaris SPARC (PKG)";
}
} 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 = "";
+ } else if ( navigator.userAgent.toLowerCase().indexOf(
"freebsd" ) != -1 ) {
+ UI_PLATFORM = "FreeBSD";
+ } else if ( navigator.userAgent.toLowerCase().indexOf(
"openbsd" ) != -1 ) {
+ UI_PLATFORM = "OpenBSD";
+ } else if ( navigator.userAgent.toLowerCase().indexOf( "netbsd"
) != -1 ) {
+ UI_PLATFORM = "NetBSD";
+ } else if ( navigator.userAgent.toLowerCase().indexOf( "pcbsd"
) != -1 ) {
+ UI_PLATFORM = "PC-BSD";
+ } else if ( navigator.userAgent.toLowerCase().indexOf(
"dragonfly" ) != -1 ) {
+ UI_PLATFORM = "DragonFly BSD";
}
} else {
// No platform / OS was recognized
- UI_PLATFORM = "";
- PLATFORM = "";
- EXTENSION = "";
+ UI_PLATFORM = "(OS unknown)";
+ URL_PLATFORM = "";
}
}
@@ -273,3 +263,4 @@ function openItem( itemid, uri ) {
var thisDocument = document.getElementById( itemid );
document.location = uri;
};
+