bug #1305585 Add field(s) -> type ENTER

This commit is contained in:
Sebastian Mendel
2005-11-07 16:55:00 +00:00
parent 70949dd26a
commit 10952d7ab3
2 changed files with 154 additions and 173 deletions

View File

@@ -9,6 +9,7 @@ $Source$
* libraries/display_tbl.lib.php: * libraries/display_tbl.lib.php:
bug #985399 MIME-based in print view / need to select the pk bug #985399 MIME-based in print view / need to select the pk
* db_details_db_info.php: Undefined variable: db_is_information_schema * db_details_db_info.php: Undefined variable: db_is_information_schema
* tbl_properties.inc.php: bug #1305585 Add field(s) -> type ENTER
2005-11-06 Marc Delisle <lem9@users.sourceforge.net> 2005-11-06 Marc Delisle <lem9@users.sourceforge.net>
* lang/norwegian: Update, thanks to Sven-Erik Andersen * lang/norwegian: Update, thanks to Sven-Erik Andersen

View File

@@ -11,9 +11,8 @@ PMA_checkParameters(array('db','table','action','num_fields'));
require_once('./libraries/mysql_charsets.lib.php'); require_once('./libraries/mysql_charsets.lib.php');
require_once('./libraries/storage_engines.lib.php'); require_once('./libraries/storage_engines.lib.php');
?> if ($cfg['CtrlArrowsMoving']) {
<?php if ($cfg['CtrlArrowsMoving']) { ?> ?>
<!-- Set on key handler for moving using by Ctrl+arrows -->
<script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script> <script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
@@ -21,12 +20,14 @@ var switch_movement = <?php echo $cfg['DefaultPropDisplay'] == 'horizontal' ? '0
document.onkeydown = onKeyDownArrowsHandler; document.onkeydown = onKeyDownArrowsHandler;
// --> // -->
</script> </script>
<?php } <?php
// here, the div_x_7 represents a div id which contains }
// the default CURRENT TIMESTAMP checkbox and label // here, the div_x_7 represents a div id which contains
// and, field_x_7a represents the checkbox itself // the default CURRENT TIMESTAMP checkbox and label
// and, field_x_7a represents the checkbox itself
if (PMA_MYSQL_INT_VERSION >= 40102) { ?>
if (PMA_MYSQL_INT_VERSION >= 40102) {
?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
function display_field_options(field_type, i) { function display_field_options(field_type, i) {
@@ -40,50 +41,48 @@ function display_field_options(field_type, i) {
} }
// --> // -->
</script> </script>
<?php } ?> <?php } ?>
<form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" > <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
<?php <?php
echo PMA_generate_common_hidden_inputs($db, $table); echo PMA_generate_common_hidden_inputs($db, $table);
if ($action == 'tbl_create.php') { if ($action == 'tbl_create.php') {
?> ?>
<input type="hidden" name="reload" value="1" /> <input type="hidden" name="reload" value="1" />
<?php <?php
} }
else if ($action == 'tbl_addfield.php') { elseif ($action == 'tbl_addfield.php') {
echo "\n"; ?>
?>
<input type="hidden" name="field_where" value="<?php echo $field_where; ?>" /> <input type="hidden" name="field_where" value="<?php echo $field_where; ?>" />
<input type="hidden" name="after_field" value="<?php echo $after_field; ?>" /> <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" />
<?php <?php
} }
echo "\n";
if (isset($num_fields)) { if (isset($num_fields)) {
?> ?>
<input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" /> <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" />
<?php <?php
} }
if (isset($field_where)) { if (isset($field_where)) {
?> ?>
<input type="hidden" name="orig_field_where" value="<?php echo $field_where; ?>" /> <input type="hidden" name="orig_field_where" value="<?php echo $field_where; ?>" />
<?php <?php
} }
if (isset($after_field)) { if (isset($after_field)) {
?> ?>
<input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" /> <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" />
<?php <?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) {
?> ?>
<input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" /> <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php <?php
if (!isset($true_selected)) { if (!isset($true_selected)) {
?> ?>
<input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" /> <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php <?php
} }
@@ -92,14 +91,14 @@ if (isset($selected) && is_array($selected)) {
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) {
?> ?>
<input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" /> <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" />
<?php <?php
} }
} }
} elseif (isset($field)) { } elseif (isset($field)) {
?> ?>
<input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" /> <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" />
<input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" /> <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" />
<?php <?php
@@ -118,7 +117,7 @@ if (PMA_MYSQL_INT_VERSION >= 40100) {
} }
$header_cells[] = $strAttr; $header_cells[] = $strAttr;
$header_cells[] = $strNull; $header_cells[] = $strNull;
$header_cells[] = $strDefault . '**'; $header_cells[] = $strDefault . '<sup>2</sup>';
$header_cells[] = $strExtra; $header_cells[] = $strExtra;
@@ -128,11 +127,11 @@ $header_cells[] = $strExtra;
// key fields, as tbl_addfield does. // key fields, as tbl_addfield does.
if (!$is_backup) { if (!$is_backup) {
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_primary.png" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary; $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_primary.png" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary;
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_index.png" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex; $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_index.png" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex;
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_unique.png" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique; $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_unique.png" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique;
$header_cells[] = '---'; $header_cells[] = '---';
$header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_ftext.png" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext; $header_cells[] = $cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 'b_ftext.png" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext;
} }
require_once('./libraries/relation.lib.php'); require_once('./libraries/relation.lib.php');
@@ -153,7 +152,7 @@ if ($cfgRelation['commwork']) {
$header_cells[] = $strMIME_MIMEtype; $header_cells[] = $strMIME_MIMEtype;
$header_cells[] = $strMIME_transformation; $header_cells[] = $strMIME_transformation;
$header_cells[] = $strMIME_transformation_options . '***'; $header_cells[] = $strMIME_transformation_options . '<sup>3</sup>';
} }
} }
@@ -166,7 +165,7 @@ if (isset($field_fulltext) && is_array($field_fulltext)) {
} }
} }
for ($i = 0 ; $i < $num_fields; $i++) { for ( $i = 0 ; $i <= $num_fields; $i++ ) {
$submit_null = FALSE; $submit_null = FALSE;
if (isset($regenerate) && $regenerate == TRUE) { if (isset($regenerate) && $regenerate == TRUE) {
// An error happened with previous inputs, so we will restore the data // An error happened with previous inputs, so we will restore the data
@@ -221,8 +220,6 @@ for ($i = 0 ; $i < $num_fields; $i++) {
$row = $fields_meta[$i]; $row = $fields_meta[$i];
} }
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
// Cell index: If certain fields get left out, the counter shouldn't chage. // Cell index: If certain fields get left out, the counter shouldn't chage.
$ci = 0; $ci = 0;
// Everytime a cell shall be left out the STRG-jumping feature, $ci_offset // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset
@@ -545,179 +542,162 @@ for ($i = 0 ; $i < $num_fields; $i++) {
} }
} // end for } // end for
if ($cfg['DefaultPropDisplay'] == 'horizontal') { if ( is_array( $content_cells ) && is_array( $header_cells ) ) {
?> // last row is for javascript insert
<table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1"> $empty_row = array_pop( $content_cells );
<tr>
<?php echo '<table id="table_columns">';
if (is_array($header_cells)) { if ( $cfg['DefaultPropDisplay'] == 'horizontal' ) {
foreach ($header_cells AS $header_nr => $header_val) { ?>
?> <tr>
<th class="tblHeaders"><?php echo $header_val; ?></th> <?php foreach ( $header_cells as $header_val ) { ?>
<?php <th><?php echo $header_val; ?></th>
} <?php } ?>
} </tr>
?> <?php
</tr>
<?php $odd_row = true;
if (is_array($content_cells)) { foreach ( $content_cells as $content_row ) {
$i = 0; echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">';
foreach ($content_cells AS $content_nr => $content_row) { $odd_row = ! $odd_row;
$i++;
echo "\n" . '<tr>' . "\n";
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; if ( is_array( $content_row ) ) {
foreach ($content_row as $content_row_val) {
if (is_array($content_row)) { ?>
foreach ($content_row AS $content_row_nr => $content_row_val) { <td align="center"><?php echo $content_row_val; ?></td>
?> <?php
<td bgcolor="<?php echo $bgcolor; ?>" align="center"><?php echo $content_row_val; ?></td>
<?php
} }
} }
echo '</tr>';
echo "\n" . '</tr>' . "\n";
} }
} } else {
?>
</table>
<br />
<?php
} else {
?>
<table border="<?php echo $cfg['Border']; ?>">
<?php
if (is_array($header_cells)) {
$i = 0; $i = 0;
foreach ($header_cells AS $header_nr => $header_val) { $odd_row = true;
echo "\n" . '<tr>' . "\n"; foreach ( $header_cells as $header_val ) {
?> echo '<tr class="' . ( $odd_row ? 'odd' : 'even' ) . '">';
<th align="right"><?php echo $header_val; ?></th> $odd_row = ! $odd_row;
<?php ?>
$cnt_content_cells = count($content_cells); <th><?php echo $header_val; ?></th>
for ($j = 0; $j < $cnt_content_cells; $j++) { <?php
if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') { foreach ( $content_cells as $content_cell ) {
$bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; if ( isset( $content_cell[$i] ) && $content_cell[$i] != '' ) {
?> ?>
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td> <td><?php echo $content_cell[$i]; ?></td>
<?php
}
}
echo '</tr>';
$i++;
}
}
?>
</table>
<br />
<?php <?php
}
}
echo "\n" . '</tr>' . "\n";
$i++;
}
}
?>
</table>
<br />
<?php
} }
if ($action == 'tbl_create.php') { /**
echo "\n"; * needs to be finished
*
*
if ( $cfg['DefaultPropDisplay'] == 'horizontal' ) {
$new_field = '';
foreach ( $empty_row as $content_row_val ) {
$new_field .= '<td align="center">' . $content_row_val . '</td>';
}
?> ?>
<script type="text/javascript" language="javascript">
<!--
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( '<27>\s+<2B>', ' ', preg_replace( '<27>\'<27>', '\\\'', $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> <table>
<tr valign="top"> <tr valign="top">
<td><?php echo $strTableComments; ?>:&nbsp;</td> <th><?php echo $strTableComments; ?>:&nbsp;</th>
<?php
if ($action == 'tbl_create.php') {
echo "\n";
?>
<td width="25">&nbsp;</td> <td width="25">&nbsp;</td>
<td><?php echo $strTableType; ?>:&nbsp;</td> <th><?php echo $strTableType; ?>:&nbsp;</th>
<?php
if (PMA_MYSQL_INT_VERSION >= 40100) {
echo ' <td width="25">&nbsp;</td>' . "\n"
. ' <td>' . $strCollation . ':&nbsp;</td>' . "\n";
}
}
echo "\n";
?>
</tr>
<tr>
<td>
<input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" />
</td>
<?php <?php
// BEGIN - Table Type - 2 May 2001 - Robbat2 if ( PMA_MYSQL_INT_VERSION >= 40100 ) {
// change by staybyte - 11 June 2001 echo ' <td width="25">&nbsp;</td>' . "\n"
if ($action == 'tbl_create.php') { . ' <th>' . $strCollation . ':&nbsp;</th>' . "\n";
echo "\n"; }
?> ?>
</tr>
<tr><td><input type="text" name="comment" size="40" maxlength="80"
value="<?php echo (isset($comment) ? $comment : ''); ?>"
class="textfield" />
</td>
<td width="25">&nbsp;</td> <td width="25">&nbsp;</td>
<td> <td>
<?php echo PMA_generateEnginesDropdown('tbl_type', NULL, FALSE, (isset($GLOBALS['tbl_type']) ? $GLOBALS['tbl_type'] : NULL), 3); ?> <?php echo PMA_generateEnginesDropdown('tbl_type', NULL, FALSE, (isset($GLOBALS['tbl_type']) ? $GLOBALS['tbl_type'] : NULL), 3); ?>
</td> </td>
<?php <?php
if (PMA_MYSQL_INT_VERSION >= 40100) { if ( PMA_MYSQL_INT_VERSION >= 40100 ) {
echo ' <td width="25">&nbsp;</td>' . "\n" echo ' <td width="25">&nbsp;</td>' . "\n"
. ' <td>' . "\n" . ' <td>' . "\n"
. PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, (isset($tbl_collation) ? $tbl_collation : NULL), FALSE, 3) . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, (isset($tbl_collation) ? $tbl_collation : NULL), FALSE, 3)
. ' </td>' . "\n"; . ' </td>' . "\n";
} }
} ?>
echo "\n"; </tr>
?>
</tr>
</table> </table>
<br /> <br />
<?php <?php
} } // end if ($action == 'tbl_create.php')
echo "\n"; ?>
// END - Table Type - 2 May 2001 - Robbat2
?>
<?php <fieldset class="tblFooters">
if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') {
echo '<div class="tblHeaders" style="width: 30%; text-align: left; padding: 3px;">' . "\n";
echo ' ' . sprintf($strAddFields, '<input type="text" name="added_fields" size="2" value="1" onfocus="this.select()" style="vertical-align: middle;" />') . "\n";
echo ' &nbsp;<input type="submit" name="submit_num_fields" value="' . $strGo . '" onclick="return checkFormElementInRange(this.form, \'added_fields\', \'' . str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']) . '\', 1)" style="vertical-align: middle;" />' . "\n";
echo '</div>' . "\n";
echo "<br />\n";
}
?>
<div class="tblFooters" style="width: 80%; text-align: center; padding: 3px;">
<input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" /> <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" />
</div> <?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> </form>
<table> <div class="notice">
<tr> <p> <a name="footnoote_setenumval"><sup>1</sup></a> <?php echo $strSetEnumVal; ?></p>
<td valign="top">*&nbsp;</td> <p> <a name="footnoote_defaultvalue"><sup>2</sup></a> <?php echo $strDefaultValueHelp; ?></p>
<td>
<?php echo $strSetEnumVal . "\n"; ?>
</td>
</tr>
<tr>
<td valign="top">**&nbsp;</td>
<td>
<?php echo $strDefaultValueHelp . "\n"; ?>
</td>
</tr>
<?php <?php
if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) {
?> echo '<p> <a name="footnoote_mime"><sup>3</sup></a> ' . $strMIME_transformation_options_note . '</p>';
<tr> echo '<p> ';
<td valign="top" rowspan="2">***&nbsp;</td> printf( $strMIME_transformation_note,
<td> '<a href="libraries/transformations/overview.php?'
<?php echo $strMIME_transformation_options_note . "\n"; ?> . PMA_generate_common_url($db, $table) . '" target="_blank">',
</td> '</a>' );
</tr> echo '</p>';
<tr>
<td>
<?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?>
</td>
</tr>
<?php
} }
?> ?>
</div>
</table>
<br />
<center><?php echo PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE'); ?></center> <center><?php echo PMA_showMySQLDocu('SQL-Syntax', 'CREATE_TABLE'); ?></center>