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
10 if (! defined('PHPMYADMIN')) {
17 require_once './libraries/common.inc.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 if (is_int($cfg['DefaultPropDisplay'])) {
31 if ($num_fields <= $cfg['DefaultPropDisplay']) {
32 $display_type = 'vertical';
34 $display_type = 'horizontal';
37 $display_type = $cfg['DefaultPropDisplay'];
40 if ('horizontal' == $display_type) {
41 $length_values_input_size = 8;
43 $length_values_input_size = 30;
46 $_form_params = array(
51 if ($action == 'tbl_create.php') {
52 $_form_params['reload'] = 1;
53 } elseif ($action == 'tbl_addfield.php') {
54 $_form_params['field_where'] = $_REQUEST['field_where'];
55 $_form_params['after_field'] = $_REQUEST['after_field'];
58 if (isset($num_fields)) {
59 $_form_params['orig_num_fields'] = $num_fields;
62 if (isset($_REQUEST['field_where'])) {
63 $_form_params['orig_field_where'] = $_REQUEST['field_where'];
66 if (isset($_REQUEST['after_field'])) {
67 $_form_params['orig_after_field'] = $_REQUEST['after_field'];
70 if (isset($selected) && is_array($selected)) {
71 foreach ($selected as $o_fld_nr => $o_fld_val) {
72 $_form_params['selected[' . $o_fld_nr . ']'] = $o_fld_val;
73 if (! isset($true_selected)) {
74 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
78 if (isset($true_selected) && is_array($true_selected)) {
79 foreach ($true_selected as $o_fld_nr => $o_fld_val) {
80 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
83 } elseif (isset($_REQUEST['field'])) {
84 $_form_params['orig_field'] = $_REQUEST['field'];
85 if (isset($orig_field)) {
86 $_form_params['true_selected[]'] = $orig_field;
88 $_form_params['true_selected[]'] = $_REQUEST['field'];
92 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
94 $header_cells = array();
95 $content_cells = array();
97 $header_cells[] = $strField;
98 $header_cells[] = $strType
99 . ($GLOBALS['cfg']['ReplaceHelpImg']
100 ?
PMA_showMySQLDocu('SQL-Syntax', 'data-types')
101 : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('SQL-Syntax', 'data-types')
103 $header_cells[] = $strLengthSet . PMA_showHint($strSetEnumVal);
104 $header_cells[] = $strDefault . PMA_showHint($strDefaultValueHelp);
105 $header_cells[] = $strCollation;
106 $header_cells[] = $strAttr;
107 $header_cells[] = $strNull;
109 // lem9: We could remove this 'if' and let the key information be shown and
110 // editable. However, for this to work, tbl_alter must be modified to use the
111 // key fields, as tbl_addfield does.
114 $header_cells[] = $strIndex;
117 $header_cells[] = '<abbr title="AUTO_INCREMENT">' . ($display_type == 'horizontal' ?
'A_I' : 'AUTO_INCREMENT') . '</abbr>';
119 require_once './libraries/relation.lib.php';
120 require_once './libraries/transformations.lib.php';
121 $cfgRelation = PMA_getRelationsParam();
123 $comments_map = array();
125 $available_mime = array();
127 $comments_map = PMA_getComments($db, $table);
128 $header_cells[] = $strComments;
130 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
131 $mime_map = PMA_getMIME($db, $table);
132 $available_mime = PMA_getAvailableMIMEtypes();
135 sprintf($strMIME_transformation_note,
136 '<a href="transformation_overview.php?'
137 . PMA_generate_common_url($db, $table) . '" target="_blank">',
141 $header_cells[] = $strMIME_MIMEtype;
142 $header_cells[] = $strMIME_transformation;
143 $header_cells[] = $strMIME_transformation_options
144 . PMA_showHint($strMIME_transformation_options_note . $hint);
147 // garvin: workaround for field_fulltext, because its submitted indizes contain
148 // the index as a value, not a key. Inserted here for easier maintaineance
149 // and less code to change in existing files.
150 if (isset($field_fulltext) && is_array($field_fulltext)) {
151 foreach ($field_fulltext as $fulltext_nr => $fulltext_indexkey) {
152 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
156 for ($i = 0; $i < $num_fields; $i++
) {
157 if (! empty($regenerate)) {
158 // An error happened with previous inputs, so we will restore the data
159 // to embed it once again in this form.
161 $row['Field'] = (isset($_REQUEST['field_name'][$i]) ?
$_REQUEST['field_name'][$i] : false);
162 $row['Type'] = (isset($_REQUEST['field_type'][$i]) ?
$_REQUEST['field_type'][$i] : false);
163 $row['Collation'] = (isset($_REQUEST['field_collation'][$i]) ?
$_REQUEST['field_collation'][$i] : '');
164 $row['Null'] = (isset($_REQUEST['field_null'][$i]) ?
$_REQUEST['field_null'][$i] : '');
166 if (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'primary_' . $i) {
168 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'index_' . $i) {
170 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'unique_' . $i) {
172 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'fulltext_' . $i) {
173 $row['Key'] = 'FULLTEXT';
178 // put None in the drop-down for Default, when someone adds a field
179 $row['DefaultType'] = (isset($_REQUEST['field_default_type'][$i]) ?
$_REQUEST['field_default_type'][$i] : 'NONE');
180 $row['DefaultValue'] = (isset($_REQUEST['field_default_value'][$i]) ?
$_REQUEST['field_default_value'][$i] : '');
182 switch ($row['DefaultType']) {
184 $row['Default'] = null;
186 case 'USER_DEFINED' :
187 $row['Default'] = $row['DefaultValue'];
190 case 'CURRENT_TIMESTAMP' :
191 $row['Default'] = $row['DefaultType'];
195 $row['Extra'] = (isset($_REQUEST['field_extra'][$i]) ?
$_REQUEST['field_extra'][$i] : false);
196 $row['Comment'] = (isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ?
'FULLTEXT' : false);
198 $submit_length = (isset($_REQUEST['field_length'][$i]) ?
$_REQUEST['field_length'][$i] : false);
199 $submit_attribute = (isset($_REQUEST['field_attribute'][$i]) ?
$_REQUEST['field_attribute'][$i] : false);
201 $submit_default_current_timestamp = (isset($_REQUEST['field_default_current_timestamp'][$i]) ?
true : false);
203 if (isset($_REQUEST['field_comments'][$i])) {
204 $comments_map[$row['Field']] = $_REQUEST['field_comments'][$i];
207 if (isset($_REQUEST['field_mimetype'][$i])) {
208 $mime_map[$row['Field']]['mimetype'] = $_REQUEST['field_mimetype'][$i];
211 if (isset($_REQUEST['field_transformation'][$i])) {
212 $mime_map[$row['Field']]['transformation'] = $_REQUEST['field_transformation'][$i];
215 if (isset($_REQUEST['field_transformation_options'][$i])) {
216 $mime_map[$row['Field']]['transformation_options'] = $_REQUEST['field_transformation_options'][$i];
219 } elseif (isset($fields_meta[$i])) {
220 $row = $fields_meta[$i];
221 switch ($row['Default']) {
223 if ($row['Null'] == 'YES') {
224 $row['DefaultType'] = 'NULL';
226 $row['DefaultType'] = 'NONE';
228 $row['DefaultValue'] = '';
230 case 'CURRENT_TIMESTAMP':
231 $row['DefaultType'] = 'CURRENT_TIMESTAMP';
232 $row['DefaultValue'] = '';
235 $row['DefaultType'] = 'USER_DEFINED';
236 $row['DefaultValue'] = $row['Default'];
241 if (isset($row['Type'])) {
242 $extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
243 if ($extracted_fieldspec['type'] == 'bit') {
244 $row['Default'] = PMA_printable_bit_value($row['Default'], $extracted_fieldspec['spec_in_brackets']);
247 // Cell index: If certain fields get left out, the counter shouldn't change.
249 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
250 // has to be incremented ($ci_offset++)
255 if (! empty($true_selected[$i])) {
256 $_form_params['field_orig[' . $i . ']'] = $true_selected[$i];
257 } elseif (isset($row['Field'])) {
258 $_form_params['field_orig[' . $i . ']'] = $row['Field'];
260 $_form_params['field_orig[' . $i . ']'] = '';
265 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
266 . ' type="text" name="field_name[' . $i . ']"'
267 . ' maxlength="64" class="textfield" title="' . $strField . '"'
268 . ' size="' . ($GLOBALS['cfg']['DefaultPropDisplay'] == 'horizontal' ?
'10' : '30') . '"'
269 . ' value="' . (isset($row['Field']) ?
htmlspecialchars($row['Field']) : '') . '"'
274 $content_cells[$i][$ci] = '<select name="field_type[' . $i . ']"'
275 .' id="field_' . $i . '_' . ($ci - $ci_offset) . '" >';
277 if (empty($row['Type'])) {
282 $type = $row['Type'];
285 if (! empty($row['Type'])) {
286 $type = $extracted_fieldspec['type'];
287 if ('set' == $extracted_fieldspec['type'] ||
'enum' == $extracted_fieldspec['type']) {
288 $length = $extracted_fieldspec['spec_in_brackets'];
290 // strip the "BINARY" attribute, except if we find "BINARY(" because
291 // this would be a BINARY or VARBINARY field type
292 $type = preg_replace('@BINARY([^\(])@i', '', $type);
293 $type = preg_replace('@ZEROFILL@i', '', $type);
294 $type = preg_replace('@UNSIGNED@i', '', $type);
295 $length = $extracted_fieldspec['spec_in_brackets'];
302 // some types, for example longtext, are reported as
303 // "longtext character set latin7" when their charset and / or collation
304 // differs from the ones of the corresponding database.
305 $tmp = strpos($type, 'character set');
307 $type = substr($type, 0, $tmp - 1);
310 if (isset($submit_length) && $submit_length != false) {
311 $length = $submit_length;
314 // rtrim the type, for cases like "float unsigned"
315 $type = rtrim($type);
316 $type_upper = strtoupper($type);
318 foreach ($cfg['ColumnTypes'] as $col_goup => $column_type) {
319 if (is_array($column_type)) {
320 $content_cells[$i][$ci] .= '<optgroup label="' . htmlspecialchars($col_goup) . '">';
321 foreach ($column_type as $col_group_type) {
322 $content_cells[$i][$ci] .= '<option value="'. $col_group_type . '"';
323 if ($type_upper == strtoupper($col_group_type)) {
324 $content_cells[$i][$ci] .= ' selected="selected"';
326 $content_cells[$i][$ci] .= '>' . $col_group_type . '</option>';
328 $content_cells[$i][$ci] .= '</optgroup>';
332 $content_cells[$i][$ci] .= '<option value="'. $column_type . '"';
333 if ($type_upper == strtoupper($column_type)) {
334 $content_cells[$i][$ci] .= ' selected="selected"';
336 $content_cells[$i][$ci] .= '>' . $column_type . '</option>';
339 $content_cells[$i][$ci] .= ' </select>';
344 $_form_params['field_length_orig[' . $i . ']'] = $length;
348 if (isset($extracted_fieldspec) && ('set' == $extracted_fieldspec['type'] ||
'enum' == $extracted_fieldspec['type'])) {
352 $length_to_display = htmlspecialchars($length);
354 $length_to_display = $length;
356 $unsigned = stristr($row['Type'], 'unsigned');
357 $zerofill = stristr($row['Type'], 'zerofill');
360 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
361 . ' type="text" name="field_length[' . $i . ']" size="' . $length_values_input_size . '"'
362 . ' value="' . htmlspecialchars($length_to_display) . '"'
363 . ' class="textfield" />';
368 * having NULL enabled does not implicit having Default with NULL
371 && !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
372 $row['Default'] = 'NULL';
376 // old column default
378 $_form_params['field_default_orig[' . $i . ']'] =
379 (isset($row['Default']) ?
$row['Default'] : '');
382 // here we put 'NONE' as the default value of drop-down; otherwise
383 // users would have problems if they forget to enter the default
384 // value (example, for an INT)
385 $default_options = array(
386 'NONE' => $strNoneDefault,
387 'USER_DEFINED' => $strAsDefined,
389 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP',
392 // for a TIMESTAMP, do not show CURRENT_TIMESTAMP as a default value
393 if ($type_upper == 'TIMESTAMP'
394 && $default_current_timestamp
395 && isset($row['Default'])) {
396 $row['Default'] = '';
399 $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">';
400 foreach ($default_options as $key => $value) {
401 $content_cells[$i][$ci] .= '<option value="' . $key . '"';
402 // is only set when we go back to edit a field's structure
403 if (isset($row['DefaultType']) && $row['DefaultType'] == $key) {
404 $content_cells[$i][$ci] .= ' selected="selected"';
406 $content_cells[$i][$ci] .= ' >' . $value . '</option>';
408 $content_cells[$i][$ci] .= '</select>';
409 $content_cells[$i][$ci] .= '<br />';
410 $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
411 . ' type="text" name="field_default_value[' . $i . ']" size="12"'
412 . ' value="' . (isset($row['DefaultValue']) ?
htmlspecialchars($row['DefaultValue']) : '') . '"'
413 . ' class="textfield" />';
417 $tmp_collation = empty($row['Collation']) ?
null : $row['Collation'];
418 $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(
419 PMA_CSDROPDOWN_COLLATION
, 'field_collation[' . $i . ']',
420 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, false);
421 unset($tmp_collation);
425 $content_cells[$i][$ci] = '<select style="font-size: 70%;"'
426 . ' name="field_attribute[' . $i . ']"'
427 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
431 $attribute = 'BINARY';
434 $attribute = 'UNSIGNED';
437 $attribute = 'UNSIGNED ZEROFILL';
439 if (isset($row['Extra']) && $row['Extra'] == 'on update CURRENT_TIMESTAMP') {
440 $attribute = 'on update CURRENT_TIMESTAMP';
443 if (isset($submit_attribute) && $submit_attribute != false) {
444 $attribute = $submit_attribute;
447 // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
448 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
450 if (PMA_MYSQL_INT_VERSION
< 50025
451 && isset($row['Field'])
452 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type'])
453 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP'
454 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) {
458 // MySQL 4.1.2+ TIMESTAMP options
459 // (if on_update_current_timestamp is set, then it's TRUE)
460 if (isset($row['Field'])
461 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
462 $attribute = 'on update CURRENT_TIMESTAMP';
464 if ((isset($row['Field'])
465 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp']))
466 ||
(isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) {
467 $default_current_timestamp = true;
469 $default_current_timestamp = false;
472 $cnt_attribute_types = count($cfg['AttributeTypes']);
473 for ($j = 0; $j < $cnt_attribute_types; $j++
) {
474 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
475 if (strtoupper($attribute) == strtoupper($cfg['AttributeTypes'][$j])) {
476 $content_cells[$i][$ci] .= ' selected="selected"';
478 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>';
481 $content_cells[$i][$ci] .= '</select>';
485 $content_cells[$i][$ci] = '<input name="field_null[' . $i . ']"'
486 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
488 if (! empty($row['Null']) && $row['Null'] != 'NO' && $row['Null'] != 'NOT NULL') {
489 $content_cells[$i][$ci] .= ' checked="checked"';
492 $content_cells[$i][$ci] .= ' type="checkbox" value="NULL" />';
496 // lem9: See my other comment about removing this 'if'.
498 $content_cells[$i][$ci] = '<select name="field_key[' . $i . ']"'
499 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
500 $content_cells[$i][$ci] .= '<option value="none_' . $i . '">---</option>';
502 $content_cells[$i][$ci] .= '<option value="primary_' . $i . '" title="' . $strPrimary . '"';
503 if (isset($row['Key']) && $row['Key'] == 'PRI') {
504 $content_cells[$i][$ci] .= ' selected="selected"';
506 $content_cells[$i][$ci] .= '>PRIMARY</option>';
508 $content_cells[$i][$ci] .= '<option value="unique_' . $i . '" title="' . $strUnique . '"';
509 if (isset($row['Key']) && $row['Key'] == 'UNI') {
510 $content_cells[$i][$ci] .= ' selected="selected"';
512 $content_cells[$i][$ci] .= '>UNIQUE</option>';
514 $content_cells[$i][$ci] .= '<option value="index_' . $i . '" title="' . $strIndex . '"';
515 if (isset($row['Key']) && $row['Key'] == 'MUL') {
516 $content_cells[$i][$ci] .= ' selected="selected"';
518 $content_cells[$i][$ci] .= '>INDEX</option>';
520 $content_cells[$i][$ci] .= '<option value="fulltext_' . $i . '" title="' . $strIdxFulltext . '"';
521 if (isset($row['Key']) && $row['Key'] == 'FULLTEXT') {
522 $content_cells[$i][$ci] .= ' selected="selected"';
524 $content_cells[$i][$ci] .= '>FULLTEXT</option>';
526 $content_cells[$i][$ci] .= '</select>';
528 } // end if ($action ==...)
530 // column auto_increment
531 $content_cells[$i][$ci] = '<input name="field_extra[' . $i . ']"'
532 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
534 if (isset($row['Extra']) && strtolower($row['Extra']) == 'auto_increment') {
535 $content_cells[$i][$ci] .= ' checked="checked"';
538 $content_cells[$i][$ci] .= ' type="checkbox" value="AUTO_INCREMENT" />';
542 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
543 . ' type="text" name="field_comments[' . $i . ']" size="12"'
544 . ' value="' . (isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?
htmlspecialchars($comments_map[$row['Field']]) : '') . '"'
545 . ' class="textfield" />';
549 if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
550 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">';
551 $content_cells[$i][$ci] .= ' <option value=""> </option>';
553 if (is_array($available_mime['mimetype'])) {
554 foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) {
555 $checked = (isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ?
'selected ' : '');
556 $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
560 $content_cells[$i][$ci] .= '</select>';
563 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[' . $i . ']">';
564 $content_cells[$i][$ci] .= ' <option value="" title="' . $strNone . '"></option>';
565 if (is_array($available_mime['transformation'])) {
566 foreach ($available_mime['transformation'] AS $mimekey => $transform) {
567 $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 ' : '');
568 $tooltip = 'strTransformation_' . strtolower(str_replace('.inc.php', '', $available_mime['transformation_file'][$mimekey]));
569 $tooltip = isset($
$tooltip) ? $
$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
570 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>';
574 $content_cells[$i][$ci] .= '</select>';
577 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
578 . ' type="text" name="field_transformation_options[' . $i . ']"'
579 . ' size="16" class="textfield"'
580 . ' value="' . (isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?
htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '"'
586 if ($cfg['CtrlArrowsMoving']) {
588 <script src
="./js/keyhandler.js" type
="text/javascript"></script
>
589 <script type
="text/javascript">
591 var switch_movement
= <?php
echo $display_type == 'horizontal' ?
'0' : '1'; ?
>;
592 document
.onkeydown
= onKeyDownArrowsHandler
;
599 <form method
="post" action
="<?php echo $action; ?>">
601 echo PMA_generate_common_hidden_inputs($_form_params);
602 unset($_form_params);
604 if (is_array($content_cells) && is_array($header_cells)) {
605 // last row is for javascript insert
606 //$empty_row = array_pop($content_cells);
608 echo '<table id="table_columns">';
609 if ($display_type == 'horizontal') {
612 <?php
foreach ($header_cells as $header_val) { ?
>
613 <th
><?php
echo $header_val; ?
></th
>
619 foreach ($content_cells as $content_row) {
620 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . ' noclick">';
621 $odd_row = ! $odd_row;
623 if (is_array($content_row)) {
624 foreach ($content_row as $content_row_val) {
626 <td align
="center"><?php
echo $content_row_val; ?
></td
>
635 foreach ($header_cells as $header_val) {
636 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . ' noclick">';
637 $odd_row = ! $odd_row;
639 <th
><?php
echo $header_val; ?
></th
>
641 foreach ($content_cells as $content_cell) {
642 if (isset($content_cell[$i]) && $content_cell[$i] != '') {
644 <td
><?php
echo $content_cell[$i]; ?
></td
>
659 * needs to be finished
662 if ($display_type == 'horizontal') {
664 foreach ($empty_row as $content_row_val) {
665 $new_field .= '<td align="center">' . $content_row_val . '</td>';
668 <script type="text/javascript">
670 var odd_row = <?php echo $odd_row; ?>;
672 function addField() {
673 var new_fields = document.getElementById('added_fields').value;
674 var new_field_container = document.getElementById('table_columns');
675 var new_field = '<?php echo preg_replace('|\s+|', ' ', preg_replace('|\'|', '\\\'', $new_field)); ?>';
677 for (i = 0; i < new_fields; i++) {
679 new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>';
681 new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>';
694 if ($action == 'tbl_create.php') {
698 <th
><?php
echo $strTableComments; ?
>: 
;</th
>
699 <td width
="25"> 
;</td
>
700 <th
><?php
echo $strStorageEngine; ?
>:
701 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
703 <td width
="25"> 
;</td
>
704 <th
><?php
echo $strCollation ;?
>: 
;</th
>
706 <tr
><td
><input type
="text" name
="comment" size
="40" maxlength
="80"
707 value
="<?php echo (isset($_REQUEST['comment']) ? htmlspecialchars($_REQUEST['comment']) : ''); ?>"
710 <td width
="25"> 
;</td
>
713 echo PMA_StorageEngine
::getHtmlSelect('tbl_type', null,
714 (isset($_REQUEST['tbl_type']) ?
$_REQUEST['tbl_type'] : null));
717 <td width
="25"> 
;</td
>
720 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
, 'tbl_collation',
721 null, (isset($_REQUEST['tbl_collation']) ?
$_REQUEST['tbl_collation'] : null), false, 3);
726 if (PMA_Partition
::havePartitioning()) {
729 <th
><?php
echo $strPartitionDefinition; ?
>: 
;<?php
echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?
>
734 <textarea name
="partition_definition" id
="partitiondefinition"
735 cols
="<?php echo $GLOBALS['cfg']['TextareaCols'];?>"
736 rows
="<?php echo $GLOBALS['cfg']['TextareaRows'];?>"
737 dir
="<?php echo $GLOBALS['text_dir'];?>"><?php
echo (isset($_REQUEST['partition_definition']) ?
htmlspecialchars($_REQUEST['partition_definition']) : ''); ?
></textarea
>
746 } // end if ($action == 'tbl_create.php')
749 <fieldset
class="tblFooters">
750 <input type
="submit" name
="do_save_data" value
="<?php echo $strSave; ?>"
751 onclick
="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" />
752 <?php
if ($action == 'tbl_create.php' ||
$action == 'tbl_addfield.php') { ?
>
753 <?php
echo $GLOBALS['strOr']; ?
>
754 <?php
echo sprintf($strAddFields, '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?
>
755 <input type
="submit" name
="submit_num_fields"
756 value
="<?php echo $GLOBALS['strGo']; ?>"
757 <?php
/* onclick="if (addField()) return false;" */ ?
>
758 onclick
="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)"
765 <center
><?php
echo PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE'); ?
></center
>