Initial import.
[openemr.git] / interface / main / myadmin / tbl_properties.inc.php
blobcdf92607455810dfc4063a6e21c682f518dd6c9f
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 // Check parameters
6 require_once('./libraries/common.lib.php');
7 PMA_checkParameters(array('db','table','action','num_fields'));
10 // Get available character sets
11 require_once('./libraries/mysql_charsets.lib.php');
14 <?php if ($cfg['CtrlArrowsMoving']) { ?>
15 <!-- Set on key handler for moving using by Ctrl+arrows -->
16 <script type="text/javascript" language="javascript">
17 <!--
18 document.onkeydown = onKeyDownArrowsHandler;
19 // -->
20 </script>
21 <?php } ?>
23 <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
24 <?php
25 echo PMA_generate_common_hidden_inputs($db, $table);
26 if ($action == 'tbl_create.php') {
28 <input type="hidden" name="reload" value="1" />
29 <?php
31 else if ($action == 'tbl_addfield.php') {
32 echo "\n";
34 <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
35 <?php
37 echo "\n";
39 if (isset($num_fields)) {
41 <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
42 <?php
45 if (isset($after_field)) {
47 <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
48 <?php
51 if (isset($selected) && is_array($selected)) {
52 foreach($selected AS $o_fld_nr => $o_fld_val) {
54 <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
55 <?php
56 if (!isset($true_selected)) {
58 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
59 <?php
64 if (isset($true_selected) && is_array($true_selected)) {
65 foreach($true_selected AS $o_fld_nr => $o_fld_val) {
67 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
68 <?php
72 } elseif (isset($field)) {
74 <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />
75 <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />
76 <?php
79 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
81 $header_cells = array();
82 $content_cells = array();
84 $header_cells[] = $strField;
85 $header_cells[] = $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>';
86 $header_cells[] = $strLengthSet;
87 if (PMA_MYSQL_INT_VERSION >= 40100) {
88 $header_cells[] = $strCharset;
90 $header_cells[] = $strAttr;
91 $header_cells[] = $strNull;
92 $header_cells[] = $strDefault . '**';
93 $header_cells[] = $strExtra;
95 require_once('./libraries/relation.lib.php');
96 require_once('./libraries/transformations.lib.php');
97 $cfgRelation = PMA_getRelationsParam();
99 $comments_map = array();
100 $mime_map = array();
101 $available_mime = array();
103 if ($cfgRelation['commwork']) {
104 $comments_map = PMA_getComments($db, $table);
105 $header_cells[] = $strComments;
107 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
108 $mime_map = PMA_getMIME($db, $table);
109 $available_mime = PMA_getAvailableMIMEtypes();
111 $header_cells[] = $strMIME_MIMEtype;
112 $header_cells[] = $strMIME_transformation;
113 $header_cells[] = $strMIME_transformation_options . '***';
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.
122 if (!$is_backup) {
123 $header_cells[] = $strPrimary;
124 $header_cells[] = $strIndex;
125 $header_cells[] = $strUnique;
126 $header_cells[] = '---';
127 $header_cells[] = $strIdxFulltext;
130 // garvin: workaround for field_fulltext, because its submitted indizes contain
131 // the index as a value, not a key. Inserted here for easier maintaineance
132 // and less code to change in existing files.
133 if (isset($field_fulltext) && is_array($field_fulltext)) {
134 foreach($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
135 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
139 for ($i = 0 ; $i < $num_fields; $i++) {
140 $submit_null = FALSE;
141 if (isset($regenerate) && $regenerate == TRUE) {
142 // An error happened with previous inputs, so we will restore the data
143 // to embed it once again in this form.
145 $row['Field'] = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
146 $row['Type'] = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
147 $row['Null'] = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
148 if ($row['Null'] == '') {
149 $submit_null = TRUE;
152 if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
153 $row['Key'] = 'PRI';
154 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
155 $row['Key'] = 'MUL';
156 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
157 $row['Key'] = 'UNI';
158 } else {
159 $row['Key'] = '';
162 $row['Default'] = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
163 $row['Extra'] = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
164 $row['Comment'] = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
166 $submit_length = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
167 $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
169 if (isset($field_comments) && isset($field_comments[$i])) {
170 $comments_map[$row['Field']] = $field_comments[$i];
173 if (isset($field_mimetype) && isset($field_mimetype[$i])) {
174 $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
177 if (isset($field_transformation) && isset($field_transformation[$i])) {
178 $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
181 if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
182 $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
185 } elseif (isset($fields_meta)) {
186 $row = $fields_meta[$i];
189 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
191 // Cell index: If certain fields get left out, the counter shouldn't chage.
192 $ci = 0;
193 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
194 // has to be incremented ($ci_offset++)
195 $ci_offset = -1;
197 if ($is_backup) {
198 $backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
199 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";
200 } else {
201 $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('"', '&quot;', $row['Field']) : '') . '" class="textfield" />';
205 $ci++;
206 $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
208 if (empty($row['Type'])) {
209 $row['Type'] = '';
210 $type = '';
212 else {
213 $type = $row['Type'];
215 // set or enum types: slashes single quotes inside options
216 if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
217 $type = $tmp[1];
218 $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
219 } else {
220 $type = preg_replace('@BINARY@i', '', $type);
221 $type = preg_replace('@ZEROFILL@i', '', $type);
222 $type = preg_replace('@UNSIGNED@i', '', $type);
224 if (strpos($type, '(')) {
225 $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));
226 $type = chop(substr($type, 0, strpos($type, '(')));
227 } else {
228 $length = '';
230 } // end if else
232 // some types, for example longtext, are reported as
233 // "longtext character set latin7" when not latin1
234 if (PMA_MYSQL_INT_VERSION >= 40100) {
235 $tmp = strpos($type, 'character set');
236 if ($tmp) {
237 $type = substr($type, 0, $tmp-1);
241 if (isset($submit_length) && $submit_length != FALSE) {
242 $length = $submit_length;
245 $cnt_column_types = count($cfg['ColumnTypes']);
246 for ($j = 0; $j < $cnt_column_types; $j++) {
247 $content_cells[$i][$ci] .= ' <option value="'. $cfg['ColumnTypes'][$j] . '"';
248 if (strtoupper($type) == strtoupper($cfg['ColumnTypes'][$j])) {
249 $content_cells[$i][$ci] .= ' selected="selected"';
251 $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n";
252 } // end for
254 $content_cells[$i][$ci] .= ' </select>';
255 $ci++;
257 if ($is_backup) {
258 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_length_orig[]" value="' . urlencode($length) . '" />';
259 } else {
260 $content_cells[$i][$ci] = '';
263 $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_length[]" size="8" value="' . str_replace('"', '&quot;', $length) . '" class="textfield" />' . "\n";
264 $ci++;
266 if (preg_match('@^(set|enum)$@i', $type)) {
267 $binary = 0;
268 $unsigned = 0;
269 $zerofill = 0;
270 } else {
271 $binary = stristr($row['Type'], 'binary');
272 $unsigned = stristr($row['Type'], 'unsigned');
273 $zerofill = stristr($row['Type'], 'zerofill');
276 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'
288 ) && !$binary) {
289 $real_charset = strpos($row['Collation'], '_') ? substr($row['Collation'], 0, strpos($row['Collation'], '_')) : $row['Collation'];
290 } else {
291 $real_charset = '';
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";
296 unset($j);
297 unset($real_charset);
298 $content_cells[$i][$ci] .= '</select>' . "\n";
299 $ci++;
302 $content_cells[$i][$ci] = '<select name="field_attribute[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
304 $strAttribute = '';
305 if ($binary) {
306 $strAttribute = 'BINARY';
308 if ($unsigned) {
309 $strAttribute = 'UNSIGNED';
311 if ($zerofill) {
312 $strAttribute = 'UNSIGNED ZEROFILL';
315 if (isset($submit_attribute) && $submit_attribute != FALSE) {
316 $strAttribute = $submit_attribute;
319 $cnt_attribute_types = count($cfg['AttributeTypes']);
320 for ($j = 0;$j < $cnt_attribute_types; $j++) {
321 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
322 if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
323 $content_cells[$i][$ci] .= ' selected="selected"';
325 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
328 $content_cells[$i][$ci] .= '</select>';
329 $ci++;
331 $content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
333 if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
334 $content_cells[$i][$ci] .= "\n";
335 $content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n";
336 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n";
337 } else {
338 $content_cells[$i][$ci] .= "\n";
339 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n";
340 $content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n";
343 $content_cells[$i][$ci] .= "\n" . '</select>';
344 $ci++;
346 if (isset($row)
347 && !isset($row['Default']) && !empty($row['Null'])) {
348 $row['Default'] = 'NULL';
351 if ($is_backup) {
352 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_default_orig[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />';
353 } else {
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('"', '&quot;', $row['Default']) : '') . '" class="textfield" />';
358 $ci++;
360 $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
362 if(!isset($row) || empty($row['Extra'])) {
363 $content_cells[$i][$ci] .= "\n";
364 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
365 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
366 } else {
367 $content_cells[$i][$ci] .= "\n";
368 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
369 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
372 $content_cells[$i][$ci] .= "\n" . '</select>';
373 $ci++;
375 // garvin: comments
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" />';
378 $ci++;
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>';
395 $ci++;
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>';
409 $ci++;
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" />';
412 $ci++;
415 // lem9: See my other comment about removing this 'if'.
416 if (!$is_backup) {
417 if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') {
418 $checked_primary = ' checked="checked"';
419 } else {
420 $checked_primary = '';
422 if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') {
423 $checked_index = ' checked="checked"';
424 } else {
425 $checked_index = '';
427 if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') {
428 $checked_unique = ' checked="checked"';
429 } else {
430 $checked_unique = '';
432 if (empty($checked_primary)
433 && empty($checked_index)
434 && empty($checked_unique)) {
435 $checked_none = ' checked="checked"';
436 } else {
437 $checked_none = '';
440 if ((isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
441 $checked_fulltext = ' checked="checked"';
442 } else {
443 $checked_fulltext = '';
446 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' />';
447 $ci++;
449 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' . $checked_index . ' />';
450 $ci++;
452 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' . $checked_unique . ' />';
453 $ci++;
455 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' . $checked_none . ' />';
456 $ci++;
458 $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' />';
459 } // end if ($action ==...)
460 } // end for
462 if ($cfg['DefaultPropDisplay'] == 'horizontal') {
464 <table border="<?php echo $cfg['Border']; ?>">
465 <tr>
466 <?php
467 if (is_array($header_cells)) {
468 foreach($header_cells AS $header_nr => $header_val) {
470 <th><?php echo $header_val; ?></th>
471 <?php
475 </tr>
476 <?php
477 if (is_array($content_cells)) {
478 $i = 0;
479 foreach($content_cells AS $content_nr => $content_row) {
480 $i++;
481 echo "\n" . '<tr>' . "\n";
483 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
485 if (is_array($content_row)) {
486 foreach($content_row AS $content_row_nr => $content_row_val) {
488 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_row_val; ?></td>
489 <?php
493 echo "\n" . '</tr>' . "\n";
497 </table>
498 <br />
499 <?php
500 } else {
502 <table border="<?php echo $cfg['Border']; ?>">
503 <?php
504 if (is_array($header_cells)) {
505 $i = 0;
506 foreach($header_cells AS $header_nr => $header_val) {
507 echo "\n" . '<tr>' . "\n";
509 <th align="right"><?php echo $header_val; ?></th>
510 <?php
511 $cnt_content_cells = count($content_cells);
512 for ($j = 0; $j < $cnt_content_cells; $j++) {
513 if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') {
514 $bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
516 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td>
517 <?php
521 echo "\n" . '</tr>' . "\n";
522 $i++;
526 </table>
527 <br />
528 <?php
531 if ($action == 'tbl_create.php') {
532 echo "\n";
534 <table>
535 <tr valign="top">
536 <td><?php echo $strTableComments; ?>&nbsp;:</td>
537 <?php
538 if ($action == 'tbl_create.php') {
539 echo "\n";
541 <td width="25">&nbsp;</td>
542 <td><?php echo $strTableType; ?>&nbsp;:</td>
543 <?php
544 if (PMA_MYSQL_INT_VERSION >= 40100) {
545 echo ' <td width="25">&nbsp;</td>' . "\n"
546 . ' <td>' . $strCharset . '&nbsp;:</td>' . "\n";
549 echo "\n";
551 </tr>
552 <tr>
553 <td>
554 <input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
555 </td>
556 <?php
557 // BEGIN - Table Type - 2 May 2001 - Robbat2
558 // change by staybyte - 11 June 2001
559 if ($action == 'tbl_create.php') {
560 // 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)) {
565 if (isset($tmp['Variable_name'])) {
566 switch ($tmp['Variable_name']) {
567 case 'have_bdb':
568 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
569 $tbl_bdb = TRUE;
571 break;
572 case 'have_gemini':
573 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
574 $tbl_gemini = TRUE;
576 break;
577 case 'have_innodb':
578 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
579 $tbl_innodb = TRUE;
581 break;
582 case 'have_isam':
583 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
584 $tbl_isam = TRUE;
586 break;
587 } // end switch
588 } // end if
589 } // end while
590 } // end if
591 mysql_free_result($result);
593 echo "\n";
595 <td width="25">&nbsp;</td>
596 <td>
597 <select name="tbl_type">
598 <option <?php echo (isset($tbl_type) && $tbl_type == 'Default' ? 'selected="checked"' : ''); ?> value="Default"><?php echo $strDefault; ?></option>
599 <option <?php echo (isset($tbl_type) && $tbl_type == 'MYISAM' ? 'selected="checked"' : ''); ?> value="MYISAM">MyISAM</option>
600 <option <?php echo (isset($tbl_type) && $tbl_type == 'HEAP' ? 'selected="checked"' : ''); ?> value="HEAP">Heap</option>
601 <option <?php echo (isset($tbl_type) && $tbl_type == 'MERGE' ? 'selected="checked"' : ''); ?> value="MERGE">Merge</option>
602 <?php if (isset($tbl_bdb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'BDB' ? 'selected="checked"' : ''); ?> value="BDB">Berkeley DB</option><?php } ?>
603 <?php if (isset($tbl_gemini)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'GEMINI' ? 'selected="checked"' : ''); ?> value="GEMINI">Gemini</option><?php } ?>
604 <?php if (isset($tbl_innodb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'INNO DB' ? 'selected="checked"' : ''); ?> value="InnoDB">INNO DB</option><?php } ?>
605 <?php if (isset($tbl_isam)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'ISAM' ? 'selected="checked"' : ''); ?> value="ISAM">ISAM</option><?php } ?>
606 </select>
607 </td>
608 <?php
609 if (PMA_MYSQL_INT_VERSION >= 40100) {
610 echo ' <td width="25">&nbsp;</td>' . "\n"
611 . ' <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";
616 unset($i);
617 echo ' </select>' . "\n"
618 . ' </td>' . "\n";
621 echo "\n";
623 </tr>
624 </table>
625 <br />
626 <?php
628 echo "\n";
629 // END - Table Type - 2 May 2001 - Robbat2
632 <input type="submit" name="submit" value="<?php echo $strSave; ?>" />
633 </form>
635 <table>
636 <tr>
637 <td valign="top">*&nbsp;</td>
638 <td>
639 <?php echo $strSetEnumVal . "\n"; ?>
640 </td>
641 </tr>
642 <tr>
643 <td valign="top">**&nbsp;</td>
644 <td>
645 <?php echo $strDefaultValueHelp . "\n"; ?>
646 </td>
647 </tr>
649 <?php
650 if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
652 <tr>
653 <td valign="top" rowspan="2">***&nbsp;</td>
654 <td>
655 <?php echo $strMIME_transformation_options_note . "\n"; ?>
656 </td>
657 </tr>
659 <tr>
660 <td>
661 <?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?>
662 </td>
663 </tr>
664 <?php
668 </table>
669 <br />
671 <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>