From 9badb87f1aef2f92552e5545f57628e864d7bcbf Mon Sep 17 00:00:00 2001 From: lorilee Date: Wed, 14 Jul 2010 11:55:31 -0700 Subject: [PATCH] Reveal-on-hover table structure actions --- js/functions.js | 24 ++++++ tbl_structure.php | 98 +++++++++++++++++++++--- themes/original/css/theme_right.css.php | 21 ++++- themes/original/img/more.png | Bin 0 -> 553 bytes 4 files changed, 132 insertions(+), 11 deletions(-) create mode 100644 themes/original/img/more.png diff --git a/js/functions.js b/js/functions.js index 4f425b314..cbfe0e38a 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1829,4 +1829,28 @@ $(document).ready(function() { 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) + $("table[id='tablestructure'] td[class='browse']").remove(); + $("table[id='tablestructure'] td[class='primary']").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 + $("table[id='tablestructure'] td[class='more_opts']").show() + + // When "more" is hovered over, show the hidden actions + $("table[id='tablestructure'] td[class='more_opts']").hover( + function() { + $(this).children(".structure_actions_dropdown").show(); + }, + function() { + $(this).children(".structure_actions_dropdown").hide(); + } + ); }); \ No newline at end of file diff --git a/tbl_structure.php b/tbl_structure.php index 8f1f26db9..cfbd961ad 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -160,6 +160,18 @@ $titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), tru $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'), true, true); +$hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'), true, true); +$hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true, true); +$hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Index'), true, true); +$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true, true); +$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'), true, true); +$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true, true); +$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'), true, true); +$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true, true); + /** * Displays the table structure ('show table' works correct since 3.23.03) */ @@ -361,59 +373,63 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { echo '' . _pgettext('None for default','None') . ''; } ?> - + - + - + - + hasColumn($field_name))) { echo $titles['NoPrimary'] . "\n"; + $primary = false; } else { echo "\n"; ?> - - + - - + @@ -424,22 +440,84 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) { && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char'))) { echo "\n"; ?> - + + - + + + + More +
+ +
+ + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ + + + + +
+
+ ; color: ; } @@ -1391,4 +1392,22 @@ a.close_enum_editor { #enum_editor_output { margin-top: 50px; +} + +/** + * Table structure styles + */ +.structure_actions_dropdown { + position: absolute; + padding: 3px; + display: none; + margin-left: 30px; +} + +td.more_opts { + display: none; +} + +table#tablestructure { + margin-right: 50px; } \ No newline at end of file diff --git a/themes/original/img/more.png b/themes/original/img/more.png new file mode 100644 index 0000000000000000000000000000000000000000..e83694b3b67f35cc5f73fdfc466a1e9d12c18caa GIT binary patch literal 553 zcmeAS@N?(olHy`uVBq!ia0vp@3=9k$9Bd2>3`%OH=NT9nSkfJR9T^zbpD<_bdda}R zI5X4PIl$A|Ss|b(KP@vSm4TsxaqXn@-b{`n$M@&82wYSB?I`f(q)kSLkcP_wIjuJd zN)h+2l?FRrPc7T>i+LCK-9^s!3xZvizjz`4K=*}!Aj@CI#tW(`)tj9wJYHSmG5$Ss z`~AxNdwUqC%u9t98S`wjU+hpuZJ z)i;x0+|Y2`U#i}d=oOXU`r}dFw(Ua*--jniKw}0)r zaa*--#?x7zfBa8YzKd-a-`%+`pR zM|j*d`TBH%RIf`|%RBC}+QJlF%Mbnx3=GzuE{-7*lF11Q%mz+h|EN3aEBgq0@Eb}U zd^OQj@DfKjce;Wl|Lk6kR{<6lCXa%em&hDElBVo5EkumL(2b3?zx16u0|Nttr>mdK II;Vst02H+9BLDyZ literal 0 HcmV?d00001