00001 <?php
00002
00003
00004
00005
00006 require_once('./libraries/common.lib.php');
00007 PMA_checkParameters(array('db','table','action','num_fields'));
00008
00009
00010
00011 require_once('./libraries/mysql_charsets.lib.php');
00012
00013 ?>
00014 <?php if ($cfg['CtrlArrowsMoving']) { ?>
00015 <!-- Set on key handler for moving using by Ctrl+arrows -->
00016 <script type="text/javascript" language="javascript">
00017 <!--
00018 document.onkeydown = onKeyDownArrowsHandler;
00019
00020 </script>
00021 <?php } ?>
00022
00023 <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
00024 <?php
00025 echo PMA_generate_common_hidden_inputs($db, $table);
00026 if ($action == 'tbl_create.php') {
00027 ?>
00028 <input type="hidden" name="reload" value="1" />
00029 <?php
00030 }
00031 else if ($action == 'tbl_addfield.php') {
00032 echo "\n";
00033 ?>
00034 <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
00035 <?php
00036 }
00037 echo "\n";
00038
00039 if (isset($num_fields)) {
00040 ?>
00041 <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
00042 <?php
00043 }
00044
00045 if (isset($after_field)) {
00046 ?>
00047 <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
00048 <?php
00049 }
00050
00051 if (isset($selected) && is_array($selected)) {
00052 foreach($selected AS $o_fld_nr => $o_fld_val) {
00053 ?>
00054 <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
00055 <?php
00056 if (!isset($true_selected)) {
00057 ?>
00058 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
00059 <?php
00060 }
00061
00062 }
00063
00064 if (isset($true_selected) && is_array($true_selected)) {
00065 foreach($true_selected AS $o_fld_nr => $o_fld_val) {
00066 ?>
00067 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
00068 <?php
00069 }
00070 }
00071
00072 } elseif (isset($field)) {
00073 ?>
00074 <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />
00075 <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />
00076 <?php
00077 }
00078
00079 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
00080
00081 $header_cells = array();
00082 $content_cells = array();
00083
00084 $header_cells[] = $strField;
00085 $header_cells[] = $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>';
00086 $header_cells[] = $strLengthSet;
00087 if (PMA_MYSQL_INT_VERSION >= 40100) {
00088 $header_cells[] = $strCharset;
00089 }
00090 $header_cells[] = $strAttr;
00091 $header_cells[] = $strNull;
00092 $header_cells[] = $strDefault . '**';
00093 $header_cells[] = $strExtra;
00094
00095 require_once('./libraries/relation.lib.php');
00096 require_once('./libraries/transformations.lib.php');
00097 $cfgRelation = PMA_getRelationsParam();
00098
00099 $comments_map = array();
00100 $mime_map = array();
00101 $available_mime = array();
00102
00103 if ($cfgRelation['commwork']) {
00104 $comments_map = PMA_getComments($db, $table);
00105 $header_cells[] = $strComments;
00106
00107 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
00108 $mime_map = PMA_getMIME($db, $table);
00109 $available_mime = PMA_getAvailableMIMEtypes();
00110
00111 $header_cells[] = $strMIME_MIMEtype;
00112 $header_cells[] = $strMIME_transformation;
00113 $header_cells[] = $strMIME_transformation_options . '***';
00114 }
00115 }
00116
00117
00118 // lem9: We could remove this 'if' and let the key information be shown and
00119 // editable. However, for this to work, tbl_alter must be modified to use the
00120 // key fields, as tbl_addfield does.
00121
00122 if (!$is_backup) {
00123 $header_cells[] = $strPrimary;
00124 $header_cells[] = $strIndex;
00125 $header_cells[] = $strUnique;
00126 $header_cells[] = '---';
00127 $header_cells[] = $strIdxFulltext;
00128 }
00129
00130 // garvin: workaround for field_fulltext, because its submitted indizes contain
00131 // the index as a value, not a key. Inserted here for easier maintaineance
00132 // and less code to change in existing files.
00133 if (isset($field_fulltext) && is_array($field_fulltext)) {
00134 foreach($field_fulltext AS $fulltext_nr => $fulltext_indexkey) {
00135 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
00136 }
00137 }
00138
00139 for ($i = 0 ; $i < $num_fields; $i++) {
00140 $submit_null = FALSE;
00141 if (isset($regenerate) && $regenerate == TRUE) {
00142 // An error happened with previous inputs, so we will restore the data
00143 // to embed it once again in this form.
00144
00145 $row['Field'] = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE);
00146 $row['Type'] = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE);
00147 $row['Null'] = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : '');
00148 if ($row['Null'] == '') {
00149 $submit_null = TRUE;
00150 }
00151
00152 if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) {
00153 $row['Key'] = 'PRI';
00154 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) {
00155 $row['Key'] = 'MUL';
00156 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) {
00157 $row['Key'] = 'UNI';
00158 } else {
00159 $row['Key'] = '';
00160 }
00161
00162 $row['Default'] = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE);
00163 $row['Extra'] = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE);
00164 $row['Comment'] = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE);
00165
00166 $submit_length = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE);
00167 $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE);
00168
00169 if (isset($field_comments) && isset($field_comments[$i])) {
00170 $comments_map[$row['Field']] = $field_comments[$i];
00171 }
00172
00173 if (isset($field_mimetype) && isset($field_mimetype[$i])) {
00174 $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i];
00175 }
00176
00177 if (isset($field_transformation) && isset($field_transformation[$i])) {
00178 $mime_map[$row['Field']]['transformation'] = $field_transformation[$i];
00179 }
00180
00181 if (isset($field_transformation_options) && isset($field_transformation_options[$i])) {
00182 $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i];
00183 }
00184
00185 } elseif (isset($fields_meta)) {
00186 $row = $fields_meta[$i];
00187 }
00188
00189 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00190
00191 // Cell index: If certain fields get left out, the counter shouldn't chage.
00192 $ci = 0;
00193 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
00194 // has to be incremented ($ci_offset++)
00195 $ci_offset = -1;
00196
00197 if ($is_backup) {
00198 $backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : ''));
00199 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n";
00200 } else {
00201 $content_cells[$i][$ci] = '';
00202 }
00203
00204 $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" />';
00205 $ci++;
00206 $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
00207
00208 if (empty($row['Type'])) {
00209 $row['Type'] = '';
00210 $type = '';
00211 }
00212 else {
00213 $type = $row['Type'];
00214 }
00215 // set or enum types: slashes single quotes inside options
00216 if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
00217 $type = $tmp[1];
00218 $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
00219 } else {
00220 $type = preg_replace('@BINARY@i', '', $type);
00221 $type = preg_replace('@ZEROFILL@i', '', $type);
00222 $type = preg_replace('@UNSIGNED@i', '', $type);
00223
00224 if (strpos($type, '(')) {
00225 $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1)));
00226 $type = chop(substr($type, 0, strpos($type, '(')));
00227 } else {
00228 $length = '';
00229 }
00230 } // end if else
00231
00232 // some types, for example longtext, are reported as
00233 // "longtext character set latin7" when not latin1
00234 if (PMA_MYSQL_INT_VERSION >= 40100) {
00235 $tmp = strpos($type, 'character set');
00236 if ($tmp) {
00237 $type = substr($type, 0, $tmp-1);
00238 }
00239 }
00240
00241 if (isset($submit_length) && $submit_length != FALSE) {
00242 $length = $submit_length;
00243 }
00244
00245 $cnt_column_types = count($cfg['ColumnTypes']);
00246 for ($j = 0; $j < $cnt_column_types; $j++) {
00247 $content_cells[$i][$ci] .= ' <option value="'. $cfg['ColumnTypes'][$j] . '"';
00248 if (strtoupper($type) == strtoupper($cfg['ColumnTypes'][$j])) {
00249 $content_cells[$i][$ci] .= ' selected="selected"';
00250 }
00251 $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n";
00252 }
00253
00254 $content_cells[$i][$ci] .= ' </select>';
00255 $ci++;
00256
00257 if ($is_backup) {
00258 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_length_orig[]" value="' . urlencode($length) . '" />';
00259 } else {
00260 $content_cells[$i][$ci] = '';
00261 }
00262
00263 $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_length[]" size="8" value="' . str_replace('"', '"', $length) . '" class="textfield" />' . "\n";
00264 $ci++;
00265
00266 if (preg_match('@^(set|enum)$@i', $type)) {
00267 $binary = 0;
00268 $unsigned = 0;
00269 $zerofill = 0;
00270 } else {
00271 $binary = stristr($row['Type'], 'binary');
00272 $unsigned = stristr($row['Type'], 'unsigned');
00273 $zerofill = stristr($row['Type'], 'zerofill');
00274 }
00275
00276 if (PMA_MYSQL_INT_VERSION >= 40100) {
00277 $content_cells[$i][$ci] = '<select name="field_charset[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n"
00278 . ' <option value=""></option>' . "\n";
00279 if (!empty($row['Collation']) && (
00280 strtolower(substr($type, 0, 4)) == 'char'
00281 || strtolower(substr($type, 0, 7)) == 'varchar'
00282 || strtolower(substr($type, 0, 4)) == 'text'
00283 || strtolower(substr($type, 0, 8)) == 'tinytext'
00284 || strtolower(substr($type, 0, 10)) == 'mediumtext'
00285 || strtolower(substr($type, 0, 8)) == 'longtext'
00286 || strtolower(substr($type, 0, 3)) == 'set'
00287 || strtolower(substr($type, 0, 4)) == 'enum'
00288 ) && !$binary) {
00289 $real_charset = strpos($row['Collation'], '_') ? substr($row['Collation'], 0, strpos($row['Collation'], '_')) : $row['Collation'];
00290 } else {
00291 $real_charset = '';
00292 }
00293 for ($j = 0; isset($mysql_charsets[$j]); $j++) {
00294 $content_cells[$i][$ci] .= ' <option value="' . $mysql_charsets[$j] . '"' . ($mysql_charsets[$j] == $real_charset ? ' selected="selected"' : '') . '>' . $mysql_charsets[$j] . '</option>' . "\n";
00295 }
00296 unset($j);
00297 unset($real_charset);
00298 $content_cells[$i][$ci] .= '</select>' . "\n";
00299 $ci++;
00300 }
00301
00302 $content_cells[$i][$ci] = '<select name="field_attribute[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
00303
00304 $strAttribute = '';
00305 if ($binary) {
00306 $strAttribute = 'BINARY';
00307 }
00308 if ($unsigned) {
00309 $strAttribute = 'UNSIGNED';
00310 }
00311 if ($zerofill) {
00312 $strAttribute = 'UNSIGNED ZEROFILL';
00313 }
00314
00315 if (isset($submit_attribute) && $submit_attribute != FALSE) {
00316 $strAttribute = $submit_attribute;
00317 }
00318
00319 $cnt_attribute_types = count($cfg['AttributeTypes']);
00320 for ($j = 0;$j < $cnt_attribute_types; $j++) {
00321 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
00322 if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
00323 $content_cells[$i][$ci] .= ' selected="selected"';
00324 }
00325 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
00326 }
00327
00328 $content_cells[$i][$ci] .= '</select>';
00329 $ci++;
00330
00331 $content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
00332
00333 if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) {
00334 $content_cells[$i][$ci] .= "\n";
00335 $content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n";
00336 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n";
00337 } else {
00338 $content_cells[$i][$ci] .= "\n";
00339 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n";
00340 $content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n";
00341 }
00342
00343 $content_cells[$i][$ci] .= "\n" . '</select>';
00344 $ci++;
00345
00346 if (isset($row)
00347 && !isset($row['Default']) && !empty($row['Null'])) {
00348 $row['Default'] = 'NULL';
00349 }
00350
00351 if ($is_backup) {
00352 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_default_orig[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />';
00353 } else {
00354 $content_cells[$i][$ci] = "\n";
00355 }
00356
00357 $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" />';
00358 $ci++;
00359
00360 $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">';
00361
00362 if(!isset($row) || empty($row['Extra'])) {
00363 $content_cells[$i][$ci] .= "\n";
00364 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
00365 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
00366 } else {
00367 $content_cells[$i][$ci] .= "\n";
00368 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n";
00369 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n";
00370 }
00371
00372 $content_cells[$i][$ci] .= "\n" . '</select>';
00373 $ci++;
00374
00375 // garvin: comments
00376 if ($cfgRelation['commwork']) {
00377 $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" />';
00378 $ci++;
00379 }
00380
00381 // garvin: MIME-types
00382 if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) {
00383 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n";
00384 $content_cells[$i][$ci] .= ' <option value=""></option>' . "\n";
00385 $content_cells[$i][$ci] .= ' <option value="auto">auto-detect</option>' . "\n";
00386
00387 if (is_array($available_mime['mimetype'])) {
00388 foreach($available_mime['mimetype'] AS $mimekey => $mimetype) {
00389 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : '');
00390 $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>';
00391 }
00392 }
00393
00394 $content_cells[$i][$ci] .= '</select>';
00395 $ci++;
00396
00397 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n";
00398 $content_cells[$i][$ci] .= ' <option value="" title="' . $strNone . '"></option>' . "\n";
00399 if (is_array($available_mime['transformation'])) {
00400 foreach($available_mime['transformation'] AS $mimekey => $transform) {
00401 $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 ' : '');
00402 $tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey]));
00403 $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()');
00404 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n";
00405 }
00406 }
00407
00408 $content_cells[$i][$ci] .= '</select>';
00409 $ci++;
00410
00411 $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" />';
00412 $ci++;
00413 }
00414
00415 // lem9: See my other comment about removing this 'if'.
00416 if (!$is_backup) {
00417 if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') {
00418 $checked_primary = ' checked="checked"';
00419 } else {
00420 $checked_primary = '';
00421 }
00422 if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') {
00423 $checked_index = ' checked="checked"';
00424 } else {
00425 $checked_index = '';
00426 }
00427 if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') {
00428 $checked_unique = ' checked="checked"';
00429 } else {
00430 $checked_unique = '';
00431 }
00432 if (empty($checked_primary)
00433 && empty($checked_index)
00434 && empty($checked_unique)) {
00435 $checked_none = ' checked="checked"';
00436 } else {
00437 $checked_none = '';
00438 }
00439
00440 if ((isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) {
00441 $checked_fulltext = ' checked="checked"';
00442 } else {
00443 $checked_fulltext = '';
00444 }
00445
00446 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' />';
00447 $ci++;
00448
00449 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' . $checked_index . ' />';
00450 $ci++;
00451
00452 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' . $checked_unique . ' />';
00453 $ci++;
00454
00455 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' . $checked_none . ' />';
00456 $ci++;
00457
00458 $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' />';
00459 } // end if ($action ==...)
00460 } // end for
00461
00462 if ($cfg['DefaultPropDisplay'] == 'horizontal') {
00463 ?>
00464 <table border="<?php echo $cfg['Border']; ?>">
00465 <tr>
00466 <?php
00467 if (is_array($header_cells)) {
00468 foreach($header_cells AS $header_nr => $header_val) {
00469 ?>
00470 <th><?php echo $header_val; ?></th>
00471 <?php
00472 }
00473 }
00474 ?>
00475 </tr>
00476 <?php
00477 if (is_array($content_cells)) {
00478 $i = 0;
00479 foreach($content_cells AS $content_nr => $content_row) {
00480 $i++;
00481 echo "\n" . '<tr>' . "\n";
00482
00483 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00484
00485 if (is_array($content_row)) {
00486 foreach($content_row AS $content_row_nr => $content_row_val) {
00487 ?>
00488 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_row_val; ?></td>
00489 <?php
00490 }
00491 }
00492
00493 echo "\n" . '</tr>' . "\n";
00494 }
00495 }
00496 ?>
00497 </table>
00498 <br />
00499 <?php
00500 } else {
00501 ?>
00502 <table border="<?php echo $cfg['Border']; ?>">
00503 <?php
00504 if (is_array($header_cells)) {
00505 $i = 0;
00506 foreach($header_cells AS $header_nr => $header_val) {
00507 echo "\n" . '<tr>' . "\n";
00508 ?>
00509 <th align="right"><?php echo $header_val; ?></th>
00510 <?php
00511 $cnt_content_cells = count($content_cells);
00512 for ($j = 0; $j < $cnt_content_cells; $j++) {
00513 if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') {
00514 $bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00515 ?>
00516 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td>
00517 <?php
00518 }
00519 }
00520
00521 echo "\n" . '</tr>' . "\n";
00522 $i++;
00523 }
00524 }
00525 ?>
00526 </table>
00527 <br />
00528 <?php
00529 }
00530
00531 if ($action == 'tbl_create.php') {
00532 echo "\n";
00533 ?>
00534 <table>
00535 <tr valign="top">
00536 <td><?php echo $strTableComments; ?> :</td>
00537 <?php
00538 if ($action == 'tbl_create.php') {
00539 echo "\n";
00540 ?>
00541 <td width="25"> </td>
00542 <td><?php echo $strTableType; ?> :</td>
00543 <?php
00544 if (PMA_MYSQL_INT_VERSION >= 40100) {
00545 echo ' <td width="25"> </td>' . "\n"
00546 . ' <td>' . $strCharset . ' :</td>' . "\n";
00547 }
00548 }
00549 echo "\n";
00550 ?>
00551 </tr>
00552 <tr>
00553 <td>
00554 <input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
00555 </td>
00556 <?php
00557 // BEGIN - Table Type - 2 May 2001 - Robbat2
00558 // change by staybyte - 11 June 2001
00559 if ($action == 'tbl_create.php') {
00560 // find mysql capability - staybyte - 11. June 2001
00561 $query = 'SHOW VARIABLES LIKE \'have_%\'';
00562 $result = PMA_mysql_query($query);
00563 if ($result != FALSE && mysql_num_rows($result) > 0) {
00564 while ($tmp = PMA_mysql_fetch_array($result)) {
00565 if (isset($tmp['Variable_name'])) {
00566 switch ($tmp['Variable_name']) {
00567 case 'have_bdb':
00568 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
00569 $tbl_bdb = TRUE;
00570 }
00571 break;
00572 case 'have_gemini':
00573 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
00574 $tbl_gemini = TRUE;
00575 }
00576 break;
00577 case 'have_innodb':
00578 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
00579 $tbl_innodb = TRUE;
00580 }
00581 break;
00582 case 'have_isam':
00583 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') {
00584 $tbl_isam = TRUE;
00585 }
00586 break;
00587 } // end switch
00588 } // end if
00589 } // end while
00590 } // end if
00591 mysql_free_result($result);
00592
00593 echo "\n";
00594 ?>
00595 <td width="25"> </td>
00596 <td>
00597 <select name="tbl_type">
00598 <option <?php echo (isset($tbl_type) && $tbl_type == 'Default' ? 'selected="checked"' : ''); ?> value="Default"><?php echo $strDefault; ?></option>
00599 <option <?php echo (isset($tbl_type) && $tbl_type == 'MYISAM' ? 'selected="checked"' : ''); ?> value="MYISAM">MyISAM</option>
00600 <option <?php echo (isset($tbl_type) && $tbl_type == 'HEAP' ? 'selected="checked"' : ''); ?> value="HEAP">Heap</option>
00601 <option <?php echo (isset($tbl_type) && $tbl_type == 'MERGE' ? 'selected="checked"' : ''); ?> value="MERGE">Merge</option>
00602 <?php if (isset($tbl_bdb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'BDB' ? 'selected="checked"' : ''); ?> value="BDB">Berkeley DB</option><?php } ?>
00603 <?php if (isset($tbl_gemini)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'GEMINI' ? 'selected="checked"' : ''); ?> value="GEMINI">Gemini</option><?php } ?>
00604 <?php if (isset($tbl_innodb)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'INNO DB' ? 'selected="checked"' : ''); ?> value="InnoDB">INNO DB</option><?php } ?>
00605 <?php if (isset($tbl_isam)) { ?><option <?php echo (isset($tbl_type) && $tbl_type == 'ISAM' ? 'selected="checked"' : ''); ?> value="ISAM">ISAM</option><?php } ?>
00606 </select>
00607 </td>
00608 <?php
00609 if (PMA_MYSQL_INT_VERSION >= 40100) {
00610 echo ' <td width="25"> </td>' . "\n"
00611 . ' <td>' . "\n"
00612 . ' <select name="tbl_charset">' . "\n";
00613 for ($i = 0; isset($mysql_charsets[$i]); $i++) {
00614 echo ' <option value="' . $mysql_charsets[$i] . '"' . ($mysql_charsets[$i] == 'latin1' ? ' selected="selected"' : '') . '>' . $mysql_charsets[$i] . '</option>' . "\n";
00615 }
00616 unset($i);
00617 echo ' </select>' . "\n"
00618 . ' </td>' . "\n";
00619 }
00620 }
00621 echo "\n";
00622 ?>
00623 </tr>
00624 </table>
00625 <br />
00626 <?php
00627 }
00628 echo "\n";
00629
00630 ?>
00631
00632 <input type="submit" name="submit" value="<?php echo $strSave; ?>" />
00633 </form>
00634
00635 <table>
00636 <tr>
00637 <td valign="top">* </td>
00638 <td>
00639 <?php echo $strSetEnumVal . "\n"; ?>
00640 </td>
00641 </tr>
00642 <tr>
00643 <td valign="top">** </td>
00644 <td>
00645 <?php echo $strDefaultValueHelp . "\n"; ?>
00646 </td>
00647 </tr>
00648
00649 <?php
00650 if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
00651 ?>
00652 <tr>
00653 <td valign="top" rowspan="2">*** </td>
00654 <td>
00655 <?php echo $strMIME_transformation_options_note . "\n"; ?>
00656 </td>
00657 </tr>
00658
00659 <tr>
00660 <td>
00661 <?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?>
00662 </td>
00663 </tr>
00664 <?php
00665 }
00666 ?>
00667
00668 </table>
00669 <br />
00670
00671 <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>