From e82c53f93df773024548bc281eb96068f99ed65f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 09:34:37 +0200 Subject: [PATCH 1/8] Move navigation node CSS class generation to Node object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/navigation/NavigationTree.class.php | 17 +++---------- libraries/navigation/Nodes/Node.class.php | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index de9cc45cc1..61ec232bd4 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -839,14 +839,6 @@ class PMA_NavigationTree || (! in_array($parentName, $sterile) && ! $node->isNew) || (in_array($node->real_name, $sterile)) ) { - $loaded = ''; - if ($node->is_group) { - $loaded = ' loaded'; - } - $container = ''; - if ($node->type == Node::CONTAINER) { - $container = ' container'; - } $retval .= "
"; $iClass = ''; if ($class == 'first') { @@ -866,7 +858,6 @@ class PMA_NavigationTree } } if ($match) { - $loaded = ' loaded'; if (! $node->is_group) { $icon = PMA_Util::getImage( 'b_minus.png' @@ -885,16 +876,14 @@ class PMA_NavigationTree } } if ($match) { - $loaded = ' loaded'; $icon = PMA_Util::getImage('b_minus.png'); break; } } - if (! $GLOBALS['cfg']['NavigationTreeDisableDatabaseExpansion']) { - $retval .= "getCssClasses($match) . '"'; + + if ($GLOBALS['cfg']['NavigationTreeDisableDatabaseExpansion']) { $icon = ""; } $retval .= " href='#'>"; diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php index 70dd75b098..c310008c27 100644 --- a/libraries/navigation/Nodes/Node.class.php +++ b/libraries/navigation/Nodes/Node.class.php @@ -457,5 +457,30 @@ class Node { return ''; } + + /** + * Returns CSS classes for a node + * + * @param boolean $match Whether the node matched loaded tree + * + * @return String with html classes. + */ + public function getCssClasses($match) + { + if ($GLOBALS['cfg']['NavigationTreeDisableDatabaseExpansion']) { + return ''; + } + + $result = array('expander'); + + if ($this->is_group || $match) { + $result[] = 'loaded'; + } + if ($this->type == Node::CONTAINER) { + $result[] = 'container'; + } + + return implode(' ', $result); + } } ?> From e320d423e24de5e68750e44f856ae3ac8c62990e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 09:40:22 +0200 Subject: [PATCH 2/8] Factor out tree walking into separate method to share the code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/navigation/NavigationTree.class.php | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 61ec232bd4..ce03f58e95 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -796,6 +796,31 @@ class PMA_NavigationTree return $retval; } + /** + * Finds whether given tree matches this tree. + * + * @param array $tree Tree to check + * @param string $attribute Attribute to walk + * + * @return boolean + */ + private function _findTreeMatch($tree, $attribute) + { + foreach ($tree as $path) { + $match = true; + foreach ($paths[$attribute] as $key => $part) { + if (! isset($path[$key]) || $part != $path[$key]) { + $match = false; + break; + } + } + if ($match) { + break; + } + } + return $match; + } + /** * Renders a single node or a branch of the tree * @@ -849,36 +874,13 @@ class PMA_NavigationTree $retval .= ""; } $icon = PMA_Util::getImage('b_plus.png', __('Expand/Collapse')); - foreach ($this->_aPath as $path) { - $match = 1; - foreach ($paths['aPath_clean'] as $key => $part) { - if (! isset($path[$key]) || $part != $path[$key]) { - $match = 0; - break; - } - } - if ($match) { - if (! $node->is_group) { - $icon = PMA_Util::getImage( - 'b_minus.png' - ); - } - break; - } - } - foreach ($this->_vPath as $path) { - $match = 1; - foreach ($paths['vPath_clean'] as $key => $part) { - if ((! isset($path[$key]) || $part != $path[$key])) { - $match = 0; - break; - } - } - if ($match) { - $icon = PMA_Util::getImage('b_minus.png'); - break; - } + $match = $this->_findTreeMatch($this->_aPath, 'aPath_clean'); + $match |= $this->_findTreeMatch($this->_vPath, 'vPath_clean'); + if ($match && ! $node->is_group) { + $icon = PMA_Util::getImage( + 'b_minus.png' + ); } $retval .= ' Date: Sat, 10 May 2014 09:42:53 +0200 Subject: [PATCH 3/8] Move code for geting navigation node icon into Node class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/navigation/NavigationTree.class.php | 12 +----------- libraries/navigation/Nodes/Node.class.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index ce03f58e95..80ce657a45 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -873,21 +873,11 @@ class PMA_NavigationTree if (strpos($class, 'last') === false) { $retval .= ""; } - $icon = PMA_Util::getImage('b_plus.png', __('Expand/Collapse')); $match = $this->_findTreeMatch($this->_aPath, 'aPath_clean'); $match |= $this->_findTreeMatch($this->_vPath, 'vPath_clean'); - if ($match && ! $node->is_group) { - $icon = PMA_Util::getImage( - 'b_minus.png' - ); - } $retval .= '_pos; $retval .= ""; $retval .= $this->_getPaginationParamsHtml($node); - $retval .= $icon; + $retval .= $node->getIcon($match); $retval .= ""; $retval .= "
"; diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php index c310008c27..655f61aa82 100644 --- a/libraries/navigation/Nodes/Node.class.php +++ b/libraries/navigation/Nodes/Node.class.php @@ -482,5 +482,23 @@ class Node return implode(' ', $result); } + + /** + * Returns icon for the node + * + * @param boolean $match Whether the node matched loaded tree + * + * @return String with image name + */ + public function getIcon($match) + { + if ($GLOBALS['cfg']['NavigationTreeDisableDatabaseExpansion']) { + return ''; + } elseif ($match && ! $node->is_group) { + return PMA_Util::getImage('b_minus.png'); + } else { + return PMA_Util::getImage('b_plus.png', __('Expand/Collapse')); + } + } } ?> From 1865f72f2f8cef8f77c19cb4b5ec7cab07994f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 09:45:33 +0200 Subject: [PATCH 4/8] Fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/navigation/NavigationTree.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 80ce657a45..f7fa6fee5e 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -877,7 +877,7 @@ class PMA_NavigationTree $match = $this->_findTreeMatch($this->_aPath, 'aPath_clean'); $match |= $this->_findTreeMatch($this->_vPath, 'vPath_clean'); - $retval .= 'getCssClasses($match) . '"'; $retval .= " href='#'>"; $retval .= ""; $retval .= $paths['aPath']; From c1f060d77f20a1a3a83c9595980b39e1e028d99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 09:50:07 +0200 Subject: [PATCH 5/8] More compact rendering of code status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- README.rst | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 5536c987b6..33a9b5b60a 100644 --- a/README.rst +++ b/README.rst @@ -5,28 +5,20 @@ A set of PHP-scripts to manage MySQL over the web. http://www.phpmyadmin.net/ -Status ------- - -Continuous integration: +Code status +----------- .. image:: https://secure.travis-ci.org/phpmyadmin/phpmyadmin.png?branch=master :alt: Build status :target: https://travis-ci.org/phpmyadmin/phpmyadmin -Translations: - .. image:: http://l10n.cihar.com/widgets/phpmyadmin-status-badge.png :alt: Translation status :target: https://l10n.cihar.com/engage/phpmyadmin/?utm_source=widget -Code coverage: - .. image:: https://coveralls.io/repos/phpmyadmin/phpmyadmin/badge.png?branch=master :target: https://coveralls.io/r/phpmyadmin/phpmyadmin?branch=master -Code quality: - .. image:: https://scrutinizer-ci.com/g/phpmyadmin/phpmyadmin/badges/quality-score.png?s=93dfde29ffa5771d9c254b7ffb11c4e673315035 :target: https://scrutinizer-ci.com/g/phpmyadmin/phpmyadmin/ From 0f3fdcc31056d034f51217a6950540096bca3894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 09:52:06 +0200 Subject: [PATCH 6/8] Add another point to do when creating a release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- scripts/create-release.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/create-release.sh b/scripts/create-release.sh index aa1a723254..a11449ce47 100755 --- a/scripts/create-release.sh +++ b/scripts/create-release.sh @@ -315,6 +315,8 @@ Todo now: 9. send a private twitter message to @phpmya, containing a short version of the announcement -10. the end :-) +10. update demo/php/versions.ini in the scripts repository so that the demo server shows current versions + +11. the end :-) END From 35828972c1173d0a0a2ba8be187ddc13e1755bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 10:02:10 +0200 Subject: [PATCH 7/8] Another point to do on the release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- scripts/create-release.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/create-release.sh b/scripts/create-release.sh index a11449ce47..542a153e55 100755 --- a/scripts/create-release.sh +++ b/scripts/create-release.sh @@ -317,6 +317,8 @@ Todo now: 10. update demo/php/versions.ini in the scripts repository so that the demo server shows current versions -11. the end :-) +11. in case of new major release, update the render.py in website repository to include the new major releases + +12. the end :-) END From 8341ddea857bf4062d62a65f0cb9f0f32b41b2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 10:07:40 +0200 Subject: [PATCH 8/8] Add ChangeLog entry for rfe #1518 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 3ed7eeb3f4..b198d4005c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog ====================== 4.3.0.0 (not yet released) +- rfe #1518 Confirm dialog on accidentally leaving a page 4.2.1.0 (not yet released) - bug #4380 Cannot display table structure with enums containing special characters