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 2012/09/15 19:25:26 UTC
svn commit: r832085 - in /websites/staging/ooo-site/trunk: cgi-bin/ content/
content/download/test/new/download.js
Author: buildbot
Date: Sat Sep 15 17:25:25 2012
New Revision: 832085
Log:
Staging update by buildbot for openofficeorg
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/test/new/download.js
Propchange: websites/staging/ooo-site/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Sep 15 17:25:25 2012
@@ -1 +1 @@
-1385120
+1385133
Propchange: websites/staging/ooo-site/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Sep 15 17:25:25 2012
@@ -1 +1 @@
-1385120
+1385133
Modified: websites/staging/ooo-site/trunk/content/download/test/new/download.js
==============================================================================
--- websites/staging/ooo-site/trunk/content/download/test/new/download.js (original)
+++ websites/staging/ooo-site/trunk/content/download/test/new/download.js Sat Sep 15 17:25:25 2012
@@ -1,24 +1,33 @@
/*
* Overview of all functions defined below
- * function getArray ( nl_language )
- * function getLanguageISO ( nl_language )
+ * function getArray ()
+ * function getLanguageISO ()
* function hasMirrorLink ()
- * function getLink ( version, nl_language )
+ * function getLink ()
* function getPlatform ()
- * function getFilename ( version, nl_language )
- * function getChecksum ( version, nl_language, hash )
* function openItem ( itemid, uri )
*/
/*
+ * define global variables
+ */
+
+var PLATFORM = "";
+var UI_PLATFORM = "";
+var EXTENSION = "";
+var CHECKSUM_ASC = "";
+var CHECKSUM_MD5 = "";
+var CHECKSUM_SHA256 = "";
+
+/*
* get array for language
* depends on nl_language
*/
-function getArray( nl_language ) {
+function getArray() {
var language = "";
- if ( nl_language != "" )
- language = nl_language;
+ if ( NL_LANGUAGE != "" )
+ language = NL_LANGUAGE;
else if ( navigator.language )
language = navigator.language;
else if ( navigator.userLanguage )
@@ -34,9 +43,8 @@ function getArray( nl_language ) {
language = "pt-PT";
// Konqueror uses '_' where other browsers use '-'.
- if ( language.indexOf( "_" ) != -1 ) {
+ if ( language.indexOf( "_" ) != -1 )
language = language.split( "_" ).join( "-" );
- }
language = language.toLowerCase();
var languageCode = language.split( "-" )[ 0 ];
@@ -50,12 +58,12 @@ function getArray( nl_language ) {
thisLanguageSet = languages[ languageCode ];
}
- if ( regionCode != null ) {
+ if ( regionCode != null )
// found additional region code
- if ( thisLanguageSet[ regionCode ] != null ) {
+ if ( thisLanguageSet[ regionCode ] != null )
// choose langCode-regionCode
thisLanguage = thisLanguageSet[ regionCode ];
- } else {
+ else
// choose default
thisLanguage = thisLanguageSet[ "-" ];
if ( languageCode == "en" ) {
@@ -64,11 +72,10 @@ function getArray( nl_language ) {
thisLanguageSet = languages[ languageCode ];
thisLanguage = thisLanguageSet[ regionCode ];
}
- }
- } else {
+ else
// choose default for none given region code
thisLanguage = thisLanguageSet[ "-" ];
- };
+
LANG_ARRAY = thisLanguage;
NATIVE_LANG = thisLanguage[ 2 ];
return thisLanguage;
@@ -78,11 +85,11 @@ function getArray( nl_language ) {
* get language for user-language in ISO format
* depends on nl_language
*/
-function getLanguageISO( nl_language ) {
+function getLanguageISO() {
var language = "";
- if ( nl_language != "" )
- language = nl_language;
+ if ( NL_LANGUAGE != "" )
+ language = NL_LANGUAGE;
else if ( navigator.language )
language = navigator.language;
else if ( navigator.userLanguage )
@@ -92,7 +99,7 @@ function getLanguageISO( nl_language ) {
// Convert "en" to "en-US" as well since en-US build is the canonical
// translation, and thus better tested.
- if ( language == "" || language == "null" || language == "en" )
+ if ( !language || language == "" || language == "null" || language == "en" )
language = "en-US";
if ( language == "pt" )
language = "pt-PT";
@@ -106,28 +113,26 @@ function getLanguageISO( nl_language ) {
var regionCode = language.split( "-" )[ 1 ];
var thisLanguageSet = languages[ languageCode ];
- if ( thisLanguageSet == null ) {
+ if ( thisLanguageSet == null )
language = "en-US";
- } else if ( regionCode != null ) {
- if ( regionCode == "pt" && languageCode == "pt" ) {
+ else if ( regionCode != null ) {
+ if ( regionCode == "pt" && languageCode == "pt" )
// fix for Port. pt-PT downloads named only pt without region code!
language = languageCode;
- }
- if ( thisLanguageSet[ regionCode ] != null ) {
+ if ( thisLanguageSet[ regionCode ] != null )
// choose langCode-regionCode
language = languageCode + "-" + regionCode.toUpperCase();
- } else {
+ else
// choose default
- if ( languageCode == "en" ) {
+ if ( languageCode == "en" )
// special case, default is en-US for en-XX
language = "en-US";
- } else
+ else
language = languageCode;
- }
- } else {
+ } else
// choose default
language = languageCode;
- };
+
LANG_ISO = language;
return language;
}
@@ -137,65 +142,55 @@ function getLanguageISO( nl_language ) {
* depends on array-list
*/
function hasMirrorLink() {
- if ( PLATFORM == "no_native_platform" )
+ if ( PLATFORM == "no_mirror_platform" )
return false;
// Check the flag in "languages.js", 'y' -> provide download link, 'n' -> redirect to alternative webpage
- if ( LANG_ARRAY[ 3 ] == 'y' ) {
+ if ( LANG_ARRAY[ 3 ] == 'y' )
return true;
- } else {
+ else
return false;
- }
}
/*
- * get link to mirror system for download-set
+ * get link to mirror system for download-set and checksum file
* depends on array-list
*/
-function getLink( version, nl_language ) {
- var LANG_ARRAY = getArray( nl_language );
- var LANG_ISO = getLanguageISO( nl_language );
- var PLATFORM = getPlatform();
- var link = "";
+function getLink() {
+ var file_link = "";
+ var chk_link = "";
+ LANG_ARRAY = getArray();
+ LANG_ISO = getLanguageISO();
- if ( nl_language == "" )
- nl_language = LANG_ISO;
+ getPlatform();
- // trim timestamp from version, required for RC
- if ( version.indexOf( "_" ) > -1 )
- version = version.split( "_" )[0];
+ // alert( PLATFORM + "<br />" + UI_PLATFORM + "<br />" + EXTENSION );
- if ( hasMirrorLink() ) {
- link = SOURCEFORGE_BASE_URL + "files/";
- if ( nl_language == "en-US" ) {
- link = link + "stable/" + version + "/";
- } else {
- link = link + "localized/" + nl_language + "/" + version + "/";
- }
- link = link + getFilename( version, nl_language );
- return link + "/download";
- } else {
- return LANG_ARRAY[ 4 ];
- }
-}
+ if ( NL_LANGUAGE == "" )
+ NL_LANGUAGE = LANG_ISO;
-/*
- * get checksum file
- * depending on which install file was recognized and assembled
- */
-function getChecksum( version, nl_language, hash ) {
- var link = "";
+ // trim timestamp from version, required for RC
+ // if ( version.indexOf( "_" ) > -1 )
+ // version = version.split( "_" )[0];
if ( hasMirrorLink() ) {
- if ( LANG_ISO == "en-US" ) {
- link = APACHE_DIST_BASE_URL + "files/stable/" + version + "/";
+ if ( NL_LANGUAGE == "en-US" ) {
+ file_link = SOURCEFORGE_BASE_URL + "files/stable/" + VERSION + "/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION + "/download";
+ chk_link = APACHE_DIST_BASE_URL + "files/stable/" + VERSION + "/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
} else {
- link = APACHE_DIST_BASE_URL + "files/localized/" + LANG_ISO + "/" + version + "/";
+ file_link = SOURCEFORGE_BASE_URL + "files/localized/" + NL_LANGUAGE + "/" + VERSION + "/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION + "/download";
+ chk_link = APACHE_DIST_BASE_URL + "files/localized/" + LANG_ISO + "/" + VERSION + "/Apache_OpenOffice_incubating_" + VERSION + "_" + PLATFORM + "_" + NL_LANGUAGE + EXTENSION;
}
+ CHECKSUM_ASC = chk_link + ".asc";
+ CHECKSUM_MD5 = chk_link + ".md5";
+ CHECKSUM_SHA256 = chk_link + ".sha256";
+ return file_link;
} else {
- return "no_checksum";
+ CHECKSUM_ASC = "no_checksum";
+ CHECKSUM_MD5 = "no_checksum";
+ CHECKSUM_SHA256 = "no_checksum";
+ return LANG_ARRAY[ 4 ];
}
- return link + getFilename( version, nl_language ) + "." + hash;
}
/*
@@ -203,82 +198,96 @@ function getChecksum( version, nl_langua
* depending on what is recognized from browser's user-agent data
*/
function getPlatform() {
- var mirror_platform = "";
+ // assume a not recognizable platform first and apply respective values
+
+ // if you need help or more data: "http://www.useragentstring.com"
if ( navigator.platform != "" ) {
- if ( navigator.platform.toLowerCase().indexOf( "windows" ) != -1 ||
- navigator.platform.toLowerCase().indexOf( "win" ) != -1 ) {
- mirror_platform = "Win_x86_install";
- PLATFORM = "Windows (EXE)";
- EXTENSION = ".exe";
+ if ( navigator.platform.toLowerCase().indexOf( "windows" ) != -1 ) {
+ UI_PLATFORM = "Windows (EXE)";
+ PLATFORM = "Win_x86_install";
+ EXTENSION = ".exe";
+ if ( navigator.userAgent.toLowerCase().indexOf( "phone" ) != -1 ||
+ navigator.userAgent.toLowerCase().indexOf( "mobile" ) != -1 ||
+ navigator.userAgent.toLowerCase().indexOf( "ce" ) != -1 ) {
+ UI_PLATFORM = "Windows mobile device";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ }
} else if ( navigator.platform.toLowerCase().indexOf( "linux" ) != -1 ) {
if ( navigator.platform.indexOf( "64" ) != -1 ) {
- if ( navigator.platform != "" ) {
- if ( navigator.userAgent.toLowerCase().indexOf( "debian" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "ubuntu" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "iceweasel" ) != -1 ) {
- mirror_platform = "Linux_x86-64_install-deb";
- PLATFORM = "Linux Debian 64-bit (DEB)";
- EXTENSION = ".tar.gz";
- } else {
- mirror_platform = "Linux_x86-64_install-rpm";
- PLATFORM = "Linux 64-bit (RPM)";
- EXTENSION = ".tar.gz";
- }
- } else {
- mirror_platform = "Linux_x86-64_install-rpm";
- PLATFORM = "Linux 64-bit (RPM)";
- EXTENSION = ".tar.gz";
+ UI_PLATFORM = "Linux 64-bit (RPM)";
+ PLATFORM = "Linux_x86-64_install-rpm";
+ 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 {
- if ( navigator.platform != "" ) {
- if ( navigator.userAgent.toLowerCase().indexOf( "debian" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "ubuntu" ) != -1 ||
- navigator.userAgent.toLowerCase().indexOf( "iceweasel" ) != -1 ) {
- mirror_platform = "Linux_x86_install-deb";
- PLATFORM = "Linux Debian 32-Bit (DEB)";
- EXTENSION = ".tar.gz";
- } else {
- mirror_platform = "Linux_x86_install-rpm";
- PLATFORM = "Linux 32-Bit (RPM)";
- EXTENSION = ".tar.gz";
- }
- } else {
- mirror_platform = "Linux_x86-64_install-rpm";
- PLATFORM = "Linux 32-Bit (RPM)";
- EXTENSION = ".tar.gz";
+ UI_PLATFORM = "Linux 32-Bit (RPM)";
+ PLATFORM = "Linux_x86_install-rpm";
+ 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 ) {
- mirror_platform = "MacOS_x86_install";
- PLATFORM = "Mac OS Intel (DMG)";
- EXTENSION = ".dmg";
+ 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 = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ }
+ } else if ( navigator.platform.toLowerCase().indexOf( "sunos" ) != -1 ) {
+ UI_PLATFORM = "Solaris x86 (PKG)";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ if ( navigator.userAgent.toLowerCase().indexOf( "sun4u" ) != -1 ) {
+ UI_PLATFORM = "Solaris SPARC (PKG)";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ }
+ } else if ( navigator.platform.toLowerCase().indexOf( "freebsd" ) != -1 ) {
+ UI_PLATFORM = "FreeBSD (PKG)";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ } else if ( navigator.platform.toLowerCase().indexOf( "os/2" ) != -1 ) {
+ UI_PLATFORM = "OS/2";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_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 = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ } else if ( navigator.userAgent.toLowerCase().indexOf( "android" ) != -1 ) {
+ UI_PLATFORM = "Android mobile device";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ } else if ( navigator.userAgent.toLowerCase().indexOf( "blackberry" ) != -1 ) {
+ UI_PLATFORM = "Blackberry mobile device";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
+ } else if ( navigator.userAgent.toLowerCase().indexOf( "symbian" ) != -1 ) {
+ UI_PLATFORM = "Symbian mobile device";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
}
} else {
- // if navigator.platform is null or empty, then no platform was recognized
- mirror_platform = "no_platform";
- PLATFORM = "no_native_platform";
- EXTENSION = "no_native_extension";
- }
- return mirror_platform;
-}
-
-/*
- * get filename for mirror-link
- * depends on nl_language
- */
-function getFilename( version, nl_language ) {
- var filename = "";
-
- if ( nl_language == "" )
- nl_language = LANG_ISO;
-
- if ( hasMirrorLink() ) {
- filename = "Apache_OpenOffice_incubating_" + version + "_" + getPlatform() + "_" + nl_language + EXTENSION;
- } else {
- filename = "no_filename";
+ UI_PLATFORM = "not recognizable";
+ PLATFORM = "no_mirror_platform";
+ EXTENSION = "no_extension";
}
- return filename;
}
/*