Export the js work from tbl_properties.php3 & db_details.php3 to functions.js

This commit is contained in:
Loïc Chapeaux
2001-07-10 19:40:33 +00:00
parent 23f3af54c8
commit 565283d72c
4 changed files with 79 additions and 42 deletions

View File

@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2001-07-09 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* header.inc.php3: cosmetic changes.
* tbl_properties.php3, db_details.php3, functions.js: export the js work
from the formers to the later.
* Updated the Spanish translation thanks to
Martin Marconcini <megadeth@millic.com.ar>.
2001-07-10 Steve Alberty <alberty@neptunlabs.de> 2001-07-10 Steve Alberty <alberty@neptunlabs.de>
* tbl_properties.php3: add avg row size * tbl_properties.php3: add avg row size

View File

@@ -232,6 +232,8 @@ echo "\n";
*/ */
?> ?>
<!-- DATABASE WORK --> <!-- DATABASE WORK -->
<script src="functions.js" type="text/javascript" language="javascript"></script>
<ul> <ul>
<?php <?php
if ($num_tables > 0) { if ($num_tables > 0) {
@@ -356,14 +358,14 @@ if ($num_tables > 0) {
<?php echo $strDataOnly; ?>&nbsp;&nbsp; <?php echo $strDataOnly; ?>&nbsp;&nbsp;
</td> </td>
<td> <td>
<input type="checkbox" name="asfile" value="sendit"<?php if (function_exists('gzencode')) { ?>onclick="if (!document.forms['db_dump'].elements['asfile'].checked) document.forms['db_dump'].elements['gzip'].checked = false<?php }; ?>" /> <input type="checkbox" name="asfile" value="sendit" onclick="return checkTransmitDump(this.form, 'transmit')" />
<?php echo $strSend . "\n"; ?> <?php echo $strSend . "\n"; ?>
<?php <?php
// gzip encode feature // gzip encode feature
if (function_exists('gzencode')) { if (function_exists('gzencode')) {
echo "\n"; echo "\n";
?> ?>
(<input type="checkbox" name="gzip" value="gzip" onclick="document.forms['db_dump'].elements['asfile'].checked = true" /><?php echo $strGzip; ?>) (<input type="checkbox" name="gzip" value="gzip" onclick="return checkTransmitDump(this.form, 'gzip')" /><?php echo $strGzip; ?>)
<?php <?php
} }
echo "\n"; echo "\n";

View File

@@ -1,5 +1,9 @@
/* $Id$ */
var isFormElementInRange; var isFormElementInRange;
/** /**
* Ensures a value submitted in a form is numeric and is in a range * Ensures a value submitted in a form is numeric and is in a range
* *
@@ -10,7 +14,7 @@ var isFormElementInRange;
* *
* @return boolean whether a valid number has been submitted or not * @return boolean whether a valid number has been submitted or not
*/ */
function checkFormElementInRange(theForm, theFieldName, min, max ) function checkFormElementInRange(theForm, theFieldName, min, max)
{ {
isFormElementInRange = true; isFormElementInRange = true;
var theField = theForm.elements[theFieldName]; var theField = theForm.elements[theFieldName];
@@ -25,7 +29,7 @@ function checkFormElementInRange(theForm, theFieldName, min, max )
return false; return false;
} }
// It's a number but it is not between min and max // It's a number but it is not between min and max
else if (val < min || val > max) { else if (val < min || val > max) {
alert(val + errorMsg2); alert(val + errorMsg2);
isFormElementInRange = false; isFormElementInRange = false;
theField.select(); theField.select();
@@ -36,5 +40,37 @@ function checkFormElementInRange(theForm, theFieldName, min, max )
else { else {
theField.value = val; theField.value = val;
} }
return true; return true;
} // end of the 'checkFormElementInRange()' function } // end of the 'checkFormElementInRange()' function
/**
* Ensures the choice between 'transmit' and 'gzipped' checkboxes is consistant
*
* @param object the form
* @param string a code for the action that causes this function to be run
*
* @return boolean always true
*/
function checkTransmitDump(theForm, theAction)
{
var formElts = theForm.elements;
// 'gzipped' option has been checked/unchecked
if (theAction == 'gzip') {
if (formElts['gzip'].checked && !formElts['asfile'].checked) {
theForm.elements['asfile'].checked = true;
}
}
// 'transmit' option has been checked/unchecked
else if (theAction == 'transmit') {
if (!formElts['asfile'].checked
&& (typeof(formElts['gzip']) != 'undefined' && formElts['gzip'].checked)) {
theForm.elements['gzip'].checked = false;
}
}
return true;
} // end of the 'checkTransmitDump()' function

View File

@@ -12,24 +12,27 @@ if (!isset($message)) {
} }
unset($sql_query); unset($sql_query);
/*
/**
* Selects the db that will be used during this script execution * Selects the db that will be used during this script execution
*/ */
mysql_select_db($db); mysql_select_db($db);
/*
/**
* Set parameters for links * Set parameters for links
*/ */
$query="server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3"; $query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
?> ?>
<!-- first browse link -->
<!-- first browse link -->
<p> <p>
<a href="sql.php3?sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0&<?php echo $query; ?>"> <a href="sql.php3?sql_query=<?php echo urlencode("SELECT * FROM $table"); ?>&pos=0&<?php echo $query; ?>">
<b><?php echo $strBrowse; ?></b></a> <b><?php echo $strBrowse; ?></b></a>
</p> </p>
<?php <?php
/** /**
* Gets table informations * Gets table informations
*/ */
@@ -55,7 +58,7 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) >= 3) {
$show_comment = $showtable['Comment']; $show_comment = $showtable['Comment'];
?> ?>
<!-- Table comment --> <!-- Table comment -->
<p><i> <p><i>
<?php echo $show_comment . "\n"; ?> <?php echo $show_comment . "\n"; ?>
</i></p> </i></p>
@@ -87,7 +90,6 @@ $result = mysql_query("SHOW FIELDS FROM $table") or mysql_die();
<!-- TABLE INFORMATIONS --> <!-- TABLE INFORMATIONS -->
<table border="<?php echo $cfgBorder; ?>"> <table border="<?php echo $cfgBorder; ?>">
<tr> <tr>
<th><?php echo ucfirst($strField); ?></th> <th><?php echo ucfirst($strField); ?></th>
@@ -109,8 +111,7 @@ echo "\n";
<?php <?php
$i = 0; $i = 0;
$aryFields = array(); $aryFields = array();
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
while ($row = mysql_fetch_array($result)) { while ($row = mysql_fetch_array($result)) {
$i++; $i++;
@@ -144,7 +145,7 @@ while ($row = mysql_fetch_array($result)) {
$strAttribute = 'UNSIGNED'; $strAttribute = 'UNSIGNED';
if ($zerofill) if ($zerofill)
$strAttribute = 'UNSIGNED ZEROFILL'; $strAttribute = 'UNSIGNED ZEROFILL';
echo "\n";
?> ?>
<tr bgcolor="<?php echo $bgcolor; ?>"> <tr bgcolor="<?php echo $bgcolor; ?>">
<td><?php echo $row['Field']; ?>&nbsp;</td> <td><?php echo $row['Field']; ?>&nbsp;</td>
@@ -178,8 +179,8 @@ while ($row = mysql_fetch_array($result)) {
?> ?>
</tr> </tr>
<?php <?php
} // (end while) } // end while
echo "\n"; echo "\n";
?> ?>
</table> </table>
<br /> <br />
@@ -190,7 +191,7 @@ while ($row = mysql_fetch_array($result)) {
* Displays indexes * Displays indexes
*/ */
?> ?>
<!-- Indexes --> <!-- Indexes, space usage and row statistics -->
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<?php <?php
@@ -199,6 +200,8 @@ $index_count = (isset($ret_keys))
: 0; : 0;
if ($index_count > 0) { if ($index_count > 0) {
?> ?>
<!-- Indexes -->
<td valign="top" align="left"> <td valign="top" align="left">
<?php echo $strIndexes . '&nbsp;:' . "\n"; ?> <?php echo $strIndexes . '&nbsp;:' . "\n"; ?>
<table border="<?php echo $cfgBorder; ?>"> <table border="<?php echo $cfgBorder; ?>">
@@ -221,15 +224,9 @@ if ($index_count > 0) {
echo "\n"; echo "\n";
?> ?>
<tr> <tr>
<td> <td><?php echo $row['Key_name'] . "\n"; ?></td>
<?php echo $row['Key_name'] . "\n"; ?> <td><?php echo (($row['Non_unique'] == '0') ? $strYes : $strNo) . "\n"; ?></td>
</td> <td><?php echo $row['Column_name'] . "\n"; ?></td>
<td>
<?php echo (($row['Non_unique'] == '0') ? $strYes : $strNo) . "\n"; ?>
</td>
<td>
<?php echo $row['Column_name'] . "\n"; ?>
</td>
<td> <td>
<?php echo "<a href=\"sql.php3?$query&sql_query=$sql_query&zero_rows=$zero_rows\">$strDrop</a>\n"; ?> <?php echo "<a href=\"sql.php3?$query&sql_query=$sql_query&zero_rows=$zero_rows\">$strDrop</a>\n"; ?>
</td> </td>
@@ -249,7 +246,6 @@ if ($index_count > 0) {
* Displays Space usage and row statistics * Displays Space usage and row statistics
*/ */
?> ?>
<!-- Space usage and row statistics -->
<?php <?php
// BEGIN - Calc Table Space - staybyte - 9 June 2001 // BEGIN - Calc Table Space - staybyte - 9 June 2001
if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_type != "INNODB" && isset($showtable)) { if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_type != "INNODB" && isset($showtable)) {
@@ -261,12 +257,14 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
} }
list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']); list($effect_size, $effect_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
list($tot_size, $tot_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']); list($tot_size, $tot_unit) = format_byte_down($showtable['Data_length'] + $showtable['Index_length']);
list($avg_size, $avg_unit) = format_byte_down(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows']);
// Displays them // Displays them
if ($index_count > 0) { if ($index_count > 0) {
echo ' <td width="20">&nbsp;</td>' . "\n"; echo ' <td width="20">&nbsp;</td>' . "\n";
} }
?> ?>
<!-- Space usage --> <!-- Space usage -->
<td valign="top"> <td valign="top">
<?php echo $strSpaceUsage . '&nbsp;:' . "\n"; ?> <?php echo $strSpaceUsage . '&nbsp;:' . "\n"; ?>
@@ -276,13 +274,11 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
<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>
</tr> </tr>
<!-- Data -->
<tr bgcolor="<?php echo $cfgBgcolorTwo; ?>"> <tr bgcolor="<?php echo $cfgBgcolorTwo; ?>">
<td style="padding-right: 10px"><?php echo ucfirst($strData); ?></td> <td style="padding-right: 10px"><?php echo ucfirst($strData); ?></td>
<td align="right"><?php echo $data_size; ?></td> <td align="right"><?php echo $data_size; ?></td>
<td><?php echo $data_unit; ?></td> <td><?php echo $data_unit; ?></td>
</tr> </tr>
<!-- Index -->
<tr bgcolor="<?php echo $cfgBgcolorTwo; ?>"> <tr bgcolor="<?php echo $cfgBgcolorTwo; ?>">
<td style="padding-right: 10px"><?php echo ucfirst($strIndex); ?></td> <td style="padding-right: 10px"><?php echo ucfirst($strIndex); ?></td>
<td align="right"><?php echo $index_size; ?></td> <td align="right"><?php echo $index_size; ?></td>
@@ -292,13 +288,11 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
if (!empty($showtable['Data_free'])) { if (!empty($showtable['Data_free'])) {
echo "\n"; echo "\n";
?> ?>
<!-- Overhead -->
<tr bgcolor="<?php echo $cfgBgcolorTwo; ?>" style="color: #bb0000"> <tr bgcolor="<?php echo $cfgBgcolorTwo; ?>" style="color: #bb0000">
<td style="padding-right: 10px"><?php echo ucfirst($strOverhead); ?></td> <td style="padding-right: 10px"><?php echo ucfirst($strOverhead); ?></td>
<td align="right"><?php echo $free_size; ?></td> <td align="right"><?php echo $free_size; ?></td>
<td><?php echo $free_unit; ?></td> <td><?php echo $free_unit; ?></td>
</tr> </tr>
<!-- Effective -->
<tr bgcolor="<?php echo $cfgBgcolorOne; ?>"> <tr bgcolor="<?php echo $cfgBgcolorOne; ?>">
<td style="padding-right: 10px"><?php echo ucfirst($strEffective); ?></td> <td style="padding-right: 10px"><?php echo ucfirst($strEffective); ?></td>
<td align="right"><?php echo $effect_size; ?></td> <td align="right"><?php echo $effect_size; ?></td>
@@ -308,18 +302,17 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
} }
echo "\n"; echo "\n";
?> ?>
<!-- Total -->
<tr bgcolor="<?php echo $cfgBgcolorOne; ?>"> <tr bgcolor="<?php echo $cfgBgcolorOne; ?>">
<td style="padding-right: 10px"><?php echo ucfirst($strTotal); ?></td> <td style="padding-right: 10px"><?php echo ucfirst($strTotal); ?></td>
<td align="right"><?php echo $tot_size; ?></td> <td align="right"><?php echo $tot_size; ?></td>
<td><?php echo $tot_unit; ?></td> <td><?php echo $tot_unit; ?></td>
</tr> </tr>
<?php <?php
// Optimize link if overhead
if (!empty($showtable['Data_free']) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) { if (!empty($showtable['Data_free']) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) {
echo "\n"; echo "\n";
$query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3"; $query = "server=$server&lang=$lang&db=$db&table=$table&goto=tbl_properties.php3";
?> ?>
<!-- Optimize link -->
<tr> <tr>
<td colspan="3" align="center"> <td colspan="3" align="center">
<a href="sql.php3?sql_query=<?php echo urlencode("OPTIMIZE TABLE $table"); ?>&pos=0&<?php echo $query; ?>">[<?php echo $strOptimizeTable; ?>]</a> <a href="sql.php3?sql_query=<?php echo urlencode("OPTIMIZE TABLE $table"); ?>&pos=0&<?php echo $query; ?>">[<?php echo $strOptimizeTable; ?>]</a>
@@ -387,7 +380,7 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
</tr> </tr>
<?php <?php
} }
if (isset($showtable['Data_length']) && $showtable['Rows']>0) { if (isset($showtable['Data_length']) && $showtable['Rows'] > 0) {
echo (++$i%2) echo (++$i%2)
? ' <tr bgcolor="' . $cfgBgcolorTwo . '">' ? ' <tr bgcolor="' . $cfgBgcolorTwo . '">'
: ' <tr bgcolor="' . $cfgBgcolorOne . '">'; : ' <tr bgcolor="' . $cfgBgcolorOne . '">';
@@ -395,10 +388,7 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
?> ?>
<td><?php echo ucfirst($strRowSize) . '&nbsp;&oslash;'; ?></td> <td><?php echo ucfirst($strRowSize) . '&nbsp;&oslash;'; ?></td>
<td align="right"> <td align="right">
<?php <?php echo "$avg_size $avg_unit\n"; ?>
list($avg_size, $avg_unit) =format_byte_down(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows']);
echo "$avg_size $avg_unit\n";
?>
</td> </td>
</tr> </tr>
<?php <?php
@@ -437,6 +427,8 @@ echo "\n";
*/ */
?> ?>
<!-- TABLE WORK --> <!-- TABLE WORK -->
<script src="functions.js" type="text/javascript" language="javascript"></script>
<ul> <ul>
<!-- Printable view of the table --> <!-- Printable view of the table -->
@@ -588,14 +580,14 @@ echo "\n";
<?php echo $strDataOnly; ?>&nbsp;&nbsp; <?php echo $strDataOnly; ?>&nbsp;&nbsp;
</td> </td>
<td> <td>
<input type="checkbox" name="asfile" value="sendit"<?php if (function_exists('gzencode')) { ?>onclick="if (!document.forms['tbl_dump'].elements['asfile'].checked) document.forms['tbl_dump'].elements['gzip'].checked = false<?php }; ?>" /> <input type="checkbox" name="asfile" value="sendit" onclick="return checkTransmitDump(this.form, 'transmit')" />
<?php echo $strSend . "\n"; ?> <?php echo $strSend . "\n"; ?>
<?php <?php
// gzip encode feature // gzip encode feature
if (function_exists('gzencode')) { if (function_exists('gzencode')) {
echo "\n"; echo "\n";
?> ?>
(<input type="checkbox" name="gzip" value="gzip" onclick="document.forms['tbl_dump'].elements['asfile'].checked = true" /><?php echo $strGzip; ?>) (<input type="checkbox" name="gzip" value="gzip" onclick="return checkTransmitDump(this.form, 'gzip')" /><?php echo $strGzip; ?>)
<?php <?php
} }
echo "\n"; echo "\n";