- moved styles into css

- minor code improvements
This commit is contained in:
Sebastian Mendel
2005-11-23 18:48:37 +00:00
parent c55e55c478
commit 161f320f6e
3 changed files with 160 additions and 186 deletions

View File

@@ -20,6 +20,9 @@ $Source$
- moved styles into css - moved styles into css
- no need for javascript - no need for javascript
* relation.lib.php: uninitialized variable * relation.lib.php: uninitialized variable
* tbl_select.php, css/phpmyadmin.css.php:
- moved styles into css
- minor code improvements
2005-11-23 Michal Čihař <michal@cihar.com> 2005-11-23 Michal Čihař <michal@cihar.com>
* config.default.php, libraries/import/csv.php, libraries/import/ldi.php: * config.default.php, libraries/import/csv.php, libraries/import/ldi.php:

View File

@@ -646,6 +646,9 @@ img.lightbulb {
border: 0.1em solid red; border: 0.1em solid red;
} }
#fieldset_select_fields {
float: left;
}
<?php <?php
$_valid_css = array( 'left', 'right', 'print' ); $_valid_css = array( 'left', 'right', 'print' );

View File

@@ -10,20 +10,14 @@ require_once('./libraries/common.lib.php');
require_once('./libraries/relation.lib.php'); // foreign keys require_once('./libraries/relation.lib.php'); // foreign keys
require_once('./libraries/mysql_charsets.lib.php'); require_once('./libraries/mysql_charsets.lib.php');
if ($cfg['PropertiesIconic'] == true) { if ( $GLOBALS['cfg']['PropertiesIconic'] == true ) {
// We need to copy the value or else the == 'both' check will always return true $titles['Browse'] =
$propicon = (string)$cfg['PropertiesIconic']; '<img class="icon" width="16" height="16" src="' . $pmaThemeImage
.'b_browse.png" alt="' . $strBrowseForeignValues . '" title="'
.$strBrowseForeignValues . '" />';
if ($propicon == 'both') { if ($GLOBALS['cfg']['PropertiesIconic'] === 'both') {
$iconic_spacer = '<div class="nowrap">'; $titles['Browse'] .= $strBrowseForeignValues;
} else {
$iconic_spacer = '';
}
$titles['Browse'] = $iconic_spacer . '<img width="16" height="16" src="' . $pmaThemeImage . 'b_browse.png" alt="' . $strBrowseForeignValues . '" title="' . $strBrowseForeignValues . '" border="0" />';
if ($propicon == 'both') {
$titles['Browse'] .= '&nbsp;' . $strBrowseForeignValues . '</div>';
} }
} else { } else {
$titles['Browse'] = $strBrowseForeignValues; $titles['Browse'] = $strBrowseForeignValues;
@@ -49,7 +43,7 @@ if (!isset($param) || $param[0] == '') {
require_once('./tbl_properties_links.php'); require_once('./tbl_properties_links.php');
if (!isset($goto)) { if (!isset($goto)) {
$goto = $cfg['DefaultTabTable']; $goto = $GLOBALS['cfg']['DefaultTabTable'];
} }
// Defines the url to return to in case of error in the next sql statement // Defines the url to return to in case of error in the next sql statement
$err_url = $goto . '?' . PMA_generate_common_url($db, $table); $err_url = $goto . '?' . PMA_generate_common_url($db, $table);
@@ -99,7 +93,7 @@ if (!isset($param) || $param[0] == '') {
$foreigners = PMA_getForeigners($db, $table); $foreigners = PMA_getForeigners($db, $table);
?> ?>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
<!-- // <![CDATA[
function PMA_tbl_select_operator(f, index, multiple) { function PMA_tbl_select_operator(f, index, multiple) {
switch (f.elements["func[" + index + "]"].options[f.elements["func[" + index + "]"].selectedIndex].value) { switch (f.elements["func[" + index + "]"].options[f.elements["func[" + index + "]"].selectedIndex].value) {
<?php <?php
@@ -116,156 +110,128 @@ function PMA_tbl_select_operator(f, index, multiple) {
} }
f.elements["fields[" + index + "]" + ((multiple) ? "[]": "")].disabled = bDisabled; f.elements["fields[" + index + "]" + ((multiple) ? "[]": "")].disabled = bDisabled;
} }
// --> // ]]>
</script> </script>
<form method="post" action="tbl_select.php" name="insertForm"> <form method="post" action="tbl_select.php" name="insertForm">
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="goto" value="<?php echo $goto; ?>" /> <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="back" value="tbl_select.php" /> <input type="hidden" name="back" value="tbl_select.php" />
<table border="0" cellpadding="0" cellspacing="0">
<tr> <fieldset id="fieldset_table_search">
<td valign="top">
<table border="0" cellpadding="3" cellspacing="0"> <fieldset id="fieldset_select_fields">
<tr> <legend><?php echo $strSelectFields; ?></legend>
<th align="left" colspan="2"> <select name="param[]" size="<?php echo min($fields_cnt, 10); ?>"
<?php echo $strSelectFields; ?> multiple="multiple" align="left">
</th>
</tr>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<select name="param[]" size="<?php echo min($fields_cnt, 10); ?>" multiple="multiple" align="left">
<?php <?php
echo "\n";
// Displays the list of the fields // Displays the list of the fields
for ($i = 0 ; $i < $fields_cnt; $i++) { foreach ( $fields_list as $each_field ) {
echo ' ' echo ' '
. '<option value="' . htmlspecialchars($fields_list[$i]) . '" selected="selected">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n"; .'<option value="' . htmlspecialchars( $each_field ) . '"'
.' selected="selected">' . htmlspecialchars( $each_field )
.'</option>' . "\n";
} }
?> ?>
</select> </select>
</td> <input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct" />
<td valign="bottom" bgcolor="<?php echo $cfg['BgcolorOne']; ?>"> <label for="oDistinct">DISTINCT</label>
<input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct" /><label for="oDistinct">DISTINCT</label> </fieldset>
</td>
</tr> <fieldset id="fieldset_limit_rows">
</table> <legend><?php echo $strLimitNumRows; ?></legend>
</td> <input type="text" size="4" name="session_max_rows"
<td nowrap="nowrap" width="50">&nbsp;</td> value="<?php echo $GLOBALS['cfg']['MaxRows']; ?>" class="textfield" />
<td valign="top"> </fieldset>
<table border="0" cellpadding="3" cellspacing="0">
<tr> <fieldset id="fieldset_display_order">
<th align="left"> <legend><?php echo $strDisplayOrder; ?></legend>
<?php echo $strLimitNumRows . "\n"; ?>:
</th>
</tr>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<input type="text" size="4" name="session_max_rows" value="<?php echo $cfg['MaxRows']; ?>" class="textfield" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<th align="left">
<?php echo $strDisplayOrder; ?>
</th>
</tr>
<tr>
<td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
<select name="orderField" style="vertical-align: middle"> <select name="orderField" style="vertical-align: middle">
<option value="--nil--"></option> <option value="--nil--"></option>
<?php <?php
echo "\n"; foreach ( $fields_list as $each_field ) {
for ($i = 0; $i < $fields_cnt; $i++) { echo ' '
echo ' '; .'<option value="' . htmlspecialchars( $each_field ) . '">'
echo '<option value="' . htmlspecialchars($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n"; .htmlspecialchars( $each_field ) . '</option>' . "\n";
} // end for } // end for
?> ?>
</select><br /> </select>
<input type="radio" name="order" value="ASC" checked="checked" id="sortASC" /><label for="sortASC"><?php echo $strAscending; ?></label><br />
<input type="radio" name="order" value="DESC" id="sortDESC" /><label for="sortDESC"><?php echo $strDescending; ?></label> <div class="formelement">
</td> <input type="radio" name="order" value="ASC" checked="checked" id="sortASC" />
</tr> <label for="sortASC"><?php echo $strAscending; ?></label>
</table> </div>
</td>
</tr> <div class="formelement">
</table> <input type="radio" name="order" value="DESC" id="sortDESC" />
<table border="0" cellpadding="3" cellspacing="0"> <label for="sortDESC"><?php echo $strDescending; ?></label>
<tr> </div>
<td colspan="2">&nbsp;</td> </fieldset>
</tr>
<tr> <br class="clearfloat" />
<th align="left" class="tblHeaders" colspan="2">
<?php echo $strAddSearchConditions; ?> <?php echo $strAddSearchConditions; ?>
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'Functions') . "\n"; ?> <?php echo PMA_showMySQLDocu('SQL-Syntax', 'Functions'); ?>
</th>
</tr>
<tr>
<td>
<input type="text" name="where" class="textfield" size="64" /> <input type="text" name="where" class="textfield" size="64" />
</td>
<td align="right"> </fieldset>
<fieldset class="tblFooters">
<input type="submit" name="submit" value="<?php echo $strGo; ?>" /> <input type="submit" name="submit" value="<?php echo $strGo; ?>" />
</td> </fieldset>
</tr>
<tr> <fieldset id="fieldset_table_qbe">
<td colspan="2">&nbsp;</td> <legend><?php echo '<em>' . $strOr . '</em> ' . $strDoAQuery; ?></legend>
</tr> <table class="data">
<tr> <thead>
<th align="left" class="tblHeaders" colspan="2"> <tr><th><?php echo $strField; ?></th>
<?php echo '<i>' . $strOr . '</i> ' . $strDoAQuery; ?>
</th>
</tr>
<tr>
<td colspan="2">
<table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
<tr>
<th><?php echo $strField; ?></th>
<th><?php echo $strType; ?></th> <th><?php echo $strType; ?></th>
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '<th>' . $strCollation . '</th>' . "\n" : ''; ?> <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '<th>' . $strCollation . '</th>' . "\n" : ''; ?>
<th><?php echo $strOperator; ?></th> <th><?php echo $strOperator; ?></th>
<th><?php echo $strValue; ?></th> <th><?php echo $strValue; ?></th>
</tr> </tr>
</thead>
<tbody>
<?php <?php
$odd_row = true;
for ($i = 0; $i < $fields_cnt; $i++) { for ($i = 0; $i < $fields_cnt; $i++) {
echo "\n";
$bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
?> ?>
<tr> <tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<td bgcolor="<?php echo $bgcolor; ?>"><b><?php echo htmlspecialchars($fields_list[$i]); ?></b></td> <th><?php echo htmlspecialchars($fields_list[$i]); ?></th>
<td bgcolor="<?php echo $bgcolor; ?>"><?php echo $fields_type[$i]; ?></td> <td><?php echo $fields_type[$i]; ?></td>
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '<td bgcolor="' . $bgcolor . '">' . $fields_collation[$i] . '</td>' . "\n" : ''; ?> <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '<td>'
<td bgcolor="<?php echo $bgcolor; ?>"> . $fields_collation[$i] . '</td>' . "\n" : ''; ?>
<select name="func[]"> <td><select name="func[]">
<?php <?php
if (strncasecmp($fields_type[$i], 'enum', 4) == 0) { if (strncasecmp($fields_type[$i], 'enum', 4) == 0) {
foreach ($GLOBALS['cfg']['EnumOperators'] as $k => $fc) { foreach ($GLOBALS['cfg']['EnumOperators'] as $fc) {
echo "\n" . ' ' echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '">' . htmlspecialchars($fc) . '</option>'; . '<option value="' . htmlspecialchars($fc) . '">'
. htmlspecialchars($fc) . '</option>';
} }
} elseif (preg_match('@char|blob|text|set@i', $fields_type[$i])) { } elseif (preg_match('@char|blob|text|set@i', $fields_type[$i])) {
foreach ($GLOBALS['cfg']['TextOperators'] as $k => $fc) { foreach ($GLOBALS['cfg']['TextOperators'] as $fc) {
echo "\n" . ' ' echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '">' . htmlspecialchars($fc) . '</option>'; . '<option value="' . htmlspecialchars($fc) . '">'
. htmlspecialchars($fc) . '</option>';
} }
} else { } else {
foreach ($GLOBALS['cfg']['NumOperators'] as $k => $fc) { foreach ($GLOBALS['cfg']['NumOperators'] as $fc) {
echo "\n" . ' ' echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '">' . htmlspecialchars($fc) . '</option>'; . '<option value="' . htmlspecialchars($fc) . '">'
. htmlspecialchars($fc) . '</option>';
} }
} // end if... else... } // end if... else...
if ($fields_null[$i]) { if ($fields_null[$i]) {
foreach ($GLOBALS['cfg']['NullOperators'] as $k => $fc) { foreach ($GLOBALS['cfg']['NullOperators'] as $fc) {
echo "\n" . ' ' echo "\n" . ' '
. '<option value="' . htmlspecialchars($fc) . '">' . htmlspecialchars($fc) . '</option>'; . '<option value="' . htmlspecialchars($fc) . '">'
. htmlspecialchars($fc) . '</option>';
} }
} }
echo "\n";
?> ?>
</select> </select>
</td> </td>
<td bgcolor="<?php echo $bgcolor; ?>"> <td>
<?php <?php
// <markus@noga.de> // <markus@noga.de>
$field = $fields_list[$i]; $field = $fields_list[$i];
@@ -273,7 +239,6 @@ function PMA_tbl_select_operator(f, index, multiple) {
// do not use require_once here // do not use require_once here
require('./libraries/get_foreign.lib.php'); require('./libraries/get_foreign.lib.php');
echo "\n";
// we got a bug report: in some cases, even if $disp is true, // we got a bug report: in some cases, even if $disp is true,
// there are no rows, so we add a fetch_array // there are no rows, so we add a fetch_array
@@ -285,11 +250,14 @@ function PMA_tbl_select_operator(f, index, multiple) {
// here, the 4th parameter is empty because there is no current // here, the 4th parameter is empty because there is no current
// value of data for the dropdown (the search page initial values // value of data for the dropdown (the search page initial values
// are displayed empty) // are displayed empty)
echo PMA_foreignDropdown($disp_row, $foreign_field, $foreign_display, '', $cfg['ForeignKeyMaxLimit']); echo PMA_foreignDropdown($disp_row, $foreign_field, $foreign_display,
'', $GLOBALS['cfg']['ForeignKeyMaxLimit']);
echo ' </select>' . "\n"; echo ' </select>' . "\n";
} elseif (isset($foreign_link) && $foreign_link == true) { } elseif (isset($foreign_link) && $foreign_link == true) {
?> ?>
<input type="text" name="fields[<?php echo $i; ?>]" id="field_<?php echo md5($field); ?>[<?php echo $i; ?>]" class="textfield" /> <input type="text" name="fields[<?php echo $i; ?>]"
id="field_<?php echo md5($field); ?>[<?php echo $i; ?>]"
class="textfield" />
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&amp;field=<?php echo urlencode($field); ?>&amp;fieldkey=<?php echo $i; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>'); document.writeln('<a target="_blank" onclick="window.open(this.href, \'foreigners\', \'width=640,height=240,scrollbars=yes\'); return false" href="browse_foreigners.php?<?php echo PMA_generate_common_url($db, $table); ?>&amp;field=<?php echo urlencode($field); ?>&amp;fieldkey=<?php echo $i; ?>"><?php echo str_replace("'", "\'", $titles['Browse']); ?></a>');
</script> </script>
@@ -298,36 +266,39 @@ function PMA_tbl_select_operator(f, index, multiple) {
// e n u m s // e n u m s
$enum_value=explode(', ', str_replace("'", '', substr($fields_type[$i], 5, -1))); $enum_value=explode(', ', str_replace("'", '', substr($fields_type[$i], 5, -1)));
$cnt_enum_value = count($enum_value); $cnt_enum_value = count($enum_value);
echo ' <select name="fields[' . $i . '][]" multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n"; echo ' <select name="fields[' . $i . '][]"'
.' multiple="multiple" size="' . min(3, $cnt_enum_value) . '">' . "\n";
for ($j = 0; $j < $cnt_enum_value; $j++) { for ($j = 0; $j < $cnt_enum_value; $j++) {
echo ' <option value="' . $enum_value[$j] . '">' . $enum_value[$j] . '</option>'; echo ' <option value="' . $enum_value[$j] . '">'
. $enum_value[$j] . '</option>';
} // end for } // end for
echo ' </select>' . "\n"; echo ' </select>' . "\n";
} else { } else {
// o t h e r c a s e s // o t h e r c a s e s
echo ' <input type="text" name="fields[' . $i . ']" size="40" class="textfield" />' . "\n"; echo ' <input type="text" name="fields[' . $i . ']"'
.' size="40" class="textfield" />' . "\n";
} }
?> ?>
<input type="hidden" name="names[<?php echo $i; ?>]" value="<?php echo htmlspecialchars($fields_list[$i]); ?>" /> <input type="hidden" name="names[<?php echo $i; ?>]"
<input type="hidden" name="types[<?php echo $i; ?>]" value="<?php echo $fields_type[$i]; ?>" /> value="<?php echo htmlspecialchars($fields_list[$i]); ?>" />
<input type="hidden" name="collations[<?php echo $i; ?>]" value="<?php echo $fields_collation[$i]; ?>" /> <input type="hidden" name="types[<?php echo $i; ?>]"
value="<?php echo $fields_type[$i]; ?>" />
<input type="hidden" name="collations[<?php echo $i; ?>]"
value="<?php echo $fields_collation[$i]; ?>" />
</td> </td>
</tr> </tr>
<?php <?php
} // end for } // end for
echo "\n";
?> ?>
</tbody>
</table> </table>
</td> </fieldset>
</tr> <fieldset class="tblFooters">
<tr> <input type="hidden" name="max_number_of_fields"
<td nowrap="nowrap" colspan="2" align="right"> value="<?php echo $fields_cnt; ?>" />
<input type="hidden" name="max_number_of_fields" value="<?php echo $fields_cnt; ?>" />
<input type="submit" name="submit" value="<?php echo $strGo; ?>" /> <input type="submit" name="submit" value="<?php echo $strGo; ?>" />
</td> </fieldset>
</tr>
</table>
</form> </form>
<?php <?php
require_once('./footer.inc.php'); require_once('./footer.inc.php');
@@ -349,12 +320,9 @@ else {
if (count($param) == $max_number_of_fields) { if (count($param) == $max_number_of_fields) {
$sql_query .= '* '; $sql_query .= '* ';
} else { } else {
$param = PMA_backquote( $param );
$sql_query .= PMA_backquote(urldecode($param[0])); $sql_query .= implode( ', ', $param );
$c = count($param); unset( $param );
for ($i = 1; $i < $c; $i++) {
$sql_query .= ',' . PMA_backquote(urldecode($param[$i]));
}
} // end if } // end if
$sql_query .= ' FROM ' . PMA_backquote($table); $sql_query .= ' FROM ' . PMA_backquote($table);