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/07/06 21:58:43 UTC
svn commit: r1608288 -
/openoffice/ooo-site/trunk/content/download/test/download.js
Author: marcus
Date: Sun Jul 6 19:58:42 2014
New Revision: 1608288
URL: http://svn.apache.org/r1608288
Log:
Changed the global functions to be used only as methods of the global 'DL' object
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=1608288&r1=1608287&r2=1608288&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download.js Sun Jul 6 19:58:42 2014
@@ -1,29 +1,32 @@
/*
- * Overview of all functions defined below
- * ----------------------------------------------------
+ * Overview of all methods (functions) defined below of the global object "DL"
+ * ---------------------------------------------------------------------------
+ * function DL.initVariables ()
+ * function DL.getLanguage ()
+ * function DL.fillOSSelection ()
+ * function DL.fillLanguageSelection ()
+ * function DL.fillVersionSelection ()
+ * function DL.getOSSelection ()
+ * function DL.getLanguageSelection ()
+ * function DL.getVersionSelection ()
+ * function DL.setOSSelection ()
+ * function DL.setLanguageSelection ()
+ * function DL.setVersionSelection ()
+ * function DL.hideElements ()
+ * function DL.showWindow ( target_link )
+ * function DL.showErrorMessage ( error_text )
+ * function DL.isLanguageSupported ()
+ * function DL.checkForLinkExceptions ()
+ * function DL.getLinkSelection ()
+ * function DL.getPlatform ()
+ * function DL.getReleaseMatrixPosition ()
+ * function DL.getFileData ( version )
+ * function DL.debug ( location )
+ *
+ * Overview of global functions defined below
+ * ------------------------------------------
* function init ()
- * function initVariables ()
- * function getLanguage ()
- * function fillOSSelection ()
- * function fillLanguageSelection ()
- * function fillVersionSelection ()
- * function getOSSelection ()
- * function getLanguageSelection ()
- * function getVersionSelection ()
- * function setOSSelection ()
- * function setLanguageSelection ()
- * function setVersionSelection ()
- * function hideElements ()
- * function showWindow ( target_link )
- * function showErrorMessage ( error_text )
- * function isLanguageSupported ()
- * function checkForLinkExceptions ()
- * function getLinkSelection ()
- * function getPlatform ()
- * function getReleaseMatrixPosition ()
- * function getFileData ( version )
* function openItem ( itemid, uri )
- * function debug ( location )
*/
/*
@@ -33,29 +36,29 @@
*/
function init( release_mode ) {
// Set global variables.
- initVariables( 1 );
+ DL.initVariables( 1 );
// Fill the OS, language and version select boxes.
- fillOSSelection();
- fillLanguageSelection();
- fillVersionSelection();
+ DL.fillOSSelection();
+ DL.fillLanguageSelection();
+ DL.fillVersionSelection();
// Get the language and platform from the browser data.
- getLanguage();
- getPlatform();
+ DL.getLanguage();
+ DL.getPlatform();
// Set the recognized platform and language as default.
- setOSSelection();
- setLanguageSelection();
- setVersionSelection();
+ DL.setOSSelection();
+ DL.setLanguageSelection();
+ DL.setVersionSelection();
// When release mode = 2, it is a beta release. Otherwise assume "stable release" as default.
if( release_mode === 2 ) {
- RELEASE_MODE = mode;
+ DL.RELEASE_MODE = mode;
}
- getLinkSelection();
+ DL.getLinkSelection();
return;
}
@@ -65,7 +68,7 @@ function init( release_mode ) {
* @param: init_all - Should all variables initialized or just a part?
* @return: None
*/
-function initVariables( init_all ) {
+DL.initVariables = function( init_all ) {
// Define variables without "var" to make them globally available.
// The following are used in "download.js". and "index.html".
@@ -124,9 +127,6 @@ function initVariables( init_all ) {
DL.SHOW_SUB_BOX = true; // Is the download URL OK to show the sub-box (true) or not (false)?
DL.ERROR = false; // Is the download URL in general OK (false) or not (true)?
-// alert( DL.VERSION + "\n\n" + DL.VERSION_TEST );
-// exit;
-
return;
}
@@ -135,7 +135,7 @@ function initVariables( init_all ) {
* @param: None
* @return: DL.LANG_ISO - The language as ISO code
*/
-function getLanguage() {
+DL.getLanguage = function() {
var language = "";
// If available, use the manual set ISO code (see "index.html") that overrides $LANG_ISO.
@@ -224,7 +224,7 @@ function getLanguage() {
* @param: None
* @return: None
*/
-function fillOSSelection() {
+DL.fillOSSelection = function() {
var selection = document.getElementById( "os" );
var option = "";
@@ -246,7 +246,7 @@ function fillOSSelection() {
* @param: None
* @return: None
*/
-function fillLanguageSelection() {
+DL.fillLanguageSelection = function() {
var selection = document.getElementById( "language" );
var option = "";
@@ -268,7 +268,7 @@ function fillLanguageSelection() {
* @param: None
* @return: None
*/
-function fillVersionSelection() {
+DL.fillVersionSelection = function() {
var selection = document.getElementById( "version" );
var option = "";
@@ -290,7 +290,7 @@ function fillVersionSelection() {
* @param: None
* @return: DL.PLATFORM_SEL - The platform as short code that was set as selected in the drop-down box
*/
-function setOSSelection() {
+DL.setOSSelection = function() {
// Depending on $DL.PLATFORM assign the platform string of the release matrix.
var selection = document.getElementById( "os" );
@@ -326,7 +326,7 @@ function setOSSelection() {
* @param: None
* @return: DL.LANG_SEL - The language as ISO code that was set as selected in the drop-down box
*/
-function setLanguageSelection() {
+DL.setLanguageSelection = function() {
// Depending on $DL.LANG_ISO assign the language position of the release matrix.
var selection = document.getElementById( "language" );
@@ -364,7 +364,7 @@ function setLanguageSelection() {
* @param: None
* @return: DL.VERSION_SEL - The version that was set as selected in the drop-down box
*/
-function setVersionSelection() {
+DL.setVersionSelection = function() {
// Depending on $DL.VERSION assign the version.
var selection = document.getElementById( "version" );
@@ -400,7 +400,7 @@ function setVersionSelection() {
* @param: None
* @return: DL.PLATFORM_SEL - The platform as short code that was selected from the drop-down box
*/
-function getOSSelection() {
+DL.getOSSelection = function() {
var os_value = document[ "download" ]["os" ].options[ document[ "download" ][ "os" ].selectedIndex ].value;
// Search through the <select> element until the chosen OS is found.
@@ -422,7 +422,7 @@ function getOSSelection() {
* @param: None
* @return: DL.LANG_SEL - The language as ISO code that was selected from the drop-down box
*/
-function getLanguageSelection() {
+DL.getLanguageSelection = function() {
var language_value = document[ "download" ][ "language" ].options[ document[ "download" ][ "language" ].selectedIndex ].value;
// Search through the <select> element until the chosen language is found.
@@ -442,7 +442,7 @@ function getLanguageSelection() {
* @param: None
* @return: DL.VERSION_SEL - The version that was selected from the drop-down box
*/
-function getVersionSelection() {
+DL.getVersionSelection = function() {
var version_value = document[ "download" ][ "version" ].options[ document[ "download" ][ "version" ].selectedIndex ].value;
// Search through the <select> element until the chosen version is found.
@@ -461,7 +461,7 @@ function getVersionSelection() {
* @param: None
* @return: None
*/
-function hideElements() {
+DL.hideElements = function() {
// Change CSS styles for all elements with ID in the green and sub-green colored boxes.
// Emtpy the values for all elements, make them invisible.
@@ -481,7 +481,7 @@ function hideElements() {
* @param: target_link - The URL that should be opened as popup window
* @return: None
*/
-function showWindow( target_link ) {
+DL.showWindow = function( target_link ) {
// Open a popup window with specific parameters to show the file from "target_link".
var popup_window = "";
@@ -497,11 +497,11 @@ function showWindow( target_link ) {
* @param: error_text - The text should should be shown as error message
* @return: DL.ERROR - Set the general error flag to "true"
*/
-function showErrorMessage( error_text ) {
+DL.showErrorMessage = function( error_text ) {
// The chosen items from select boxes lead to no download link, show an error message about reason + alternative.
// In general, hide the data for link, text and title of all elements.
- hideElements();
+ DL.hideElements();
// Now set again the values for all elements that should be shown with changed data.
document.getElementById( "dl_f_link" ).style.display = "inline";
@@ -540,7 +540,7 @@ function showErrorMessage( error_text )
* @param: None
* @return: DL.ERROR - Depending on if the language is supported set the general error flag to "true" or "false"
*/
-function isLanguageSupported() {
+DL.isLanguageSupported = function() {
// Check if the language in "release_matrix.js" is a release language depending on the version.
// If no VERSION was selected, assume the default version.
@@ -579,7 +579,7 @@ function isLanguageSupported() {
* @param: None
* @return: None
*/
-function checkForLinkExceptions() {
+DL.checkForLinkExceptions = function() {
// If recognized resp. selected platform, language or version does not lead to a normal download link,
// show the none-availability to the user.
@@ -587,7 +587,7 @@ function checkForLinkExceptions() {
DL.ERROR = false;
// If language is not supported, show the none-availability to the user.
- if( ! isLanguageSupported() ) {
+ if( ! DL.isLanguageSupported() ) {
// Show an error message that the chosen items do not lead to a download.
// If a customized string is not available in the "msg_prop_l10n_XX.js" file.
@@ -606,7 +606,7 @@ function checkForLinkExceptions() {
var error_text = l10n_download_error_custom_4_text;
}
- showErrorMessage( error_text );
+ DL.showErrorMessage( error_text );
}
// If the browser-guessed platform is not supported, show the none-availability to the user.
@@ -628,7 +628,7 @@ function checkForLinkExceptions() {
var error_text = l10n_download_error_custom_3_text;
}
- showErrorMessage( error_text );
+ DL.showErrorMessage( error_text );
}
// If version is '4.1.0' (or newer) and platform is 'Mac OS X <= 10.6', show the none-availability to the user.
@@ -650,7 +650,7 @@ function checkForLinkExceptions() {
var error_text = l10n_download_error_custom_1_text;
}
- showErrorMessage( error_text );
+ DL.showErrorMessage( error_text );
}
// If version is '4.0.1' (or older) and platform is 'Mac OS X >= 10.7', show the none-availability to the user.
@@ -672,13 +672,13 @@ function checkForLinkExceptions() {
var error_text = l10n_download_error_custom_2_text;
}
- showErrorMessage( error_text );
+ DL.showErrorMessage( error_text );
}
// If version is '3.4.1', create a download link that leads to the "other-3.4.1.html" webpage.
if( DL.VERSION_SEL === "3.4.1" ) {
// In general, hide the data for link, text and title of all elements.
- hideElements();
+ DL.hideElements();
// Set the values for the single download text button.
document.getElementById( "dl_f_link" ).href = l10n_download_aoo341_link;
@@ -695,7 +695,7 @@ function checkForLinkExceptions() {
// If platform is 'other', create a download link that leads to the Porting webpage.
if( DL.PLATFORM_SEL === "other" ) {
// In general, hide the data for link, text and title of all elements.
- hideElements();
+ DL.hideElements();
// Set the values for the single download text button.
document.getElementById( "dl_f_link" ).href = l10n_download_porting_link;
@@ -712,7 +712,7 @@ function checkForLinkExceptions() {
// If version is 'older', create a download link that leads to the archive webpage.
if( DL.VERSION_SEL === "older" ) {
// In general, hide the data for link, text and title of all elements.
- hideElements();
+ DL.hideElements();
// Set the values for the single download text button.
document.getElementById( "dl_f_link" ).href = l10n_download_archive_link;
@@ -734,25 +734,25 @@ function checkForLinkExceptions() {
* @param: None
* @return: None
*/
-function getLinkSelection() {
+DL.getLinkSelection = function() {
// Reset all variables that could have been set until now.
- initVariables( 0 );
+ DL.initVariables( 0 );
// Get the selected data from the select boxes.
- getOSSelection();
- getLanguageSelection();
- getVersionSelection();
+ DL.getOSSelection();
+ DL.getLanguageSelection();
+ DL.getVersionSelection();
// First check for expections that do not lead to real download links.
- checkForLinkExceptions();
+ DL.checkForLinkExceptions();
// If the selected options lead to no download URL, should the sub-box shown anyway?
// Yes when SHOW_SUB_BOX = "true" and ERROR = "false".
if( DL.SHOW_SUB_BOX && ! DL.ERROR ) {
// Assemble the filenames and text for download and checksums.
- getReleaseMatrixPosition();
- getFileData( DL.VERSION_SEL );
+ DL.getReleaseMatrixPosition();
+ DL.getFileData( DL.VERSION_SEL );
DL.SF_BASE_URL = DL.SF + DL.VERSION_SEL + "/binaries/";
DL.ASF_ARC_BASE_URL = DL.ASF_ARC + DL.VERSION_SEL;
@@ -893,7 +893,7 @@ function getLinkSelection() {
* @param: None
* @return: None
*/
-function getPlatform() {
+DL.getPlatform = function() {
// For more help or data see: "http://www.useragentstring.com".
var av, os, ua, ve = "";
@@ -1096,7 +1096,7 @@ function getPlatform() {
* @param: None
* @return: None
*/
-function getReleaseMatrixPosition() {
+DL.getReleaseMatrixPosition = function() {
// Depending on $PLATFORM, assign the platform position from the release matrix.
switch( DL.PLATFORM ) {
@@ -1156,7 +1156,7 @@ function getReleaseMatrixPosition() {
* @param: version - The version to use to get the file data
* @return: None
*/
-function getFileData( version ) {
+DL.getFileData = function( version ) {
// Depending on $ver, a different release matrix has to be used to assemble the download filenames.
switch( version ) {
@@ -1255,7 +1255,7 @@ function openItem( itemid, uri ) {
* @param: location - The location where the debug utput should take place
* @return: None
*/
-function debug( location ) {
+DL.debug = function( location ) {
// Depending on the current position in the code, show the values for the variables as alert box.
// Usage:
// Call the function in the code position you want to debug.