make form definition structure the same for setup script and user preferences

This commit is contained in:
Crack
2010-06-21 15:24:07 +02:00
parent b68ba42f9f
commit 3a8de5a716
9 changed files with 48 additions and 69 deletions

View File

@@ -1 +1,6 @@
cache'ing of user preferences to avoid round trips to server on each page refresh
backlog:
- Import and Export options
restore cache'ing in phpmyadmin.css.php

View File

@@ -177,11 +177,9 @@ class ConfigFile
{
// no recursion for numeric arrays
if (is_array($value) && !isset($value[0])) {
//$prefix .= (empty($prefix) ? '' : '/') . $key;
$prefix .= $key . '/';
array_walk($value, array($this, '_flattenArray'), $prefix);
} else {
//$this->_flattenArrayResult[$prefix . '/' . $key] = $value;
$this->_flattenArrayResult[$prefix . $key] = $value;
}
}

View File

@@ -121,12 +121,11 @@ $strSetupForm_Server_pmadb_desc = __('Configure phpMyAdmin database to gain acce
$strSetupForm_Server_pmadb = __('PMA database');
$strSetupForm_Server_tracking_desc = __('Tracking of changes made in database. Requires configured PMA database.');
$strSetupForm_Server_tracking = __('Changes tracking');
$strSetupFormset_customization = __('Customization');
$strSetupFormset_export = __('Customize export options');
$strSetupFormset_features = __('Features');
$strSetupFormset_import = __('Customize import defaults');
$strSetupFormset_left_frame = __('Customize navigation frame');
$strSetupFormset_main_frame = __('Customize main frame');
$strSetupFormset_Export = __('Customize export options');
$strSetupFormset_Features = __('Features');
$strSetupFormset_Import = __('Customize import defaults');
$strSetupFormset_Left_frame = __('Customize navigation frame');
$strSetupFormset_Main_frame = __('Customize main frame');
$strSetupForm_Sql_box_desc = __('Customize links shown in SQL Query boxes');
$strSetupForm_Sql_box = __('SQL Query box');
$strSetupForm_Sql_queries_desc = __('SQL queries settings, for SQL Query box options see [a@?page=form&formset=main_frame#tab_Sql_box]Navigation frame[/a] settings');

View File

@@ -4,12 +4,12 @@
* Fields MUST have their counterparts in the $cfg array.
*
* There are two possible notations:
* $forms['Form name'] = array('Servers' => array(1 => array('host')));
* $forms['Form group']['Form name'] = array('Servers' => array(1 => array('host')));
* can be written as
* $forms['Form name'] = array('Servers/1/host');
* $forms['Form group']['Form name'] = array('Servers/1/host');
*
* You can assign default values set by special button ("set value: ..."), eg.:
* $forms['Server_pmadb'] = array('Servers' => array(1 => array(
* $forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
* 'pmadb' => 'phpmyadmin')));
*
* @package phpMyAdmin-setup
@@ -21,7 +21,7 @@ $forms = array();
$forms['_config.php'] = array(
'DefaultLang',
'ServerDefault');
$forms['Server'] = array('Servers' => array(1 => array(
$forms['Servers']['Server'] = array('Servers' => array(1 => array(
'verbose',
'host',
'port',
@@ -36,11 +36,11 @@ $forms['Server'] = array('Servers' => array(1 => array(
'password',
'nopassword',
'auth_swekey_config' => './swekey.conf')));
$forms['Server_login_options'] = array('Servers' => array(1 => array(
$forms['Servers']['Server_login_options'] = array('Servers' => array(1 => array(
'SignonSession',
'SignonURL',
'LogoutURL')));
$forms['Server_config'] = array('Servers' => array(1 => array(
$forms['Servers']['Server_config'] = array('Servers' => array(1 => array(
'only_db',
'hide_db',
'AllowRoot',
@@ -50,7 +50,7 @@ $forms['Server_config'] = array('Servers' => array(1 => array(
'AllowDeny/rules',
'ShowDatabasesCommand',
'CountTables')));
$forms['Server_pmadb'] = array('Servers' => array(1 => array(
$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controluser',
'controlpass',
@@ -65,14 +65,14 @@ $forms['Server_pmadb'] = array('Servers' => array(1 => array(
'table_coords' => 'pma_table_coords',
'pdf_pages' => 'pma_pdf_pages',
'designer_coords' => 'pma_designer_coords')));
$forms['Server_tracking'] = array('Servers' => array(1 => array(
$forms['Servers']['Server_tracking'] = array('Servers' => array(1 => array(
'tracking_version_auto_create',
'tracking_default_statements',
'tracking_add_drop_view',
'tracking_add_drop_table',
'tracking_add_drop_database',
)));
$forms['Import_export'] = array(
$forms['Features']['Import_export'] = array(
'UploadDir',
'SaveDir',
'AllowAnywhereRecoding',
@@ -83,7 +83,7 @@ $forms['Import_export'] = array(
'GZipDump',
'BZipDump',
'CompressOnFly');
$forms['Security'] = array(
$forms['Features']['Security'] = array(
'blowfish_secret',
'ForceSSL',
'CheckConfigurationPermissions',
@@ -94,7 +94,7 @@ $forms['Security'] = array(
'LoginCookieValidity',
'LoginCookieStore',
'LoginCookieDeleteAll');
$forms['Sql_queries'] = array(
$forms['Features']['Sql_queries'] = array(
'ShowSQL',
'Confirm',
'QueryHistoryDB',
@@ -106,12 +106,12 @@ $forms['Sql_queries'] = array(
//'QueryWindowWidth', // overridden in theme
//'QueryWindowHeight',
'QueryWindowDefTab');
$forms['Page_titles'] = array(
$forms['Features']['Page_titles'] = array(
'TitleDefault',
'TitleTable',
'TitleDatabase',
'TitleServer');
$forms['Other_core_settings'] = array(
$forms['Features']['Other_core_settings'] = array(
'NaturalOrder',
'InitialSlidersState',
'ErrorIconic',
@@ -125,21 +125,21 @@ $forms['Other_core_settings'] = array(
'MemoryLimit',
'SkipLockedTables',
'UseDbSearch');
$forms['Left_frame'] = array(
$forms['Left_frame']['Left_frame'] = array(
'LeftFrameLight',
'LeftDisplayLogo',
'LeftLogoLink',
'LeftLogoLinkWindow',
'LeftPointerEnable');
$forms['Left_servers'] = array(
$forms['Left_frame']['Left_servers'] = array(
'LeftDisplayServers',
'DisplayServersList');
$forms['Left_databases'] = array(
$forms['Left_frame']['Left_databases'] = array(
'DisplayDatabasesList',
'LeftFrameDBTree',
'LeftFrameDBSeparator',
'ShowTooltipAliasDB');
$forms['Left_tables'] = array(
$forms['Left_frame']['Left_tables'] = array(
'LeftDefaultTabTable',
'LeftFrameTableSeparator',
'LeftFrameTableLevel',
@@ -153,7 +153,7 @@ $forms['Startup'] = array(
'ShowChgPassword',
'ShowCreateDb',
'SuggestDBName');
$forms['Browse'] = array(
$forms['Main_frame']['Browse'] = array(
'NavigationBarIconic',
'ShowAll',
'MaxRows',
@@ -165,7 +165,7 @@ $forms['Browse'] = array(
'ModifyDeleteAtLeft',
'ModifyDeleteAtRight',
'DefaultDisplay');
$forms['Edit'] = array(
$forms['Main_frame']['Edit'] = array(
'ProtectBinary',
'ShowFunctionFields',
'ShowFieldTypesInDataEditView',
@@ -179,24 +179,24 @@ $forms['Edit'] = array(
'ForeignKeyDropdownOrder',
'ForeignKeyMaxLimit',
'DefaultPropDisplay');
$forms['Tabs'] = array(
$forms['Main_frame']['Tabs'] = array(
'LightTabs',
'PropertiesIconic',
'DefaultTabServer',
'DefaultTabDatabase',
'DefaultTabTable',
'QueryWindowDefTab');
$forms['Sql_box'] = array('SQLQuery' => array(
$forms['Main_frame']['Sql_box'] = array('SQLQuery' => array(
'Edit',
'Explain',
'ShowAsPHP',
'Validate',
'Refresh'));
$forms['Import_defaults'] = array('Import' => array(
$forms['Import']['Import_defaults'] = array('Import' => array(
'format',
'allow_interrupt',
'skip_queries'));
$forms['Export_defaults'] = array('Export' => array(
$forms['Export']['Export_defaults'] = array('Export' => array(
'format',
'compression',
'asfile',

View File

@@ -7,8 +7,7 @@
* $forms['Form group']['Form name'] = array('Servers/1/host');
*
* You can assign default values set by special button ("set value: ..."), eg.:
* $forms['Server_pmadb'] = array('Servers' => array(1 => array(
* 'pmadb' => 'phpmyadmin')));
* $forms['Server']['pmadb form'] = array('Servers/1/pmadb' => 'phpmyadmin');
*
* @package phpMyAdmin
*/

View File

@@ -20,33 +20,18 @@ require_once './setup/lib/form_processing.lib.php';
require './libraries/config/setup.forms.php';
$formsets = array(
'features' => array(
'forms' => array('Import_export', 'Security', 'Sql_queries', 'Page_titles',
'Other_core_settings')),
'left_frame' => array(
'forms' => array('Left_frame', 'Left_servers', 'Left_databases', 'Left_tables')),
'main_frame' => array(
'forms' => array('Startup', 'Browse', 'Edit', 'Tabs', 'Sql_box')),
'import' => array(
'forms' => array('Import_defaults')),
'export' => array(
'forms' => array('Export_defaults'))
);
$formset_id = filter_input(INPUT_GET, 'formset');
$mode = filter_input(INPUT_GET, 'mode');
if (!isset($formsets[$formset_id])) {
if (!isset($forms[$formset_id])) {
die('Incorrect formset, check $formsets array in setup/frames/form.inc.php');
}
$formset = $formsets[$formset_id];
if (isset($GLOBALS['strSetupFormset_' . $formset_id])) {
echo '<h2>' . $GLOBALS['strSetupFormset_' . $formset_id] . '</h2>';
}
$form_display = new FormDisplay();
foreach ($formset['forms'] as $form_name) {
$form_display->registerForm($form_name, $forms[$form_name]);
foreach ($forms[$formset_id] as $form_name => $form) {
$form_display->registerForm($form_name, $form);
}
process_formset($form_display);
?>

View File

@@ -15,9 +15,9 @@ $separator = PMA_get_arg_separator('html');
?>
<ul>
<li><a href="index.php"><?php echo __('Overview') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=features"><?php echo __('Features') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=left_frame"><?php echo __('Navigation frame') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=main_frame"><?php echo __('Main frame') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=import"><?php echo __('Import') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=export"><?php echo __('Export') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=Features"><?php echo __('Features') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=Left_frame"><?php echo __('Navigation frame') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=Main_frame"><?php echo __('Main frame') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=Import"><?php echo __('Import') ?></a></li>
<li><a href="?page=form<?php echo $separator ?>formset=Export"><?php echo __('Export') ?></a></li>
</ul>

View File

@@ -43,10 +43,8 @@ if (isset($page_title)) {
echo '<h2>' . $page_title . '</h2>';
}
$form_display = new FormDisplay();
$form_display->registerForm('Server', $forms['Server'], $id);
$form_display->registerForm('Server_login_options', $forms['Server_login_options'], $id);
$form_display->registerForm('Server_config', $forms['Server_config'], $id);
$form_display->registerForm('Server_pmadb', $forms['Server_pmadb'], $id);
$form_display->registerForm('Server_tracking', $forms['Server_tracking'], $id);
foreach ($forms['Servers'] as $form_name => $form) {
$form_display->registerForm($form_name, $form, $id);
}
process_formset($form_display);
?>

View File

@@ -41,13 +41,8 @@ foreach (array_keys($forms) as $formset) {
echo PMA_generate_html_tabs($tabs, array());
// handle form display and processing
$forms_all_keys = array();
foreach ($forms as $formset) {
foreach ($formset as $form) {
$forms_all_keys = array_merge($forms_all_keys, $form);
}
}
$forms_all_keys = PMA_read_userprefs_fieldnames($forms);
$cf = ConfigFile::getInstance();
$cf->setAllowedKeys($forms_all_keys);
$cf->updateWithGlobalConfig($GLOBALS['PMA_Config']);