2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Display form for changing/adding table fields/columns
6 * included by tbl_addfield.php, -_alter.php, -_create.php
9 if (! defined('PHPMYADMIN')) {
16 require_once './libraries/common.inc.php';
17 require_once './libraries/common.lib.php';
18 PMA_checkParameters(array('db', 'table', 'action', 'num_fields'));
21 // Get available character sets and storage engines
22 require_once './libraries/mysql_charsets.lib.php';
23 require_once './libraries/StorageEngine.class.php';
26 * Class for partition management
28 require_once './libraries/Partition.class.php';
30 // load additional configuration variables
32 require_once './libraries/data_drizzle.inc.php';
34 require_once './libraries/data_mysql.inc.php';
37 if (is_int($cfg['DefaultPropDisplay'])) {
38 if ($num_fields <= $cfg['DefaultPropDisplay']) {
39 $display_type = 'vertical';
41 $display_type = 'horizontal';
44 $display_type = $cfg['DefaultPropDisplay'];
47 if ('horizontal' == $display_type) {
48 $length_values_input_size = 8;
50 $length_values_input_size = 30;
53 $_form_params = array(
57 if ($action == 'tbl_create.php') {
58 $_form_params['reload'] = 1;
59 } elseif ($action == 'tbl_addfield.php') {
60 $_form_params['field_where'] = $_REQUEST['field_where'];
61 $_form_params['after_field'] = $_REQUEST['after_field'];
62 $_form_params['table'] = $table;
64 $_form_params['table'] = $table;
67 if (isset($num_fields)) {
68 $_form_params['orig_num_fields'] = $num_fields;
71 if (isset($_REQUEST['field_where'])) {
72 $_form_params['orig_field_where'] = $_REQUEST['field_where'];
75 if (isset($_REQUEST['after_field'])) {
76 $_form_params['orig_after_field'] = $_REQUEST['after_field'];
79 if (isset($selected) && is_array($selected)) {
80 foreach ($selected as $o_fld_nr => $o_fld_val) {
81 $_form_params['selected[' . $o_fld_nr . ']'] = $o_fld_val;
82 if (! isset($true_selected)) {
83 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
87 if (isset($true_selected) && is_array($true_selected)) {
88 foreach ($true_selected as $o_fld_nr => $o_fld_val) {
89 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
92 } elseif (isset($_REQUEST['field'])) {
93 $_form_params['orig_field'] = $_REQUEST['field'];
94 if (isset($orig_field)) {
95 $_form_params['true_selected[]'] = $orig_field;
97 $_form_params['true_selected[]'] = $_REQUEST['field'];
101 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
103 $header_cells = array();
104 $content_cells = array();
106 $header_cells[] = __('Name');
107 $header_cells[] = __('Type')
108 . ($GLOBALS['cfg']['ReplaceHelpImg']
109 ?
PMA_showMySQLDocu('SQL-Syntax', 'data-types')
110 : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('SQL-Syntax', 'data-types')
112 $header_cells[] = __('Length/Values') . PMA_showHint(__('If column type is "enum" or "set", please enter the values using this format: \'a\',\'b\',\'c\'...<br />If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').'));
113 $header_cells[] = __('Default') . PMA_showHint(__('For default values, please enter just a single value, without backslash escaping or quotes, using this format: a'));
114 $header_cells[] = __('Collation');
115 $header_cells[] = __('Attributes');
116 $header_cells[] = __('Null');
118 // We could remove this 'if' and let the key information be shown and
119 // editable. However, for this to work, tbl_alter must be modified to use the
120 // key fields, as tbl_addfield does.
123 $header_cells[] = __('Index');
126 $header_cells[] = '<abbr title="AUTO_INCREMENT">' . ($display_type == 'horizontal' ?
'A_I' : 'AUTO_INCREMENT') . '</abbr>';
128 require_once './libraries/transformations.lib.php';
129 $cfgRelation = PMA_getRelationsParam();
131 $comments_map = array();
133 $available_mime = array();
135 $comments_map = PMA_getComments($db, $table);
136 $header_cells[] = __('Comments');
138 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
139 $mime_map = PMA_getMIME($db, $table);
140 $available_mime = PMA_getAvailableMIMEtypes();
143 sprintf(__('For a list of available transformation options and their MIME type transformations, click on %stransformation descriptions%s'),
144 '<a href="transformation_overview.php?'
145 . PMA_generate_common_url($db, $table) . '" target="_blank">',
149 $header_cells[] = __('MIME type');
150 $header_cells[] = __('Browser transformation');
151 $header_cells[] = __('Transformation options')
152 . PMA_showHint(__('Please enter the values for transformation options using this format: \'a\', 100, b,\'c\'...<br />If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, precede it with a backslash (for example \'\\\\xyz\' or \'a\\\'b\').') . $hint);
155 // workaround for field_fulltext, because its submitted indizes contain
156 // the index as a value, not a key. Inserted here for easier maintaineance
157 // and less code to change in existing files.
158 if (isset($field_fulltext) && is_array($field_fulltext)) {
159 foreach ($field_fulltext as $fulltext_nr => $fulltext_indexkey) {
160 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
164 for ($i = 0; $i < $num_fields; $i++
) {
165 if (! empty($regenerate)) {
166 // An error happened with previous inputs, so we will restore the data
167 // to embed it once again in this form.
169 $row['Field'] = (isset($_REQUEST['field_name'][$i]) ?
$_REQUEST['field_name'][$i] : false);
170 $row['Type'] = (isset($_REQUEST['field_type'][$i]) ?
$_REQUEST['field_type'][$i] : false);
171 $row['Collation'] = (isset($_REQUEST['field_collation'][$i]) ?
$_REQUEST['field_collation'][$i] : '');
172 $row['Null'] = (isset($_REQUEST['field_null'][$i]) ?
$_REQUEST['field_null'][$i] : '');
174 if (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'primary_' . $i) {
176 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'index_' . $i) {
178 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'unique_' . $i) {
180 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'fulltext_' . $i) {
181 $row['Key'] = 'FULLTEXT';
186 // put None in the drop-down for Default, when someone adds a field
187 $row['DefaultType'] = (isset($_REQUEST['field_default_type'][$i]) ?
$_REQUEST['field_default_type'][$i] : 'NONE');
188 $row['DefaultValue'] = (isset($_REQUEST['field_default_value'][$i]) ?
$_REQUEST['field_default_value'][$i] : '');
190 switch ($row['DefaultType']) {
192 $row['Default'] = null;
194 case 'USER_DEFINED' :
195 $row['Default'] = $row['DefaultValue'];
198 case 'CURRENT_TIMESTAMP' :
199 $row['Default'] = $row['DefaultType'];
203 $row['Extra'] = (isset($_REQUEST['field_extra'][$i]) ?
$_REQUEST['field_extra'][$i] : false);
204 $row['Comment'] = (isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ?
'FULLTEXT' : false);
206 $submit_length = (isset($_REQUEST['field_length'][$i]) ?
$_REQUEST['field_length'][$i] : false);
207 $submit_attribute = (isset($_REQUEST['field_attribute'][$i]) ?
$_REQUEST['field_attribute'][$i] : false);
209 $submit_default_current_timestamp = (isset($_REQUEST['field_default_current_timestamp'][$i]) ?
true : false);
211 if (isset($_REQUEST['field_comments'][$i])) {
212 $comments_map[$row['Field']] = $_REQUEST['field_comments'][$i];
215 if (isset($_REQUEST['field_mimetype'][$i])) {
216 $mime_map[$row['Field']]['mimetype'] = $_REQUEST['field_mimetype'][$i];
219 if (isset($_REQUEST['field_transformation'][$i])) {
220 $mime_map[$row['Field']]['transformation'] = $_REQUEST['field_transformation'][$i];
223 if (isset($_REQUEST['field_transformation_options'][$i])) {
224 $mime_map[$row['Field']]['transformation_options'] = $_REQUEST['field_transformation_options'][$i];
227 } elseif (isset($fields_meta[$i])) {
228 $row = $fields_meta[$i];
229 switch ($row['Default']) {
231 if ($row['Null'] == 'YES') {
232 $row['DefaultType'] = 'NULL';
233 $row['DefaultValue'] = '';
234 // SHOW FULL COLUMNS does not report the case when there is a DEFAULT value
235 // which is empty so we need to use the results of SHOW CREATE TABLE
236 } elseif (isset($row) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_value'])) {
237 $row['DefaultType'] = 'USER_DEFINED';
238 $row['DefaultValue'] = $row['Default'];
240 $row['DefaultType'] = 'NONE';
241 $row['DefaultValue'] = '';
244 case 'CURRENT_TIMESTAMP':
245 $row['DefaultType'] = 'CURRENT_TIMESTAMP';
246 $row['DefaultValue'] = '';
249 $row['DefaultType'] = 'USER_DEFINED';
250 $row['DefaultValue'] = $row['Default'];
255 if (isset($row['Type'])) {
256 $extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
257 if ($extracted_fieldspec['type'] == 'bit') {
258 $row['Default'] = PMA_convert_bit_default_value($row['Default']);
261 // Cell index: If certain fields get left out, the counter shouldn't change.
263 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
264 // has to be incremented ($ci_offset++)
269 if (! empty($true_selected[$i])) {
270 $_form_params['field_orig[' . $i . ']'] = $true_selected[$i];
271 } elseif (isset($row['Field'])) {
272 $_form_params['field_orig[' . $i . ']'] = $row['Field'];
274 $_form_params['field_orig[' . $i . ']'] = '';
279 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
280 . ' type="text" name="field_name[' . $i . ']"'
281 . ' maxlength="64" class="textfield" title="' . __('Column') . '"'
282 . ' size="' . ($GLOBALS['cfg']['DefaultPropDisplay'] == 'horizontal' ?
'10' : '30') . '"'
283 . ' value="' . (isset($row['Field']) ?
htmlspecialchars($row['Field']) : '') . '"'
288 $select_id = 'field_' . $i . '_' . ($ci - $ci_offset);
289 $content_cells[$i][$ci] = '<select class="column_type" name="field_type[' . $i . ']"'
290 .' id="' . $select_id . '">';
292 if (empty($row['Type'])) {
297 $type = $row['Type'];
300 if (! empty($row['Type'])) {
301 $type = $extracted_fieldspec['type'];
302 if ('set' == $extracted_fieldspec['type'] ||
'enum' == $extracted_fieldspec['type']) {
303 $length = $extracted_fieldspec['spec_in_brackets'];
305 $type = $extracted_fieldspec['print_type'];
306 $length = $extracted_fieldspec['spec_in_brackets'];
313 // some types, for example longtext, are reported as
314 // "longtext character set latin7" when their charset and / or collation
315 // differs from the ones of the corresponding database.
316 $tmp = strpos($type, 'character set');
318 $type = substr($type, 0, $tmp - 1);
321 if (isset($submit_length) && $submit_length != false) {
322 $length = $submit_length;
325 // rtrim the type, for cases like "float unsigned"
326 $type = rtrim($type);
327 $type_upper = strtoupper($type);
329 $content_cells[$i][$ci] .= PMA_getSupportedDatatypes(true, $type_upper);
330 $content_cells[$i][$ci] .= ' </select>';
335 $_form_params['field_length_orig[' . $i . ']'] = $length;
339 $length_to_display = $length;
341 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
342 . ' type="text" name="field_length[' . $i . ']" size="' . $length_values_input_size . '"'
343 . ' value="' . htmlspecialchars($length_to_display) . '"'
344 . ' class="textfield" />'
345 . '<p class="enum_notice" id="enum_notice_' . $i . '_' . ($ci - $ci_offset) . '">';
346 $content_cells[$i][$ci] .= __('ENUM or SET data too long?')
347 . '<a onclick="return false;" href="enum_editor.php?' . PMA_generate_common_url() . '&values=' . urlencode($length_to_display) . '&field=' . (isset($row['Field']) ?
urlencode($row['Field']) : "") . '" class="open_enum_editor" target="_blank"> '
348 . __('Get more editing space') . '</a></p>';
353 * having NULL enabled does not implicit having Default with NULL
356 && ! isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
357 $row['Default'] = 'NULL';
361 // old column default
363 $_form_params['field_default_orig[' . $i . ']'] =
364 (isset($row['Default']) ?
$row['Default'] : '');
367 // here we put 'NONE' as the default value of drop-down; otherwise
368 // users would have problems if they forget to enter the default
369 // value (example, for an INT)
370 $default_options = array(
371 'NONE' => _pgettext('for default', 'None'),
372 'USER_DEFINED' => __('As defined:'),
374 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP',
377 // for a TIMESTAMP, do not show the string "CURRENT_TIMESTAMP" as a default value
378 if ($type_upper == 'TIMESTAMP'
379 && ! empty($default_current_timestamp)
380 && isset($row['Default'])) {
381 $row['Default'] = '';
384 if ($type_upper == 'BIT') {
385 $row['DefaultValue'] = PMA_convert_bit_default_value($row['DefaultValue']);
388 $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">';
389 foreach ($default_options as $key => $value) {
390 $content_cells[$i][$ci] .= '<option value="' . $key . '"';
391 // is only set when we go back to edit a field's structure
392 if (isset($row['DefaultType']) && $row['DefaultType'] == $key) {
393 $content_cells[$i][$ci] .= ' selected="selected"';
395 $content_cells[$i][$ci] .= ' >' . $value . '</option>';
397 $content_cells[$i][$ci] .= '</select>';
398 $content_cells[$i][$ci] .= '<br />';
399 $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
400 . ' type="text" name="field_default_value[' . $i . ']" size="12"'
401 . ' value="' . (isset($row['DefaultValue']) ?
htmlspecialchars($row['DefaultValue']) : '') . '"'
402 . ' class="textfield" />';
406 $tmp_collation = empty($row['Collation']) ?
null : $row['Collation'];
407 $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(
408 PMA_CSDROPDOWN_COLLATION
, 'field_collation[' . $i . ']',
409 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, false);
410 unset($tmp_collation);
414 $content_cells[$i][$ci] = '<select style="font-size: 70%;"'
415 . ' name="field_attribute[' . $i . ']"'
416 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
419 if (isset($extracted_fieldspec)) {
420 $attribute = $extracted_fieldspec['attribute'];
423 if (isset($row['Extra']) && $row['Extra'] == 'on update CURRENT_TIMESTAMP') {
424 $attribute = 'on update CURRENT_TIMESTAMP';
427 if (isset($submit_attribute) && $submit_attribute != false) {
428 $attribute = $submit_attribute;
431 // here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having the
432 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
434 if (PMA_MYSQL_INT_VERSION
< 50025
435 && isset($row['Field'])
436 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type'])
437 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP'
438 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) {
442 // MySQL 4.1.2+ TIMESTAMP options
443 // (if on_update_current_timestamp is set, then it's TRUE)
444 if (isset($row['Field'])
445 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
446 $attribute = 'on update CURRENT_TIMESTAMP';
448 if ((isset($row['Field'])
449 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp']))
450 ||
(isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) {
451 $default_current_timestamp = true;
453 $default_current_timestamp = false;
456 $cnt_attribute_types = count($cfg['AttributeTypes']);
457 for ($j = 0; $j < $cnt_attribute_types; $j++
) {
458 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
459 if (strtoupper($attribute) == strtoupper($cfg['AttributeTypes'][$j])) {
460 $content_cells[$i][$ci] .= ' selected="selected"';
462 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>';
465 $content_cells[$i][$ci] .= '</select>';
469 $content_cells[$i][$ci] = '<input name="field_null[' . $i . ']"'
470 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
472 if (! empty($row['Null']) && $row['Null'] != 'NO' && $row['Null'] != 'NOT NULL') {
473 $content_cells[$i][$ci] .= ' checked="checked"';
476 $content_cells[$i][$ci] .= ' type="checkbox" value="NULL" />';
480 // See my other comment about removing this 'if'.
482 $content_cells[$i][$ci] = '<select name="field_key[' . $i . ']"'
483 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
484 $content_cells[$i][$ci] .= '<option value="none_' . $i . '">---</option>';
486 $content_cells[$i][$ci] .= '<option value="primary_' . $i . '" title="' . __('Primary') . '"';
487 if (isset($row['Key']) && $row['Key'] == 'PRI') {
488 $content_cells[$i][$ci] .= ' selected="selected"';
490 $content_cells[$i][$ci] .= '>PRIMARY</option>';
492 $content_cells[$i][$ci] .= '<option value="unique_' . $i . '" title="' . __('Unique') . '"';
493 if (isset($row['Key']) && $row['Key'] == 'UNI') {
494 $content_cells[$i][$ci] .= ' selected="selected"';
496 $content_cells[$i][$ci] .= '>UNIQUE</option>';
498 $content_cells[$i][$ci] .= '<option value="index_' . $i . '" title="' . __('Index') . '"';
499 if (isset($row['Key']) && $row['Key'] == 'MUL') {
500 $content_cells[$i][$ci] .= ' selected="selected"';
502 $content_cells[$i][$ci] .= '>INDEX</option>';
505 $content_cells[$i][$ci] .= '<option value="fulltext_' . $i . '" title="' . __('Fulltext') . '"';
506 if (isset($row['Key']) && $row['Key'] == 'FULLTEXT') {
507 $content_cells[$i][$ci] .= ' selected="selected"';
509 $content_cells[$i][$ci] .= '>FULLTEXT</option>';
512 $content_cells[$i][$ci] .= '</select>';
514 } // end if ($action ==...)
516 // column auto_increment
517 $content_cells[$i][$ci] = '<input name="field_extra[' . $i . ']"'
518 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
520 if (isset($row['Extra']) && strtolower($row['Extra']) == 'auto_increment') {
521 $content_cells[$i][$ci] .= ' checked="checked"';
524 $content_cells[$i][$ci] .= ' type="checkbox" value="AUTO_INCREMENT" />';
528 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
529 . ' type="text" name="field_comments[' . $i . ']" size="12"'
530 . ' value="' . (isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?
htmlspecialchars($comments_map[$row['Field']]) : '') . '"'
531 . ' class="textfield" />';
535 if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
536 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">';
537 $content_cells[$i][$ci] .= ' <option value=""> </option>';
539 if (is_array($available_mime['mimetype'])) {
540 foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) {
541 $checked = (isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ?
'selected ' : '');
542 $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
546 $content_cells[$i][$ci] .= '</select>';
549 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[' . $i . ']">';
550 $content_cells[$i][$ci] .= ' <option value="" title="' . __('None') . '"></option>';
551 if (is_array($available_mime['transformation'])) {
552 foreach ($available_mime['transformation'] AS $mimekey => $transform) {
553 $checked = (isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && (preg_match('@' . preg_quote($available_mime['transformation_file'][$mimekey]) . '3?@i', $mime_map[$row['Field']]['transformation'])) ?
'selected ' : '');
554 $tooltip = 'strTransformation_' . strtolower(str_replace('.inc.php', '', $available_mime['transformation_file'][$mimekey]));
555 $tooltip = isset($
$tooltip) ? $
$tooltip : sprintf(str_replace('<br />', ' ', __('No description is available for this transformation.<br />Please ask the author what %s does.')), 'PMA_transformation_' . $tooltip . '()');
556 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>';
560 $content_cells[$i][$ci] .= '</select>';
563 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
564 . ' type="text" name="field_transformation_options[' . $i . ']"'
565 . ' size="16" class="textfield"'
566 . ' value="' . (isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?
htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '"'
573 <script src
="./js/keyhandler.js" type
="text/javascript"></script
>
574 <script type
="text/javascript">
576 var switch_movement
= <?php
echo $display_type == 'horizontal' ?
'0' : '1'; ?
>;
577 document
.onkeydown
= onKeyDownArrowsHandler
;
581 <form id
="<?php echo ($action == 'tbl_create.php' ? 'create_table' : 'append_fields'); ?>_form" method
="post" action
="<?php echo $action; ?>" <?php
echo ($GLOBALS['cfg']['AjaxEnable'] ?
' class="ajax"' : ''); ?
>>
583 echo PMA_generate_common_hidden_inputs($_form_params);
584 unset($_form_params);
585 if ($action == 'tbl_create.php') {
589 <th
><?php
echo __('Table name'); ?
>: 
;</th
>
591 <tr
><td
><input type
="text" name
="table" size
="40" maxlength
="80"
592 value
="<?php echo (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : ''); ?>"
596 <?php
if ($action == 'tbl_create.php' ||
$action == 'tbl_addfield.php') { ?
>
597 <?php
echo sprintf(__('Add %s column(s)'), '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?
>
598 <input type
="submit" name
="submit_num_fields" value
="<?php echo __('Go'); ?>"
599 onclick
="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)"
609 if (is_array($content_cells) && is_array($header_cells)) {
610 // last row is for javascript insert
611 //$empty_row = array_pop($content_cells);
613 echo '<table id="table_columns" class="noclick">';
614 echo '<caption class="tblHeaders">' . __('Structure') . PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE') . '</caption>';
616 if ($display_type == 'horizontal') {
619 <?php
foreach ($header_cells as $header_val) { ?
>
620 <th
><?php
echo $header_val; ?
></th
>
626 foreach ($content_cells as $content_row) {
627 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . '">';
628 $odd_row = ! $odd_row;
630 if (is_array($content_row)) {
631 foreach ($content_row as $content_row_val) {
633 <td align
="center"><?php
echo $content_row_val; ?
></td
>
642 foreach ($header_cells as $header_val) {
643 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . '">';
644 $odd_row = ! $odd_row;
646 <th
><?php
echo $header_val; ?
></th
>
648 foreach ($content_cells as $content_cell) {
649 if (isset($content_cell[$i]) && $content_cell[$i] != '') {
651 <td
><?php
echo $content_cell[$i]; ?
></td
>
666 * needs to be finished
669 if ($display_type == 'horizontal') {
671 foreach ($empty_row as $content_row_val) {
672 $new_field .= '<td align="center">' . $content_row_val . '</td>';
675 <script type="text/javascript">
677 var odd_row = <?php echo $odd_row; ?>;
681 var new_fields = document.getElementById('added_fields').value;
682 var new_field_container = document.getElementById('table_columns');
683 var new_field = '<?php echo preg_replace('|\s+|', ' ', preg_replace('|\'|', '\\\'', $new_field)); ?>';
685 for (i = 0; i < new_fields; i++) {
687 new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>';
689 new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>';
702 if ($action == 'tbl_create.php') {
706 <th
><?php
echo __('Table comments'); ?
>: 
;</th
>
707 <td width
="25"> 
;</td
>
708 <th
><?php
echo __('Storage Engine'); ?
>:
709 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
711 <td width
="25"> 
;</td
>
712 <th
><?php
echo __('Collation') ;?
>: 
;</th
>
714 <tr
><td
><input type
="text" name
="comment" size
="40" maxlength
="80"
715 value
="<?php echo (isset($_REQUEST['comment']) ? htmlspecialchars($_REQUEST['comment']) : ''); ?>"
718 <td width
="25"> 
;</td
>
721 echo PMA_StorageEngine
::getHtmlSelect('tbl_type', null,
722 (isset($_REQUEST['tbl_type']) ?
$_REQUEST['tbl_type'] : null));
725 <td width
="25"> 
;</td
>
728 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
, 'tbl_collation',
729 null, (isset($_REQUEST['tbl_collation']) ?
$_REQUEST['tbl_collation'] : null), false, 3);
734 if (PMA_Partition
::havePartitioning()) {
737 <th
><?php
echo __('PARTITION definition'); ?
>: 
;<?php
echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?
>
742 <textarea name
="partition_definition" id
="partitiondefinition"
743 cols
="<?php echo $GLOBALS['cfg']['TextareaCols'];?>"
744 rows
="<?php echo $GLOBALS['cfg']['TextareaRows'];?>"
745 dir
="<?php echo $GLOBALS['text_dir'];?>"><?php
echo (isset($_REQUEST['partition_definition']) ?
htmlspecialchars($_REQUEST['partition_definition']) : ''); ?
></textarea
>
754 } // end if ($action == 'tbl_create.php')
757 <fieldset
class="tblFooters">
758 <input type
="submit" name
="do_save_data" value
="<?php echo __('Save'); ?>" />
760 <div id
="properties_message"></div
>
763 <div id
="enum_editor">
764 <a
class="close_enum_editor"><?php
echo __('Close'); ?
></a
>
765 <h3
><?php
printf(__('Values for the column "%s"'), isset($row['Field']) ?
htmlspecialchars($row['Field']) : ""); ?
></h3
>
766 <p
><?php
echo __('Enter each value in a separate field.'); ?
></p
>
767 <div id
="values"></div
>
768 <p
><a
class="add_value"><?php
echo __('+ Add a value'); ?
></a
></p
>
769 <input type
="submit" value
="<?php echo __('Go'); ?>" /> <a
class="cancel_enum_editor"><?php
echo __('Cancel'); ?
></a
>
772 <div id
="popup_background"></div
>