Fixing bug for when the table is a view or information_schema
This commit is contained in:
@@ -1841,34 +1841,36 @@ $(document).ready(function() {
|
|||||||
* in a dropdown menu when the user hovers over the word "More."
|
* 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)
|
// Remove the actions from the table cells (they are available by default for JavaScript-disabled browsers)
|
||||||
$("table[id='tablestructure'] td[class='browse']").remove();
|
// if the table is not a view or information_schema (otherwise there is only one action to hide and there's no point)
|
||||||
$("table[id='tablestructure'] td[class='primary']").remove();
|
if($("input[type='hidden'][name='table_type']").attr("value") == "table") {
|
||||||
$("table[id='tablestructure'] td[class='unique']").remove();
|
$("table[id='tablestructure'] td[class='browse']").remove();
|
||||||
$("table[id='tablestructure'] td[class='index']").remove();
|
$("table[id='tablestructure'] td[class='primary']").remove();
|
||||||
$("table[id='tablestructure'] td[class='fulltext']").remove();
|
$("table[id='tablestructure'] td[class='unique']").remove();
|
||||||
|
$("table[id='tablestructure'] td[class='index']").remove();
|
||||||
|
$("table[id='tablestructure'] td[class='fulltext']").remove();
|
||||||
|
|
||||||
// Display the "more" text
|
// Display the "more" text
|
||||||
$("table[id='tablestructure'] td[class='more_opts']").show()
|
$("table[id='tablestructure'] td[class='more_opts']").show()
|
||||||
|
|
||||||
// Move the dropdown to the left so the right edge is aligned with the parent cell's right edge
|
// Move the dropdown to the left so the right edge is aligned with the parent cell's right edge
|
||||||
// All the more_opts table cells have the same left offset so choose any
|
// All the more_opts table cells have the same left offset so choose any
|
||||||
var parent_cell = $("table[id='tablestructure'] td[class='more_opts']");
|
var parent_cell = $("table[id='tablestructure'] td[class='more_opts']");
|
||||||
var cell_right_edge_offset = parent_cell.offset().left + parent_cell.innerWidth();
|
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
|
// 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 left_offset = cell_right_edge_offset - $(".structure_actions_dropdown").innerWidth();
|
||||||
// var curr_top_offset = $(".structure_actions_dropdown").offset().top;
|
|
||||||
|
|
||||||
$.each($(".structure_actions_dropdown"), function() {
|
$.each($(".structure_actions_dropdown"), function() {
|
||||||
$(this).offset({ left: left_offset });
|
$(this).offset({ left: left_offset });
|
||||||
});
|
});
|
||||||
|
|
||||||
// When "more" is hovered over, show the hidden actions
|
// When "more" is hovered over, show the hidden actions
|
||||||
$("table[id='tablestructure'] td[class='more_opts']").hover(
|
$("table[id='tablestructure'] td[class='more_opts']").hover(
|
||||||
function() {
|
function() {
|
||||||
$(this).children(".structure_actions_dropdown").show();
|
$(this).children(".structure_actions_dropdown").show();
|
||||||
},
|
},
|
||||||
function() {
|
function() {
|
||||||
$(this).children(".structure_actions_dropdown").hide();
|
$(this).children(".structure_actions_dropdown").hide();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
});
|
});
|
@@ -199,10 +199,17 @@ $i = 0;
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
unset($i);
|
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
|
// table body
|
||||||
|
|
||||||
// prepare comments
|
// prepare comments
|
||||||
@@ -469,52 +476,56 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="action_primary">
|
<div class="action_primary">
|
||||||
<?php
|
<?php
|
||||||
if($primary) { ?>
|
if(isset($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']))); ?>"
|
if($primary_enabled) { ?>
|
||||||
onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table) . ($primary ? ' DROP PRIMARY KEY,' : ''); ?> ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
|
<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']))); ?>"
|
||||||
<?php echo $hidden_titles['Primary']; ?>
|
onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table) . ($primary ? ' DROP PRIMARY KEY,' : ''); ?> ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
|
||||||
</a>
|
<?php echo $hidden_titles['Primary']; ?>
|
||||||
<?php
|
</a>
|
||||||
} else {
|
<?php
|
||||||
echo $hidden_titles['NoPrimary'];
|
} else {
|
||||||
}
|
echo $hidden_titles['NoPrimary'];
|
||||||
?>
|
}
|
||||||
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="action_unique">
|
<div class="action_unique">
|
||||||
<?php
|
<?php
|
||||||
if($unique_enabled) { ?>
|
if(isset($unique_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']))); ?>">
|
if($uniqe_enabled) { ?>
|
||||||
<?php echo $hidden_titles['Unique']; ?>
|
<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']))); ?>">
|
||||||
</a>
|
<?php echo $hidden_titles['Unique']; ?>
|
||||||
<?php
|
</a>
|
||||||
} else {
|
<?php
|
||||||
echo $hidden_titles['NoUnique'];
|
} else {
|
||||||
}
|
echo $hidden_titles['NoUnique'];
|
||||||
?>
|
}
|
||||||
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="action_index">
|
<div class="action_index">
|
||||||
<?php
|
<?php
|
||||||
if($index_enabled) { ?>
|
if(isset($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']))); ?>">
|
if($index_enabled) { ?>
|
||||||
<?php echo $hidden_titles['Index']; ?>
|
<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']))); ?>">
|
||||||
</a>
|
<?php echo $hidden_titles['Index']; ?>
|
||||||
<?php
|
</a>
|
||||||
} else {
|
<?php
|
||||||
echo $hidden_titles['NoIndex'];
|
} else {
|
||||||
}
|
echo $hidden_titles['NoIndex'];
|
||||||
?>
|
}
|
||||||
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="action_fulltext">
|
<div class="action_fulltext">
|
||||||
<?php
|
<?php
|
||||||
if($fulltext_enabled) { ?>
|
if(isset($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']))); ?>">
|
if($fulltext_enabled) { ?>
|
||||||
<?php echo $hidden_titles['IdxFulltext']; ?>
|
<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']))); ?>">
|
||||||
</a>
|
<?php echo $hidden_titles['IdxFulltext']; ?>
|
||||||
<?php
|
</a>
|
||||||
} else {
|
<?php
|
||||||
echo $hidden_titles['NoIdxFulltext'];
|
} else {
|
||||||
}
|
echo $hidden_titles['NoIdxFulltext'];
|
||||||
?>
|
}
|
||||||
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user