3 // vim: expandtab sw=4 ts=4 sts=4:
6 require_once('./libraries/common.lib.php');
7 PMA_checkParameters(array('db', 'table', 'action', 'num_fields'));
10 // Get available character sets and storage engines
11 require_once('./libraries/mysql_charsets.lib.php');
12 require_once('./libraries/storage_engines.lib.php');
14 if (is_int($cfg['DefaultPropDisplay'])) {
15 if ($num_fields <= $cfg['DefaultPropDisplay']) {
16 $display_type = 'vertical';
18 $display_type = 'horizontal';
21 $display_type = $cfg['DefaultPropDisplay'];
24 if ($cfg['CtrlArrowsMoving']) {
26 <script src
="./js/keyhandler.js" type
="text/javascript" language
="javascript"></script
>
27 <script type
="text/javascript" language
="javascript">
29 var switch_movement
= <?php
echo $display_type == 'horizontal' ?
'0' : '1'; ?
>;
30 document
.onkeydown
= onKeyDownArrowsHandler
;
35 // here, the div_x_7 represents a div id which contains
36 // the default CURRENT TIMESTAMP checkbox and label
37 // and, field_x_7a represents the checkbox itself
39 if (PMA_MYSQL_INT_VERSION
>= 40102) {
41 <script type
="text/javascript" language
="javascript">
43 function display_field_options(field_type
, i
) {
44 if (field_type
== 'TIMESTAMP') {
45 getElement('div_' + i +
'_7').style
.display
= 'block';
47 getElement('div_' + i +
'_7').style
.display
= 'none';
48 getElement('field_' + i +
'_7a').checked
= false;
56 <form method
="post" action
="<?php echo $action; ?>">
58 echo PMA_generate_common_hidden_inputs($db, $table);
59 if ($action == 'tbl_create.php') {
61 <input type
="hidden" name
="reload" value
="1" />
63 } elseif ($action == 'tbl_addfield.php') {
65 <input type
="hidden" name
="field_where" value
="<?php echo $field_where; ?>" />
66 <input type
="hidden" name
="after_field" value
="<?php echo $after_field; ?>" />
70 if (isset($num_fields)) {
72 <input type
="hidden" name
="orig_num_fields" value
="<?php echo $num_fields; ?>" />
76 if (isset($field_where)) {
78 <input type
="hidden" name
="orig_field_where" value
="<?php echo $field_where; ?>" />
82 if (isset($after_field)) {
84 <input type
="hidden" name
="orig_after_field" value
="<?php echo $after_field; ?>" />
88 if (isset($selected) && is_array($selected)) {
89 foreach ($selected AS $o_fld_nr => $o_fld_val) {
91 <input type
="hidden" name
="selected[<?php echo $o_fld_nr; ?>]" value
="<?php echo urlencode($o_fld_val); ?>" />
93 if (!isset($true_selected)) {
95 <input type
="hidden" name
="true_selected[<?php echo $o_fld_nr; ?>]" value
="<?php echo urlencode($o_fld_val); ?>" />
101 if (isset($true_selected) && is_array($true_selected)) {
102 foreach ($true_selected AS $o_fld_nr => $o_fld_val) {
104 <input type
="hidden" name
="true_selected[<?php echo $o_fld_nr; ?>]" value
="<?php echo urlencode($o_fld_val); ?>" />
109 } elseif (isset($field)) {
111 <input type
="hidden" name
="orig_field" value
="<?php echo urlencode($field); ?>" />
112 <input type
="hidden" name
="true_selected[] value="<?php
echo (isset($orig_field) ?
$orig_field : urlencode($field)); ?
>" />
116 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
118 $header_cells = array();
119 $content_cells = array();
121 $header_cells[] = $strField;
122 $header_cells[] = $strType . ($GLOBALS['cfg']['ReplaceHelpImg'] ? PMA_showMySQLDocu('SQL-Syntax', 'data-types') : '<br /><span style="font
-weight
: normal
">' . PMA_showMySQLDocu('SQL-Syntax', 'data-types') . '</span>');
123 $header_cells[] = $strLengthSet . '<sup>1</sup>';
124 if (PMA_MYSQL_INT_VERSION >= 40100) {
125 $header_cells[] = $strCollation;
127 $header_cells[] = $strAttr;
128 $header_cells[] = $strNull;
129 $header_cells[] = $strDefault . '<sup>2</sup>';
130 $header_cells[] = $strExtra;
134 // lem9: We could remove this 'if' and let the key information be shown and
135 // editable. However, for this to work, tbl_alter must be modified to use the
136 // key fields, as tbl_addfield does.
139 $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon
" src="' . $pmaThemeImage . 'b_primary
.png
" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary;
140 $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon
" src="' . $pmaThemeImage . 'b_index
.png
" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex;
141 $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon
" src="' . $pmaThemeImage . 'b_unique
.png
" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique;
142 $header_cells[] = '---';
143 $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon
" src="' . $pmaThemeImage . 'b_ftext
.png
" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext;
146 require_once('./libraries/relation.lib.php');
147 require_once('./libraries/transformations.lib.php');
148 $cfgRelation = PMA_getRelationsParam();
150 $comments_map = array();
152 $available_mime = array();
154 if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {
155 $comments_map = PMA_getComments($db, $table);
156 $header_cells[] = $strComments;
158 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
159 $mime_map = PMA_getMIME($db, $table);
160 $available_mime = PMA_getAvailableMIMEtypes();
162 $header_cells[] = $strMIME_MIMEtype;
163 $header_cells[] = $strMIME_transformation;
164 $header_cells[] = $strMIME_transformation_options . '<sup>3</sup>';
168 // garvin: workaround for field_fulltext, because its submitted indizes contain
169 // the index as a value, not a key. Inserted here for easier maintaineance
170 // and less code to change in existing files.
171 if (isset($field_fulltext) && is_array($field_fulltext)) {
172 foreach ($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
173 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
177 for ( $i = 0 ; $i <= $num_fields; $i++ ) {
178 $submit_null = FALSE;
179 if (isset($regenerate) && $regenerate == TRUE) {
180 // An error happened with previous inputs, so we will restore the data
181 // to embed it once again in this form.
183 $row['Field'] = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
184 $row['Type'] = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
185 if (PMA_MYSQL_INT_VERSION >= 40100) {
186 $row['Collation'] = (isset($field_collation) && isset($field_collation[$i]) ? $field_collation[$i] : '');
188 $row['Null'] = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
189 if (isset($field_type[$i]) && $row['Null'] == '') {
193 if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
195 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
197 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
203 $row['Default'] = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
204 $row['Extra'] = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
205 $row['Comment'] = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
207 $submit_length = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
208 $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
210 $submit_default_current_timestamp = (isset($field_default_current_timestamp) && isset($field_default_current_timestamp[$i]) ? TRUE : FALSE);
212 if (isset($field_comments) && isset($field_comments[$i])) {
213 $comments_map[$row['Field']] = $field_comments[$i];
216 if (isset($field_mimetype) && isset($field_mimetype[$i])) {
217 $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
220 if (isset($field_transformation) && isset($field_transformation[$i])) {
221 $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
224 if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
225 $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
228 } elseif (isset($fields_meta) && isset($fields_meta[$i])) {
229 $row = $fields_meta[$i];
232 // Cell index: If certain fields get left out, the counter shouldn't chage.
234 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
235 // has to be incremented ($ci_offset++)
239 $backup_field = (isset($true_selected) && isset($true_selected[$i]) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
240 $content_cells[$i][$ci] = "\n
" . '<input type="hidden
" name="field_orig
[]" value="' . $backup_field . '" />' . "\n
";
242 $content_cells[$i][$ci] = '';
245 $content_cells[$i][$ci] .= "\n
" . '<input id="field_
' . $i . '_
' . ($ci - $ci_offset) . '" type="text
" name="field_name
[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field
']) ? str_replace('"', '"', $row['Field']) : '') . '" class="textfield" title
="' . $strField . '" />';
247 $content_cells[$i][$ci] = '<select name
="field_type[]" id
="field_' . $i . '_' . ($ci - $ci_offset) . '" ';
248 if (PMA_MYSQL_INT_VERSION >= 40102) {
249 $content_cells[$i][$ci] .= 'onchange
="display_field_options(this.options[this.selectedIndex].value,' . $i .')" ';
251 $content_cells[$i][$ci] .= '>' . "\n";
253 if (empty($row['Type
'])) {
257 $type = $row['Type
'];
259 // set or enum types: slashes single quotes inside options
260 if (preg_match('@^
(set|enum
)\
((.+
)\
)$@i
', $type, $tmp)) {
262 $length = substr(preg_replace('@([^
,])\'\'@', '\\
1\\\'', ',' . $tmp[2]), 1);
264 // strip the "BINARY" attribute, except if we find "BINARY(" because
265 // this would be a BINARY or VARBINARY field type
266 $type = preg_replace('@BINARY
([^\
(])@i
', '', $type);
267 $type = preg_replace('@ZEROFILL@i
', '', $type);
268 $type = preg_replace('@UNSIGNED@i
', '', $type);
270 if (strpos($type, '(')) {
271 $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));
272 $type = chop(substr($type, 0, strpos($type, '(')));
278 // some types, for example longtext, are reported as
279 // "longtext character set latin7" when their charset and / or collation
280 // differs from the ones of the corresponding database.
281 if (PMA_MYSQL_INT_VERSION >= 40100) {
282 $tmp = strpos($type, 'character set
');
284 $type = substr($type, 0, $tmp-1);
288 if (isset($submit_length) && $submit_length != FALSE) {
289 $length = $submit_length;
292 // rtrim the type, for cases like "float unsigned"
293 $type = rtrim($type);
294 $type_upper = strtoupper($type);
296 $cnt_column_types = count($cfg['ColumnTypes
']);
297 for ($j = 0; $j < $cnt_column_types; $j++) {
298 $content_cells[$i][$ci] .= ' <option value
="'. $cfg['ColumnTypes'][$j] . '"';
299 if ($type_upper == strtoupper($cfg['ColumnTypes
'][$j])) {
300 $content_cells[$i][$ci] .= ' selected
="selected"';
302 $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes
'][$j] . '</option
>' . "\n";
305 $content_cells[$i][$ci] .= ' </select
>';
309 $content_cells[$i][$ci] = "\n" . '<input type
="hidden" name
="field_length_orig[]" value
="' . urlencode($length) . '" />';
311 $content_cells[$i][$ci] = '';
314 if (preg_match('@^
(set|enum
)$@i
', $type)) {
318 $length_to_display = htmlspecialchars($length);
320 $length_to_display = $length;
321 if (!preg_match('@BINARY
[\
(]@i
', $row['Type
']) && PMA_MYSQL_INT_VERSION < 40100) {
322 $binary = stristr($row['Type
'], 'binary
');
326 $unsigned = stristr($row['Type
'], 'unsigned
');
327 $zerofill = stristr($row['Type
'], 'zerofill
');
330 $content_cells[$i][$ci] .= "\n" . '<input id
="field_' . $i . '_' . ($ci - $ci_offset) . '" type
="text" name
="field_length[]" size
="8" value
="' . str_replace('"', '"
;', $length_to_display) . '" class="textfield
" />' . "\n
";
333 if (PMA_MYSQL_INT_VERSION >= 40100) {
334 $tmp_collation = empty($row['Collation']) ? null : $row['Collation'];
335 $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[]', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE);
336 unset($tmp_collation);
340 $content_cells[$i][$ci] = '<select style="font
-size
: 70%
;" name="field_attribute
[]" id="field_
' . $i . '_
' . ($ci - $ci_offset) . '">' . "\n
";
344 $attribute = 'BINARY';
347 $attribute = 'UNSIGNED';
350 $attribute = 'UNSIGNED ZEROFILL';
353 if (isset($submit_attribute) && $submit_attribute != FALSE) {
354 $attribute = $submit_attribute;
357 // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
358 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
360 if (isset($row['Field'])
361 && isset($analyzed_sql[0])
362 && isset($analyzed_sql[0]['create_table_fields'])
363 && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type'])
364 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP'
365 && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) {
369 // MySQL 4.1.2+ TIMESTAMP options
370 // (if on_update_current_timestamp is set, then it's TRUE)
371 if (isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
372 $attribute = 'ON UPDATE CURRENT_TIMESTAMP';
374 if ((isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp']))
375 || (isset($submit_default_current_timestamp) && $submit_default_current_timestamp) ) {
376 $default_current_timestamp = TRUE;
378 $default_current_timestamp = FALSE;
381 // Dynamically add ON UPDATE CURRENT_TIMESTAMP to the possible attributes
382 if (PMA_MYSQL_INT_VERSION >= 40102 && !in_array('ON UPDATE CURRENT_TIMESTAMP', $cfg['AttributeTypes'])) {
383 $cfg['AttributeTypes'][] = 'ON UPDATE CURRENT_TIMESTAMP';
387 $cnt_attribute_types = count($cfg['AttributeTypes']);
388 for ($j = 0;$j < $cnt_attribute_types; $j++) {
389 if (PMA_MYSQL_INT_VERSION >= 40100 && $cfg['AttributeTypes'][$j] == 'BINARY') {
392 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes
'][$j] . '"';
393 if (strtoupper($attribute) == strtoupper($cfg['AttributeTypes'][$j])) {
394 $content_cells[$i][$ci] .= ' selected="selected
"';
396 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n
";
399 $content_cells[$i][$ci] .= '</select>';
402 $content_cells[$i][$ci] = '<select name="field_null
[]" id="field_
' . $i . '_
' . ($ci - $ci_offset) . '">';
404 if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NO' || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
405 $content_cells[$i][$ci] .= "\n
";
406 $content_cells[$i][$ci] .= ' <option value="NOT
NULL" selected="selected
" >not null</option>' . "\n
";
407 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n
";
409 $content_cells[$i][$ci] .= "\n
";
410 $content_cells[$i][$ci] .= ' <option value="" selected="selected
" >null</option>' . "\n
";
411 $content_cells[$i][$ci] .= ' <option value="NOT
NULL">not null</option>' . "\n
";
414 $content_cells[$i][$ci] .= "\n
" . '</select>';
418 && !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') {
419 $row['Default'] = 'NULL';
423 $content_cells[$i][$ci] = "\n
" . '<input type="hidden
" name="field_default_orig
[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />';
425 $content_cells[$i][$ci] = "\n
";
428 // for a TIMESTAMP, do not show CURRENT_TIMESTAMP as a default value
429 if (PMA_MYSQL_INT_VERSION >= 40102
430 && $type_upper == 'TIMESTAMP'
431 && $default_current_timestamp
433 && isset($row['Default'])) {
434 $row['Default'] = '';
437 $content_cells[$i][$ci] .= '<input id="field_
' . $i . '_
' . ($ci - $ci_offset) . '" type="text
" name="field_default
[]" size="12" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '"', $row['Default']) : '') . '" class="textfield" />';
438 if (PMA_MYSQL_INT_VERSION >= 40102) {
439 if ($type_upper == 'TIMESTAMP
') {
440 $tmp_display_type = 'block
';
442 $tmp_display_type = 'none
';
443 $default_current_timestamp = FALSE;
445 $content_cells[$i][$ci] .= '<br
/><div id
="div_' . $i . '_' . ($ci - $ci_offset) . '" style
="white-space: nowrap; display: ' . $tmp_display_type . '"><input id
="field_' . $i . '_' . ($ci - $ci_offset) . 'a" type
="checkbox" name
="field_default_current_timestamp[' . $i . ']"';
446 if ($default_current_timestamp) {
447 $content_cells[$i][$ci] .= ' checked
="checked" ';
449 $content_cells[$i][$ci] .= ' /><label
for="field_' . $i . '_' . ($ci - $ci_offset) . 'a" style
="font-size: 70%;">CURRENT_TIMESTAMP
</label
></div
>';
453 $content_cells[$i][$ci] = '<select name
="field_extra[]" id
="field_' . $i . '_' . ($ci - $ci_offset) . '">';
455 if (!isset($row) || empty($row['Extra
'])) {
456 $content_cells[$i][$ci] .= "\n";
457 $content_cells[$i][$ci] .= '<option value
=""></option
>' . "\n";
458 $content_cells[$i][$ci] .= '<option value
="AUTO_INCREMENT">auto_increment
</option
>' . "\n";
460 $content_cells[$i][$ci] .= "\n";
461 $content_cells[$i][$ci] .= '<option value
="AUTO_INCREMENT">auto_increment
</option
>' . "\n";
462 $content_cells[$i][$ci] .= '<option value
=""></option
>' . "\n";
465 $content_cells[$i][$ci] .= "\n" . '</select
>';
469 // lem9: See my other comment about removing this 'if'.
471 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'PRI
') {
472 $checked_primary = ' checked
="checked"';
474 $checked_primary = '';
476 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'MUL
') {
477 $checked_index = ' checked
="checked"';
481 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'UNI
') {
482 $checked_unique = ' checked
="checked"';
484 $checked_unique = '';
486 if (empty($checked_primary)
487 && empty($checked_index)
488 && empty($checked_unique)) {
489 $checked_none = ' checked
="checked"';
494 if ((isset($row) && isset($row['Comment
']) && $row['Comment
'] == 'FULLTEXT
')) {
495 $checked_fulltext = ' checked
="checked"';
497 $checked_fulltext = '';
500 $content_cells[$i][$ci] = "\n" . '<input type
="radio" name
="field_key_' . $i . '" value
="primary_' . $i . '"' . $checked_primary . ' title
="' . $strPrimary . '" />';
503 $content_cells[$i][$ci] = "\n" . '<input type
="radio" name
="field_key_' . $i . '" value
="index_' . $i . '"' . $checked_index . ' title
="' . $strIndex . '" />';
506 $content_cells[$i][$ci] = "\n" . '<input type
="radio" name
="field_key_' . $i . '" value
="unique_' . $i . '"' . $checked_unique . ' title
="' . $strUnique . '" />';
509 $content_cells[$i][$ci] = "\n" . '<input type
="radio" name
="field_key_' . $i . '" value
="none_' . $i . '"' . $checked_none . ' title
="---" />';
512 $content_cells[$i][$ci] = '<input type
="checkbox" name
="field_fulltext[]" value
="' . $i . '"' . $checked_fulltext . ' title
="' . $strIdxFulltext . '" />';
514 } // end if ($action ==...)
517 if ($cfgRelation['commwork
'] || PMA_MYSQL_INT_VERSION >= 40100) {
518 $content_cells[$i][$ci] = '<input id
="field_' . $i . '_' . ($ci - $ci_offset) . '" type
="text" name
="field_comments[]" size
="12" value
="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ? htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />';
522 // garvin: MIME-types
523 if ($cfgRelation['mimework
'] && $cfg['BrowseMIME
'] && $cfgRelation['commwork
']) {
524 $content_cells[$i][$ci] = '<select id
="field_' . $i . '_' . ($ci - $ci_offset) . '" size
="1" name
="field_mimetype[]">' . "\n";
525 $content_cells[$i][$ci] .= ' <option value
=""></option
>' . "\n";
526 $content_cells[$i][$ci] .= ' <option value
="auto">auto
-detect
</option
>' . "\n";
528 if (is_array($available_mime['mimetype
'])) {
529 foreach ($available_mime['mimetype
'] AS $mimekey => $mimetype) {
530 $checked = (isset($row) && isset($row['Field
']) && isset($mime_map[$row['Field
']]['mimetype
']) && ($mime_map[$row['Field
']]['mimetype
'] == str_replace('/', '_
', $mimetype)) ? 'selected
' : '');
531 $content_cells[$i][$ci] .= ' <option value
="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option
>';
535 $content_cells[$i][$ci] .= '</select
>';
538 $content_cells[$i][$ci] = '<select id
="field_' . $i . '_' . ($ci - $ci_offset) . '" size
="1" name
="field_transformation[]">' . "\n";
539 $content_cells[$i][$ci] .= ' <option value
="" title
="' . $strNone . '"></option
>' . "\n";
540 if (is_array($available_mime['transformation
'])) {
541 foreach ($available_mime['transformation
'] AS $mimekey => $transform) {
542 $checked = (isset($row) && 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
' : '');
543 $tooltip = 'strTransformation_
' . strtolower(preg_replace('@(\
.inc\
.php3?
)$
@', '', $available_mime['transformation_file
'][$mimekey]));
544 $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br
/>', ' ', $strMIME_nodescription), 'PMA_transformation_
' . $tooltip . '()');
545 $content_cells[$i][$ci] .= '<option value
="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title
="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option
>' . "\n";
549 $content_cells[$i][$ci] .= '</select
>';
552 $content_cells[$i][$ci] = '<input id
="field_' . $i . '_' . ($ci - $ci_offset) . '" type
="text" name
="field_transformation_options[]" size
="16" value
="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ? htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />';
557 if ( is_array( $content_cells ) && is_array( $header_cells ) ) {
558 // last row is for javascript insert
559 $empty_row = array_pop( $content_cells );
561 echo '<table id
="table_columns">';
562 if ( $display_type == 'horizontal
' ) {
565 <?php foreach ( $header_cells as $header_val ) { ?>
566 <th><?php echo $header_val; ?></th>
572 foreach ( $content_cells as $content_row ) {
573 echo '<tr
class="' . ( $odd_row ? 'odd' : 'even' ) . ' noclick">';
574 $odd_row = ! $odd_row;
576 if ( is_array( $content_row ) ) {
577 foreach ($content_row as $content_row_val) {
579 <td align="center"><?php echo $content_row_val; ?></td>
588 foreach ( $header_cells as $header_val ) {
589 echo '<tr
class="' . ( $odd_row ? 'odd' : 'even' ) . ' noclick">';
590 $odd_row = ! $odd_row;
592 <th><?php echo $header_val; ?></th>
594 foreach ( $content_cells as $content_cell ) {
595 if ( isset( $content_cell[$i] ) && $content_cell[$i] != '' ) {
597 <td><?php echo $content_cell[$i]; ?></td>
612 * needs to be finished
615 if ( $display_type == 'horizontal
' ) {
617 foreach ( $empty_row as $content_row_val ) {
618 $new_field .= '<td align
="center">' . $content_row_val . '</td
>';
621 <script type="text/javascript" language="javascript">
623 var odd_row = <?php echo $odd_row; ?>;
625 function addField() {
626 var new_fields = document.getElementById('added_fields
').value;
627 var new_field_container = document.getElementById('table_columns
');
628 var new_field = '<?php
echo preg_replace( '�\s+�', ' ', preg_replace( '�\'�', '\\\'', $new_field ) ); ?
>';
630 for ( i = 0; i < new_fields; i++ ) {
632 new_field_container.innerHTML += '<tr
class="odd">' + new_field + '</tr
>';
634 new_field_container.innerHTML += '<tr
class="even">' + new_field + '</tr
>';
647 if ($action == 'tbl_create
.php
') {
651 <th><?php echo $strTableComments; ?>: </th>
652 <td width="25"> </td>
653 <th><?php echo $strStorageEngine; ?>: <?php echo PMA_showMySQLDocu('Storage_engines
', 'Storage_engines
'); ?>
656 if ( PMA_MYSQL_INT_VERSION >= 40100 ) {
657 echo ' <td width
="25"> 
;</td
>' . "\n"
658 . ' <th
>' . $strCollation . ': 
;</th
>' . "\n";
662 <tr><td><input type="text" name="comment" size="40" maxlength="80"
663 value="<?php echo (isset($comment) ? $comment : ''); ?>"
666 <td width="25"> </td>
668 <?php echo PMA_generateEnginesDropdown('tbl_type
', null, FALSE, (isset($GLOBALS['tbl_type
']) ? $GLOBALS['tbl_type
'] : null), 3); ?>
671 if ( PMA_MYSQL_INT_VERSION >= 40100 ) {
672 echo ' <td width
="25"> 
;</td
>' . "\n"
674 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation
', null, (isset($tbl_collation) ? $tbl_collation : null), FALSE, 3)
682 } // end if ($action == 'tbl_create
.php
')
685 <fieldset class="tblFooters">
686 <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" onclick="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" />
687 <?php if ($action == 'tbl_create
.php
' || $action == 'tbl_addfield
.php
') { ?>
688 <?php echo $GLOBALS['strOr
']; ?>
689 <?php echo sprintf( $strAddFields, '<input type
="text" id
="added_fields" name
="added_fields" size
="2" value
="1" onfocus
="this.select()" />' ); ?>
690 <input type="submit" name="submit_num_fields"
691 value="<?php echo $GLOBALS['strGo
']; ?>"
692 <?php /* onclick="if ( addField() ) return false;" */ ?>
693 onclick="return checkFormElementInRange(this.form, 'added_fields
', '<?php
echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?
>', 1)"
701 <p> <a name="footnoote_setenumval"><sup>1</sup></a> <?php echo $strSetEnumVal; ?></p>
702 <p> <a name="footnoote_defaultvalue"><sup>2</sup></a> <?php echo $strDefaultValueHelp; ?></p>
704 if ($cfgRelation['commwork
'] && $cfgRelation['mimework
'] && $cfg['BrowseMIME
']) {
705 echo '<p
> <a name
="footnoote_mime"><sup
>3</sup
></a
> ' . $strMIME_transformation_options_note . '</p
>';
707 printf( $strMIME_transformation_note,
708 '<a href
="transformation_overview.php?'
709 . PMA_generate_common_url($db, $table) . '" target
="_blank">',
716 <center><?php echo PMA_showMySQLDocu('SQL
-Syntax
', 'CREATE_TABLE
'); ?></center>