Loic cleanup

This commit is contained in:
Marc Delisle
2002-11-06 13:51:49 +00:00
parent 57186b9885
commit b7b7b056ad
3 changed files with 201 additions and 177 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2002-11-06 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* db_datadict.php3, tbl_printview.php3: code cleanup
2002-11-06 Marc Delisle <lem9@users.sourceforge.net> 2002-11-06 Marc Delisle <lem9@users.sourceforge.net>
* lang/ukrainian: update, thanks to Markijan Baran * lang/ukrainian: update, thanks to Markijan Baran

View File

@@ -1,6 +1,7 @@
<?php <?php
/* $Id$ */ /* $Id$ */
/** /**
* Gets the variables sent or posted to this script, then displays headers * Gets the variables sent or posted to this script, then displays headers
*/ */
@@ -9,10 +10,13 @@ if (!isset($selected_tbl)) {
include('./header.inc.php3'); include('./header.inc.php3');
} }
/** /**
* Gets the relations settings * Gets the relations settings
*/ */
require('./libraries/relation.lib.php3'); require('./libraries/relation.lib.php3');
/** /**
* Defines the url to return to in case of error in a sql statement * Defines the url to return to in case of error in a sql statement
*/ */
@@ -30,28 +34,30 @@ if (isset($table)) {
. '&amp;server=' . $server . '&amp;server=' . $server
. '&amp;db=' . urlencode($db); . '&amp;db=' . urlencode($db);
} }
/** /**
* Selects the database * Selects the database and gets tables names
*/ */
PMA_mysql_select_db($db); PMA_mysql_select_db($db);
$sql="show tables from $db"; $sql = 'SHOW TABLES FROM ' . PMA_backquote($db);
$rowset=mysql_query($sql); $rowset = mysql_query($sql);
$count=0; $count = 0;
while ($row=mysql_fetch_array($rowset)) { while ($row = mysql_fetch_array($rowset)) {
if (PMA_MYSQL_INT_VERSION >= 32303) { if (PMA_MYSQL_INT_VERSION >= 32303) {
$myfieldname="Tables_in_".$db; $myfieldname = 'Tables_in_' . $db;
} }
else { else {
$myfieldname="Tables in ".$db; $myfieldname = 'Tables in ' . $db;
} }
$table=$row[$myfieldname]; $table = $row[$myfieldname];
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
$comments = PMA_getComments($db, $table); $comments = PMA_getComments($db, $table);
} }
if ($count!=0){ if ($count != 0) {
echo "<p style='page-break-before:always'>"; echo '<div style="page-break-before: always">' . "\n";
} }
echo '<h1>' . $table . '</h1>' . "\n"; echo '<h1>' . $table . '</h1>' . "\n";
@@ -156,25 +162,25 @@ while ($row=mysql_fetch_array($rowset)) {
*/ */
?> ?>
<!-- TABLE INFORMATIONS --> <!-- TABLE INFORMATIONS -->
<table width=100% bordercolorlight=black border style='border-collapse:collapse;background-color:white'> <table width="100%" bordercolorlight="black" border="border" style="border-collapse: collapse;background-color: white">
<tr> <tr>
<th width=50><?php echo ucfirst($strField); ?></th> <th width="50"><?php echo ucfirst($strField); ?></th>
<th width=50><?php echo ucfirst($strType); ?></th> <th width="50"><?php echo ucfirst($strType); ?></th>
<!--<th width=50><?php echo ucfirst($strAttr); ?></th>--> <!--<th width="50"><?php echo ucfirst($strAttr); ?></th>-->
<th width=50><?php echo ucfirst($strNull); ?></th> <th width="50"><?php echo ucfirst($strNull); ?></th>
<th width=50><?php echo ucfirst($strDefault); ?></th> <th width="50"><?php echo ucfirst($strDefault); ?></th>
<!--<th width=50><?php echo ucfirst($strExtra); ?></th>--> <!--<th width="50"><?php echo ucfirst($strExtra); ?></th>-->
<?php <?php
echo "\n"; echo "\n";
if ($have_rel) { if ($have_rel) {
echo ' <th width=50>' . ucfirst($strLinksTo) . '</th>' . "\n"; echo ' <th width="50">' . ucfirst($strLinksTo) . '</th>' . "\n";
} }
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
echo ' <th width=400>' . ucfirst($strComments) . '</th>' . "\n"; echo ' <th width="400">' . ucfirst($strComments) . '</th>' . "\n";
} }
?> ?>
</tr> </tr>
<?php <?php
$i = 0; $i = 0;
@@ -222,9 +228,10 @@ while ($row=mysql_fetch_array($rowset)) {
$field_name = htmlspecialchars($row['Field']); $field_name = htmlspecialchars($row['Field']);
echo "\n"; echo "\n";
?> ?>
<tr> <tr>
<td width=50 class='print' nowrap="nowrap"> <td width=50 class='print' nowrap="nowrap">
<?php <?php
echo "\n";
if (isset($pk_array[$row['Field']])) { if (isset($pk_array[$row['Field']])) {
echo ' <u>' . $field_name . '</u>&nbsp;' . "\n"; echo ' <u>' . $field_name . '</u>&nbsp;' . "\n";
} else { } else {
@@ -232,58 +239,64 @@ while ($row=mysql_fetch_array($rowset)) {
} }
?> ?>
</td> </td>
<td width=50 class='print' <?php echo $type_nowrap; ?>><?php echo $type; ?><bdo dir="ltr"></bdo></td> <td width="50" class="print"<?php echo $type_nowrap; ?>><?php echo $type; ?><bdo dir="ltr"></bdo></td>
<!--<td width=50 bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>--> <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>-->
<td width=50 class='print'><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td> <td width="50" class="print"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
<td width=50 class='print' nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td> <td width="50" class="print" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
<!--<td width=50 bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>--> <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>-->
<?php <?php
echo "\n"; echo "\n";
if ($have_rel) { if ($have_rel) {
echo ' <td width=50 class="print" >'; echo ' <td width="50" class="print">';
if (isset($res_rel[$field_name])) { if (isset($res_rel[$field_name])) {
echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] ); echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field']);
} }
echo '&nbsp;</td>' . "\n"; echo '&nbsp;</td>' . "\n";
} }
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
echo ' <td width=400 class="print" >'; echo ' <td width="400" class="print">';
if (isset($comments[$field_name])) { if (isset($comments[$field_name])) {
echo htmlspecialchars($comments[$field_name]); echo htmlspecialchars($comments[$field_name]);
} }
echo '&nbsp;</td>' . "\n"; echo '&nbsp;</td>' . "\n";
} }
?> ?>
</tr> </tr>
<?php <?php
} // end while } // end while
mysql_free_result($result); mysql_free_result($result);
echo "\n"; echo "\n";
?> ?>
</table> </table>
<?echo '</div>' . "\n";
<?php
echo '</div>' . "\n";
$count++; $count++;
}//ends main while } //ends main while
/** /**
* Displays the footer * Displays the footer
*/ */
echo "\n"; echo "\n";
echo '<br><br>&nbsp;<input type="button" style="visibility:;width:100px;height:25px" name="print" value="' . $strPrint . '" onclick="printPage()">';
require('./footer.inc.php3');
?> ?>
<script type="text/javascript" language="javascript1.2"> <script type="text/javascript" language="javascript1.2">
<!-- <!--
function printPage() function printPage()
{ {
document.all.print.style.visibility='hidden'; document.all.print.style.visibility = 'hidden';
// Do print the page // Do print the page
if (typeof(window.print) != 'undefined') { if (typeof(window.print) != 'undefined') {
window.print(); window.print();
} }
document.all.print.style.visibility=''; document.all.print.style.visibility = '';
} }
//--> //-->
</script> </script>
<?php
echo '<br /><br />&nbsp;<input type="button" style="visibility: ; width: 100px; height: 25px" name="print" value="' . $strPrint . '" onclick="printPage()">' . "\n";
require('./footer.inc.php3');
?>

