diff --git a/js/messages.php b/js/messages.php new file mode 100644 index 000000000..f8239f7b9 --- /dev/null +++ b/js/messages.php @@ -0,0 +1,52 @@ + $js_message) { + echo "PMA_messages['" . $name . "'] = '" . PMA_escapeJsString($js_message) . "';\n"; +} +?> diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 8a45e751f..b190f1297 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -549,12 +549,6 @@ $GLOBALS['js_include'][] = 'mootools.js'; $GLOBALS['js_include'][] = 'jquery/jquery-1.4.2-min.js'; $GLOBALS['js_include'][] = 'update-location.js'; -/** - * holds locale messages required by JavaScript function - * @global array $js_messages - */ -$GLOBALS['js_messages'] = array(); - /** * JavaScript events that will be registered * @global array $js_events diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php index 6d6175801..55ebe4711 100644 --- a/libraries/header_scripts.inc.php +++ b/libraries/header_scripts.inc.php @@ -65,49 +65,12 @@ $title = str_replace( // here, the function does not exist with this configuration: $cfg['ServerDefault'] = 0; $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser(); -if (in_array('functions.js', $GLOBALS['js_include'])) { - $GLOBALS['js_messages']['strFormEmpty'] = $GLOBALS['strFormEmpty']; - $GLOBALS['js_messages']['strNotNumber'] = $GLOBALS['strNotNumber']; - $GLOBALS['js_messages']['strClickToSelect'] = $GLOBALS['strClickToSelect']; - $GLOBALS['js_messages']['strClickToUnselect'] = $GLOBALS['strClickToUnselect']; - - if (!$is_superuser && !$GLOBALS['cfg']['AllowUserDropDatabase']) { - $GLOBALS['js_messages']['strNoDropDatabases'] = $GLOBALS['strNoDropDatabases']; - } else { - $GLOBALS['js_messages']['strNoDropDatabases'] = ''; - } - - if ($GLOBALS['cfg']['Confirm']) { - $GLOBALS['js_messages']['strDoYouReally'] = $GLOBALS['strDoYouReally']; - $GLOBALS['js_messages']['strDropDatabaseStrongWarning'] = $GLOBALS['strDropDatabaseStrongWarning']; - - // rajk - for blobstreaming - $GLOBALS['js_messages']['strBLOBRepositoryDisableStrongWarning'] = $GLOBALS['strBLOBRepositoryDisableStrongWarning']; - $GLOBALS['js_messages']['strBLOBRepositoryDisableAreYouSure'] = sprintf($GLOBALS['strBLOBRepositoryDisableAreYouSure'], $GLOBALS['db']); - } else { - $GLOBALS['js_messages']['strDoYouReally'] = ''; - $GLOBALS['js_messages']['strDropDatabaseStrongWarning'] = ''; - - // rajk - for blobstreaming - $GLOBALS['js_messages']['strBLOBRepositoryDisableStrongWarning'] = ''; - $GLOBALS['js_messages']['strBLOBRepositoryDisableAreYouSure'] = ''; - } -} elseif (in_array('indexes.js', $GLOBALS['js_include'])) { - $GLOBALS['js_messages']['strFormEmpty'] = $GLOBALS['strFormEmpty']; - $GLOBALS['js_messages']['strNotNumber'] = $GLOBALS['strNotNumber']; -} - -if (in_array('server_privileges.js', $GLOBALS['js_include'])) { - $GLOBALS['js_messages']['strHostEmpty'] = $GLOBALS['strHostEmpty']; - $GLOBALS['js_messages']['strUserEmpty'] = $GLOBALS['strUserEmpty']; - $GLOBALS['js_messages']['strPasswordEmpty'] = $GLOBALS['strPasswordEmpty']; - $GLOBALS['js_messages']['strPasswordNotSame'] = $GLOBALS['strPasswordNotSame']; -} - -$GLOBALS['js_messages']['strGo'] = __('Go'); -$GLOBALS['js_messages']['strCancel'] = __('Cancel'); - $GLOBALS['js_include'][] = 'tooltip.js'; +$params = array('lang' => $GLOBALS['lang']); +if (isset($GLOBALS['db'])) { + $params['db'] = $GLOBALS['db']; +} +$GLOBALS['js_include'][] = 'messages.php' . PMA_generate_common_url($params); $GLOBALS['js_events'][] = array( 'object' => 'window', @@ -121,7 +84,11 @@ $GLOBALS['js_events'][] = array( * browser cache. This produces an HTTP 304 request for each file. */ foreach ($GLOBALS['js_include'] as $js_script_file) { - echo '' . "\n"; + if (strpos($js_script_file, '?') === FALSE) { + echo '' . "\n"; + } else { + echo '' . "\n"; + } } ?>