Skip to content

Commit

Permalink
Start "stay on the sub-pages" work for table properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Chapeaux committed May 1, 2002
1 parent a43b5cc commit 12d4167
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 64 deletions.
44 changes: 2 additions & 42 deletions tbl_properties.php3
Expand Up @@ -4,15 +4,6 @@

require('./tbl_properties_common.php3');

/**
* Drop multiple fields if required
*/
if ((!empty($submit_mult) && isset($selected_fld))
|| isset($mult_btn)) {
$action = 'tbl_properties.php3';
include('./mult_submits.inc.php3');
}


/**
* Defines the query to be displayed in the query textarea
Expand All @@ -35,39 +26,6 @@ if (isset($show_query) && $show_query == 'y') {
unset($sql_query);


/**
* Updates table type, comment and order if required
*/
if (isset($submitcomment)) {
if (get_magic_quotes_gpc()) {
$comment = stripslashes($comment);
}
if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}
}
if (isset($submittype)) {
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}
if (isset($submitorderby) && !empty($order_field)) {
$order_field = PMA_backquote(urldecode($order_field));
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . 'ORDER BY ' . $order_field;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}

/**
* Update table options
*/
if (isset($submitoptions)) {
$local_query = 'ALTER TABLE ' . PMA_backquote($table)
. (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
. (isset($checksum) ? ' checksum=1': ' checksum=0')
. (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0');
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}

/**
* Work on the table
*/
Expand Down Expand Up @@ -161,6 +119,8 @@ echo "\n";
</ul>

<?php


/**
* Displays the footer
*/
Expand Down
2 changes: 1 addition & 1 deletion tbl_properties_links.php3
Expand Up @@ -52,7 +52,7 @@ if ($num_rows > 0) {
<b><?php echo $strOptions; ?></b></a>
&nbsp;]&nbsp;&nbsp;&nbsp;
[&nbsp;
<a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
<a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties' . $sub_part . '.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
class="drop" onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<b><?php echo $strDrop; ?></b></a>
&nbsp;]
Expand Down
31 changes: 22 additions & 9 deletions tbl_properties_operations.php3
Expand Up @@ -3,15 +3,35 @@


require('./tbl_properties_common.php3');


/**
* Reordering the table has been requested by the user
*/
if (isset($submitorderby) && !empty($order_field)) {
$order_field = PMA_backquote(urldecode($order_field));
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . 'ORDER BY ' . $order_field;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
} // end if


require('./tbl_properties_table_info.php3');

// Get columns names

/**
* Get columns names
*/
$local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
for ($i = 0; $row = mysql_fetch_array($result); $i++) {
$columns[$i] = $row['Field'];
}
mysql_free_result($result);


/**
* Displays the page
*/
?>
<ul>

Expand All @@ -20,7 +40,7 @@ if (PMA_MYSQL_INT_VERSION >= 32334) {
?>
<!-- Order the table -->
<li>
<form method="post" action="tbl_properties.php3">
<form method="post" action="tbl_properties_operations.php3">
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="db" value="<?php echo $db; ?>" />
Expand Down Expand Up @@ -302,13 +322,6 @@ if (!empty($cfg['Server']['relation'])) {
<br /><br />
</li>

<!-- Deletes the table -->
<li>
<a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">
<?php echo $strDropTable; ?></a>
</li>

</ul>

<?php
Expand Down
33 changes: 30 additions & 3 deletions tbl_properties_options.php3
Expand Up @@ -6,6 +6,33 @@
* Gets tables informations and displays top links
*/
require('./tbl_properties_common.php3');


/**
* Updates table comment, type and options if required
*/
if (isset($submitcomment)) {
if (get_magic_quotes_gpc()) {
$comment = stripslashes($comment);
}
if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}
}
if (isset($submittype)) {
$local_query = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $tbl_type;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}
if (isset($submitoptions)) {
$local_query = 'ALTER TABLE ' . PMA_backquote($table)
. (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
. (isset($checksum) ? ' checksum=1': ' checksum=0')
. (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0');
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url);
}


require('./tbl_properties_table_info.php3');


Expand All @@ -17,7 +44,7 @@ if (PMA_MYSQL_INT_VERSION >= 32322) {
<ul>
<!-- Table comments -->
<li>
<form method="post" action="tbl_properties.php3">
<form method="post" action="tbl_properties_options.php3">
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="db" value="<?php echo $db; ?>" />
Expand Down Expand Up @@ -67,7 +94,7 @@ if (PMA_MYSQL_INT_VERSION >= 32322) {
echo "\n";
?>
<li>
<form method="post" action="tbl_properties.php3">
<form method="post" action="tbl_properties_options.php3">
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="db" value="<?php echo $db; ?>" />
Expand All @@ -92,7 +119,7 @@ if (PMA_MYSQL_INT_VERSION >= 32322) {
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<form method="post" action="tbl_properties.php3">
<form method="post" action="tbl_properties_options.php3">
<input type="hidden" name="server" value="<?php echo $server; ?>" />
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="db" value="<?php echo $db; ?>" />
Expand Down
18 changes: 9 additions & 9 deletions tbl_properties_structure.php3
Expand Up @@ -9,7 +9,7 @@ require('./tbl_properties_common.php3');
*/
if ((!empty($submit_mult) && isset($selected_fld))
|| isset($mult_btn)) {
$action = 'tbl_properties.php3';
$action = 'tbl_properties_structure.php3';
include('./mult_submits.inc.php3');
}

Expand Down Expand Up @@ -257,6 +257,7 @@ if ($fields_cnt > 20) {
<!-- Browse links -->
<?php
echo "\n";
$sub_part = '_structure';
include('./tbl_properties_links.php3');
} // end if ($fields_cnt > 20)
echo "\n\n";
Expand Down Expand Up @@ -480,7 +481,6 @@ echo "\n";
<hr />



<?php
/**
* Work on the table
Expand Down Expand Up @@ -521,17 +521,17 @@ unset($aryFields);

<?php
if ($cfg['Server']['relation']) {
?>
<!-- Work on Relations -->
?>
<!-- Work on Relations -->
<li>
<div style="margin-bottom: 10px"><a href="tbl_relation.php3?<?php
echo $url_query; ?>"><?php echo $strRelationView; ?></a></div>
<div style="margin-bottom: 10px">
<a href="tbl_relation.php3?<?php echo $url_query; ?>"><?php echo $strRelationView; ?></a>
</div>
</li>

<?php
<?php
}
echo "\n";
?>

</ul>

<?php
Expand Down
1 change: 1 addition & 0 deletions tbl_properties_table_info.php3
Expand Up @@ -39,6 +39,7 @@ mysql_free_result($result);
* Displays top menu links
*/
echo '<!-- first browse links -->' . "\n";
$sub_part = '_table_info';
require('./tbl_properties_links.php3');


Expand Down

0 comments on commit 12d4167

Please sign in to comment.