Setup script update

* removed server numbers from language strings
* changed some variable names in FormDisplay to make it more consistent
This commit is contained in:
Piotr Przybylski
2008-09-04 12:22:12 +00:00
parent 1030a66e8c
commit 296bd5679e
4 changed files with 122 additions and 101 deletions

View File

@@ -135,81 +135,81 @@ $str['Form_Export_defaults'] = 'Defaults';
$str['Form_Export_defaults_desc'] = 'Customize default export options';
// Form: Server
$str['Servers/1/verbose_name'] = 'Verbose name of this server';
$str['Servers/1/verbose_desc'] = 'Hostname where MySQL server is running';
$str['Servers/1/host_name'] = 'Server hostname';
$str['Servers/1/host_desc'] = '';
$str['Servers/1/port_name'] = 'Server port';
$str['Servers/1/port_desc'] = 'Port on which MySQL server is listening, leave empty for default';
$str['Servers/1/socket_name'] = 'Server socket';
$str['Servers/1/socket_desc'] = 'Socket on which MySQL server is listening, leave empty for default';
$str['Servers/1/ssl_name'] = 'Use SSL';
$str['Servers/1/ssl_desc'] = '';
$str['Servers/1/connect_type_name'] = 'Connection type';
$str['Servers/1/connect_type_desc'] = 'How to connect to server, keep tcp if unsure';
$str['Servers/1/extension_name'] = 'PHP extension to use';
$str['Servers/1/extension_desc'] = 'What PHP extension to use, use mysqli if supported';
$str['Servers/1/compress_name'] = 'Compress connection';
$str['Servers/1/compress_desc'] = 'Compress connection to MySQL server';
$str['Servers/1/auth_type_name'] = 'Authentication type';
$str['Servers/1/auth_type_desc'] = 'Authentication method to use';
$str['Servers/1/user_name'] = 'User for config auth';
$str['Servers/1/user_desc'] = 'Leave empty if not using config auth';
$str['Servers/1/password_name'] = 'Password for config auth';
$str['Servers/1/password_desc'] = 'Leave empty if not using config auth';
$str['Servers/1/nopassword_name'] = 'Connect without password';
$str['Servers/1/nopassword_desc'] = 'Try to connect without password';
$str['Servers/verbose_name'] = 'Verbose name of this server';
$str['Servers/verbose_desc'] = 'Hostname where MySQL server is running';
$str['Servers/host_name'] = 'Server hostname';
$str['Servers/host_desc'] = '';
$str['Servers/port_name'] = 'Server port';
$str['Servers/port_desc'] = 'Port on which MySQL server is listening, leave empty for default';
$str['Servers/socket_name'] = 'Server socket';
$str['Servers/socket_desc'] = 'Socket on which MySQL server is listening, leave empty for default';
$str['Servers/ssl_name'] = 'Use SSL';
$str['Servers/ssl_desc'] = '';
$str['Servers/connect_type_name'] = 'Connection type';
$str['Servers/connect_type_desc'] = 'How to connect to server, keep tcp if unsure';
$str['Servers/extension_name'] = 'PHP extension to use';
$str['Servers/extension_desc'] = 'What PHP extension to use, use mysqli if supported';
$str['Servers/compress_name'] = 'Compress connection';
$str['Servers/compress_desc'] = 'Compress connection to MySQL server';
$str['Servers/auth_type_name'] = 'Authentication type';
$str['Servers/auth_type_desc'] = 'Authentication method to use';
$str['Servers/user_name'] = 'User for config auth';
$str['Servers/user_desc'] = 'Leave empty if not using config auth';
$str['Servers/password_name'] = 'Password for config auth';
$str['Servers/password_desc'] = 'Leave empty if not using config auth';
$str['Servers/nopassword_name'] = 'Connect without password';
$str['Servers/nopassword_desc'] = 'Try to connect without password';
// Form: Server_login_options
$str['Servers/1/SignonSession_name'] = 'Signon session name';
$str['Servers/1/SignonSession_desc'] = 'See [a@http://wiki.cihar.com/pma/auth_types#signon]authentication types[/a] for an example';
$str['Servers/1/SignonURL_name'] = 'Signon URL';
$str['Servers/1/LogoutURL_name'] = 'Logout URL';
$str['Servers/1/auth_swekey_config_name'] = 'SweKey config file';
$str['Servers/1/auth_swekey_config_desc'] = 'Config file for [a@http://swekey.com]SweKey hardware authentication[/a], relative to phpMyAdmin root directory, eg. ./swekey.conf';
$str['Servers/SignonSession_name'] = 'Signon session name';
$str['Servers/SignonSession_desc'] = 'See [a@http://wiki.cihar.com/pma/auth_types#signon]authentication types[/a] for an example';
$str['Servers/SignonURL_name'] = 'Signon URL';
$str['Servers/LogoutURL_name'] = 'Logout URL';
$str['Servers/auth_swekey_config_name'] = 'SweKey config file';
$str['Servers/auth_swekey_config_desc'] = 'Config file for [a@http://swekey.com]SweKey hardware authentication[/a], relative to phpMyAdmin root directory, eg. ./swekey.conf';
// Form: Server_config
$str['Servers/1/only_db_name'] = 'Show only listed databases';
$str['Servers/1/only_db_desc'] = 'You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use \'my\_db\' and not \'my_db\'';
$str['Servers/1/hide_db_name'] = 'Hide databases';
$str['Servers/1/hide_db_desc'] = 'Hide databases matching regular expression (PCRE)';
$str['Servers/1/AllowRoot_name'] = 'Allow root login';
$str['Servers/1/AllowNoPasswordRoot_name'] = 'Allow root without password';
$str['Servers/1/DisableIS_name'] = 'Disable use of INFORMATION_SCHEMA';
$str['Servers/1/DisableIS_desc'] = 'More information on [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]';
$str['Servers/1/AllowDeny/order_name'] = 'Host authentication order';
$str['Servers/1/AllowDeny/order_desc'] = 'Leave blank if not used';
$str['Servers/1/AllowDeny/rules_name'] = 'Host authentication rules';
$str['Servers/1/AllowDeny/rules_desc'] = 'Leave blank for defaults';
$str['Servers/1/ShowDatabasesCommand_name'] = 'SHOW DATABASES command';
$str['Servers/1/ShowDatabasesCommand_desc'] = 'SQL command to fetch available databases';
$str['Servers/1/CountTables_name'] = 'Count tables';
$str['Servers/1/CountTables_desc'] = 'Count tables when showing database list';
$str['Servers/only_db_name'] = 'Show only listed databases';
$str['Servers/only_db_desc'] = 'You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use \'my\_db\' and not \'my_db\'';
$str['Servers/hide_db_name'] = 'Hide databases';
$str['Servers/hide_db_desc'] = 'Hide databases matching regular expression (PCRE)';
$str['Servers/AllowRoot_name'] = 'Allow root login';
$str['Servers/AllowNoPasswordRoot_name'] = 'Allow root without password';
$str['Servers/DisableIS_name'] = 'Disable use of INFORMATION_SCHEMA';
$str['Servers/DisableIS_desc'] = 'More information on [a@http://sf.net/support/tracker.php?aid=1849494]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]';
$str['Servers/AllowDeny/order_name'] = 'Host authentication order';
$str['Servers/AllowDeny/order_desc'] = 'Leave blank if not used';
$str['Servers/AllowDeny/rules_name'] = 'Host authentication rules';
$str['Servers/AllowDeny/rules_desc'] = 'Leave blank for defaults';
$str['Servers/ShowDatabasesCommand_name'] = 'SHOW DATABASES command';
$str['Servers/ShowDatabasesCommand_desc'] = 'SQL command to fetch available databases';
$str['Servers/CountTables_name'] = 'Count tables';
$str['Servers/CountTables_desc'] = 'Count tables when showing database list';
// Form: Server_pmadb
$str['Servers/1/pmadb_name'] = 'PMA database';
$str['Servers/1/pmadb_desc'] = 'Database used for relations, bookmarks, and PDF features. See [a@http://wiki.cihar.com/pma/pmadb]pmadb[/a] for complete information. Leave blank for no support. Default: [kbd]phpmyadmin[/kbd]';
$str['Servers/1/controluser_name'] = 'Control user';
$str['Servers/1/controluser_desc'] = 'A special MySQL user configured with limited permissions, more information available on [a@http://wiki.cihar.com/pma/controluser]wiki[/a]';
$str['Servers/1/controlpass_name'] = 'Control user password';
$str['Servers/1/verbose_check_name'] = 'Verbose check';
$str['Servers/1/verbose_check_desc'] = 'Disable if you know that your pma_* tables are up to date. This prevents compatibility checks and thereby increases performance';
$str['Servers/1/bookmarktable_name'] = 'Bookmark table';
$str['Servers/1/bookmarktable_desc'] = 'Leave blank for no [a@http://wiki.cihar.com/pma/bookmark]bookmark[/a] support, default: [kbd]pma_bookmark[/kbd]';
$str['Servers/1/relation_name'] = 'Relation table';
$str['Servers/1/relation_desc'] = 'Leave blank for no [a@http://wiki.cihar.com/pma/relation]relation-links[/a] support, default: [kbd]pma_relation[/kbd]';
$str['Servers/1/table_info_name'] = 'Display fields table';
$str['Servers/1/table_info_desc'] = 'Table to describe the display fields, leave blank for no support; default: [kbd]pma_table_info[/kbd]';
$str['Servers/1/table_coords_name'] = 'PDF schema: table coordinates';
$str['Servers/1/table_coords_desc'] = 'Leave blank for no PDF schema support, default: [kbd]pma_table_coords[/kbd]';
$str['Servers/1/pdf_pages_name'] = 'PDF schema: pages table';
$str['Servers/1/pdf_pages_desc'] = 'Leave blank for no PDF schema support, default: [kbd]pma_pdf_pages[/kbd]';
$str['Servers/1/column_info_name'] = 'Column information table';
$str['Servers/1/column_info_desc'] = 'Leave blank for no column comments/mime types, default: [kbd]pma_column_info[/kbd]';
$str['Servers/1/history_name'] = 'SQL query history table';
$str['Servers/1/history_desc'] = 'Leave blank for no SQL query history support, default: [kbd]pma_history[/kbd]';
$str['Servers/1/designer_coords_name'] = 'Designer table';
$str['Servers/1/designer_coords_desc'] = 'Leave blank for no Designer support, default: [kbd]designer_coords[/kbd]';
$str['Servers/pmadb_name'] = 'PMA database';
$str['Servers/pmadb_desc'] = 'Database used for relations, bookmarks, and PDF features. See [a@http://wiki.cihar.com/pma/pmadb]pmadb[/a] for complete information. Leave blank for no support. Default: [kbd]phpmyadmin[/kbd]';
$str['Servers/controluser_name'] = 'Control user';
$str['Servers/controluser_desc'] = 'A special MySQL user configured with limited permissions, more information available on [a@http://wiki.cihar.com/pma/controluser]wiki[/a]';
$str['Servers/controlpass_name'] = 'Control user password';
$str['Servers/verbose_check_name'] = 'Verbose check';
$str['Servers/verbose_check_desc'] = 'Disable if you know that your pma_* tables are up to date. This prevents compatibility checks and thereby increases performance';
$str['Servers/bookmarktable_name'] = 'Bookmark table';
$str['Servers/bookmarktable_desc'] = 'Leave blank for no [a@http://wiki.cihar.com/pma/bookmark]bookmark[/a] support, default: [kbd]pma_bookmark[/kbd]';
$str['Servers/relation_name'] = 'Relation table';
$str['Servers/relation_desc'] = 'Leave blank for no [a@http://wiki.cihar.com/pma/relation]relation-links[/a] support, default: [kbd]pma_relation[/kbd]';
$str['Servers/table_info_name'] = 'Display fields table';
$str['Servers/table_info_desc'] = 'Table to describe the display fields, leave blank for no support; default: [kbd]pma_table_info[/kbd]';
$str['Servers/table_coords_name'] = 'PDF schema: table coordinates';
$str['Servers/table_coords_desc'] = 'Leave blank for no PDF schema support, default: [kbd]pma_table_coords[/kbd]';
$str['Servers/pdf_pages_name'] = 'PDF schema: pages table';
$str['Servers/pdf_pages_desc'] = 'Leave blank for no PDF schema support, default: [kbd]pma_pdf_pages[/kbd]';
$str['Servers/column_info_name'] = 'Column information table';
$str['Servers/column_info_desc'] = 'Leave blank for no column comments/mime types, default: [kbd]pma_column_info[/kbd]';
$str['Servers/history_name'] = 'SQL query history table';
$str['Servers/history_desc'] = 'Leave blank for no SQL query history support, default: [kbd]pma_history[/kbd]';
$str['Servers/designer_coords_name'] = 'Designer table';
$str['Servers/designer_coords_desc'] = 'Leave blank for no Designer support, default: [kbd]designer_coords[/kbd]';
// Form: Import_export
$str['UploadDir_name'] = 'Upload directory';

