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 2013/07/27 17:22:40 UTC

svn commit: r1507664 - /openoffice/ooo-site/trunk/content/download/test/download.js

Author: marcus
Date: Sat Jul 27 15:22:39 2013
New Revision: 1507664

URL: http://svn.apache.org/r1507664
Log:
Extended the handling of unknown plaforms/OS and provide a way to refer to the 'other.html' webpage.

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=1507664&r1=1507663&r2=1507664&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download.js Sat Jul 27 15:22:39 2013
@@ -132,26 +132,29 @@ function getLink() {
 
 	if ( hasMirrorLink() ) {
 		if ( URL_PLATFORM == "" ) {
-			if ( UI_PLATFORM == "" )
-				UI_PLATFORM = "(OS unknown)";
+			if ( UI_PLATFORM == "" ) {
+				UI_PLATFORM = "an unknown platform/OS";
+			}
 			file_link = "http://www.openoffice.org/download/other.html";
 			return file_link;
-		}
+		} else {
 
-		file_link       = SOURCEFORGE_BASE_URL + NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION + "_" + URL_PLATFORM;
-		file_link       = file_link + "_" + NL_LANGUAGE + EXTENSION + "/download";
+			file_link	= SOURCEFORGE_BASE_URL + NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION + "_";
+			file_link	= file_link + URL_PLATFORM + "_" + NL_LANGUAGE + EXTENSION + "/download";
 
-		FILENAME        = "Apache_OpenOffice_" + VERSION + "_" + URL_PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+			FILENAME	= "Apache_OpenOffice_" + VERSION + "_" + URL_PLATFORM + "_" + NL_LANGUAGE;
+			FILENAME	= FILENAME + EXTENSION;
 
-		chk_link        = APACHE_DIST_BASE_URL + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_" + VERSION;
-		chk_link        = chk_link + "_" + URL_PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
+			chk_link	= APACHE_DIST_BASE_URL + "/binaries/" + NL_LANGUAGE + "/Apache_OpenOffice_";
+			chk_link	= chk_link + VERSION + "_" + 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;
+			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 "http://www.openoffice.org/download/other.html";
+ 		return file_link;
 
 		/*
 		Used for debugging
@@ -173,86 +176,97 @@ function getLink() {
 function getPlatform() {
 	// For more help or data see: "http://www.useragentstring.com"
 
+	var os	= navigator.platform.toLowerCase();
+	var ua	= navigator.userAgent.toLowerCase();
+
+	// Assume as default: No platform / OS was recognized, set $UI_PLATFORM to show it to the user
+								UI_PLATFORM	= "an unknown platform/OS";
+
 	if ( navigator.platform != "" ) {
-		if ( navigator.platform.toLowerCase().indexOf( "windows" ) != -1 ||
-		     navigator.platform.toLowerCase().indexOf( "win" )     != -1 ) {
-			UI_PLATFORM	= "Windows (EXE)";
-			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";
-			}
-		} else if ( navigator.platform.toLowerCase().indexOf( "linux" ) != -1 ) {
-			if ( navigator.platform.indexOf( "64" ) != -1 ) {
-				UI_PLATFORM	= "Linux 64-bit (RPM)";
-				URL_PLATFORM	= "Linux_x86-64_install-rpm";
-				EXTENSION	= ".tar.gz";
-				// UI_PLATFORM	= "Linux 64-bit (RPM/DEB ?)";
-				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)";
-					URL_PLATFORM	= "Linux_x86-64_install-deb";
-					EXTENSION	= ".tar.gz";
-				}
-			} else {
-				UI_PLATFORM	= "Linux 32-Bit (RPM)";
-				URL_PLATFORM	= "Linux_x86_install-rpm";
-				EXTENSION	= ".tar.gz";
-				// UI_PLATFORM	= "Linux 32-Bit (RPM/DEB ?)";
-				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)";
-					URL_PLATFORM	= "Linux_x86_install-deb";
-					EXTENSION	= ".tar.gz";
-				}
-			}
-		} else if ( navigator.platform.toLowerCase().indexOf( "mac" ) != -1 ) {
-			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)";
-				URL_PLATFORM	= "";
-				EXTENSION	= "";
-			}
-		} else if ( navigator.platform.toLowerCase().indexOf( "sunos" ) != -1 ) {
-			UI_PLATFORM		= "Solaris x86 (PKG)";
-			if ( navigator.userAgent.toLowerCase().indexOf( "sun4u" ) != -1 ) {
-				UI_PLATFORM	= "Solaris SPARC (PKG)";
-			}
-		} else if ( navigator.platform.toLowerCase().indexOf( "freebsd" ) != -1 ) {
-			UI_PLATFORM	= "FreeBSD (PKG)";
-		} else if ( navigator.platform.toLowerCase().indexOf( "os/2" ) != -1 ) {
-			UI_PLATFORM	= "OS/2";
-		} 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)";
-		} else if ( navigator.userAgent.toLowerCase().indexOf( "android" ) != -1 ) {
-			UI_PLATFORM	= "Android mobile device";
-		} else if ( navigator.userAgent.toLowerCase().indexOf( "blackberry" ) != -1 ) {
-			UI_PLATFORM	= "Blackberry mobile device";
-		} else if ( navigator.userAgent.toLowerCase().indexOf( "symbian" ) != -1 ) {
-			UI_PLATFORM	= "Symbian mobile device";
-		} 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";
+
+	  // Windows
+	  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
+	  } else if ( os.indexOf( "linux"	 ) != -1 ) {
+	      if ( 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";
 		}
-	} else {
-		// No platform / OS was recognized
-		UI_PLATFORM	= "(OS unknown)";
-		URL_PLATFORM	= "";
-	}
+	      } else {
+								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";
+		    }
+	      }
+
+	  // Mac OS x86
+	  } else if ( os.indexOf( "mac"		 ) != -1 ) {	UI_PLATFORM	= "Mac OS Intel (DMG)";
+								URL_PLATFORM	= "MacOS_x86_install";
+								EXTENSION	= ".dmg";
+
+	  // Recognized but not supported platforms / OS, set $UI_PLATFORM to show it to the user
+	      if    ( ua.indexOf( "ppc"		) != -1 )	UI_PLATFORM	= "Mac OS PPC (DMG)";
+	  } else if ( os.indexOf( "sunos"	) != -1 ) {	UI_PLATFORM	= "Solaris x86 (PKG)";
+	      if    ( ua.indexOf( "sun4u"	) != -1 )	UI_PLATFORM	= "Solaris SPARC (PKG)";
+	  } else if ( os.indexOf( "freebsd"	) != -1 )	UI_PLATFORM	= "FreeBSD (PKG)";
+	    else if ( os.indexOf( "os/2"	) != -1 )	UI_PLATFORM	= "OS/2";
+	    else if ( os.indexOf( "freebsd"	) != -1 )	UI_PLATFORM	= "FreeBSD";
+	    else if ( os.indexOf( "openbsd"	) != -1 )	UI_PLATFORM	= "OpenBSD";
+	    else if ( os.indexOf( "netbsd"	) != -1 )	UI_PLATFORM	= "NetBSD";
+	    else if ( os.indexOf( "pcbsd"	) != -1 )	UI_PLATFORM	= "PC-BSD";
+	    else if ( os.indexOf( "dragonfly"	) != -1 )	UI_PLATFORM	= "DragonFly BSD";
+
+	    else if ( os.indexOf( "amiga"	) != -1 )	UI_PLATFORM	= "AmigaOS";
+	    else if ( os.indexOf( "darwin"	) != -1 )	UI_PLATFORM	= "Darwin";
+	    else if ( os.indexOf( "aix"		) != -1 )	UI_PLATFORM	= "IBM AIX";
+	    else if ( os.indexOf( "irix"	) != -1 )	UI_PLATFORM	= "IRIX";
+	    else if ( os.indexOf( "vms"		) != -1 )	UI_PLATFORM	= "OpenVMS";
+	    else if ( os.indexOf( "alphaserver"	) != -1 )	UI_PLATFORM	= "AlphaServer";
+	    else if ( os.indexOf( "qnx"		) != -1 )	UI_PLATFORM	= "QNX";
+	    else if ( os.indexOf( "x11"		) != -1 )	UI_PLATFORM	= "an unknown OS with X11 support";
+
+	  // Recognized but not supported mobile devices, set $UI_PLATFORM to show it to the user
+	    else if ( os.indexOf( "blackberry"  ) != -1 )	UI_PLATFORM	= "a Blackberry Smartphone";
+	    else if ( os.indexOf( "android"	) != -1 )	UI_PLATFORM	= "Android mobile device";
+	    else if ( os.indexOf( "nokia"	) != -1 )	UI_PLATFORM	= "a Nokia Mobile device";
+	    else if ( os.indexOf( "s60"	        ) != -1 )	UI_PLATFORM	= "a Mobilephone with Series60/S60 support";
+	    else if ( os.indexOf( "series60"    ) != -1 )	UI_PLATFORM	= "a Mobilephone with Series60/S60 support";
+	    else if ( os.indexOf( "symbian"	) != -1 )	UI_PLATFORM	= "a Mobilephone with Symbian OS";
+	    else if ( os.indexOf( "palm"	) != -1 )	UI_PLATFORM	= "a Mobilephone with Palm OS";
+	    else if ( os.indexOf( "webos"	) != -1 )	UI_PLATFORM	= "a Mobilephone with Palm webOS";
+	    else if ( os.indexOf( "pike"	) != -1 )	UI_PLATFORM	= "a Mobilephone with Pike support";
+	    else if ( os.indexOf( "ce.net"	) != -1 )	UI_PLATFORM	= "a Mobilephone with Windows CE";
+	    else if ( os.indexOf( "widerweb"    ) != -1 )	UI_PLATFORM	= "a Mobilephone with WiderWeb support";
+	    else if ( os.indexOf( "brew"	) != -1 )	UI_PLATFORM	= "a Smartphone with BREW support";
+	    else if ( os.indexOf( "hiptop"	) != -1 )	UI_PLATFORM	= "a Smartphone with Hiptop support";
+	    else if ( ua.indexOf( "iphone"	) != -1 ||
+		      ua.indexOf( "ipad"	) != -1 ||
+		      ua.indexOf( "ipod"	) != -1 )	UI_PLATFORM	= "Apple mobile device (iPhone/iPad/iPod)";
+
+	  // Recognized but not supported video game consoles, set $UI_PLATFORM to show it to the user
+	    else if ( os.indexOf( "playstation"	) != -1 )	UI_PLATFORM	= "a Sony Playstation";
+	    else if ( os.indexOf( "psp"		) != -1 )	UI_PLATFORM	= "a Sony Playstation Portable";
+	    else if ( os.indexOf( "nintendo"	) != -1 )	UI_PLATFORM	= "a Nintendo game console";
+	    else if ( os.indexOf( "wii"		) != -1 )	UI_PLATFORM	= "a Wii game console";
+	} 
 }
 
 /*