Author: marcus
Date: Thu Jun 5 21:05:12 2014
New Revision: 1600764
URL: http://svn.apache.org/r1600764
Log:
Changed the behavior of initializing/resetting global variables
Modified:
openoffice/ooo-site/trunk/content/download/test/download_droplist.js
Modified: openoffice/ooo-site/trunk/content/download/test/download_droplist.js
URL:
http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/download/test/download_droplist.js?rev=1600764&r1=1600763&r2=1600764&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download_droplist.js
(original)
+++ openoffice/ooo-site/trunk/content/download/test/download_droplist.js Thu
Jun 5 21:05:12 2014
@@ -14,7 +14,6 @@
* function setLangSel ()
* function setVerSel ()
* function getTypeSel ()
- * function resetVars ()
* function resetElements ()
* function showWindow ( target_url )
* function showErrorMessage ( error_text )
@@ -33,9 +32,9 @@
/*
* Init function
*/
-function init( a, b ) {
+function init( a ) {
// Set global variables.
- initVars();
+ initVars( 1 );
// Fill the OS, language and version select boxes.
fillOSSel()
@@ -58,9 +57,9 @@ function init( a, b ) {
}
/*
- * Define all global variables
+ * Define all global variables with default values
*/
-function initVars() {
+function initVars( init_all ) {
// Define variables without "var" to make them globally available.
// The following are used in "download.js" only.
@@ -79,23 +78,26 @@ function initVars() {
"dl_lp_chk_keys", "dl_lp_chk_asc", "dl_lp_chk_md5", "dl_lp_chk_sha256",
"dl_hlp", "dl_chk", "dl_rpt" ];
// The following are used in "download.js". and "index.html".
- R_MODE = ""; // The release mode (1
= stable release (default), 2 = beta release, etc.).
- LANG_ISO = ""; // The language as ISO
code.
+ if( init_all === 1 ) {
+ R_MODE = ""; // The release mode (1
= stable release (default), 2 = beta release, etc.).
+ LANG_ISO = ""; // The language as ISO
code.
+ LANG_SEL = ""; // The selected
language as ISO code from select box.
+ UI_PLATFORM_NO_SUP = ""; // The platform as
readable string, if not supported.
+ OLD_PLATFORM = false; // Is the browser
platform old (true) or not (false)?
+ PLATFORM_SEL = ""; // The selected
platform from select box.
+ VERSION_SEL = ""; // The selected
version from select box.
+ }
+
// LANG_ARRAY = ""; // This array contains
all language specific data.
- LANG_SEL = ""; // The selected
language as ISO code from select box.
UI_PLATFORM = ""; // The platform as
readable string.
- UI_PLATFORM_NO_SUP = ""; // The platform as
readable string, if not supported.
PLATFORM = ""; // The platform in
short form.
PLATFORM_FULL = ""; // The platform as
part of the download URL (full install).
PLATFORM_LP = ""; // The platform as
part of the download URL (langpack).
- PLATFORM_SEL = ""; // The selected
platform from select box.
- OLD_PLATFORM = false; // Is the browser
platform old (true) or not (false)?
RELEASE_PLATFORM_POS_FULL = -1; // The position of the
platform in the release matrix array (full install).
RELEASE_PLATFORM_POS_LP = -1; // The position of the
platform in the release matrix array (langpack).
RELEASE_PLATFORM = ""; // The platform in the
release matrix array.
RELEASE_LANG = ""; // The language
specific data depending on LANG_ISO.
REL_TEXT = ""; // The release data
(milestone, build ID, svn rev, release date).
- VERSION_SEL = ""; // The selected
version from select box.
FILENAME_FULL = ""; // The complete
filename of the download URL (full install).
FILENAME_LP = ""; // The complete
filename of the download URL (langpack).
FILESIZE_FULL = -1; // The filesize of the
download file (full install).
@@ -776,45 +778,6 @@ function getTypeSel() {
}
/*
- * Reset global variables
- */
-function resetVars() {
- // Empty global variables to avoid any mixed data and confusion.
- UI_PLATFORM = "";
- PLATFORM = "";
- PLATFORM_FULL = "";
- PLATFORM_LP = "";
- RELEASE_PLATFORM_POS_FULL = -1;
- RELEASE_PLATFORM_POS_LP = -1;
- RELEASE_PLATFORM = "";
- RELEASE_LANG = "";
- FILENAME_FULL = "";
- FILENAME_LP = "";
- FILESIZE_FULL = -1;
- FILESIZE_LP = -1;
- EXTENSION = "";
- REL_TEXT = "";
- LINK_FULL = "";
- LINK_LP = "";
- LINK_CHK_KEYS = "";
- LINK_CHK_ASC_FULL = "";
- LINK_CHK_MD5_FULL = "";
- LINK_CHK_SHA256_FULL = "";
- LINK_CHK_ASC_LP = "";
- LINK_CHK_MD5_LP = "";
- LINK_CHK_SHA256_LP = "";
- SOURCEFORGE_BASE_URL = "";
- SOURCEFORGE_PREV_URL = "";
- ASF_BASE_URL = "";
- ASF_ARC_BASE_URL = "";
- ASF_ARC_PREV_URL = "";
- SF = false;
- OTHER = false;
- ARCHIVE = false;
- ERROR = true;
-}
-
-/*
* Reset CSS style for all elements with ID to make them invisible
*/
function resetElements() {
@@ -1204,7 +1167,7 @@ function getLinkSel() {
// ERROR = true;
// Reset all variables that could have been set until now.
- resetVars();
+ initVars( 0 );
// If no mode was given, assume it is the release mode (stable release).
if( R_MODE === undefined )