Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-21 05:14:23 +0400
committerBenaka Moorthi <benaka.moorthi@gmail.com>2013-09-21 05:14:23 +0400
commitc08f6c1cc37ad1ab1ccceb6e7df5f63f05fcd49a (patch)
treec42f33a58e534c610292ce4afe8dbe35d14028e5 /plugins
parentc2061d4fd17875fba690b404c38bee30cde2fd31 (diff)
Refs #4077, fix bug with zoom out button toggling and make sure treemap icon is not displayed on evolution graph.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TreemapVisualization/TreemapVisualization.php19
-rw-r--r--plugins/TreemapVisualization/javascripts/treemapViz.js11
2 files changed, 28 insertions, 2 deletions
diff --git a/plugins/TreemapVisualization/TreemapVisualization.php b/plugins/TreemapVisualization/TreemapVisualization.php
index 306aa948a0..eb8c09c39a 100644
--- a/plugins/TreemapVisualization/TreemapVisualization.php
+++ b/plugins/TreemapVisualization/TreemapVisualization.php
@@ -11,6 +11,7 @@
namespace Piwik\Plugins\TreemapVisualization;
+use Piwik\Period;
use Piwik\Common;
/**
@@ -43,7 +44,7 @@ class TreemapVisualization extends \Piwik\Plugin
public function getListHooksRegistered()
{
return array(
- 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
+ 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'AssetManager.getJsFiles' => 'getJsFiles',
'DataTableVisualization.getAvailable' => 'getAvailableDataTableVisualizations',
'ViewDataTable.configureReportView' => 'configureReportViewForActions'
@@ -76,6 +77,22 @@ class TreemapVisualization extends \Piwik\Plugin
// make sure treemap is shown on actions reports
if ($module === 'Actions') {
+ if ($view->getViewDataTableId() != Treemap::ID) {
+ // make sure we're looking at data that the treemap visualization can use (a single datatable)
+ // TODO: this is truly ugly code. need to think up an abstraction that can allow us to describe the
+ // problem...
+ $requestArray = $view->getRequestArray() + $_GET + $_POST;
+ $date = Common::getRequestVar('date', null, 'string', $requestArray);
+ $period = Common::getRequestVar('period', null, 'string', $requestArray);
+ $idSite = Common::getRequestVar('idSite', null, 'string', $requestArray);
+ if (Period::isMultiplePeriod($date, $period)
+ || strpos($idSite, ',') !== false
+ || $idSite == 'all'
+ ) {
+ return;
+ }
+ }
+
$view->show_all_views_icons = true;
$view->show_bar_chart = false;
$view->show_pie_chart = false;
diff --git a/plugins/TreemapVisualization/javascripts/treemapViz.js b/plugins/TreemapVisualization/javascripts/treemapViz.js
index a3ba92d388..51e19c9690 100644
--- a/plugins/TreemapVisualization/javascripts/treemapViz.js
+++ b/plugins/TreemapVisualization/javascripts/treemapViz.js
@@ -415,7 +415,16 @@
* Show/hide the zoom out button based on the currently selected node.
*/
_toggleZoomOut: function (toggle) {
- $('.infoviz-treemap-zoom-out', this.$element).css('visibility', toggle || !this.treemap.clickedNode ? 'visible' : 'hidden');
+ var toggle = toggle || !this._isFirstLevelNode(this.treemap.clickedNode);
+ $('.infoviz-treemap-zoom-out', this.$element).css('visibility', toggle ? 'visible' : 'hidden');
+ },
+
+ /**
+ * Returns true if node is a child of the root node, false if it represents a subtable row.
+ */
+ _isFirstLevelNode: function (node) {
+ var parent = node.getParents()[0];
+ return !parent || parent.id.indexOf('treemap-root') != -1;
},
/**