📄 tbl_properties.inc.php
字号:
$default_options = array( 'NONE' => $strNone, 'USER_DEFINED' => $strAsDefined, 'NULL' => 'NULL', 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP', ); // for a TIMESTAMP, do not show CURRENT_TIMESTAMP as a default value if ($type_upper == 'TIMESTAMP' && $default_current_timestamp && isset($row['Default'])) { $row['Default'] = ''; } $content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">'; foreach ($default_options as $key => $value) { $content_cells[$i][$ci] .= '<option value="' . $key . '"'; // is only set when we go back to edit a field's structure if (isset($row['DefaultType']) && $row['DefaultType'] == $key) { $content_cells[$i][$ci] .= ' selected="selected"'; } $content_cells[$i][$ci] .= ' >' . $value . '</option>'; } $content_cells[$i][$ci] .= '</select>'; $content_cells[$i][$ci] .= '<br />'; $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"' . ' type="text" name="field_default_value[' . $i . ']" size="12"' . ' value="' . (isset($row['DefaultValue']) ? htmlspecialchars($row['DefaultValue']) : '') . '"' . ' class="textfield" />'; $ci++; // column collation $tmp_collation = empty($row['Collation']) ? null : $row['Collation']; $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox( PMA_CSDROPDOWN_COLLATION, 'field_collation[' . $i . ']', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, false); unset($tmp_collation); $ci++; // column attribute $content_cells[$i][$ci] = '<select style="font-size: 70%;"' . ' name="field_attribute[' . $i . ']"' . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">'; $attribute = ''; if ($binary) { $attribute = 'BINARY'; } if ($unsigned) { $attribute = 'UNSIGNED'; } if ($zerofill) { $attribute = 'UNSIGNED ZEROFILL'; } if (isset($row['Extra']) && $row['Extra'] == 'on update CURRENT_TIMESTAMP') { $attribute = 'on update CURRENT_TIMESTAMP'; } if (isset($submit_attribute) && $submit_attribute != false) { $attribute = $submit_attribute; } // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe // the latter. if (PMA_MYSQL_INT_VERSION < 50025 && isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type']) && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) { $row['Null'] = ''; } // MySQL 4.1.2+ TIMESTAMP options // (if on_update_current_timestamp is set, then it's TRUE) if (isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) { $attribute = 'on update CURRENT_TIMESTAMP'; } if ((isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp'])) || (isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) { $default_current_timestamp = true; } else { $default_current_timestamp = false; } $cnt_attribute_types = count($cfg['AttributeTypes']); for ($j = 0; $j < $cnt_attribute_types; $j++) { $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"'; if (strtoupper($attribute) == strtoupper($cfg['AttributeTypes'][$j])) { $content_cells[$i][$ci] .= ' selected="selected"'; } $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>'; } $content_cells[$i][$ci] .= '</select>'; $ci++; // column NULL $content_cells[$i][$ci] = '<input name="field_null[' . $i . ']"' . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"'; if (! empty($row['Null']) && $row['Null'] != 'NO' && $row['Null'] != 'NOT NULL') { $content_cells[$i][$ci] .= ' checked="checked"'; } $content_cells[$i][$ci] .= ' type="checkbox" value="NULL" />'; $ci++; // column indexes // lem9: See my other comment about removing this 'if'. if (!$is_backup) { $content_cells[$i][$ci] = '<select name="field_key[' . $i . ']"' . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '">'; $content_cells[$i][$ci] .= '<option value="none_' . $i . '">---</option>'; $content_cells[$i][$ci] .= '<option value="primary_' . $i . '" title="' . $strPrimary . '"'; if (isset($row['Key']) && $row['Key'] == 'PRI') { $content_cells[$i][$ci] .= ' selected="selected"'; } $content_cells[$i][$ci] .= '>PRIMARY</option>'; $content_cells[$i][$ci] .= '<option value="unique_' . $i . '" title="' . $strUnique . '"'; if (isset($row['Key']) && $row['Key'] == 'UNI') { $content_cells[$i][$ci] .= ' selected="selected"'; } $content_cells[$i][$ci] .= '>UNIQUE</option>'; $content_cells[$i][$ci] .= '<option value="index_' . $i . '" title="' . $strIndex . '"'; if (isset($row['Key']) && $row['Key'] == 'MUL') { $content_cells[$i][$ci] .= ' selected="selected"'; } $content_cells[$i][$ci] .= '>INDEX</option>'; $content_cells[$i][$ci] .= '<option value="fulltext_' . $i . '" title="' . $strIdxFulltext . '"'; if (isset($row['Key']) && $row['Key'] == 'FULLTEXT') { $content_cells[$i][$ci] .= ' selected="selected"'; } $content_cells[$i][$ci] .= '>FULLTEXT</option>'; $content_cells[$i][$ci] .= '</select>'; $ci++; } // end if ($action ==...) // column auto_increment $content_cells[$i][$ci] = '<input name="field_extra[' . $i . ']"' . ' id="field_' . $i . '_' . ($ci - $ci_offset) . '"'; if (isset($row['Extra']) && strtolower($row['Extra']) == 'auto_increment') { $content_cells[$i][$ci] .= ' checked="checked"'; } $content_cells[$i][$ci] .= ' type="checkbox" value="AUTO_INCREMENT" />'; $ci++; // column comments $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"' . ' type="text" name="field_comments[' . $i . ']" size="12"' . ' value="' . (isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ? htmlspecialchars($comments_map[$row['Field']]) : '') . '"' . ' class="textfield" />'; $ci++; // column MIME-types if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) { $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[' . $i . ']">'; $content_cells[$i][$ci] .= ' <option value=""> </option>'; if (is_array($available_mime['mimetype'])) { foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) { $checked = (isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : ''); $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>'; } } $content_cells[$i][$ci] .= '</select>'; $ci++; $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[' . $i . ']">'; $content_cells[$i][$ci] .= ' <option value="" title="' . $strNone . '"></option>'; if (is_array($available_mime['transformation'])) { foreach ($available_mime['transformation'] AS $mimekey => $transform) { $checked = (isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && (preg_match('@' . preg_quote($available_mime['transformation_file'][$mimekey]) . '3?@i', $mime_map[$row['Field']]['transformation'])) ? 'selected ' : ''); $tooltip = 'strTransformation_' . strtolower(str_replace('.inc.php', '', $available_mime['transformation_file'][$mimekey])); $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()'); $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>'; } } $content_cells[$i][$ci] .= '</select>'; $ci++; $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"' . ' type="text" name="field_transformation_options[' . $i . ']"' . ' size="16" class="textfield"' . ' value="' . (isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ? htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '"' . ' />'; //$ci++; }} // end forif ($cfg['CtrlArrowsMoving']) { ?><script src="./js/keyhandler.js" type="text/javascript"></script><script type="text/javascript">// <![CDATA[var switch_movement = <?php echo $display_type == 'horizontal' ? '0' : '1'; ?>;document.onkeydown = onKeyDownArrowsHandler;// ]]></script> <?php}?><form method="post" action="<?php echo $action; ?>"><?phpecho PMA_generate_common_hidden_inputs($_form_params);unset($_form_params);if (is_array($content_cells) && is_array($header_cells)) { // last row is for javascript insert //$empty_row = array_pop($content_cells); echo '<table id="table_columns">'; if ($display_type == 'horizontal') { ?><tr> <?php foreach ($header_cells as $header_val) { ?> <th><?php echo $header_val; ?></th> <?php } ?></tr> <?php $odd_row = true; foreach ($content_cells as $content_row) { echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">'; $odd_row = ! $odd_row; if (is_array($content_row)) { foreach ($content_row as $content_row_val) { ?> <td align="center"><?php echo $content_row_val; ?></td> <?php } } echo '</tr>'; } } else { $i = 0; $odd_row = true; foreach ($header_cells as $header_val) { echo '<tr class="' . ($odd_row ? 'odd' : 'even') . ' noclick">'; $odd_row = ! $odd_row; ?> <th><?php echo $header_val; ?></th> <?php foreach ($content_cells as $content_cell) { if (isset($content_cell[$i]) && $content_cell[$i] != '') { ?> <td><?php echo $content_cell[$i]; ?></td> <?php } } echo '</tr>'; $i++; } } ?></table><br /> <?php}/** * needs to be finished * *if ($display_type == 'horizontal') { $new_field = ''; foreach ($empty_row as $content_row_val) { $new_field .= '<td align="center">' . $content_row_val . '</td>'; } ?><script type="text/javascript">// <![CDATA[var odd_row = <?php echo $odd_row; ?>;function addField() { var new_fields = document.getElementById('added_fields').value; var new_field_container = document.getElementById('table_columns'); var new_field = '<?php echo preg_replace('|\s+|', ' ', preg_replace('|\'|', '\\\'', $new_field)); ?>'; var i = 0; for (i = 0; i < new_fields; i++) { if (odd_row) { new_field_container.innerHTML += '<tr class="odd">' + new_field + '</tr>'; } else { new_field_container.innerHTML += '<tr class="even">' + new_field + '</tr>'; } odd_row = ! odd_row; } return true;}// ]]></script> <?php} */if ($action == 'tbl_create.php') { ?> <table> <tr valign="top"> <th><?php echo $strTableComments; ?>: </th> <td width="25"> </td> <th><?php echo $strStorageEngine; ?>: <?php echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?> </th> <td width="25"> </td> <th><?php echo $strCollation ;?>: </th> </tr> <tr><td><input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($_REQUEST['comment']) ? htmlspecialchars($_REQUEST['comment']) : ''); ?>" class="textfield" /> </td> <td width="25"> </td> <td> <?php echo PMA_StorageEngine::getHtmlSelect('tbl_type', null, (isset($_REQUEST['tbl_type']) ? $_REQUEST['tbl_type'] : null)); ?> </td> <td width="25"> </td> <td> <?php echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', null, (isset($_REQUEST['tbl_collation']) ? $_REQUEST['tbl_collation'] : null), false, 3); ?> </td> </tr> <?php if (PMA_Partition::havePartitioning()) { ?> <tr valign="top"> <th><?php echo $strPartitionDefinition; ?>: <?php echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?> </th> </tr> <tr> <td> <textarea name="partition_definition" id="partitiondefinition" cols="<?php echo $GLOBALS['cfg']['TextareaCols'];?>" rows="<?php echo $GLOBALS['cfg']['TextareaRows'];?>" dir="<?php echo $GLOBALS['text_dir'];?>"><?php echo (isset($_REQUEST['partition_definition']) ? htmlspecialchars($_REQUEST['partition_definition']) : ''); ?></textarea> </td> </tr> <?php } ?> </table> <br /> <?php} // end if ($action == 'tbl_create.php')?><fieldset class="tblFooters"> <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" onclick="return checkTableEditForm(this.form, <?php echo $num_fields; ?>)" /><?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?> <?php echo $GLOBALS['strOr']; ?> <?php echo sprintf($strAddFields, '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?> <input type="submit" name="submit_num_fields" value="<?php echo $GLOBALS['strGo']; ?>"<?php /* onclick="if (addField()) return false;" */ ?> onclick="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)" /><?php } ?></fieldset></form><center><?php echo PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE'); ?></center>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -