diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-02 07:04:54 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-02 07:04:54 +0400 |
commit | d5091534263cc61c84d1feaea29c1e26f2e16929 (patch) | |
tree | f5036e53dbedc034d794126687f537d709fe5123 /plugins | |
parent | 1109a86a867381f051b8a5682e711190586caf85 (diff) |
refs #1915 added missing method to delete all viewdatatableparams, metricsToPlot should be saved now as well
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreVisualizations/javascripts/seriesPicker.js | 2 | ||||
-rw-r--r-- | plugins/ExampleUI/Controller.php | 14 | ||||
-rw-r--r-- | plugins/Goals/Controller.php | 26 | ||||
-rw-r--r-- | plugins/VisitFrequency/Controller.php | 14 | ||||
-rw-r--r-- | plugins/VisitsSummary/Controller.php | 14 |
5 files changed, 49 insertions, 21 deletions
diff --git a/plugins/CoreVisualizations/javascripts/seriesPicker.js b/plugins/CoreVisualizations/javascripts/seriesPicker.js index 04bec3d6a9..a4a1f3ddb4 100644 --- a/plugins/CoreVisualizations/javascripts/seriesPicker.js +++ b/plugins/CoreVisualizations/javascripts/seriesPicker.js @@ -273,7 +273,7 @@ // inform dashboard widget about changed parameters (to be restored on reload) var UI = require('piwik/UI') - var params = {columns: columns, rows: rows}; + var params = {columns: columns, rows: rows, columns_to_display: columns}; var tableNode = $('#' + this.dataTableId); UI.DataTable.prototype.notifyWidgetParametersChange(tableNode, params); } diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php index d4dd15c3b3..5dd0e9bb52 100644 --- a/plugins/ExampleUI/Controller.php +++ b/plugins/ExampleUI/Controller.php @@ -46,7 +46,7 @@ class Controller extends \Piwik\Plugin\Controller $view = new View('@ExampleUI/evolutiongraph'); $this->setPeriodVariablesView($view); - $view->evolutionGraph = $this->getEvolutionGraph(array('server1', 'server2')); + $view->evolutionGraph = $this->getEvolutionGraph(array(), array('server1', 'server2')); return $view->render(); } @@ -78,17 +78,23 @@ class Controller extends \Piwik\Plugin\Controller return $view->render(); } - public function getEvolutionGraph(array $columns = array()) + public function getEvolutionGraph(array $columns = array(), array $defaultColumns = array()) { if (empty($columns)) { - $columns = Common::getRequestVar('columns'); - $columns = Piwik::getArrayFromApiParameter($columns); + $columns = Common::getRequestVar('columns', false); + if (false !== $columns) { + $columns = Piwik::getArrayFromApiParameter($columns); + } } $view = $this->getLastUnitGraphAcrossPlugins($this->pluginName, __FUNCTION__, $columns, $selectableColumns = array('server1', 'server2'), 'My documentation', 'ExampleUI.getTemperaturesEvolution'); $view->requestConfig->filter_sort_column = 'label'; + if (empty($view->config->columns_to_display) && !empty($defaultColumns)) { + $view->config->columns_to_display = $defaultColumns; + } + return $this->renderView($view); } diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php index 2d64135948..47ed50ac43 100644 --- a/plugins/Goals/Controller.php +++ b/plugins/Goals/Controller.php @@ -140,7 +140,7 @@ class Controller extends \Piwik\Plugin\Controller $view->idGoal = $idGoal; $view->goalName = $goalDefinition['name']; $view->goalAllowMultipleConversionsPerVisit = $goalDefinition['allow_multiple']; - $view->graphEvolution = $this->getEvolutionGraph(array('nb_conversions'), $idGoal); + $view->graphEvolution = $this->getEvolutionGraph(array(), $idGoal, array('nb_conversions')); $view->nameGraphEvolution = 'Goals.getEvolutionGraph' . $idGoal; $view->topDimensions = $this->getTopDimensions($idGoal); @@ -189,7 +189,7 @@ class Controller extends \Piwik\Plugin\Controller $view = new View('@Goals/getOverviewView'); $this->setGeneralVariablesView($view); - $view->graphEvolution = $this->getEvolutionGraph(array('nb_conversions')); + $view->graphEvolution = $this->getEvolutionGraph(array(), false, array('nb_conversions')); $view->nameGraphEvolution = 'GoalsgetEvolutionGraph'; // sparkline for the historical data of the above values @@ -247,14 +247,18 @@ class Controller extends \Piwik\Plugin\Controller return $view->render(); } - public function getEvolutionGraph(array $columns = array(), $idGoal = false) + public function getEvolutionGraph(array $columns = array(), $idGoal = false, array $defaultColumns = array()) { if (empty($columns)) { - $columns = Common::getRequestVar('columns'); - $columns = Piwik::getArrayFromApiParameter($columns); + $columns = Common::getRequestVar('columns', false); + if (false !== $columns) { + $columns = Piwik::getArrayFromApiParameter($columns); + } } - $columns = !is_array($columns) ? array($columns) : $columns; + if (false !== $columns) { + $columns = !is_array($columns) ? array($columns) : $columns; + } if (empty($idGoal)) { $idGoal = Common::getRequestVar('idGoal', false, 'string'); @@ -278,7 +282,7 @@ class Controller extends \Piwik\Plugin\Controller $selectableColumns[] = 'avg_order_revenue'; } - foreach (array_merge($columns, $selectableColumns) as $columnName) { + foreach (array_merge($columns ? $columns : array(), $selectableColumns) as $columnName) { $columnTranslation = ''; // find the right translation for this column, eg. find 'revenue' if column is Goal_1_revenue foreach ($nameToLabel as $metric => $metricTranslation) { @@ -294,7 +298,13 @@ class Controller extends \Piwik\Plugin\Controller } $view->config->translations[$columnName] = $columnTranslation; } - $view->config->columns_to_display = $columns; + + if (!empty($columns)) { + $view->config->columns_to_display = $columns; + } elseif (empty($view->config->columns_to_display) && !empty($defaultColumns)) { + $view->config->columns_to_display = $defaultColumns; + } + $view->config->selectable_columns = $selectableColumns; $langString = $idGoal ? 'Goals_SingleGoalOverviewDocumentation' : 'Goals_GoalsOverviewDocumentation'; diff --git a/plugins/VisitFrequency/Controller.php b/plugins/VisitFrequency/Controller.php index 5ddfd1b6ad..e3ba12abb1 100644 --- a/plugins/VisitFrequency/Controller.php +++ b/plugins/VisitFrequency/Controller.php @@ -21,7 +21,7 @@ class Controller extends \Piwik\Plugin\Controller function index() { $view = new View('@VisitFrequency/index'); - $view->graphEvolutionVisitFrequency = $this->getEvolutionGraph(array('nb_visits_returning')); + $view->graphEvolutionVisitFrequency = $this->getEvolutionGraph(array(), array('nb_visits_returning')); $this->setSparklinesAndNumbers($view); return $view->render(); } @@ -33,11 +33,13 @@ class Controller extends \Piwik\Plugin\Controller return $view->render(); } - public function getEvolutionGraph(array $columns = array()) + public function getEvolutionGraph(array $columns = array(), array $defaultColumns = array()) { if (empty($columns)) { - $columns = Common::getRequestVar('columns'); - $columns = Piwik::getArrayFromApiParameter($columns); + $columns = Common::getRequestVar('columns', false); + if (false !== $columns) { + $columns = Piwik::getArrayFromApiParameter($columns); + } } $documentation = Piwik::translate('VisitFrequency_ReturningVisitsDocumentation') . '<br />' @@ -74,6 +76,10 @@ class Controller extends \Piwik\Plugin\Controller $view = $this->getLastUnitGraphAcrossPlugins($this->pluginName, __FUNCTION__, $columns, $selectableColumns, $documentation); + if (empty($view->config->columns_to_display) && !empty($defaultColumns)) { + $view->config->columns_to_display = $defaultColumns; + } + return $this->renderView($view); } diff --git a/plugins/VisitsSummary/Controller.php b/plugins/VisitsSummary/Controller.php index 0bcae74281..638f5feee2 100644 --- a/plugins/VisitsSummary/Controller.php +++ b/plugins/VisitsSummary/Controller.php @@ -26,7 +26,7 @@ class Controller extends \Piwik\Plugin\Controller { $view = new View('@VisitsSummary/index'); $this->setPeriodVariablesView($view); - $view->graphEvolutionVisitsSummary = $this->getEvolutionGraph(array('nb_visits')); + $view->graphEvolutionVisitsSummary = $this->getEvolutionGraph(array(), array('nb_visits')); $this->setSparklinesAndNumbers($view); return $view->render(); } @@ -39,11 +39,13 @@ class Controller extends \Piwik\Plugin\Controller return $view->render(); } - public function getEvolutionGraph(array $columns = array()) + public function getEvolutionGraph(array $columns = array(), array $defaultColumns = array()) { if (empty($columns)) { - $columns = Common::getRequestVar('columns'); - $columns = Piwik::getArrayFromApiParameter($columns); + $columns = Common::getRequestVar('columns', false); + if (false !== $columns) { + $columns = Piwik::getArrayFromApiParameter($columns); + } } $documentation = Piwik::translate('VisitsSummary_VisitsSummaryDocumentation') . '<br />' @@ -91,6 +93,10 @@ class Controller extends \Piwik\Plugin\Controller $view = $this->getLastUnitGraphAcrossPlugins($this->pluginName, __FUNCTION__, $columns, $selectableColumns, $documentation); + if (empty($view->config->columns_to_display) && !empty($defaultColumns)) { + $view->config->columns_to_display = $defaultColumns; + } + return $this->renderView($view); } |