code order
This commit is contained in:
Sebastian Mendel
2007-12-12 08:58:47 +00:00
parent 0ced617aff
commit ba3226c70a

View File

@@ -31,94 +31,50 @@ if (is_int($cfg['DefaultPropDisplay'])) {
$display_type = $cfg['DefaultPropDisplay']; $display_type = $cfg['DefaultPropDisplay'];
} }
if ($cfg['CtrlArrowsMoving']) { $_form_aprams = array(
?> 'db' => $db,
<script src="./js/keyhandler.js" type="text/javascript"></script> 'table' => $table,
<script type="text/javascript"> );
// <![CDATA[
var switch_movement = <?php echo $display_type == 'horizontal' ? '0' : '1'; ?>;
document.onkeydown = onKeyDownArrowsHandler;
// ]]>
</script>
<?php
}
// here, the div_x_7 represents a div id which contains
// the default CURRENT TIMESTAMP checkbox and label
// and, field_x_7a represents the checkbox itself
?>
<script type="text/javascript">
// <![CDATA[
function display_field_options(field_type, i) {
if (field_type == 'TIMESTAMP') {
getElement('div_' + i + '_7').style.display = 'block';
} else {
getElement('div_' + i + '_7').style.display = 'none';
getElement('field_' + i + '_7a').checked = false;
}
return true;
}
// ]]>
</script>
<form method="post" action="<?php echo $action; ?>">
<?php
echo PMA_generate_common_hidden_inputs($db, $table);
if ($action == 'tbl_create.php') { if ($action == 'tbl_create.php') {
?> $_form_aprams['reload'] = 1;
<input type="hidden" name="reload" value="1" />
<?php
} elseif ($action == 'tbl_addfield.php') { } elseif ($action == 'tbl_addfield.php') {
?> $_form_aprams['field_where'] = $field_where;
<input type="hidden" name="field_where" value="<?php echo $field_where; ?>" /> $_form_aprams['after_field'] = $after_field;
<input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
<?php
} }
if (isset($num_fields)) { if (isset($num_fields)) {
?> $_form_aprams['orig_num_fields'] = $num_fields;
<input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
<?php
} }
if (isset($field_where)) { if (isset($field_where)) {
?> $_form_aprams['orig_field_where'] = $field_where;
<input type="hidden" name="orig_field_where" value="<?php echo $field_where; ?>" />
<?php
} }
if (isset($after_field)) { if (isset($after_field)) {
?> $_form_aprams['orig_after_field'] = $after_field;
<input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
<?php
} }
if (isset($selected) && is_array($selected)) { if (isset($selected) && is_array($selected)) {
foreach ($selected AS $o_fld_nr => $o_fld_val) { foreach ($selected as $o_fld_nr => $o_fld_val) {
?> $_form_aprams['selected[' . $o_fld_nr . ']'] = $o_fld_val;
<input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" /> if (! isset($true_selected)) {
<?php $_form_aprams['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
if (!isset($true_selected)) {
?>
<input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php
} }
} }
if (isset($true_selected) && is_array($true_selected)) { if (isset($true_selected) && is_array($true_selected)) {
foreach ($true_selected AS $o_fld_nr => $o_fld_val) { foreach ($true_selected as $o_fld_nr => $o_fld_val) {
?> $_form_aprams['true_selected[' . $o_fld_nr . ']'] = $o_fld_val;
<input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php
} }
} }
} elseif (isset($field)) { } elseif (isset($field)) {
?> $_form_aprams['orig_field'] = $field;
<input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" /> if (isset($orig_field)) {
<input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" /> $_form_aprams['true_selected[]'] = $orig_field;
<?php } else {
$_form_aprams['true_selected[]'] = $field;
}
} }
$is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php'); $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
@@ -356,21 +312,22 @@ for ($i = 0 ; $i <= $num_fields; $i++) {
// here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
// NULL attribute, but SHOW CREATE TABLE says the contrary. Believe // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
// the latter. // the latter.
if (isset($row['Field']) if (PMA_MYSQL_INT_VERSION < 50025
&& isset($analyzed_sql[0]) && isset($row['Field'])
&& isset($analyzed_sql[0]['create_table_fields']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['type'])
&& 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']]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) {
&& $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == true) {
$row['Null'] = ''; $row['Null'] = '';
} }
// MySQL 4.1.2+ TIMESTAMP options // MySQL 4.1.2+ TIMESTAMP options
// (if on_update_current_timestamp is set, then it's TRUE) // (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'])) { if (isset($row['Field'])
&& isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
$attribute = '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'])) 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)) { || (isset($submit_default_current_timestamp) && $submit_default_current_timestamp)) {
$default_current_timestamp = TRUE; $default_current_timestamp = TRUE;
} else { } else {
@@ -546,6 +503,40 @@ for ($i = 0 ; $i <= $num_fields; $i++) {
} }
} // end for } // end for
if ($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
}
// here, the div_x_7 represents a div id which contains
// the default CURRENT TIMESTAMP checkbox and label
// and, field_x_7a represents the checkbox itself
?>
<script type="text/javascript">
// <![CDATA[
function display_field_options(field_type, i) {
if (field_type == 'TIMESTAMP') {
getElement('div_' + i + '_7').style.display = 'block';
} else {
getElement('div_' + i + '_7').style.display = 'none';
getElement('field_' + i + '_7a').checked = false;
}
return true;
}
// ]]>
</script>
<form method="post" action="<?php echo $action; ?>">
<?php
echo PMA_generate_common_hidden_inputs($_form_aprams);
if (is_array($content_cells) && is_array($header_cells)) { if (is_array($content_cells) && is_array($header_cells)) {
// last row is for javascript insert // last row is for javascript insert
$empty_row = array_pop($content_cells); $empty_row = array_pop($content_cells);
@@ -617,7 +608,7 @@ var odd_row = <?php echo $odd_row; ?>;
function addField() { function addField() {
var new_fields = document.getElementById('added_fields').value; var new_fields = document.getElementById('added_fields').value;
var new_field_container = document.getElementById('table_columns'); var new_field_container = document.getElementById('table_columns');
var new_field = '<?php echo preg_replace('<EFBFBD>\s+<EFBFBD>', ' ', preg_replace('<EFBFBD>\'<EFBFBD>', '\\\'', $new_field)); ?>'; var new_field = '<?php echo preg_replace('|\s+|', ' ', preg_replace('|\'|', '\\\'', $new_field)); ?>';
var i = 0; var i = 0;
for (i = 0; i < new_fields; i++) { for (i = 0; i < new_fields; i++) {
if (odd_row) { if (odd_row) {
@@ -642,10 +633,11 @@ if ($action == 'tbl_create.php') {
<tr valign="top"> <tr valign="top">
<th><?php echo $strTableComments; ?>:&nbsp;</th> <th><?php echo $strTableComments; ?>:&nbsp;</th>
<td width="25">&nbsp;</td> <td width="25">&nbsp;</td>
<th><?php echo $strStorageEngine; ?>:&nbsp;<?php echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?> <th><?php echo $strStorageEngine; ?>:
<?php echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?>
</th> </th>
<td width="25">&nbsp;</td> <td width="25">&nbsp;</td>
<th><?php echo $strCollation ;?>:&nbsp;</th> <th><?php echo $strCollation ;?>:&nbsp;</th>
</tr> </tr>
<tr><td><input type="text" name="comment" size="40" maxlength="80" <tr><td><input type="text" name="comment" size="40" maxlength="80"
value="<?php echo (isset($comment) ? $comment : ''); ?>" value="<?php echo (isset($comment) ? $comment : ''); ?>"
@@ -668,7 +660,7 @@ if ($action == 'tbl_create.php') {
</tr> </tr>
<?php <?php
if (PMA_Partition::havePartitioning()) { if (PMA_Partition::havePartitioning()) {
?> ?>
<tr valign="top"> <tr valign="top">
<th><?php echo $strPartitionDefinition; ?>:&nbsp;<?php echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?> <th><?php echo $strPartitionDefinition; ?>:&nbsp;<?php echo PMA_showMySQLDocu('Partitioning', 'Partitioning'); ?>
</th> </th>
@@ -678,7 +670,7 @@ if ($action == 'tbl_create.php') {
<textarea name="partition_definition" id="partitiondefinition" cols="<?php echo $GLOBALS['cfg']['TextareaCols'];?>" rows="<?php echo $GLOBALS['cfg']['TextareaRows'];?>" dir="<?php echo $GLOBALS['text_dir'];?>"></textarea> <textarea name="partition_definition" id="partitiondefinition" cols="<?php echo $GLOBALS['cfg']['TextareaCols'];?>" rows="<?php echo $GLOBALS['cfg']['TextareaRows'];?>" dir="<?php echo $GLOBALS['text_dir'];?>"></textarea>
</td> </td>
</tr> </tr>
<?php <?php
} }
?> ?>
</table> </table>