Skip to content

Commit

Permalink
Refs #4040, #4041 convert RowEvolution popup rendering code to set vi…
Browse files Browse the repository at this point in the history
…ew properties directly.
  • Loading branch information
Benaka Moorthi committed Jul 30, 2013
1 parent edf2c04 commit 0ea1a94
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
6 changes: 3 additions & 3 deletions core/ViewDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function __construct()
$this->viewProperties['show_table'] = true;
$this->viewProperties['show_table_all_columns'] = true;
$this->viewProperties['show_all_views_icons'] = true;
$this->viewProperties['hide_all_views_icons'] = false;
$this->viewProperties['show_active_view_icon'] = true;
$this->viewProperties['hide_annotations_view'] = true;
$this->viewProperties['show_bar_chart'] = true;
$this->viewProperties['show_pie_chart'] = true;
Expand Down Expand Up @@ -310,7 +310,7 @@ public function getOverridableProperties()
'show_table',
'show_table_all_columns',
'show_all_views_icons',
'hide_all_views_icons',
'show_active_view_icon',
'hide_annotations_view',
'show_barchart',
'show_piechart',
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public function disableShowAllViewsIcons()
public function hideAllViewsIcons()
{
$this->viewProperties['show_all_views_icons'] = false;
$this->viewProperties['hide_all_views_icons'] = true;
$this->viewProperties['show_active_view_icon'] = false;
}

/**
Expand Down
21 changes: 21 additions & 0 deletions core/ViewDataTable/Properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,27 @@ class Piwik_ViewDataTable_Properties
*/
const DISPLAY_LOGO_INSTEAD_OF_LABEL = 'display_logo_instead_of_label';

/**
* Controls whether the footer icons that change the ViewDataTable type of a view are shown
* or not.
*/
const SHOW_ALL_VIEW_ICONS = 'show_all_views_icons';

/**
* Controls whether to display a tiny upside-down caret over the currently active view icon.
*/
const SHOW_ACTIVE_VIEW_ICON = 'show_active_view_icon';

/**
* TODO: this property is specific ONLY to the row evolution popup. Need to move it.
*/
const EXTERNAL_SERIES_TOGGLE = 'external_series_toggle';

/**
* TODO: this property is specific ONLY to the row evolution popup. Need to move it.
*/
const EXTERNAL_SERIES_TOGGLE_SHOW_ALL = 'external_series_toggle_show_all';

/**
* Returns the set of all valid ViewDataTable properties. The result is an array with property
* name as a key. Values of the array are undefined.
Expand Down
21 changes: 11 additions & 10 deletions plugins/CoreHome/DataTableRowAction/RowEvolution.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,24 @@ protected function extractEvolutionReport($report)
public function getRowEvolutionGraph($graphType = false, $metrics = false)
{
// set up the view data table
$view = Piwik_ViewDataTable::factory($graphType ?: $this->graphType);
$view = Piwik_ViewDataTable::factory(
$graphType ?: $this->graphType, $this->apiMethod, $controllerAction = 'CoreHome.getRowEvolutionGraph');
$view->setDataTable($this->dataTable);
$view->init('CoreHome', 'getRowEvolutionGraph', $this->apiMethod);

if (!empty($this->graphMetrics)) // In row Evolution popover, this is empty
{
$view->setColumnsToDisplay(array_keys($metrics ?: $this->graphMetrics));
if (!empty($this->graphMetrics)) { // In row Evolution popover, this is empty
$view->columns_to_display = array_keys($metrics ?: $this->graphMetrics);
}
$view->hideAllViewsIcons();

$view->show_all_views_icons = false;
$view->show_active_view_icon = false;
$view->show_related_reports = false;

foreach ($this->availableMetrics as $metric => $metadata) {
$view->setColumnTranslation($metric, $metadata['name']);
$view->translations[$metric] = $metadata['name'];
}

if (method_exists($view, 'addRowEvolutionSeriesToggle')) {
$view->addRowEvolutionSeriesToggle($this->initiallyShowAllMetrics);
}
$view->external_series_toggle = 'RowEvolutionSeriesToggle';
$view->external_series_toggle_show_all = $this->initiallyShowAllMetrics;

return $view;
}
Expand Down
10 changes: 1 addition & 9 deletions plugins/CoreHome/templates/_dataTableFooter.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{% if properties.show_footer_icons %}
<div class="dataTableFooterIcons">
<div class="dataTableFooterWrap" var="{{ javascriptVariablesToSet.viewDataTable }}">
{% if not properties.hide_all_views_icons %}
{% if properties.show_active_view_icon %}
<img src="plugins/Zeitgeist/images/data_table_footer_active_item.png" class="dataTableFooterActiveItem"/>
{% endif %}
<div class="tableIconsGroup">
Expand Down Expand Up @@ -77,14 +77,6 @@
{% endif %}
</span>
</div>
{% elseif not properties.hide_all_views_icons and javascriptVariablesToSet.viewDataTable == "generateDataChartEvolution" %}
<div class="tableIconsGroup">
<span class="tableGraphViews">
<a class="tableIcon" format="graphEvolution" var="graphEvolution">
<img width="16" height="16" src="plugins/Zeitgeist/images/chart_bar.png" title="{{ 'General_VBarGraph'|translate }}"/>
</a>
</span>
</div>
{% endif %}
<div class="tableIconsGroup">
<span class="exportToFormatIcons">
Expand Down

0 comments on commit 0ea1a94

Please sign in to comment.