Skip to content
Extraits de code Groupes Projets
Valider c08f6c1c rédigé par Benaka Moorthi's avatar Benaka Moorthi
Parcourir les fichiers

Refs #4077, fix bug with zoom out button toggling and make sure treemap icon...

Refs #4077, fix bug with zoom out button toggling and make sure treemap icon is not displayed on evolution graph.
parent c2061d4f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -681,7 +681,7 @@ class ViewDataTable ...@@ -681,7 +681,7 @@ class ViewDataTable
/** /**
* @return string URL to call the API, eg. "method=Referers.getKeywords&period=day&date=yesterday"... * @return string URL to call the API, eg. "method=Referers.getKeywords&period=day&date=yesterday"...
*/ */
protected function getRequestArray() public function getRequestArray()
{ {
// we prepare the array to give to the API Request // we prepare the array to give to the API Request
// we setup the method and format variable // we setup the method and format variable
...@@ -1057,11 +1057,10 @@ class ViewDataTable ...@@ -1057,11 +1057,10 @@ class ViewDataTable
protected function buildView() protected function buildView()
{ {
Piwik_PostEvent(self::CONFIGURE_VIEW_EVENT, array($this));
$visualization = new $this->visualizationClass($this); $visualization = new $this->visualizationClass($this);
Piwik_PostEvent(self::CONFIGURE_VIEW_EVENT, array($this));
$this->overrideViewProperties(); $this->overrideViewProperties();
try { try {
$this->loadDataTableFromAPI(); $this->loadDataTableFromAPI();
$this->postDataTableLoadedFromAPI(); $this->postDataTableLoadedFromAPI();
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
namespace Piwik\Plugins\TreemapVisualization; namespace Piwik\Plugins\TreemapVisualization;
use Piwik\Period;
use Piwik\Common; use Piwik\Common;
/** /**
...@@ -43,7 +44,7 @@ class TreemapVisualization extends \Piwik\Plugin ...@@ -43,7 +44,7 @@ class TreemapVisualization extends \Piwik\Plugin
public function getListHooksRegistered() public function getListHooksRegistered()
{ {
return array( return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'AssetManager.getJsFiles' => 'getJsFiles', 'AssetManager.getJsFiles' => 'getJsFiles',
'DataTableVisualization.getAvailable' => 'getAvailableDataTableVisualizations', 'DataTableVisualization.getAvailable' => 'getAvailableDataTableVisualizations',
'ViewDataTable.configureReportView' => 'configureReportViewForActions' 'ViewDataTable.configureReportView' => 'configureReportViewForActions'
...@@ -76,6 +77,22 @@ class TreemapVisualization extends \Piwik\Plugin ...@@ -76,6 +77,22 @@ class TreemapVisualization extends \Piwik\Plugin
// make sure treemap is shown on actions reports // make sure treemap is shown on actions reports
if ($module === 'Actions') { 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_all_views_icons = true;
$view->show_bar_chart = false; $view->show_bar_chart = false;
$view->show_pie_chart = false; $view->show_pie_chart = false;
......
...@@ -415,7 +415,16 @@ ...@@ -415,7 +415,16 @@
* Show/hide the zoom out button based on the currently selected node. * Show/hide the zoom out button based on the currently selected node.
*/ */
_toggleZoomOut: function (toggle) { _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;
}, },
/** /**
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter