From fa1b8d5c948b9263b8a19381f8b5e0aafff11e7a Mon Sep 17 00:00:00 2001 From: Nettika Date: Mon, 21 Apr 2025 00:26:28 -0700 Subject: [PATCH] Remove more table actions dropdown Add spatial index action icons --- js/functions.js | 72 --------- libraries/common.lib.php | 19 +++ tbl_structure.php | 190 +++++------------------- themes/original/css/theme_left.css.php | 6 + themes/original/css/theme_right.css.php | 36 +---- themes/original/img/b_spatial.png | Bin 0 -> 4033 bytes themes/original/img/bd_spatial.png | Bin 0 -> 344 bytes 7 files changed, 66 insertions(+), 257 deletions(-) create mode 100644 themes/original/img/b_spatial.png create mode 100644 themes/original/img/bd_spatial.png diff --git a/js/functions.js b/js/functions.js index 824c1743c..07b958b21 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1922,78 +1922,6 @@ $(document).ready(function() { $("input[id='" + values_id + "']").attr("value", value_array.join(",")); disable_popup(); }); - - /** - * 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." - */ - // 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']").val() == "table") { - var $table = $("table[id='tablestructure']"); - $table.find("td[class='browse']").remove(); - $table.find("td[class='primary']").remove(); - $table.find("td[class='unique']").remove(); - $table.find("td[class='index']").remove(); - $table.find("td[class='fulltext']").remove(); - $table.find("th[class='action']").attr("colspan", 3); - - // Display the "more" text - $table.find("td[class='more_opts']").show(); - - // 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().offset().left + $this_dropdown.parent().innerWidth(); - var left_offset = cell_right_edge_offset - $this_dropdown.innerWidth(); - var top_offset = $this_dropdown.parent().offset().top + $this_dropdown.parent().innerHeight(); - $this_dropdown.offset({ top: top_offset, left: left_offset }); - }); - - // 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']"); - $("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[class='more_opts']") - .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 }); - } - }) - .mouseleave(function() { - $(this).children(".structure_actions_dropdown").hide(); - if($.browser.msie && $.browser.version == "6.0") { - $("iframe[class='IE_hack']").hide(); - } - }); - } }); /* Displays tooltips */ diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 214f7b053..bce807218 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -123,6 +123,25 @@ function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = f return $button; } +/** + * Creates a span with only an icon + * + * @uses $GLOBALS['pmaThemeImage'] + * @uses htmlspecialchars() + * @param string $icon name of icon file + * @param string $alternate alternate text + * @return string span with icon + */ +function PMA_getOnlyIcon($icon, $alternate = '') { + + $alternate = htmlspecialchars($alternate); + + return '' + . '' . $alternate . ''; +} + /** * Displays the maximum size for an upload * diff --git a/tbl_structure.php b/tbl_structure.php index e134f0eae..4cd4b0551 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -147,36 +147,18 @@ $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table)); /** * prepare table infos */ -// action titles (image or string) -$titles = array(); -$titles['Change'] = PMA_getIcon('b_edit.png', __('Change'), true); -$titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true); -$titles['NoDrop'] = PMA_getIcon('b_drop.png', __('Drop'), true); -$titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'), true); -$titles['Index'] = PMA_getIcon('b_index.png', __('Index'), true); -$titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'), true); -$titles['Spatial'] = PMA_getIcon('b_ftext.png', __('Spatial'), true); -$titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'), true); -$titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true); -$titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true); -$titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true); -$titles['NoSpatial'] = PMA_getIcon('bd_ftext.png', __('Spatial'), true); -$titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true); -$titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true); - -// hidden action titles (image and string) -$hidden_titles = array(); -$hidden_titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), false, true); -$hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Add primary key'), false, true); -$hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Add primary key'), false, true); -$hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Add index'), false, true); -$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), false, true); -$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), false, true); -$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), false, true); -$hidden_titles['Spatial'] = PMA_getIcon('b_ftext.png', __('Add SPATIAL index'), false, true); -$hidden_titles['NoSpatial'] = PMA_getIcon('bd_ftext.png', __('Add SPATIAL index'), false, true); -$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), false, true); -$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), false, true); +// action icons +$titles = [ + 'Change' => PMA_getOnlyIcon('b_edit.png', __('Change')), + 'Drop' => PMA_getOnlyIcon('b_drop.png', __('Drop')), + 'NoDrop' => PMA_getOnlyIcon('b_drop.png', __('Drop')), + 'Primary' => PMA_getOnlyIcon('b_primary.png', __('Primary')), + 'Index' => PMA_getOnlyIcon('b_index.png', __('Index')), + 'Unique' => PMA_getOnlyIcon('b_unique.png', __('Unique')), + 'Spatial' => PMA_getOnlyIcon('bd_spatial.png', __('Spatial')), + 'IdxFulltext' => PMA_getOnlyIcon('b_ftext.png', __('Fulltext')), + 'BrowseDistinctValues' => PMA_getOnlyIcon('b_browse.png', __('Browse distinct values')) +]; /** * Displays the table structure ('show table' works correct since 3.23.03) @@ -211,7 +193,7 @@ $i = 0; - + @@ -411,169 +393,66 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { hasColumn($field_name))) { - echo $titles['NoPrimary'] . "\n"; $primary_enabled = false; } else { - echo "\n"; - ?> - - - + ?> + + - - - + ?> + href="sql.php?&sql_query=&message_to_show="> + - - - + href="sql.php?&sql_query=&message_to_show="> + - + - - - + href="sql.php?&sql_query=&message_to_show="> + - + - - - - - - - - - + href="sql.php?&sql_query=&message_to_show="> + - - <?php echo __('Show more actions'); ?> -
- -
- - - -
-
> - - - - - -
-
- - - - - -
-
- - - - - -
-
- - - - - -
-
- - - - - -
-
- - @@ -612,7 +491,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) { } if (! empty($tbl_type) && $tbl_type == 'MYISAM') { - PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_ftext.png', 'spatial'); + PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_spatial.png', 'spatial'); } if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')) { PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext'); @@ -701,7 +580,6 @@ if (! $tbl_is_view && ! $db_is_information_schema) { ?> -
; color: ; } @@ -1525,33 +1530,6 @@ a.close_enum_editor { margin-top: 50px; } -/** - * Table structure styles - */ -.structure_actions_dropdown { - position: absolute; - padding: 3px; - display: none; - z-index: 100; -} - -.structure_actions_dropdown a { - display: block; -} - -td.more_opts { - display: none; - white-space: nowrap; -} - -iframe.IE_hack { - z-index: 1; - position: absolute; - display: none; - border: 0; - filter: alpha(opacity=0); -} - /* config forms */ .config-form ul.tabs { margin: 1.1em 0.2em 0; diff --git a/themes/original/img/b_spatial.png b/themes/original/img/b_spatial.png new file mode 100644 index 0000000000000000000000000000000000000000..32b30fa6d5f0f11f2675cd032e7832da6a298f00 GIT binary patch literal 4033 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QUeMw%_l4aq{kHnBtuu zB+8)><2h_rg<0#nl|vPbdnQ%(0u&Jv4>Ce92&V) z3K#@9Hm4{S|5avW_)%wLqpfs+eIEm3#bs^|h6BE{4;aX_|L1?@G&6>=p@s24$wUip zjs_71hpIlOWeg5(j16;Vs0A}DU|~o&ot*TTAwZWQLB0OjWrl{iKW0`lGDJ^N6lGj6 zkwHN?wZnxW!ikmJBy^84Ntb(>xe9Y-c!dPJnw80|yU-L10I# zCId?~L&6DV{m6P8Cbn#%K=RLiX@*JvohYp5odf zW{FIRvmEpeRnC+&YBb@0@c9e_!-9#Tf)AQM|E)O3x9;3Iv%YP7@w%_}v;9{}N_zb7 z>G{N}Qz_~!yp*tjm7 zu=D24r%#^T@H*lYop>s|_Fwv;_ygg8bAHy@{Q3U%!M;Z-jYhGJ?kqnZ96IyGXQ|Bj zNt`W7cb@gT|Jly{|Bvitr6Zn6J0rA29tR2)_PNaJ`E0aQsncna=26v4|5F~_*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$cSrz+eoDq%+2#Xh<^#1vCRF)Ini46QmUs91NgHn0dw+kIMHcQ1*ttJp|FME&@2|iA`Tpm^1^4I7zA|aj{`U5j zxw+*X9ewHPSt%*$g+&c{`88SD`L~`tS+-{N)f?At-oJJJ{F#FX_if#}<-q>^uU@@+ z^5n_m$B%dK-d$5uQ(Rp9|NsAUzFi^=42%pVL4LuYtT2KxL-2QYRR#uzE1oWnAr-e` z&hPg+oFL);@N=E#Ew!sYkJfo;ime(6cC_W7fmW_0fK>cTjtCr|rUuGn&GOBw5h?Qa>>*ByzSWE3w{Tqn5v-q$UP zjXaZI>3dIiWHdjzS0Zv-{pWj;^AEmU@M7j3-g^&EW`9VW$X>C9S>WAYMS+H2VoJ*{ zKVx-xyGNGsOxp2s5v~o<@rOUxiWG9p_>-7Fx8=J3g@&VSS*!bh-hMHC+k}-CyK?rt j{MVCp`rqgM>bP0l+XkK3bZXa literal 0 HcmV?d00001 diff --git a/themes/original/img/bd_spatial.png b/themes/original/img/bd_spatial.png new file mode 100644 index 0000000000000000000000000000000000000000..d1ee4d62e848070de542e148966714d316996f1c GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4rT@h1`S>QUHwb**Z=?jZvla=TefW5 zwr$6eBUewIdT`>zo$cHA96fsC?Ad1*FT6i@?$wSR`*-d-xOwxIUAuPOzkmPD`?t@Y zJ-dAE+N(FOZ{NPPfB*ikU%!6(^y%-PKYzaexwY`t*`~A44nBMP>C=Oa4=(mx{Pf_{ zhYug_uDtvG_4mg+A3r<$?97=nvD=?qVqjpH;pyTSA|c6oFwo1%QG)Hl=exhNBL%iK zDXsdOzr5=6LIn+#3qEsao?~PX@I2