Dropped the "More" dropdown from tbl_structure.php
This commit is contained in:
parent
a2df2ed10d
commit
da4196f03f
@ -28,7 +28,6 @@ AJAX.registerTeardown('tbl_structure.js', function() {
|
||||
$("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").die('click');
|
||||
$('#index_frm input[type=submit]').die('click');
|
||||
$("#move_columns_anchor").die('click');
|
||||
$("#addColumns.ajax input[type=submit]").die('click');
|
||||
});
|
||||
|
||||
AJAX.registerOnload('tbl_structure.js', function() {
|
||||
@ -347,142 +346,3 @@ function reloadFieldForm(message) {
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides certain table structure actions, replacing them
|
||||
* with the word "More". They are displayed in a dropdown
|
||||
* menu when the user hovers over the word "More."
|
||||
*/
|
||||
function moreOptsMenuResize() {
|
||||
var $table = $("#tablestructure");
|
||||
|
||||
// don't use More menu if we're only showing icons and no text
|
||||
if ($table.length == 0 || $table.hasClass("PropertiesIconic")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// reset table to defaults
|
||||
if ($table_clone === false) {
|
||||
$table_clone = $table.clone();
|
||||
}
|
||||
else {
|
||||
$table.replaceWith($table_clone);
|
||||
$table = $table_clone;
|
||||
$table_clone = $table.clone();
|
||||
}
|
||||
|
||||
$table.find("td.more_opts").hide();
|
||||
|
||||
var getCurWidth = function() {
|
||||
var cur_width = 0;
|
||||
$table.find("tr").eq(1)
|
||||
.find("td.edit, td.drop, .replaced_by_more:visible, .more_opts:visible")
|
||||
.each(function () {
|
||||
cur_width += $(this).outerWidth();
|
||||
});
|
||||
return cur_width;
|
||||
};
|
||||
|
||||
// get window width
|
||||
var window_width = $(window).width()
|
||||
- $('#pma_navigation').width()
|
||||
- $('#pma_navigation_resizer').width();
|
||||
|
||||
// find out maximum action links width
|
||||
var max_width = window_width;
|
||||
$table.find("tr").eq(0).children().each(function () {
|
||||
if ($(this).index() < 9) {
|
||||
max_width -= $(this).outerWidth() + 1;
|
||||
}
|
||||
});
|
||||
|
||||
// current action links width
|
||||
var cur_width = getCurWidth();
|
||||
|
||||
// remove some links if current width is wider than maximum allowed
|
||||
if (cur_width > max_width && $table.find("td.more_opts").length != 0) {
|
||||
while (cur_width > max_width
|
||||
&& $(".replaced_by_more:visible").length > 0) {
|
||||
|
||||
// hide last visible element
|
||||
var css_class = $table.find("tr").eq(1)
|
||||
.find(".replaced_by_more:visible").last().prop("className").split(" ");
|
||||
$table.find("." + css_class.join(".")).hide();
|
||||
// show corresponding more-menu entry
|
||||
$table.find(".replace_in_more.action_" + css_class[0]).show();
|
||||
$table.find("td.more_opts").show();
|
||||
// recalculate width
|
||||
cur_width = getCurWidth();
|
||||
}
|
||||
}
|
||||
|
||||
if ($(".replaced_by_more:hidden").length == 0) {
|
||||
$table.find("td.more_opts").hide();
|
||||
}
|
||||
|
||||
// wait for topmenu resize handler
|
||||
setTimeout(function () {
|
||||
// Position the dropdown
|
||||
$(".structure_actions_dropdown").each(function() {
|
||||
// Optimize DOM querying
|
||||
var $this_dropdown = $(this);
|
||||
// The top offset must be set for IE even if it didn't change
|
||||
var cell_right_edge_offset = $this_dropdown.parent().position().left + $this_dropdown.parent().innerWidth();
|
||||
var left_offset = cell_right_edge_offset - $this_dropdown.innerWidth();
|
||||
var top_offset = $this_dropdown.parent().position().top + $this_dropdown.parent().innerHeight();
|
||||
$this_dropdown.css({ top: top_offset, left: left_offset });
|
||||
});
|
||||
}, 100);
|
||||
|
||||
// A hack for IE6 to prevent the after_field select element from being displayed on top of the dropdown by
|
||||
// positioning an iframe directly on top of it
|
||||
var $after_field = $("select[name='after_field']");
|
||||
// This dropdown is only present for a table, not for a view
|
||||
if ($after_field.length) {
|
||||
$("iframe[class='IE_hack']")
|
||||
.width($after_field.width())
|
||||
.height($after_field.height())
|
||||
.offset({
|
||||
top: $after_field.offset().top,
|
||||
left: $after_field.offset().left
|
||||
});
|
||||
}
|
||||
|
||||
// When "more" is hovered over, show the hidden actions
|
||||
$table.find("td.more_opts")
|
||||
.unbind("mouseenter")
|
||||
.bind("mouseenter", function() {
|
||||
if($.browser.msie && $.browser.version == "6.0") {
|
||||
$("iframe[class='IE_hack']")
|
||||
.show()
|
||||
.width($after_field.width()+4)
|
||||
.height($after_field.height()+4)
|
||||
.offset({
|
||||
top: $after_field.offset().top,
|
||||
left: $after_field.offset().left
|
||||
});
|
||||
}
|
||||
$(".structure_actions_dropdown").hide(); // Hide all the other ones that may be open
|
||||
$(this).children(".structure_actions_dropdown").show();
|
||||
// Need to do this again for IE otherwise the offset is wrong
|
||||
if($.browser.msie) {
|
||||
var left_offset_IE = $(this).offset().left + $(this).innerWidth() - $(this).children(".structure_actions_dropdown").innerWidth();
|
||||
var top_offset_IE = $(this).offset().top + $(this).innerHeight();
|
||||
$(this).children(".structure_actions_dropdown").offset({
|
||||
top: top_offset_IE,
|
||||
left: left_offset_IE });
|
||||
}
|
||||
})
|
||||
.unbind("mouseleave")
|
||||
.bind("mouseleave", function() {
|
||||
$(this).children(".structure_actions_dropdown").hide();
|
||||
if($.browser.msie && $.browser.version == "6.0") {
|
||||
$("iframe[class='IE_hack']").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
AJAX.registerOnload('tbl_structure.js', function () {
|
||||
$(window).resize(moreOptsMenuResize); // FIXME: shouldn't register that can't be unbound easily
|
||||
$("div.replace_in_more").hide();
|
||||
moreOptsMenuResize();
|
||||
});
|
||||
|
||||
@ -1806,135 +1806,6 @@ function getHtmlForRowStatsTable($showtable, $tbl_collation,
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML divs for Structure Action drop down
|
||||
*
|
||||
* @param string $class link class
|
||||
* @param boolean $isActionEnabled whether action is enabled or not
|
||||
* @param string $url_query url query
|
||||
* @param array $row current row
|
||||
* @param array $hidden_titles hidden titles if action enabled
|
||||
* @param array $hidden_titles_no hidden titles if action not enabled
|
||||
* @param boolean $primary primary or not
|
||||
* @param string $syntax syntax for add action
|
||||
* @param string $message message to be shown
|
||||
* @param boolean $isPrimary is primary action
|
||||
*
|
||||
* @return string $html_output
|
||||
*/
|
||||
function PMA_getHtmlDivsForStructureActionsDropdown($class, $isActionEnabled,
|
||||
$url_query, $row, $hidden_titles, $hidden_titles_no, $primary, $syntax,
|
||||
$message, $isPrimary
|
||||
) {
|
||||
$html_output = '<div class="replace_in_more">';
|
||||
if ($isActionEnabled) {
|
||||
$html_output .= '<a class="' . $class . '" href="sql.php?' . $url_query
|
||||
. '&sql_query='
|
||||
. urlencode(
|
||||
'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table'])
|
||||
. ($isPrimary ? ($primary ? ' DROP PRIMARY KEY,' : '') : '')
|
||||
. ' ' . $syntax . '('
|
||||
. PMA_Util::backquote($row['Field']) . ');'
|
||||
)
|
||||
. '&message_to_show=' . urlencode(
|
||||
sprintf(
|
||||
$message,
|
||||
htmlspecialchars($row['Field'])
|
||||
)
|
||||
)
|
||||
. '">'
|
||||
. $hidden_titles
|
||||
. '</a>';
|
||||
} else {
|
||||
$html_output .= $hidden_titles_no;
|
||||
}
|
||||
$html_output .= '</div>';
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML snippet for more option in table structure
|
||||
*
|
||||
* @param type $rownum row numbers
|
||||
* @param type $primary_enabled is primary enabled
|
||||
* @param type $url_query url query
|
||||
* @param type $row current row
|
||||
* @param type $hidden_titles hidden titles array
|
||||
* @param type $unique_enabled is unique enabled
|
||||
* @param type $index_enabled is index enabled
|
||||
* @param type $fulltext_enabled is fulltext enabled
|
||||
* @param type $spatial_enabled is spatial enabled
|
||||
* @param type $primary primary
|
||||
*
|
||||
* @return string $html_output
|
||||
*/
|
||||
function PMA_getHtmlForMoreOptionInTableStructure($rownum, $primary_enabled,
|
||||
$url_query, $row, $hidden_titles, $unique_enabled, $index_enabled,
|
||||
$fulltext_enabled, $spatial_enabled, $primary
|
||||
) {
|
||||
$html_output = '<td class="more_opts" id="more_opts' . $rownum . '">';
|
||||
$html_output .= PMA_Util::getImage(
|
||||
'more.png', __('Show more actions')
|
||||
) . __('More');
|
||||
$html_output .= '<div class="structure_actions_dropdown" id="row_' . $rownum . '">';
|
||||
|
||||
$class = 'action_primary' . ($GLOBALS['cfg']['AjaxEnable'] ? ' ajax' : '');
|
||||
$html_output .= PMA_getHtmlDivsForStructureActionsDropdown(
|
||||
$class, $primary_enabled, $url_query, $row, $hidden_titles['Primary'],
|
||||
$hidden_titles['NoPrimary'], $primary, 'ADD PRIMARY KEY',
|
||||
__('A primary key has been added on %s'), true
|
||||
);
|
||||
|
||||
$html_output .= PMA_getHtmlDivsForStructureActionsDropdown(
|
||||
'action_unique replace_in_more',
|
||||
$unique_enabled, $url_query, $row, $hidden_titles['Unique'],
|
||||
$hidden_titles['NoUnique'], false, 'ADD UNIQUE',
|
||||
__('An index has been added on %s'), false
|
||||
);
|
||||
|
||||
$html_output .= PMA_getHtmlDivsForStructureActionsDropdown(
|
||||
'action_index replace_in_more',
|
||||
$index_enabled, $url_query, $row, $hidden_titles['Index'],
|
||||
$hidden_titles['NoIndex'], false, 'ADD INDEX',
|
||||
__('An index has been added on %s'), false
|
||||
);
|
||||
if (!PMA_DRIZZLE) {
|
||||
$html_output .= PMA_getHtmlDivsForStructureActionsDropdown(
|
||||
'action_spatial replace_in_more',
|
||||
$spatial_enabled, $url_query, $row,
|
||||
$hidden_titles['Spatial'],
|
||||
$hidden_titles['NoSpatial'], false, 'ADD SPATIAL',
|
||||
__('An index has been added on %s'), false
|
||||
);
|
||||
|
||||
$html_output .= PMA_getHtmlDivsForStructureActionsDropdown(
|
||||
'action_fulltext replace_in_more',
|
||||
$fulltext_enabled, $url_query, $row,
|
||||
$hidden_titles['IdxFulltext'],
|
||||
$hidden_titles['NoIdxFulltext'], false, 'ADD FULLTEXT',
|
||||
__('An index has been added on %s'), false
|
||||
);
|
||||
|
||||
$html_output .= '<div class="action_browse replace_in_more">';
|
||||
$html_output .= '<a href="sql.php?' . $url_query
|
||||
. '&sql_query=' . urlencode(
|
||||
'SELECT COUNT(*) AS ' . PMA_Util::backquote(__('Rows'))
|
||||
. ', ' . PMA_Util::backquote($row['Field'])
|
||||
. ' FROM ' . PMA_Util::backquote($GLOBALS['table'])
|
||||
. ' GROUP BY ' . PMA_Util::backquote($row['Field'])
|
||||
. ' ORDER BY ' . PMA_Util::backquote($row['Field'])
|
||||
)
|
||||
. '&browse_distinct=1">'
|
||||
. $hidden_titles['DistinctValues']
|
||||
. '</a>';
|
||||
$html_output .= '</div>';
|
||||
}
|
||||
$html_output .= '</div></td>';
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML snippet for action row in structure table,
|
||||
* This function returns common HTML <td> for Primary, Unique, Index,
|
||||
@ -2150,16 +2021,6 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
|
||||
}
|
||||
$html_output .= PMA_getHtmlForDistinctValueAction($url_query, $row, $titles);
|
||||
|
||||
if ($GLOBALS['cfg']['PropertiesIconic'] !== true
|
||||
&& $GLOBALS['cfg']['HideStructureActions'] === true
|
||||
) {
|
||||
$html_output .= PMA_getHtmlForMoreOptionInTableStructure(
|
||||
$rownum, $primary_enabled, $url_query, $row, $hidden_titles,
|
||||
$unique_enabled, $index_enabled,
|
||||
$fulltext_enabled, $spatial_enabled, $primary
|
||||
);
|
||||
}
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
|
||||
@ -176,11 +176,7 @@ if ($db_is_information_schema) {
|
||||
}
|
||||
$response->addHTML($tabletype);
|
||||
|
||||
$tablestructure = '<table id="tablestructure" class="data';
|
||||
if ($GLOBALS['cfg']['PropertiesIconic'] === true) {
|
||||
$tablestructure .= ' PropertiesIconic';
|
||||
}
|
||||
$tablestructure .= '">';
|
||||
$tablestructure = '<table id="tablestructure" class="data">';
|
||||
$response->addHTML($tablestructure);
|
||||
|
||||
|
||||
@ -355,10 +351,6 @@ $response->addHTML(
|
||||
if (! $tbl_is_view && ! $db_is_information_schema) {
|
||||
$response->addHTML('<br />');
|
||||
$response->addHTML(PMA_getHtmlForAddColumn($columns_list));
|
||||
|
||||
$response->addHTML(
|
||||
'<iframe class="IE_hack"></iframe><hr />'
|
||||
);
|
||||
$response->addHTML(
|
||||
'<div id="index_div" '
|
||||
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '') . ' >'
|
||||
|
||||
@ -1796,15 +1796,6 @@ table#index_columns select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
iframe.IE_hack {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
display: none;
|
||||
border: 0;
|
||||
filter: alpha(opacity=0);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#move_columns_dialog div {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
@ -2234,15 +2234,6 @@ table#index_columns select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
iframe.IE_hack {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
display: none;
|
||||
border: 0;
|
||||
filter: alpha(opacity=0);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#move_columns_dialog div {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user