From d7ecf570dcad3097adee748cc9f73fb23ed50f21 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Fri, 14 Dec 2007 11:39:46 +0000 Subject: [PATCH] replaced NULL/NOT NULL selectbox with checkbox (preserver space) --- libraries/Table.class.php | 8 ++-- libraries/tbl_properties.inc.php | 82 ++++++++++++++------------------ tbl_addfield.php | 9 +++- tbl_alter.php | 13 ++++- tbl_create.php | 3 +- 5 files changed, 63 insertions(+), 52 deletions(-) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 82cc43c68..c7a9fb226 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -299,10 +299,10 @@ class PMA_Table { } if ($null !== false) { - if (!empty($null)) { - $query .= ' NOT NULL'; - } else { + if ($null == 'NULL') { $query .= ' NULL'; + } else { + $query .= ' NOT NULL'; } } @@ -331,7 +331,7 @@ class PMA_Table { if (!empty($extra)) { $query .= ' ' . $extra; // Force an auto_increment field to be part of the primary key - // even if user did not tick the PK box; + // even if user did not tick the PK box; // but the PK could contain other columns so do not append // a PRIMARY KEY clause, just add a member to $field_primary if ($extra == 'AUTO_INCREMENT') { diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index e035d019c..31e0c5550 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -1,6 +1,7 @@ '; + $content_cells[$i][$ci] .= "\n" . ''; $ci++; - $content_cells[$i][$ci] = ''; } else { $content_cells[$i][$ci] = ''; } @@ -296,15 +293,15 @@ for ($i = 0 ; $i <= $num_fields; $i++) { $zerofill = stristr($row['Type'], 'zerofill'); } - $content_cells[$i][$ci] .= "\n" . '' . "\n"; + $content_cells[$i][$ci] .= "\n" . '' . "\n"; $ci++; $tmp_collation = empty($row['Collation']) ? null : $row['Collation']; - $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[]', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE); + $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[' . $i . ']', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE); unset($tmp_collation); $ci++; - $content_cells[$i][$ci] = '' . "\n"; $attribute = ''; if ($binary) { @@ -367,19 +364,14 @@ for ($i = 0 ; $i <= $num_fields; $i++) { $content_cells[$i][$ci] .= ''; $ci++; - $content_cells[$i][$ci] = ''; + $content_cells[$i][$ci] .= ' type="checkbox" value="NULL" />'; $ci++; if (isset($row) @@ -388,7 +380,7 @@ for ($i = 0 ; $i <= $num_fields; $i++) { } if ($is_backup) { - $content_cells[$i][$ci] = "\n" . ''; + $content_cells[$i][$ci] = "\n" . ''; } else { $content_cells[$i][$ci] = "\n"; } @@ -400,7 +392,7 @@ for ($i = 0 ; $i <= $num_fields; $i++) { $row['Default'] = ''; } - $content_cells[$i][$ci] .= ''; + $content_cells[$i][$ci] .= ''; if ($type_upper == 'TIMESTAMP') { $tmp_display_type = 'block'; } else { @@ -414,7 +406,7 @@ for ($i = 0 ; $i <= $num_fields; $i++) { $content_cells[$i][$ci] .= ' />'; $ci++; - $content_cells[$i][$ci] = ''; if (!isset($row) || empty($row['Extra'])) { $content_cells[$i][$ci] .= "\n"; @@ -473,17 +465,17 @@ for ($i = 0 ; $i <= $num_fields; $i++) { $content_cells[$i][$ci] = "\n" . ''; $ci++; - $content_cells[$i][$ci] = ''; + $content_cells[$i][$ci] = ''; $ci++; } // end if ($action ==...) // garvin: comments - $content_cells[$i][$ci] = ''; + $content_cells[$i][$ci] = ''; $ci++; // garvin: MIME-types if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) { - $content_cells[$i][$ci] = '' . "\n"; $content_cells[$i][$ci] .= ' ' . "\n"; if (is_array($available_mime['mimetype'])) { @@ -496,7 +488,7 @@ for ($i = 0 ; $i <= $num_fields; $i++) { $content_cells[$i][$ci] .= ''; $ci++; - $content_cells[$i][$ci] = '' . "\n"; $content_cells[$i][$ci] .= ' ' . "\n"; if (is_array($available_mime['transformation'])) { foreach ($available_mime['transformation'] AS $mimekey => $transform) { @@ -510,7 +502,7 @@ for ($i = 0 ; $i <= $num_fields; $i++) { $content_cells[$i][$ci] .= ''; $ci++; - $content_cells[$i][$ci] = ''; + $content_cells[$i][$ci] = ''; //$ci++; } } // end for diff --git a/tbl_addfield.php b/tbl_addfield.php index 143bae547..4316ff6c0 100644 --- a/tbl_addfield.php +++ b/tbl_addfield.php @@ -62,7 +62,14 @@ if (isset($submit_num_fields)) { continue; } - $query .= PMA_Table::generateFieldSpec($field_name[$i], $field_type[$i], $field_length[$i], $field_attribute[$i], isset($field_collation[$i]) ? $field_collation[$i] : '', $field_null[$i], $field_default[$i], isset($field_default_current_timestamp[$i]), $field_extra[$i], isset($field_comments[$i]) ? $field_comments[$i] : '', $field_primary, $i); + $query .= PMA_Table::generateFieldSpec($field_name[$i], $field_type[$i], + $field_length[$i], $field_attribute[$i], + isset($field_collation[$i]) ? $field_collation[$i] : '', + isset($field_null[$i]) ? $field_null[$i] : 'NOT NULL', + $field_default[$i], + isset($field_default_current_timestamp[$i]), $field_extra[$i], + isset($field_comments[$i]) ? $field_comments[$i] : '', + $field_primary, $i); if ($field_where != 'last') { // Only the first field can be added somewhere other than at the end diff --git a/tbl_alter.php b/tbl_alter.php index ebb0290a3..c69ee2666 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -1,6 +1,10 @@