patch #3410688 [interface] Improving field size for character columns
This commit is contained in:
parent
fd5f916ea9
commit
6f7ca79218
@ -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)
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -1027,6 +1027,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
|
||||
*
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -213,6 +213,8 @@ $forms['Main_frame']['Edit'] = array(
|
||||
'ShowFunctionFields',
|
||||
'ShowFieldTypesInDataEditView',
|
||||
'CharEditing',
|
||||
'MinSizeForInputField',
|
||||
'MaxSizeForInputField',
|
||||
'CharTextareaCols',
|
||||
'CharTextareaRows',
|
||||
'TextareaCols',
|
||||
|
||||
@ -38,6 +38,8 @@ $forms['Features']['General'] = array(
|
||||
'ShowHint');
|
||||
$forms['Features']['Text_fields'] = array(
|
||||
'CharEditing',
|
||||
'MinSizeForInputField',
|
||||
'MaxSizeForInputField',
|
||||
'CharTextareaCols',
|
||||
'CharTextareaRows',
|
||||
'TextareaCols',
|
||||
|
||||
@ -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'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user