82
89
$content_cells = array();
84
91
$header_cells[] = $strField;
85
$header_cells[] = $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>';
92
$header_cells[] = $strType . ($GLOBALS['cfg']['ReplaceHelpImg'] ? PMA_showMySQLDocu('Reference', 'Column_types') : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>');
86
93
$header_cells[] = $strLengthSet;
87
94
if (PMA_MYSQL_INT_VERSION >= 40100) {
88
$header_cells[] = $strCharset;
95
$header_cells[] = $strCollation;
90
97
$header_cells[] = $strAttr;
91
98
$header_cells[] = $strNull;
92
99
$header_cells[] = $strDefault . '**';
93
100
$header_cells[] = $strExtra;
104
// lem9: We could remove this 'if' and let the key information be shown and
105
// editable. However, for this to work, tbl_alter must be modified to use the
106
// key fields, as tbl_addfield does.
109
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_primary.png" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary;
110
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_index.png" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex;
111
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_unique.png" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique;
112
$header_cells[] = '---';
113
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_ftext.png" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext;
95
117
require_once('./libraries/relation.lib.php');
96
118
require_once('./libraries/transformations.lib.php');
97
119
$cfgRelation = PMA_getRelationsParam();
118
// lem9: We could remove this 'if' and let the key information be shown and
119
// editable. However, for this to work, tbl_alter must be modified to use the
120
// key fields, as tbl_addfield does.
123
$header_cells[] = $strPrimary;
124
$header_cells[] = $strIndex;
125
$header_cells[] = $strUnique;
126
$header_cells[] = '---';
127
$header_cells[] = $strIdxFulltext;
130
139
// garvin: workaround for field_fulltext, because its submitted indizes contain
131
140
// the index as a value, not a key. Inserted here for easier maintaineance
132
141
// and less code to change in existing files.
133
142
if (isset($field_fulltext) && is_array($field_fulltext)) {
134
foreach($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
143
foreach ($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
135
144
$submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
201
210
$content_cells[$i][$ci] = '';
204
$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" />';
213
$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 . '" />';
206
215
$content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
218
227
$length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
220
$type = preg_replace('@BINARY@i', '', $type);
229
// strip the "BINARY" attribute, except if we find "BINARY(" because
230
// this would be a BINARY or VARBINARY field type
231
$type = preg_replace('@BINARY([^\(])@i', '', $type);
221
232
$type = preg_replace('@ZEROFILL@i', '', $type);
222
233
$type = preg_replace('@UNSIGNED@i', '', $type);
271
$binary = stristr($row['Type'], 'binary');
283
if (!preg_match('@BINARY[\(]@i', $row['Type']) && PMA_MYSQL_INT_VERSION < 40100) {
284
$binary = stristr($row['Type'], 'binary');
272
288
$unsigned = stristr($row['Type'], 'unsigned');
273
289
$zerofill = stristr($row['Type'], 'zerofill');
276
292
if (PMA_MYSQL_INT_VERSION >= 40100) {
277
$content_cells[$i][$ci] = '<select name="field_charset[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n"
278
. ' <option value=""></option>' . "\n";
279
if (!empty($row['Collation']) && (
280
strtolower(substr($type, 0, 4)) == 'char'
281
|| strtolower(substr($type, 0, 7)) == 'varchar'
282
|| strtolower(substr($type, 0, 4)) == 'text'
283
|| strtolower(substr($type, 0, 8)) == 'tinytext'
284
|| strtolower(substr($type, 0, 10)) == 'mediumtext'
285
|| strtolower(substr($type, 0, 8)) == 'longtext'
286
|| strtolower(substr($type, 0, 3)) == 'set'
287
|| strtolower(substr($type, 0, 4)) == 'enum'
289
$real_charset = strpos($row['Collation'], '_') ? substr($row['Collation'], 0, strpos($row['Collation'], '_')) : $row['Collation'];
293
for ($j = 0; isset($mysql_charsets[$j]); $j++) {
294
$content_cells[$i][$ci] .= ' <option value="' . $mysql_charsets[$j] . '"' . ($mysql_charsets[$j] == $real_charset ? ' selected="selected"' : '') . '>' . $mysql_charsets[$j] . '</option>' . "\n";
297
unset($real_charset);
298
$content_cells[$i][$ci] .= '</select>' . "\n";
293
$tmp_collation = empty($row['Collation']) ? NULL : $row['Collation'];
294
$content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[]', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE);
295
unset($tmp_collation);
354
354
$content_cells[$i][$ci] = "\n";
357
$content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="8" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '"', $row['Default']) : '') . '" class="textfield" />';
357
$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" />';
360
360
$content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
362
if(!isset($row) || empty($row['Extra'])) {
362
if (!isset($row) || empty($row['Extra'])) {
363
363
$content_cells[$i][$ci] .= "\n";
364
364
$content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
365
365
$content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
372
372
$content_cells[$i][$ci] .= "\n" . '</select>';
376
if ($cfgRelation['commwork']) {
377
$content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_comments[]" size="8" value="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ? htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />';
381
// garvin: MIME-types
382
if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
383
$content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
384
$content_cells[$i][$ci] .= ' <option value=""></option>' . "\n";
385
$content_cells[$i][$ci] .= ' <option value="auto">auto-detect</option>' . "\n";
387
if (is_array($available_mime['mimetype'])) {
388
foreach($available_mime['mimetype'] AS $mimekey => $mimetype) {
389
$checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
390
$content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
394
$content_cells[$i][$ci] .= '</select>';
397
$content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
398
$content_cells[$i][$ci] .= ' <option value="" title="' . $strNone . '"></option>' . "\n";
399
if (is_array($available_mime['transformation'])) {
400
foreach($available_mime['transformation'] AS $mimekey => $transform) {
401
$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 ' : '');
402
$tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey]));
403
$tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
404
$content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n";
408
$content_cells[$i][$ci] .= '</select>';
411
$content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_transformation_options[]" size="8" value="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ? htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />';
415
376
// lem9: See my other comment about removing this 'if'.
416
377
if (!$is_backup) {
443
404
$checked_fulltext = '';
446
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' />';
449
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' . $checked_index . ' />';
452
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' . $checked_unique . ' />';
455
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' . $checked_none . ' />';
458
$content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' />';
407
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' title="' . $strPrimary . '" />';
410
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' . $checked_index . ' title="' . $strIndex . '" />';
413
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' . $checked_unique . ' title="' . $strUnique . '" />';
416
$content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' . $checked_none . ' title="---" />';
419
$content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' title="' . $strIdxFulltext . '" />';
459
421
} // end if ($action ==...)
424
if ($cfgRelation['commwork']) {
425
$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" />';
429
// garvin: MIME-types
430
if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
431
$content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
432
$content_cells[$i][$ci] .= ' <option value=""></option>' . "\n";
433
$content_cells[$i][$ci] .= ' <option value="auto">auto-detect</option>' . "\n";
435
if (is_array($available_mime['mimetype'])) {
436
foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) {
437
$checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
438
$content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
442
$content_cells[$i][$ci] .= '</select>';
445
$content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
446
$content_cells[$i][$ci] .= ' <option value="" title="' . $strNone . '"></option>' . "\n";
447
if (is_array($available_mime['transformation'])) {
448
foreach ($available_mime['transformation'] AS $mimekey => $transform) {
449
$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 ' : '');
450
$tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey]));
451
$tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
452
$content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n";
456
$content_cells[$i][$ci] .= '</select>';
459
$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" />';
462
464
if ($cfg['DefaultPropDisplay'] == 'horizontal') {
464
<table border="<?php echo $cfg['Border']; ?>">
466
<table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
467
469
if (is_array($header_cells)) {
468
foreach($header_cells AS $header_nr => $header_val) {
470
foreach ($header_cells AS $header_nr => $header_val) {
470
<th><?php echo $header_val; ?></th>
472
<th class="tblHeaders"><?php echo $header_val; ?></th>
477
479
if (is_array($content_cells)) {
479
foreach($content_cells AS $content_nr => $content_row) {
481
foreach ($content_cells AS $content_nr => $content_row) {
481
483
echo "\n" . '<tr>' . "\n";
483
485
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
485
487
if (is_array($content_row)) {
486
foreach($content_row AS $content_row_nr => $content_row_val) {
488
foreach ($content_row AS $content_row_nr => $content_row_val) {
488
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_row_val; ?></td>
490
<td bgcolor="<?php echo $bgcolor; ?>" align="center"><?php echo $content_row_val; ?></td>
535
537
<tr valign="top">
536
<td><?php echo $strTableComments; ?> :</td>
538
<td><?php echo $strTableComments; ?>: </td>
538
540
if ($action == 'tbl_create.php') {
541
543
<td width="25"> </td>
542
<td><?php echo $strTableType; ?> :</td>
544
<td><?php echo $strTableType; ?>: </td>
544
546
if (PMA_MYSQL_INT_VERSION >= 40100) {
545
547
echo ' <td width="25"> </td>' . "\n"
546
. ' <td>' . $strCharset . ' :</td>' . "\n";
548
. ' <td>' . $strCollation . ': </td>' . "\n";
558
560
// change by staybyte - 11 June 2001
559
561
if ($action == 'tbl_create.php') {
560
562
// find mysql capability - staybyte - 11. June 2001
561
$query = 'SHOW VARIABLES LIKE \'have_%\'';
562
$result = PMA_mysql_query($query);
563
if ($result != FALSE && mysql_num_rows($result) > 0) {
564
while ($tmp = PMA_mysql_fetch_array($result)) {
563
$result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'have_%\';');
565
while ($tmp = PMA_DBI_fetch_assoc($result)) {
565
566
if (isset($tmp['Variable_name'])) {
566
567
switch ($tmp['Variable_name']) {
609
610
if (PMA_MYSQL_INT_VERSION >= 40100) {
610
611
echo ' <td width="25"> </td>' . "\n"
612
. ' <select name="tbl_charset">' . "\n";
613
for ($i = 0; isset($mysql_charsets[$i]); $i++) {
614
echo ' <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == 'latin1' ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
617
echo ' </select>' . "\n"
613
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, NULL, FALSE, 3)
618
614
. ' </td>' . "\n";
629
625
// END - Table Type - 2 May 2001 - Robbat2
632
<input type="submit" name="submit" value="<?php echo $strSave; ?>" />
629
if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') {
630
echo ' ' . sprintf($strAddFields, '<input type="text" name="added_fields" size="2" value="1" onfocus="this.select()" style="vertical-align: middle;" />') . "\n";
631
echo ' <input type="submit" name="submit_num_fields" value="' . $strGo . '" onclick="return checkFormElementInRange(this.form, \'added_fields\', 1)" style="vertical-align: middle;" />' . "\n<br />\n<br />\n";
635
<div class="tblFooters" style="width: 80%; text-align: center; padding: 3px;">
636
<input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" />