Fixing bug for when the table is a view or information_schema
This commit is contained in:
@@ -1841,6 +1841,8 @@ $(document).ready(function() {
|
||||
* in a dropdown menu when the user hovers over the word "More."
|
||||
*/
|
||||
// Remove the actions from the table cells (they are available by default for JavaScript-disabled browsers)
|
||||
// if the table is not a view or information_schema (otherwise there is only one action to hide and there's no point)
|
||||
if($("input[type='hidden'][name='table_type']").attr("value") == "table") {
|
||||
$("table[id='tablestructure'] td[class='browse']").remove();
|
||||
$("table[id='tablestructure'] td[class='primary']").remove();
|
||||
$("table[id='tablestructure'] td[class='unique']").remove();
|
||||
@@ -1856,7 +1858,6 @@ $(document).ready(function() {
|
||||
var cell_right_edge_offset = parent_cell.offset().left + parent_cell.innerWidth();
|
||||
// All the structure_actions_dropdown divs have the same left offset so choose any
|
||||
var left_offset = cell_right_edge_offset - $(".structure_actions_dropdown").innerWidth();
|
||||
// var curr_top_offset = $(".structure_actions_dropdown").offset().top;
|
||||
|
||||
$.each($(".structure_actions_dropdown"), function() {
|
||||
$(this).offset({ left: left_offset });
|
||||
@@ -1871,4 +1872,5 @@ $(document).ready(function() {
|
||||
$(this).children(".structure_actions_dropdown").hide();
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
@@ -199,10 +199,17 @@ $i = 0;
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
unset($i);
|
||||
|
||||
|
||||
echo '<input type="hidden" name="table_type" value=';
|
||||
if($db_is_information_schema) {
|
||||
echo '"information_schema" />';
|
||||
} else if ($tbl_is_view) {
|
||||
echo '"view" />';
|
||||
} else {
|
||||
echo '"table" />';
|
||||
}
|
||||
// table body
|
||||
|
||||
// prepare comments
|
||||
@@ -469,7 +476,8 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
||||
</div>
|
||||
<div class="action_primary">
|
||||
<?php
|
||||
if($primary) { ?>
|
||||
if(isset($primary_enabled)) {
|
||||
if($primary_enabled) { ?>
|
||||
<a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ($primary ? ' DROP PRIMARY KEY,' : '') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf(__('A primary key has been added on %s'), htmlspecialchars($row['Field']))); ?>"
|
||||
onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table) . ($primary ? ' DROP PRIMARY KEY,' : ''); ?> ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
|
||||
<?php echo $hidden_titles['Primary']; ?>
|
||||
@@ -478,11 +486,12 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
||||
} else {
|
||||
echo $hidden_titles['NoPrimary'];
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
</div>
|
||||
<div class="action_unique">
|
||||
<?php
|
||||
if($unique_enabled) { ?>
|
||||
if(isset($unique_enabled)) {
|
||||
if($uniqe_enabled) { ?>
|
||||
<a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
|
||||
<?php echo $hidden_titles['Unique']; ?>
|
||||
</a>
|
||||
@@ -490,10 +499,11 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
||||
} else {
|
||||
echo $hidden_titles['NoUnique'];
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
</div>
|
||||
<div class="action_index">
|
||||
<?php
|
||||
if(isset($index_enabled)) {
|
||||
if($index_enabled) { ?>
|
||||
<a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
|
||||
<?php echo $hidden_titles['Index']; ?>
|
||||
@@ -502,10 +512,11 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
||||
} else {
|
||||
echo $hidden_titles['NoIndex'];
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
</div>
|
||||
<div class="action_fulltext">
|
||||
<?php
|
||||
if(isset($fulltext_enabled)) {
|
||||
if($fulltext_enabled) { ?>
|
||||
<a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
|
||||
<?php echo $hidden_titles['IdxFulltext']; ?>
|
||||
@@ -514,7 +525,7 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
||||
} else {
|
||||
echo $hidden_titles['NoIdxFulltext'];
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user