View File

@@ -1,5 +1,4 @@
<?php <?php
/* $Id$ */ /* $Id$ */
@@ -18,6 +17,7 @@ if (!isset($selected_tbl)) {
require('./libraries/relation.lib.php3'); require('./libraries/relation.lib.php3');
$cfgRelation = PMA_getRelationsParam(); $cfgRelation = PMA_getRelationsParam();
/** /**
* Defines the url to return to in case of error in a sql statement * Defines the url to return to in case of error in a sql statement
*/ */
@@ -165,8 +165,7 @@ while (list($key, $table) = each($the_tables)) {
} }
else { else {
$have_rel = FALSE; $have_rel = FALSE;
} } // end if
// end if
/** /**
@@ -182,21 +181,21 @@ while (list($key, $table) = each($the_tables)) {
?> ?>
<!-- TABLE INFORMATIONS --> <!-- TABLE INFORMATIONS -->
<table width=100% bordercolorlight=black border style='border-collapse:collapse;background-color:white'> <table width="100%" bordercolorlight="black" border="border" style="border-collapse: collapse; background-color: white">
<tr> <tr>
<th width=50><?php echo ucfirst($strField); ?></th> <th width="50"><?php echo ucfirst($strField); ?></th>
<th width=50><?php echo ucfirst($strType); ?></th> <th width="50"><?php echo ucfirst($strType); ?></th>
<!--<th width=50><?php echo ucfirst($strAttr); ?></th>--> <!--<th width="50"><?php echo ucfirst($strAttr); ?></th>-->
<th width=50><?php echo ucfirst($strNull); ?></th> <th width="50"><?php echo ucfirst($strNull); ?></th>
<th width=50><?php echo ucfirst($strDefault); ?></th> <th width="50"><?php echo ucfirst($strDefault); ?></th>
<!--<th width=50><?php echo ucfirst($strExtra); ?></th>--> <!--<th width="50"><?php echo ucfirst($strExtra); ?></th>-->
<?php <?php
echo "\n"; echo "\n";
if ($have_rel) { if ($have_rel) {
echo ' <th width=50>' . ucfirst($strLinksTo) . '</th>' . "\n"; echo ' <th width="50">' . ucfirst($strLinksTo) . '</th>' . "\n";
} }
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
echo ' <th width=400>' . ucfirst($strComments) . '</th>' . "\n"; echo ' <th width="400">' . ucfirst($strComments) . '</th>' . "\n";
} }
?> ?>
</tr> </tr>
@@ -248,7 +247,7 @@ while (list($key, $table) = each($the_tables)) {
echo "\n"; echo "\n";
?> ?>
<tr> <tr>
<td width=50 class='print' nowrap="nowrap"> <td width="50" class="print" nowrap="nowrap">
<?php <?php
if (isset($pk_array[$row['Field']])) { if (isset($pk_array[$row['Field']])) {
echo ' <u>' . $field_name . '</u>&nbsp;' . "\n"; echo ' <u>' . $field_name . '</u>&nbsp;' . "\n";
@@ -257,22 +256,22 @@ while (list($key, $table) = each($the_tables)) {
} }
?> ?>
</td> </td>
<td width=50 class='print' <?php echo $type_nowrap; ?>><?php echo $type; ?><bdo dir="ltr"></bdo></td> <td width="50" class="print"<?php echo $type_nowrap; ?>><?php echo $type; ?><bdo dir="ltr"></bdo></td>
<!--<td width=50 bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>--> <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>-->
<td width=50 class='print'><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td> <td width="50" class="print"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
<td width=50 class='print' nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td> <td width="50" class="print" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
<!--<td width=50 bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>--> <!--<td width="50" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>-->
<?php <?php
echo "\n"; echo "\n";
if ($have_rel) { if ($have_rel) {
echo ' <td width=50 class="print" >'; echo ' <td width="50" class="print">';
if (isset($res_rel[$field_name])) { if (isset($res_rel[$field_name])) {
echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] ); echo htmlspecialchars($res_rel[$field_name]['foreign_table'] . ' -> ' . $res_rel[$field_name]['foreign_field'] );
} }
echo '&nbsp;</td>' . "\n"; echo '&nbsp;</td>' . "\n";
} }
if ($cfgRelation['commwork']) { if ($cfgRelation['commwork']) {
echo ' <td width=400 class="print" >'; echo ' <td width="400" class="print">';
$comments = PMA_getComments($db, $table); $comments = PMA_getComments($db, $table);
if (isset($comments[$field_name])) { if (isset($comments[$field_name])) {
echo htmlspecialchars($comments[$field_name]); echo htmlspecialchars($comments[$field_name]);
@@ -304,7 +303,7 @@ while (list($key, $table) = each($the_tables)) {
<!-- Indexes --> <!-- Indexes -->
&nbsp;<big><?php echo $strIndexes . '&nbsp;:'; ?></big> &nbsp;<big><?php echo $strIndexes . '&nbsp;:'; ?></big>
<table bordercolorlight=black border style='border-collapse:collapse;background-color:white'> <table bordercolorlight="black" border="border" style="border-collapse: collapse; background-color: white">
<tr> <tr>
<th><?php echo $strKeyname; ?></th> <th><?php echo $strKeyname; ?></th>
<th><?php echo $strType; ?></th> <th><?php echo $strType; ?></th>
@@ -409,7 +408,7 @@ while (list($key, $table) = each($the_tables)) {
<!-- Space usage --> <!-- Space usage -->
<td class="print" valign="top"> <td class="print" valign="top">
&nbsp;<big><?php echo $strSpaceUsage . '&nbsp;:'; ?></big> &nbsp;<big><?php echo $strSpaceUsage . '&nbsp;:'; ?></big>
<table width=100% bordercolorlight=black border style='border-collapse:collapse;background-color:white'> <table width="100%" bordercolorlight="black" border="border" style="border-collapse: collapse; background-color: white">
<tr> <tr>
<th><?php echo $strType; ?></th> <th><?php echo $strType; ?></th>
<th colspan="2" align="center"><?php echo $strUsage; ?></th> <th colspan="2" align="center"><?php echo $strUsage; ?></th>
@@ -465,7 +464,7 @@ while (list($key, $table) = each($the_tables)) {
<!-- Rows Statistic --> <!-- Rows Statistic -->
<td valign="top"> <td valign="top">
&nbsp;<big><?php echo $strRowsStatistic . '&nbsp;:'; ?></big> &nbsp;<big><?php echo $strRowsStatistic . '&nbsp;:'; ?></big>
<table width=100% bordercolorlight=black border style='border-collapse:collapse;background-color:white'> <table width=100% bordercolorlight="black" border="border" style="border-collapse: collapse; background-color: white">
<tr> <tr>
<th><?php echo $strStatement; ?></th> <th><?php echo $strStatement; ?></th>
<th align="center"><?php echo $strValue; ?></th> <th align="center"><?php echo $strValue; ?></th>
@@ -570,13 +569,22 @@ while (list($key, $table) = each($the_tables)) {
* Displays the footer * Displays the footer
*/ */
echo "\n"; echo "\n";
echo "<br><br>&nbsp;<input type=button style='visibility:;width:100px;height:25px' name='print' value='Print' onclick='printPage()'>"; ?>
require('./footer.inc.php3'); <script type="text/javascript" language="javascript1.2">
?><script> <!--
function printPage() function printPage()
{ {
document.all.print.style.visibility='hidden'; document.all.print.style.visibility = 'hidden';
window.print(); // Do print the page
document.all.print.style.visibility=''; if (typeof(window.print) != 'undefined') {
window.print();
}
document.all.print.style.visibility = '';
} }
//-->
</script> </script>
<?php
echo '<br /><br />&nbsp;<input type="button" style="visibility: ; width: 100px; height: 25px" name="print" value="Print" onclick="printPage()">' . "\n";
require('./footer.inc.php3');
?>