The branch, master has been updated
via 6f7ca79218c0438cfcf34639295bc87550fc677e (commit)
from fd5f916ea92ae5a15de643e25441b9bdd68cc2e9 (commit)
- Log -----------------------------------------------------------------
commit 6f7ca79218c0438cfcf34639295bc87550fc677e
Author: Marc Delisle <marc(a)infomarc.info>
Date: Sun Oct 30 05:35:00 2011 -0400
patch #3410688 [interface] Improving field size for character columns
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
Documentation.html | 8 ++++++++
libraries/config.default.php | 14 ++++++++++++++
libraries/config/messages.inc.php | 4 ++++
libraries/config/setup.forms.php | 2 ++
libraries/config/user_preferences.forms.php | 2 ++
tbl_change.php | 13 +++++++++++--
7 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d10a483..7fdc416 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,6 +53,7 @@ phpMyAdmin - ChangeLog
- bug #3299486 [prettyprint] Order By in a query containing comment character
- [interface] Improved ENUM/SET editor
+ patch #3428376 [pmadb] pmadb on a different MySQL server
++ patch #3410688 [interface] Improving field size for character columns
3.4.8.0 (not yet released)
- bug #3425230 [interface] enum data split at space char (more space to edit)
diff --git a/Documentation.html b/Documentation.html
index e1ce310..0a403ce 100644
--- a/Documentation.html
+++ b/Documentation.html
@@ -1699,6 +1699,14 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre>
</ul>
Default is old behavior so input.</dd>
+ <dt
id="cfg_MinSizeForInputField">$cfg['MinSizeForInputField']
integer</dt>
+ <dd>Defines the minimum size for input fields generated for CHAR and
+ VARCHAR columns.</dd>
+
+ <dt
id="cfg_MaxSizeForInputField">$cfg['MaxSizeForInputField']
integer</dt>
+ <dd>Defines the maximum size for input fields generated for CHAR and
+ VARCHAR columns.</dd>
+
<dt id="cfg_InsertRows">$cfg['InsertRows']
integer</dt>
<dd>Defines the maximum number of concurrent entries for the Insert
page.</dd>
diff --git a/libraries/config.default.php b/libraries/config.default.php
index 98ace3f..8dff000 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -1028,6 +1028,20 @@ $cfg['ShowFieldTypesInDataEditView'] = true;
$cfg['CharEditing'] = 'input';
/**
+ * The minimum size for character input fields
+ *
+ * @global integer $cfg['MinSizeForInputField']
+ */
+$cfg['MinSizeForInputField'] = 4;
+
+/**
+ * The maximum size for character input fields
+ *
+ * @global integer $cfg['MinSizeForInputField']
+ */
+$cfg['MaxSizeForInputField'] = 60;
+
+/**
* How many rows can be inserted at one time
*
* @global integer $cfg['InsertRows']
diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php
index 5d19922..35a8392 100644
--- a/libraries/config/messages.inc.php
+++ b/libraries/config/messages.inc.php
@@ -31,6 +31,10 @@ $strConfigBZipDump_desc = __('Enable
[a@http://en.wikipedia.org/wiki/Bzip2]bzip2
$strConfigBZipDump_name = __('Bzip2');
$strConfigCharEditing_desc = __('Defines which type of editing controls should be
used for CHAR and VARCHAR columns; [kbd]input[/kbd] - allows limiting of input length,
[kbd]textarea[/kbd] - allows newlines in columns');
$strConfigCharEditing_name = __('CHAR columns editing');
+$strConfigMinSizeForInputField_desc = __('Defines the minimum size for input fields
generated for CHAR and VARCHAR columns');
+$strConfigMinSizeForInputField_name = __('Minimum size for input field');
+$strConfigMaxSizeForInputField_desc = __('Defines the maximum size for input fields
generated for CHAR and VARCHAR columns');
+$strConfigMaxSizeForInputField_name = __('Maximum size for input field');
$strConfigCharTextareaCols_desc = __('Number of columns for CHAR/VARCHAR
textareas');
$strConfigCharTextareaCols_name = __('CHAR textarea columns');
$strConfigCharTextareaRows_desc = __('Number of rows for CHAR/VARCHAR
textareas');
diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php
index a8b8591..d42f60d 100644
--- a/libraries/config/setup.forms.php
+++ b/libraries/config/setup.forms.php
@@ -213,6 +213,8 @@ $forms['Main_frame']['Edit'] = array(
'ShowFunctionFields',
'ShowFieldTypesInDataEditView',
'CharEditing',
+ 'MinSizeForInputField',
+ 'MaxSizeForInputField',
'CharTextareaCols',
'CharTextareaRows',
'TextareaCols',
diff --git a/libraries/config/user_preferences.forms.php
b/libraries/config/user_preferences.forms.php
index e0b2d18..44fad4b 100644
--- a/libraries/config/user_preferences.forms.php
+++ b/libraries/config/user_preferences.forms.php
@@ -38,6 +38,8 @@ $forms['Features']['General'] = array(
'ShowHint');
$forms['Features']['Text_fields'] = array(
'CharEditing',
+ 'MinSizeForInputField',
+ 'MaxSizeForInputField',
'CharTextareaCols',
'CharTextareaRows',
'TextareaCols',
diff --git a/tbl_change.php b/tbl_change.php
index 2dbbc5b..4ffe4b2 100644
--- a/tbl_change.php
+++ b/tbl_change.php
@@ -916,8 +916,17 @@ foreach ($rows as $row_id => $vrow) {
elseif (in_array($field['pma_type'], $no_support_types)) {
// ignore this column to avoid changing it
} else {
- // field size should be at least 4 and max 40
- $fieldsize = min(max($field['len'], 4), 40);
+ if ($field['is_char']) {
+ $fieldsize = $extracted_fieldspec['spec_in_brackets'];
+ } else {
+ /**
+ * This case happens for example for INT or DATE columns;
+ * in these situations, the value returned in $field['len']
+ * seems appropriate.
+ */
+ $fieldsize = $field['len'];
+ }
+ $fieldsize = min(max($fieldsize, $cfg['MinSizeForInputField']),
$cfg['MaxSizeForInputField']);
echo $backup_field . "\n";
if ($field['is_char']
&& ($cfg['CharEditing'] == 'textarea'
hooks/post-receive
--
phpMyAdmin
Show replies by date