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(
50 if ($action == 'tbl_create.php') {
51 $_form_params['reload'] = 1;
52 } elseif ($action == 'tbl_addfield.php') {
53 $_form_params['field_where'] = $_REQUEST['field_where'];
54 $_form_params['after_field'] = $_REQUEST['after_field'];
55 $_form_params['table'] = $table;
57 $_form_params['table'] = $table;
60 if (isset($num_fields)) {
61 $_form_params['orig_num_fields'] = $num_fields;
64 if (isset($_REQUEST['field_where'])) {
65 $_form_params['orig_field_where'] = $_REQUEST['field_where'];
68 if (isset($_REQUEST['after_field'])) {
69 $_form_params['orig_after_field'] = $_REQUEST['after_field'];
72 if (isset($selected) && is_array($selected)) {
73 foreach ($selected as $o_fld_nr => $o_fld_val) {
74 $_form_params['selected[' . $o_fld_nr . ']'] = $o_fld_val;
75 if (! isset($true_selected)) {
76 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
80 if (isset($true_selected) && is_array($true_selected)) {
81 foreach ($true_selected as $o_fld_nr => $o_fld_val) {
82 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
85 } elseif (isset($_REQUEST['field'])) {
86 $_form_params['orig_field'] = $_REQUEST['field'];
87 if (isset($orig_field)) {
88 $_form_params['true_selected[]'] = $orig_field;
90 $_form_params['true_selected[]'] = $_REQUEST['field'];
94 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
96 $header_cells = array();
97 $content_cells = array();
99 $header_cells[] = __('Field');
100 $header_cells[] = __('Type')
101 . ($GLOBALS['cfg']['ReplaceHelpImg']
102 ?
PMA_showMySQLDocu('SQL-Syntax', 'data-types')
103 : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('SQL-Syntax', 'data-types')
105 $header_cells[] = __('Length/Values') . PMA_showHint($strSetEnumVal);
106 $header_cells[] = __('Default') . PMA_showHint(__('For default values, please enter just a single value, without backslash escaping or quotes, using this format: a'));
107 $header_cells[] = __('Collation');
108 $header_cells[] = __('Attributes');
109 $header_cells[] = __('Null');
111 // We could remove this 'if' and let the key information be shown and
112 // editable. However, for this to work, tbl_alter must be modified to use the
113 // key fields, as tbl_addfield does.
116 $header_cells[] = __('Index');
119 $header_cells[] = '<abbr title="AUTO_INCREMENT">' . ($display_type == 'horizontal' ?
'A_I' : 'AUTO_INCREMENT') . '</abbr>';
121 require_once './libraries/relation.lib.php';
122 require_once './libraries/transformations.lib.php';
123 $cfgRelation = PMA_getRelationsParam();
125 $comments_map = array();
127 $available_mime = array();
129 $comments_map = PMA_getComments($db, $table);
130 $header_cells[] = __('Comments');
132 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
133 $mime_map = PMA_getMIME($db, $table);
134 $available_mime = PMA_getAvailableMIMEtypes();
137 sprintf(__('For a list of available transformation options and their MIME type transformations, click on %stransformation descriptions%s'),
138 '<a href="transformation_overview.php?'
139 . PMA_generate_common_url($db, $table) . '" target="_blank">',
143 $header_cells[] = __('MIME type');
144 $header_cells[] = __('Browser transformation');
145 $header_cells[] = __('Transformation options')
146 . PMA_showHint(__('Transformation options')_note
. $hint);
149 // workaround for field_fulltext, because its submitted indizes contain
150 // the index as a value, not a key. Inserted here for easier maintaineance
151 // and less code to change in existing files.
152 if (isset($field_fulltext) && is_array($field_fulltext)) {
153 foreach ($field_fulltext as $fulltext_nr => $fulltext_indexkey) {
154 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
158 for ($i = 0; $i < $num_fields; $i++
) {
159 if (! empty($regenerate)) {
160 // An error happened with previous inputs, so we will restore the data
161 // to embed it once again in this form.
163 $row['Field'] = (isset($_REQUEST['field_name'][$i]) ?
$_REQUEST['field_name'][$i] : false);
164 $row['Type'] = (isset($_REQUEST['field_type'][$i]) ?
$_REQUEST['field_type'][$i] : false);
165 $row['Collation'] = (isset($_REQUEST['field_collation'][$i]) ?
$_REQUEST['field_collation'][$i] : '');
166 $row['Null'] = (isset($_REQUEST['field_null'][$i]) ?
$_REQUEST['field_null'][$i] : '');
168 if (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'primary_' . $i) {
170 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'index_' . $i) {
172 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'unique_' . $i) {
174 } elseif (isset($_REQUEST['field_key'][$i]) && $_REQUEST['field_key'][$i] == 'fulltext_' . $i) {
175 $row['Key'] = 'FULLTEXT';
180 // put None in the drop-down for Default, when someone adds a field
181 $row['DefaultType'] = (isset($_REQUEST['field_default_type'][$i]) ?
$_REQUEST['field_default_type'][$i] : 'NONE');
182 $row['DefaultValue'] = (isset($_REQUEST['field_default_value'][$i]) ?
$_REQUEST['field_default_value'][$i] : '');
184 switch ($row['DefaultType']) {
186 $row['Default'] = null;
188 case 'USER_DEFINED' :
189 $row['Default'] = $row['DefaultValue'];
192 case 'CURRENT_TIMESTAMP' :
193 $row['Default'] = $row['DefaultType'];
197 $row['Extra'] = (isset($_REQUEST['field_extra'][$i]) ?
$_REQUEST['field_extra'][$i] : false);
198 $row['Comment'] = (isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ?
'FULLTEXT' : false);
200 $submit_length = (isset($_REQUEST['field_length'][$i]) ?
$_REQUEST['field_length'][$i] : false);
201 $submit_attribute = (isset($_REQUEST['field_attribute'][$i]) ?
$_REQUEST['field_attribute'][$i] : false);
203 $submit_default_current_timestamp = (isset($_REQUEST['field_default_current_timestamp'][$i]) ?
true : false);
205 if (isset($_REQUEST['field_comments'][$i])) {
206 $comments_map[$row['Field']] = $_REQUEST['field_comments'][$i];
209 if (isset($_REQUEST['field_mimetype'][$i])) {
210 $mime_map[$row['Field']]['mimetype'] = $_REQUEST['field_mimetype'][$i];
213 if (isset($_REQUEST['field_transformation'][$i])) {
214 $mime_map[$row['Field']]['transformation'] = $_REQUEST['field_transformation'][$i];
217 if (isset($_REQUEST['field_transformation_options'][$i])) {
218 $mime_map[$row['Field']]['transformation_options'] = $_REQUEST['field_transformation_options'][$i];
221 } elseif (isset($fields_meta[$i])) {
222 $row = $fields_meta[$i];
223 switch ($row['Default']) {
225 if ($row['Null'] == 'YES') {
226 $row['DefaultType'] = 'NULL';
227 $row['DefaultValue'] = '';
228 // SHOW FULL FIELDS does not report the case when there is a DEFAULT value
229 // which is empty so we need to use the results of SHOW CREATE TABLE
230 } elseif (isset($row) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_value'])) {
231 $row['DefaultType'] = 'USER_DEFINED';
232 $row['DefaultValue'] = $row['Default'];
234 $row['DefaultType'] = 'NONE';
235 $row['DefaultValue'] = '';
238 case 'CURRENT_TIMESTAMP':
239 $row['DefaultType'] = 'CURRENT_TIMESTAMP';
240 $row['DefaultValue'] = '';
243 $row['DefaultType'] = 'USER_DEFINED';
244 $row['DefaultValue'] = $row['Default'];
249 if (isset($row['Type'])) {
250 $extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
251 if ($extracted_fieldspec['type'] == 'bit') {
252 $row['Default'] = PMA_convert_bit_default_value($row['Default']);
255 // Cell index: If certain fields get left out, the counter shouldn't change.
257 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
258 // has to be incremented ($ci_offset++)
263 if (! empty($true_selected[$i])) {
264 $_form_params['field_orig[' . $i . ']'] = $true_selected[$i];
265 } elseif (isset($row['Field'])) {
266 $_form_params['field_orig[' . $i . ']'] = $row['Field'];
268 $_form_params['field_orig[' . $i . ']'] = '';
273 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
274 . ' type="text" name="field_name[' . $i . ']"'
275 . ' maxlength="64" class="textfield" title="' . __('Field') . '"'
276 . ' size="' . ($GLOBALS['cfg']['DefaultPropDisplay'] == 'horizontal' ?
'10' : '30') . '"'
277 . ' value="' . (isset($row['Field']) ?
htmlspecialchars($row['Field']) : '') . '"'
282 $content_cells[$i][$ci] = '<select name="field_type[' . $i . ']"'
283 .' id="field_' . $i . '_' . ($ci - $ci_offset) . '" >';
285 if (empty($row['Type'])) {
290 $type = $row['Type'];
293 if (! empty($row['Type'])) {
294 $type = $extracted_fieldspec['type'];
295 if ('set' == $extracted_fieldspec['type'] ||
'enum' == $extracted_fieldspec['type']) {
296 $length = $extracted_fieldspec['spec_in_brackets'];
298 // strip the "BINARY" attribute, except if we find "BINARY(" because
299 // this would be a BINARY or VARBINARY field type
300 $type = preg_replace('@BINARY([^\(])@i', '', $type);
301 $type = preg_replace('@ZEROFILL@i', '', $type);
302 $type = preg_replace('@UNSIGNED@i', '', $type);
303 $length = $extracted_fieldspec['spec_in_brackets'];
310 // some types, for example longtext, are reported as
311 // "longtext character set latin7" when their charset and / or collation
312 // differs from the ones of the corresponding database.
313 $tmp = strpos($type, 'character set');
315 $type = substr($type, 0, $tmp - 1);
318 if (isset($submit_length) && $submit_length != false) {
319 $length = $submit_length;
322 // rtrim the type, for cases like "float unsigned"
323 $type = rtrim($type);
324 $type_upper = strtoupper($type);
326 foreach ($cfg['ColumnTypes'] as $col_goup => $column_type) {
327 if (is_array($column_type)) {
328 $content_cells[$i][$ci] .= '<optgroup label="' . htmlspecialchars($col_goup) . '">';
329 foreach ($column_type as $col_group_type) {
330 $content_cells[$i][$ci] .= '<option value="'. $col_group_type . '"';
331 if ($type_upper == strtoupper($col_group_type)) {
332 $content_cells[$i][$ci] .= ' selected="selected"';
334 $content_cells[$i][$ci] .= '>' . $col_group_type . '</option>';
336 $content_cells[$i][$ci] .= '</optgroup>';
340 $content_cells[$i][$ci] .= '<option value="'. $column_type . '"';
341 if ($type_upper == strtoupper($column_type)) {
342 $content_cells[$i][$ci] .= ' selected="selected"';
344 $content_cells[$i][$ci] .= '>' . $column_type . '</option>';
347 $content_cells[$i][$ci] .= ' </select>';
352 $_form_params['field_length_orig[' . $i . ']'] = $length;
356 if (isset($extracted_fieldspec) && ('set' == $extracted_fieldspec['type'] ||
'enum' == $extracted_fieldspec['type'])) {
362 $unsigned = stristr($row['Type'], 'unsigned');
363 $zerofill = stristr($row['Type'], 'zerofill');
365 $length_to_display = $length;
367 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
368 . ' type="text" name="field_length[' . $i . ']" size="' . $length_values_input_size . '"'
369 . ' value="' . htmlspecialchars($length_to_display) . '"'
370 . ' class="textfield" />';
375 * having NULL enabled does not implicit having Default with NULL
378 && !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
379 $row['Default'] = 'NULL';
383 // old column default
385 $_form_params['field_default_orig[' . $i . ']'] =
386 (isset($row['Default']) ?
$row['Default'] : '');
389 // here we put 'NONE' as the default value of drop-down; otherwise
390 // users would have problems if they forget to enter the default
391 // value (example, for an INT)
392 $default_options = array(
393 'NONE' => _pgettext('for default', 'None'),
394 'USER_DEFINED' => __('As defined:'),
396 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP',
399 // for a TIMESTAMP, do not show the string "CURRENT_TIMESTAMP" as a default value
400 if ($type_upper == 'TIMESTAMP'
401 && ! empty($default_current_timestamp)
402 && isset($row['Default'])) {
403 $row['Default'] = '';
406 if ($type_upper == 'BIT') {
407 $row['DefaultValue'] = PMA_convert_bit_default_value($row['DefaultValue']);
410 $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">';
411 foreach ($default_options as $key => $value) {
412 $content_cells[$i][$ci] .= '<option value="' . $key . '"';
413 // is only set when we go back to edit a field's structure
414 if (isset($row['DefaultType']) && $row['DefaultType'] == $key) {
415 $content_cells[$i][$ci] .= ' selected="selected"';
417 $content_cells[$i][$ci] .= ' >' . $value . '</option>';
419 $content_cells[$i][$ci] .= '</select>';
420 $content_cells[$i][$ci] .= '<br />';
421 $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
422 . ' type="text" name="field_default_value[' . $i . ']" size="12"'
423 . ' value="' . (isset($row['DefaultValue']) ?
htmlspecialchars($row['DefaultValue']) : '') . '"'
424 . ' class="textfield" />';
428 $tmp_collation = empty($row['Collation']) ?
null : $row['Collation'];
429 $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(
430 PMA_CSDROPDOWN_COLLATION
, 'field_collation[' . $i . ']',
431 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, false);
432 unset($tmp_collation);
436 $content_cells[$i][$ci] = '<select style="font-size: 70%;"'
437 . ' name="field_attribute[' . $i . ']"'
438 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
442 $attribute = 'BINARY';
445 $attribute = 'UNSIGNED';
448 $attribute = 'UNSIGNED ZEROFILL';
450 if (isset($row['Extra']) && $row['Extra'] == 'on update CURRENT_TIMESTAMP') {
451 $attribute = 'on update CURRENT_TIMESTAMP';
454 if (isset($submit_attribute) && $submit_attribute != false) {
455 $attribute = $submit_attribute;
458 // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
459 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
461 if (PMA_MYSQL_INT_VERSION
< 50025
462 && isset($row['Field'])
463 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type'])
464 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP'
465 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) {
469 // MySQL 4.1.2+ TIMESTAMP options
470 // (if on_update_current_timestamp is set, then it's TRUE)
471 if (isset($row['Field'])
472 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
473 $attribute = 'on update CURRENT_TIMESTAMP';
475 if ((isset($row['Field'])
476 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp']))
477 ||
(isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) {
478 $default_current_timestamp = true;
480 $default_current_timestamp = false;
483 $cnt_attribute_types = count($cfg['AttributeTypes']);
484 for ($j = 0; $j < $cnt_attribute_types; $j++
) {
485 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
486 if (strtoupper($attribute) == strtoupper($cfg['AttributeTypes'][$j])) {
487 $content_cells[$i][$ci] .= ' selected="selected"';
489 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>';
492 $content_cells[$i][$ci] .= '</select>';
496 $content_cells[$i][$ci] = '<input name="field_null[' . $i . ']"'
497 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
499 if (! empty($row['Null']) && $row['Null'] != 'NO' && $row['Null'] != 'NOT NULL') {
500 $content_cells[$i][$ci] .= ' checked="checked"';
503 $content_cells[$i][$ci] .= ' type="checkbox" value="NULL" />';
507 // See my other comment about removing this 'if'.
509 $content_cells[$i][$ci] = '<select name="field_key[' . $i . ']"'
510 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
511 $content_cells[$i][$ci] .= '<option value="none_' . $i . '">---</option>';
513 $content_cells[$i][$ci] .= '<option value="primary_' . $i . '" title="' . __('Primary') . '"';
514 if (isset($row['Key']) && $row['Key'] == 'PRI') {
515 $content_cells[$i][$ci] .= ' selected="selected"';
517 $content_cells[$i][$ci] .= '>PRIMARY</option>';
519 $content_cells[$i][$ci] .= '<option value="unique_' . $i . '" title="' . __('Unique') . '"';
520 if (isset($row['Key']) && $row['Key'] == 'UNI') {
521 $content_cells[$i][$ci] .= ' selected="selected"';
523 $content_cells[$i][$ci] .= '>UNIQUE</option>';
525 $content_cells[$i][$ci] .= '<option value="index_' . $i . '" title="' . __('Index') . '"';
526 if (isset($row['Key']) && $row['Key'] == 'MUL') {
527 $content_cells[$i][$ci] .= ' selected="selected"';
529 $content_cells[$i][$ci] .= '>INDEX</option>';
531 $content_cells[$i][$ci] .= '<option value="fulltext_' . $i . '" title="' . __('Fulltext') . '"';
532 if (isset($row['Key']) && $row['Key'] == 'FULLTEXT') {
533 $content_cells[$i][$ci] .= ' selected="selected"';
535 $content_cells[$i][$ci] .= '>FULLTEXT</option>';
537 $content_cells[$i][$ci] .= '</select>';
539 } // end if ($action ==...)
541 // column auto_increment
542 $content_cells[$i][$ci] = '<input name="field_extra[' . $i . ']"'
543 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
545 if (isset($row['Extra']) && strtolower($row['Extra']) == 'auto_increment') {
546 $content_cells[$i][$ci] .= ' checked="checked"';
549 $content_cells[$i][$ci] .= ' type="checkbox" value="AUTO_INCREMENT" />';
553 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
554 . ' type="text" name="field_comments[' . $i . ']" size="12"'
555 . ' value="' . (isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?
htmlspecialchars($comments_map[$row['Field']]) : '') . '"'
556 . ' class="textfield" />';
560 if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
561 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">';
562 $content_cells[$i][$ci] .= ' <option value=""> </option>';
564 if (is_array($available_mime['mimetype'])) {
565 foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) {
566 $checked = (isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ?
'selected ' : '');
567 $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
571 $content_cells[$i][$ci] .= '</select>';
574 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[' . $i . ']">';
575 $content_cells[$i][$ci] .= ' <option value="" title="' . __('None') . '"></option>';
576 if (is_array($available_mime['transformation'])) {
577 foreach ($available_mime['transformation'] AS $mimekey => $transform) {
578 $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 ' : '');
579 $tooltip = 'strTransformation_' . strtolower(str_replace('.inc.php', '', $available_mime['transformation_file'][$mimekey]));
580 $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 . '()');
581 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>';
585 $content_cells[$i][$ci] .= '</select>';
588 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
589 . ' type="text" name="field_transformation_options[' . $i . ']"'
590 . ' size="16" class="textfield"'
591 . ' value="' . (isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?
htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '"'
597 if ($cfg['CtrlArrowsMoving']) {
599 <script src
="./js/keyhandler.js" type
="text/javascript"></script
>
600 <script type
="text/javascript">
602 var switch_movement
= <?php
echo $display_type == 'horizontal' ?
'0' : '1'; ?
>;
603 document
.onkeydown
= onKeyDownArrowsHandler
;
610 <form method
="post" action
="<?php echo $action; ?>">
612 echo PMA_generate_common_hidden_inputs($_form_params);
613 unset($_form_params);
614 if ($action == 'tbl_create.php') {
618 <th
><?php
echo __('Table name'); ?
>: 
;</th
>
620 <tr
><td
><input type
="text" name
="table" size
="40" maxlength
="80"
621 value
="<?php echo (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : ''); ?>"
630 if (is_array($content_cells) && is_array($header_cells)) {
631 // last row is for javascript insert
632 //$empty_row = array_pop($content_cells);
634 echo '<table id="table_columns">';
635 if ($display_type == 'horizontal') {
638 <?php
foreach ($header_cells as $header_val) { ?
>
639 <th
><?php
echo $header_val; ?
></th
>
645 foreach ($content_cells as $content_row) {
646 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . ' noclick">';
647 $odd_row = ! $odd_row;
649 if (is_array($content_row)) {
650 foreach ($content_row as $content_row_val) {
652 <td align
="center"><?php
echo $content_row_val; ?
></td
>
661 foreach ($header_cells as $header_val) {
662 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . ' noclick">';
663 $odd_row = ! $odd_row;
665 <th
><?php
echo $header_val; ?
></th
>
667 foreach ($content_cells as $content_cell) {
668 if (isset($content_cell[$i]) && $content_cell[$i] != '') {
670 <td
><?php
echo $content_cell[$i]; ?
></td
>
685 * needs to be finished
688 if ($display_type == 'horizontal') {
690 foreach ($empty_row as $content_row_val) {
691 $new_field .= '<td align="center">' . $content_row_val . '</td>';
694 <script type="text/javascript">
696 var odd_row = <?php echo $odd_row; ?>;
698 function addField() {
699 var new_fields = document.getElementById('added_fields').value;
700 var new_field_container = document.getElementById('table_columns');
701 var new_field = '<?php echo preg_replace('|\s+|', ' ', preg_replace('|\'|', '\\\'', $new_field)); ?>';
703 for (i = 0; i < new_fields; i++) {
705 new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>';
707 new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>';
720 if ($action == 'tbl_create.php') {
724 <th
><?php
echo __('Table comments'); ?
>: 
;</th
>
725 <td width
="25"> 
;</td
>
726 <th
><?php
echo __('Storage Engine'); ?
>:
727 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
729 <td width
="25"> 
;</td
>
730 <th
><?php
echo __('Collation') ;?
>: 
;</th
>
732 <tr
><td
><input type
="text" name
="comment" size
="40" maxlength
="80"
733 value
="<?php echo (isset($_REQUEST['comment']) ? htmlspecialchars($_REQUEST['comment']) : ''); ?>"
736 <td width
="25"> 
;</td
>
739 echo PMA_StorageEngine
::getHtmlSelect('tbl_type', null,
740 (isset($_REQUEST['tbl_type']) ?
$_REQUEST['tbl_type'] : null));
743 <td width
="25"> 
;</td
>
746 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
, 'tbl_collation',
747 null, (isset($_REQUEST['tbl_collation']) ?
$_REQUEST['tbl_collation'] : null), false, 3);
752 if (PMA_Partition
::havePartitioning()) {
755 <th
><?php
echo __('PARTITION definition'); ?
>: 
;<?php
echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?
>
760 <textarea name
="partition_definition" id
="partitiondefinition"
761 cols
="<?php echo $GLOBALS['cfg']['TextareaCols'];?>"
762 rows
="<?php echo $GLOBALS['cfg']['TextareaRows'];?>"
763 dir
="<?php echo $GLOBALS['text_dir'];?>"><?php
echo (isset($_REQUEST['partition_definition']) ?
htmlspecialchars($_REQUEST['partition_definition']) : ''); ?
></textarea
>
772 } // end if ($action == 'tbl_create.php')
775 <fieldset
class="tblFooters">
776 <input type
="submit" name
="do_save_data" value
="<?php echo __('Save'); ?>"
777 onclick
="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" />
778 <?php
if ($action == 'tbl_create.php' ||
$action == 'tbl_addfield.php') { ?
>
779 <?php
echo $GLOBALS['strOr']; ?
>
780 <?php
echo sprintf(__('Add %s field(s)'), '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?
>
781 <input type
="submit" name
="submit_num_fields"
782 value
="<?php echo $GLOBALS['strGo']; ?>"
783 <?php
/* onclick="if (addField()) return false;" */ ?
>
784 onclick
="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)"
791 <center
><?php
echo PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE'); ?
></center
>