View File

@@ -155,7 +155,6 @@ class FormDisplay
{
static $js_lang_sent = false;
$cf = ConfigFile::getInstance();
$js = array();
$js_default = array();
$tabbed_form = $tabbed_form && (count($this->forms) > 1);
@@ -236,25 +235,21 @@ class FormDisplay
*
* @param Form $form
* @param string $field field name as it appears in $form
* @param string $path field path, eg. Servers/4/verbose
* @param string $work_path work path, eg. Servers/1/verbose
* @param string $translated_path field path
* @param string $system_path field path, eg. Servers/1/verbose
* @param string $work_path work path, eg. Servers/4/verbose
* @param string $translated_path work path changed so that it can be used as XHTML id
* @param bool $show_restore_default whether show "restore default" button besides the input field
* @param array &$js_default array which stores JavaScript code to be displayed
*/
private function _displayFieldInput(Form $form, $field, $path, $work_path,
private function _displayFieldInput(Form $form, $field, $system_path, $work_path,
$translated_path, $show_restore_default, array &$js_default)
{
$name = isset($GLOBALS['str']["{$path}_name"])
? $GLOBALS['str']["{$path}_name"]
: $field;
$description = isset($GLOBALS['str']["{$path}_desc"])
? PMA_lang("{$path}_desc")
: '';
$name = PMA_lang_name($system_path);
$description = PMA_lang_desc($system_path);
$cf = ConfigFile::getInstance();
$value = $cf->get($work_path);
$value_default = $cf->getDefault($path);
$value_default = $cf->getDefault($system_path);
$value_is_default = false;
if ($value === null || $value === $value_default) {
$value = $value_default;
@@ -262,11 +257,11 @@ class FormDisplay
}
$opts = array(
'doc' => $this->getDocLink($path),
'wiki' => $this->getWikiLink($path),
'doc' => $this->getDocLink($system_path),
'wiki' => $this->getWikiLink($system_path),
'show_restore_default' => $show_restore_default);
if (isset($form->default[$path])) {
$opts['setvalue'] = $form->default[$path];
if (isset($form->default[$system_path])) {
$opts['setvalue'] = $form->default[$system_path];
}
if (isset($this->errors[$work_path])) {
@@ -335,10 +330,10 @@ class FormDisplay
return;
}
foreach ($this->errors as $path => $error_list) {
if (isset($this->system_paths[$path])) {
$path = $this->system_paths[$path];
$name = $GLOBALS['str']["{$path}_name"];
foreach ($this->errors as $system_path => $error_list) {
if (isset($this->system_paths[$system_path])) {
$path = $this->system_paths[$system_path];
$name = PMA_lang_name($system_path);
} else {
$name = $GLOBALS['str']["Form_$path"];
}
@@ -412,8 +407,8 @@ class FormDisplay
? $cf->getServerCount() + 1
: false;
// grab POST values
foreach ($form->fields as $field => $path) {
$work_path = array_search($path, $this->system_paths);
foreach ($form->fields as $field => $system_path) {
$work_path = array_search($system_path, $this->system_paths);
$key = $this->translated_paths[$work_path];
// ensure the value is set
@@ -422,11 +417,9 @@ class FormDisplay
if ($form->getOptionType($field) == 'boolean') {
$_POST[$key] = false;
} else {
$lang_field = isset($GLOBALS['str']["{$path}_name"])
? $GLOBALS['str']["{$path}_name"] : $path;
$this->errors[$form->name][] = PMA_lang(
'error_missing_field_data',
'<i>' . $lang_field . '</i>');
'<i>' . PMA_lang_name($system_path) . '</i>');
$result = false;
continue;
}
@@ -445,7 +438,7 @@ class FormDisplay
}
break;
case 'select':
if (!$this->_validateSelect($_POST[$key], $form->getOptionValueList($path))) {
if (!$this->_validateSelect($_POST[$key], $form->getOptionValueList($system_path))) {
$this->errors[$work_path][] = $GLOBALS['str']['error_incorrect_value'];
$result = false;
continue;
@@ -468,12 +461,12 @@ class FormDisplay
}
// now we have value with proper type
$values[$path] = $_POST[$key];
$values[$system_path] = $_POST[$key];
if ($change_index !== false) {
$work_path = str_replace("Servers/$form->index/",
"Servers/$change_index/", $work_path);
}
$to_save[$work_path] = $path;
$to_save[$work_path] = $system_path;
}
}

View File

@@ -189,6 +189,34 @@ function PMA_lang($lang_key)
}
}
/**
* Returns translated field name
*
* @param string $canonical_path
* @return string
*/
function PMA_lang_name($canonical_path)
{
$lang_key = str_replace('Servers/1/', 'Servers/', $canonical_path) . '_name';
return isset($GLOBALS['str'][$lang_key])
? $GLOBALS['str'][$lang_key]
: $lang_key;
}
/**
* Returns translated field description
*
* @param string $canonical_path
* @return string
*/
function PMA_lang_desc($canonical_path)
{
$lang_key = str_replace('Servers/1/', 'Servers/', $canonical_path) . '_desc';
return isset($GLOBALS['str'][$lang_key])
? $GLOBALS['str'][$lang_key]
: '';
}
/**
* Wraps link in <a> tags and replaces argument separator in internal links
* to the one returned by PMA_get_arg_separator()

View File

@@ -257,7 +257,7 @@ function perform_config_checks()
// should be enabled if possible
//
if (!$cf->getValue("Servers/$i/ssl")) {
$title = PMA_lang('Servers/1/ssl_name') . " ($server_name)";
$title = PMA_lang_name('Servers/1/ssl') . " ($server_name)";
messages_set('notice', "Servers/$i/ssl", $title, PMA_lang('Server_ssl_msg'));
}
@@ -266,7 +266,7 @@ function perform_config_checks()
// warn about using 'mysql'
//
if ($cf->getValue("Servers/$i/extension") == 'mysql') {
$title = PMA_lang('Servers/1/extension_name') . " ($server_name)";
$title = PMA_lang_name('Servers/1/extension') . " ($server_name)";
messages_set('notice', "Servers/$i/extension", $title, PMA_lang('Server_extension_msg'));
}
@@ -277,7 +277,7 @@ function perform_config_checks()
if ($cf->getValue("Servers/$i/auth_type") == 'config'
&& $cf->getValue("Servers/$i/user") != ''
&& $cf->getValue("Servers/$i/password") != '') {
$title = PMA_lang('Servers/1/auth_type_name') . " ($server_name)";
$title = PMA_lang_name('Servers/1/auth_type') . " ($server_name)";
messages_set('warning', "Servers/$i/auth_type", $title, PMA_lang('Server_auth_config_msg', $i));
}
}