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 PMA_checkParameters(array('db', 'table', 'action', 'num_fields'));
20 // Get available character sets and storage engines
21 require_once './libraries/mysql_charsets.lib.php';
22 require_once './libraries/StorageEngine.class.php';
25 * Class for partition management
27 require_once './libraries/Partition.class.php';
29 if (is_int($cfg['DefaultPropDisplay'])) {
30 if ($num_fields <= $cfg['DefaultPropDisplay']) {
31 $display_type = 'vertical';
33 $display_type = 'horizontal';
36 $display_type = $cfg['DefaultPropDisplay'];
39 if ('horizontal' == $display_type) {
40 $length_values_input_size = 8;
42 $length_values_input_size = 30;
45 $_form_params = array(
49 if ($action == 'tbl_create.php') {
50 $_form_params['reload'] = 1;
51 $form_id = "create_table_form";
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;
56 $form_id = "add_field_form";
58 $_form_params['table'] = $table;
61 if (isset($num_fields)) {
62 $_form_params['orig_num_fields'] = $num_fields;
65 if (isset($_REQUEST['field_where'])) {
66 $_form_params['orig_field_where'] = $_REQUEST['field_where'];
69 if (isset($_REQUEST['after_field'])) {
70 $_form_params['orig_after_field'] = $_REQUEST['after_field'];
73 if (isset($selected) && is_array($selected)) {
74 foreach ($selected as $o_fld_nr => $o_fld_val) {
75 $_form_params['selected[' . $o_fld_nr . ']'] = $o_fld_val;
76 if (! isset($true_selected)) {
77 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
81 if (isset($true_selected) && is_array($true_selected)) {
82 foreach ($true_selected as $o_fld_nr => $o_fld_val) {
83 $_form_params['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
86 } elseif (isset($_REQUEST['field'])) {
87 $_form_params['orig_field'] = $_REQUEST['field'];
88 if (isset($orig_field)) {
89 $_form_params['true_selected[]'] = $orig_field;
91 $_form_params['true_selected[]'] = $_REQUEST['field'];
95 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
97 $header_cells = array();
98 $content_cells = array();
100 $header_cells[] = __('Column');
101 $header_cells[] = __('Type')
102 . ($GLOBALS['cfg']['ReplaceHelpImg']
103 ?
PMA_showMySQLDocu('SQL-Syntax', 'data-types')
104 : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('SQL-Syntax', 'data-types')
106 $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\').'));
107 $header_cells[] = __('Default') . PMA_showHint(__('For default values, please enter just a single value, without backslash escaping or quotes, using this format: a'));
108 $header_cells[] = __('Collation');
109 $header_cells[] = __('Attributes');
110 $header_cells[] = __('Null');
112 // We could remove this 'if' and let the key information be shown and
113 // editable. However, for this to work, tbl_alter must be modified to use the
114 // key fields, as tbl_addfield does.
117 $header_cells[] = __('Index');
120 $header_cells[] = '<abbr title="AUTO_INCREMENT">' . ($display_type == 'horizontal' ?
'A_I' : 'AUTO_INCREMENT') . '</abbr>';
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(__('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);
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="' . __('Column') . '"'
276 . ' size="' . ($GLOBALS['cfg']['DefaultPropDisplay'] == 'horizontal' ?
'10' : '30') . '"'
277 . ' value="' . (isset($row['Field']) ?
htmlspecialchars($row['Field']) : '') . '"'
282 $select_id = 'field_' . $i . '_' . ($ci - $ci_offset);
283 $content_cells[$i][$ci] = '<select class="column_type" name="field_type[' . $i . ']"'
284 .' id="' . $select_id . '">';
286 if (empty($row['Type'])) {
291 $type = $row['Type'];
294 if (! empty($row['Type'])) {
295 $type = $extracted_fieldspec['type'];
296 if ('set' == $extracted_fieldspec['type'] ||
'enum' == $extracted_fieldspec['type']) {
297 $length = $extracted_fieldspec['spec_in_brackets'];
299 // strip the "BINARY" attribute, except if we find "BINARY(" because
300 // this would be a BINARY or VARBINARY field type
301 $type = preg_replace('@BINARY([^\(])@i', '', $type);
302 $type = preg_replace('@ZEROFILL@i', '', $type);
303 $type = preg_replace('@UNSIGNED@i', '', $type);
304 $length = $extracted_fieldspec['spec_in_brackets'];
311 // some types, for example longtext, are reported as
312 // "longtext character set latin7" when their charset and / or collation
313 // differs from the ones of the corresponding database.
314 $tmp = strpos($type, 'character set');
316 $type = substr($type, 0, $tmp - 1);
319 if (isset($submit_length) && $submit_length != false) {
320 $length = $submit_length;
323 // rtrim the type, for cases like "float unsigned"
324 $type = rtrim($type);
325 $type_upper = strtoupper($type);
327 foreach ($cfg['ColumnTypes'] as $col_goup => $column_type) {
328 if (is_array($column_type)) {
329 $content_cells[$i][$ci] .= '<optgroup label="' . htmlspecialchars($col_goup) . '">';
330 foreach ($column_type as $col_group_type) {
331 $content_cells[$i][$ci] .= '<option value="'. $col_group_type . '"';
332 if ($type_upper == strtoupper($col_group_type)) {
333 $content_cells[$i][$ci] .= ' selected="selected"';
335 $content_cells[$i][$ci] .= '>' . $col_group_type . '</option>';
337 $content_cells[$i][$ci] .= '</optgroup>';
341 $content_cells[$i][$ci] .= '<option value="'. $column_type . '"';
342 if ($type_upper == strtoupper($column_type)) {
343 $content_cells[$i][$ci] .= ' selected="selected"';
345 $content_cells[$i][$ci] .= '>' . $column_type . '</option>';
348 $content_cells[$i][$ci] .= ' </select>';
353 $_form_params['field_length_orig[' . $i . ']'] = $length;
357 if (isset($extracted_fieldspec) && ('set' == $extracted_fieldspec['type'] ||
'enum' == $extracted_fieldspec['type'])) {
363 $unsigned = stristr($row['Type'], 'unsigned');
364 $zerofill = stristr($row['Type'], 'zerofill');
366 $length_to_display = $length;
368 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
369 . ' type="text" name="field_length[' . $i . ']" size="' . $length_values_input_size . '"'
370 . ' value="' . htmlspecialchars($length_to_display) . '"'
371 . ' class="textfield" />'
372 . '<p class="enum_notice" id="enum_notice_' . $i . '_' . ($ci - $ci_offset) . '">';
373 $content_cells[$i][$ci] .= __('ENUM or SET data too long?')
374 . '<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"> '
375 . __('Get more editing space') . '</a></p>';
380 * having NULL enabled does not implicit having Default with NULL
383 && !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
384 $row['Default'] = 'NULL';
388 // old column default
390 $_form_params['field_default_orig[' . $i . ']'] =
391 (isset($row['Default']) ?
$row['Default'] : '');
394 // here we put 'NONE' as the default value of drop-down; otherwise
395 // users would have problems if they forget to enter the default
396 // value (example, for an INT)
397 $default_options = array(
398 'NONE' => _pgettext('for default', 'None'),
399 'USER_DEFINED' => __('As defined:'),
401 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP',
404 // for a TIMESTAMP, do not show the string "CURRENT_TIMESTAMP" as a default value
405 if ($type_upper == 'TIMESTAMP'
406 && ! empty($default_current_timestamp)
407 && isset($row['Default'])) {
408 $row['Default'] = '';
411 if ($type_upper == 'BIT') {
412 $row['DefaultValue'] = PMA_convert_bit_default_value($row['DefaultValue']);
415 $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">';
416 foreach ($default_options as $key => $value) {
417 $content_cells[$i][$ci] .= '<option value="' . $key . '"';
418 // is only set when we go back to edit a field's structure
419 if (isset($row['DefaultType']) && $row['DefaultType'] == $key) {
420 $content_cells[$i][$ci] .= ' selected="selected"';
422 $content_cells[$i][$ci] .= ' >' . $value . '</option>';
424 $content_cells[$i][$ci] .= '</select>';
425 $content_cells[$i][$ci] .= '<br />';
426 $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
427 . ' type="text" name="field_default_value[' . $i . ']" size="12"'
428 . ' value="' . (isset($row['DefaultValue']) ?
htmlspecialchars($row['DefaultValue']) : '') . '"'
429 . ' class="textfield" />';
433 $tmp_collation = empty($row['Collation']) ?
null : $row['Collation'];
434 $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(
435 PMA_CSDROPDOWN_COLLATION
, 'field_collation[' . $i . ']',
436 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, false);
437 unset($tmp_collation);
441 $content_cells[$i][$ci] = '<select style="font-size: 70%;"'
442 . ' name="field_attribute[' . $i . ']"'
443 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
447 $attribute = 'BINARY';
450 $attribute = 'UNSIGNED';
453 $attribute = 'UNSIGNED ZEROFILL';
455 if (isset($row['Extra']) && $row['Extra'] == 'on update CURRENT_TIMESTAMP') {
456 $attribute = 'on update CURRENT_TIMESTAMP';
459 if (isset($submit_attribute) && $submit_attribute != false) {
460 $attribute = $submit_attribute;
463 // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
464 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
466 if (PMA_MYSQL_INT_VERSION
< 50025
467 && isset($row['Field'])
468 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type'])
469 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP'
470 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) {
474 // MySQL 4.1.2+ TIMESTAMP options
475 // (if on_update_current_timestamp is set, then it's TRUE)
476 if (isset($row['Field'])
477 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
478 $attribute = 'on update CURRENT_TIMESTAMP';
480 if ((isset($row['Field'])
481 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp']))
482 ||
(isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) {
483 $default_current_timestamp = true;
485 $default_current_timestamp = false;
488 $cnt_attribute_types = count($cfg['AttributeTypes']);
489 for ($j = 0; $j < $cnt_attribute_types; $j++
) {
490 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
491 if (strtoupper($attribute) == strtoupper($cfg['AttributeTypes'][$j])) {
492 $content_cells[$i][$ci] .= ' selected="selected"';
494 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>';
497 $content_cells[$i][$ci] .= '</select>';
501 $content_cells[$i][$ci] = '<input name="field_null[' . $i . ']"'
502 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
504 if (! empty($row['Null']) && $row['Null'] != 'NO' && $row['Null'] != 'NOT NULL') {
505 $content_cells[$i][$ci] .= ' checked="checked"';
508 $content_cells[$i][$ci] .= ' type="checkbox" value="NULL" />';
512 // See my other comment about removing this 'if'.
514 $content_cells[$i][$ci] = '<select name="field_key[' . $i . ']"'
515 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
516 $content_cells[$i][$ci] .= '<option value="none_' . $i . '">---</option>';
518 $content_cells[$i][$ci] .= '<option value="primary_' . $i . '" title="' . __('Primary') . '"';
519 if (isset($row['Key']) && $row['Key'] == 'PRI') {
520 $content_cells[$i][$ci] .= ' selected="selected"';
522 $content_cells[$i][$ci] .= '>PRIMARY</option>';
524 $content_cells[$i][$ci] .= '<option value="unique_' . $i . '" title="' . __('Unique') . '"';
525 if (isset($row['Key']) && $row['Key'] == 'UNI') {
526 $content_cells[$i][$ci] .= ' selected="selected"';
528 $content_cells[$i][$ci] .= '>UNIQUE</option>';
530 $content_cells[$i][$ci] .= '<option value="index_' . $i . '" title="' . __('Index') . '"';
531 if (isset($row['Key']) && $row['Key'] == 'MUL') {
532 $content_cells[$i][$ci] .= ' selected="selected"';
534 $content_cells[$i][$ci] .= '>INDEX</option>';
536 $content_cells[$i][$ci] .= '<option value="fulltext_' . $i . '" title="' . __('Fulltext') . '"';
537 if (isset($row['Key']) && $row['Key'] == 'FULLTEXT') {
538 $content_cells[$i][$ci] .= ' selected="selected"';
540 $content_cells[$i][$ci] .= '>FULLTEXT</option>';
542 $content_cells[$i][$ci] .= '</select>';
544 } // end if ($action ==...)
546 // column auto_increment
547 $content_cells[$i][$ci] = '<input name="field_extra[' . $i . ']"'
548 . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"';
550 if (isset($row['Extra']) && strtolower($row['Extra']) == 'auto_increment') {
551 $content_cells[$i][$ci] .= ' checked="checked"';
554 $content_cells[$i][$ci] .= ' type="checkbox" value="AUTO_INCREMENT" />';
558 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
559 . ' type="text" name="field_comments[' . $i . ']" size="12"'
560 . ' value="' . (isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ?
htmlspecialchars($comments_map[$row['Field']]) : '') . '"'
561 . ' class="textfield" />';
565 if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
566 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">';
567 $content_cells[$i][$ci] .= ' <option value=""> </option>';
569 if (is_array($available_mime['mimetype'])) {
570 foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) {
571 $checked = (isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ?
'selected ' : '');
572 $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
576 $content_cells[$i][$ci] .= '</select>';
579 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[' . $i . ']">';
580 $content_cells[$i][$ci] .= ' <option value="" title="' . __('None') . '"></option>';
581 if (is_array($available_mime['transformation'])) {
582 foreach ($available_mime['transformation'] AS $mimekey => $transform) {
583 $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 ' : '');
584 $tooltip = 'strTransformation_' . strtolower(str_replace('.inc.php', '', $available_mime['transformation_file'][$mimekey]));
585 $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 . '()');
586 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>';
590 $content_cells[$i][$ci] .= '</select>';
593 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
594 . ' type="text" name="field_transformation_options[' . $i . ']"'
595 . ' size="16" class="textfield"'
596 . ' value="' . (isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ?
htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '"'
602 if ($cfg['CtrlArrowsMoving']) {
604 <script src
="./js/keyhandler.js" type
="text/javascript"></script
>
605 <script type
="text/javascript">
607 var switch_movement
= <?php
echo $display_type == 'horizontal' ?
'0' : '1'; ?
>;
608 document
.onkeydown
= onKeyDownArrowsHandler
;
615 <form id
=<?php
echo $form_id; ?
> method
="post" action
="<?php echo $action; ?>">
617 echo PMA_generate_common_hidden_inputs($_form_params);
618 unset($_form_params);
619 if ($action == 'tbl_create.php') {
623 <th
><?php
echo __('Table name'); ?
>: 
;</th
>
625 <tr
><td
><input type
="text" name
="table" size
="40" maxlength
="80"
626 value
="<?php echo (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : ''); ?>"
635 if (is_array($content_cells) && is_array($header_cells)) {
636 // last row is for javascript insert
637 //$empty_row = array_pop($content_cells);
639 echo '<table id="table_columns">';
640 if ($display_type == 'horizontal') {
643 <?php
foreach ($header_cells as $header_val) { ?
>
644 <th
><?php
echo $header_val; ?
></th
>
650 foreach ($content_cells as $content_row) {
651 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . ' noclick">';
652 $odd_row = ! $odd_row;
654 if (is_array($content_row)) {
655 foreach ($content_row as $content_row_val) {
657 <td align
="center"><?php
echo $content_row_val; ?
></td
>
666 foreach ($header_cells as $header_val) {
667 echo '<tr class="' . ($odd_row ?
'odd' : 'even') . ' noclick">';
668 $odd_row = ! $odd_row;
670 <th
><?php
echo $header_val; ?
></th
>
672 foreach ($content_cells as $content_cell) {
673 if (isset($content_cell[$i]) && $content_cell[$i] != '') {
675 <td
><?php
echo $content_cell[$i]; ?
></td
>
690 * needs to be finished
693 if ($display_type == 'horizontal') {
695 foreach ($empty_row as $content_row_val) {
696 $new_field .= '<td align="center">' . $content_row_val . '</td>';
699 <script type="text/javascript">
701 var odd_row = <?php echo $odd_row; ?>;
703 function addField() {
704 var new_fields = document.getElementById('added_fields').value;
705 var new_field_container = document.getElementById('table_columns');
706 var new_field = '<?php echo preg_replace('|\s+|', ' ', preg_replace('|\'|', '\\\'', $new_field)); ?>';
708 for (i = 0; i < new_fields; i++) {
710 new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>';
712 new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>';
725 if ($action == 'tbl_create.php') {
729 <th
><?php
echo __('Table comments'); ?
>: 
;</th
>
730 <td width
="25"> 
;</td
>
731 <th
><?php
echo __('Storage Engine'); ?
>:
732 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
734 <td width
="25"> 
;</td
>
735 <th
><?php
echo __('Collation') ;?
>: 
;</th
>
737 <tr
><td
><input type
="text" name
="comment" size
="40" maxlength
="80"
738 value
="<?php echo (isset($_REQUEST['comment']) ? htmlspecialchars($_REQUEST['comment']) : ''); ?>"
741 <td width
="25"> 
;</td
>
744 echo PMA_StorageEngine
::getHtmlSelect('tbl_type', null,
745 (isset($_REQUEST['tbl_type']) ?
$_REQUEST['tbl_type'] : null));
748 <td width
="25"> 
;</td
>
751 echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
, 'tbl_collation',
752 null, (isset($_REQUEST['tbl_collation']) ?
$_REQUEST['tbl_collation'] : null), false, 3);
757 if (PMA_Partition
::havePartitioning()) {
760 <th
><?php
echo __('PARTITION definition'); ?
>: 
;<?php
echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?
>
765 <textarea name
="partition_definition" id
="partitiondefinition"
766 cols
="<?php echo $GLOBALS['cfg']['TextareaCols'];?>"
767 rows
="<?php echo $GLOBALS['cfg']['TextareaRows'];?>"
768 dir
="<?php echo $GLOBALS['text_dir'];?>"><?php
echo (isset($_REQUEST['partition_definition']) ?
htmlspecialchars($_REQUEST['partition_definition']) : ''); ?
></textarea
>
777 } // end if ($action == 'tbl_create.php')
780 <fieldset
class="tblFooters">
781 <input type
="submit" name
="do_save_data" value
="<?php echo __('Save'); ?>"
782 onclick
="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" />
783 <?php
if ($action == 'tbl_create.php' ||
$action == 'tbl_addfield.php') { ?
>
784 <?php
echo __('Or'); ?
>
785 <?php
echo sprintf(__('Add %s column(s)'), '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?
>
786 <input type
="submit" name
="submit_num_fields"
787 value
="<?php echo __('Go'); ?>"
788 <?php
/* onclick="if (addField()) return false;" */ ?
>
789 onclick
="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)"
796 <center
><?php
echo PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE'); ?
></center
>
798 <div id
="enum_editor">
799 <a
class="close_enum_editor">Close
</a
>
800 <h3
><?php
printf(__('Values for the column "%s"'), isset($row['Field']) ?
htmlspecialchars($row['Field']) : ""); ?
></h3
>
801 <p
><?php
echo __('Enter each value in a separate field.'); ?
></p
>
802 <div id
="values"></div
>
803 <p
><a
class="add_value">+ Add a
new value
</a
></p
>
804 <input type
="submit" value
="Go" /> <a
class="cancel_enum_editor">Cancel
</a
>
807 <div id
="popup_background"></div
>