diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-08-08 07:23:03 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-08-08 07:23:03 +0400 |
commit | 1d09b2cbe273035c92b15f9e4b96aa88419cda81 (patch) | |
tree | e53b9c82c361baff3d672a6aec08db91bdfc4836 /plugins | |
parent | a06fb0b267a55a50dd859b658baa651d4d4db738 (diff) |
Refs #4041, fixing regressions & bugs in visualization refactor.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Actions/Actions.php | 6 | ||||
-rw-r--r-- | plugins/CoreHome/javascripts/datatable.js | 8 | ||||
-rw-r--r-- | plugins/CoreHome/javascripts/sparkline.js | 2 | ||||
-rw-r--r-- | plugins/CoreVisualizations/Visualizations/HtmlTable.php | 20 | ||||
-rw-r--r-- | plugins/CoreVisualizations/Visualizations/JqplotGraph.php | 3 | ||||
-rw-r--r-- | plugins/CoreVisualizations/Visualizations/JqplotGraph/Bar.php | 2 | ||||
-rw-r--r-- | plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php | 2 | ||||
-rw-r--r-- | plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php | 4 | ||||
-rw-r--r-- | plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig | 13 | ||||
-rw-r--r-- | plugins/DBStats/DBStats.php | 4 | ||||
-rw-r--r-- | plugins/ExampleUI/Controller.php | 12 | ||||
-rw-r--r-- | plugins/Live/Live.php | 2 | ||||
-rw-r--r-- | plugins/Referers/Referers.php | 12 | ||||
-rw-r--r-- | plugins/UserSettings/UserSettings.php | 8 | ||||
-rw-r--r-- | plugins/VisitTime/VisitTime.php | 8 | ||||
-rw-r--r-- | plugins/VisitorInterest/VisitorInterest.php | 4 |
16 files changed, 67 insertions, 43 deletions
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 20b3985e14..b97895ed7d 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -654,7 +654,7 @@ class Piwik_Actions extends Plugin private function addBaseDisplayProperties(&$result) { $result['datatable_js_type'] = 'actionDataTable'; - $result['visualization_properties']['HtmlTable']['subtable_template'] = + $result['visualization_properties']['table']['subtable_template'] = '@CoreHome/_dataTableActions_subDataTable.twig'; $result['search_recursive'] = true; $result['show_all_views_icons'] = false; @@ -666,7 +666,7 @@ class Piwik_Actions extends Plugin $result['custom_parameters'] = array('flat' => 0); if (ViewDataTable::shouldLoadExpanded()) { - $result['visualization_properties']['HtmlTable']['show_expanded'] = true; + $result['visualization_properties']['table']['show_expanded'] = true; $result['filters'][] = function ($dataTable) { Piwik_Actions::setDataTableRowLevels($dataTable); @@ -879,7 +879,7 @@ class Piwik_Actions extends Plugin 'show_table_all_columns' => false, 'show_bar_chart' => false, 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_row_evolution' => false, ) ) diff --git a/plugins/CoreHome/javascripts/datatable.js b/plugins/CoreHome/javascripts/datatable.js index 6d35f66367..acbb96e7ef 100644 --- a/plugins/CoreHome/javascripts/datatable.js +++ b/plugins/CoreHome/javascripts/datatable.js @@ -1191,7 +1191,7 @@ dataTable.prototype = self.param.enable_filter_excludelowpop = filtersToRestore.enable_filter_excludelowpop; self.param.idSubtable = idSubTable; - self.param.action = self.param.controllerActionCalledWhenRequestSubTable; + self.param.action = self.props.subtable_controller_action; delete self.param.totalRows; @@ -1427,8 +1427,8 @@ dataTable.prototype = doHandleRowActions: function (trs) { var self = this; - var availableActionsForReport = DataTable_RowActions_Registry - .getAvailableActionsForReport(self.param); + var merged = $.extend({}, self.param, self.props); + var availableActionsForReport = DataTable_RowActions_Registry.getAvailableActionsForReport(merged); if (availableActionsForReport.length == 0) { return; @@ -1759,7 +1759,7 @@ actionDataTable.prototype = this.param['enable_filter_excludelowpop'] = filtersToRestore['enable_filter_excludelowpop']; self.param.idSubtable = idSubTable; - self.param.action = self.param.controllerActionCalledWhenRequestSubTable; + self.param.action = self.props.subtable_controller_action; self.reloadAjaxDataTable(false, function (resp) { self.actionsSubDataTableLoaded(resp, idSubTable); diff --git a/plugins/CoreHome/javascripts/sparkline.js b/plugins/CoreHome/javascripts/sparkline.js index 6093955eeb..222e44e490 100644 --- a/plugins/CoreHome/javascripts/sparkline.js +++ b/plugins/CoreHome/javascripts/sparkline.js @@ -62,7 +62,7 @@ window.initializeSparklines = function () { // if this happens, we can't find the graph using $('#'+idDataTable+"Chart"); // instead, we just use the first evolution graph we can find. if (dataTable.length == 0) { - dataTable = $('div.dataTableEvolutionGraph'); + dataTable = $('div.dataTableVizEvolution'); } // reload the datatable w/ a new column & scroll to the graph diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable.php b/plugins/CoreVisualizations/Visualizations/HtmlTable.php index 8fd87fc638..d3c6a61974 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable.php @@ -45,6 +45,12 @@ class HtmlTable extends DataTableVisualization const SHOW_EXPANDED = 'show_expanded'; /** + * When showing an expanded datatable, this property controls whether rows with subtables are + * replaced with their subtables, or if they are shown alongside their subtables. + */ + const REPLACE_ROW_WITH_SUBTABLE = 'replace_row_with_subtable'; + + /** * Controls whether any DataTable Row Action icons are shown. If true, no icons are shown. * * @see also self::DISABLE_ROW_EVOLUTION @@ -132,12 +138,14 @@ class HtmlTable extends DataTableVisualization 'datatable_js_type' => 'dataTable', 'filter_limit' => Config::getInstance()->General['datatable_default_limit'], 'visualization_properties' => array( - 'disable_row_evolution' => false, - 'disable_row_actions' => false, - 'subtable_template' => "@CoreHome/_dataTable.twig", - 'show_extra_columns' => false, - 'show_goals_columns' => false, - 'disable_subtable_when_show_goals' => false, + 'table' => array( + 'disable_row_evolution' => false, + 'disable_row_actions' => false, + 'subtable_template' => "@CoreHome/_dataTable.twig", + 'show_extra_columns' => false, + 'show_goals_columns' => false, + 'disable_subtable_when_show_goals' => false, + ), ), ); diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph.php index 8ed5f24840..fb0bc2fd3f 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph.php @@ -27,6 +27,7 @@ require_once PIWIK_INCLUDE_PATH . '/plugins/CoreVisualizations/Visualizations/Jq class JqplotGraph extends DataTableVisualization { const DEFAULT_GRAPH_HEIGHT = 250; + const ID = 'jqplot_graph'; /** * Whether the series picker should allow picking more than one series or not. @@ -154,7 +155,7 @@ class JqplotGraph extends DataTableVisualization 'row_picker_match_rows_by' => false, 'row_picker_visible_rows' => array(), 'visualization_properties' => array( - 'JqplotGraph' => array( + 'jqplot_graph' => array( 'add_total_row' => 0, 'show_all_ticks' => false, 'allow_multi_select_series_picker' => true, diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Bar.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Bar.php index dffe7393f2..4ec94329e2 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Bar.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Bar.php @@ -24,7 +24,7 @@ class Bar extends JqplotGraph public static function getDefaultPropertyValues() { $result = parent::getDefaultPropertyValues(); - $result['visualization_properties']['max_graph_elements'] = 6; + $result['visualization_properties']['jqplot_graph']['max_graph_elements'] = 6; return $result; } diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php index 684b3fb524..f403684834 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Evolution.php @@ -50,7 +50,7 @@ class Evolution extends JqplotGraph $result['show_table'] = false; $result['show_table_all_columns'] = false; $result['hide_annotations_view'] = false; - $result['visualization_properties']['Evolution']['graph_height'] = self::GRAPH_HEIGHT . 'px'; + $result['visualization_properties']['graphEvolution']['graph_height'] = self::GRAPH_HEIGHT . 'px'; return $result; } diff --git a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php index 8ca39659b1..a7f62e7dfd 100644 --- a/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php +++ b/plugins/CoreVisualizations/Visualizations/JqplotGraph/Pie.php @@ -24,8 +24,8 @@ class Pie extends JqplotGraph public static function getDefaultPropertyValues() { $result = parent::getDefaultPropertyValues(); - $result['visualization_properties']['max_graph_elements'] = 6; - $result['visualization_properties']['allow_multi_select_series_picker'] = false; + $result['visualization_properties']['jqplot_graph']['max_graph_elements'] = 6; + $result['visualization_properties']['jqplot_graph']['allow_multi_select_series_picker'] = false; return $result; } diff --git a/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig index 1347218af0..a5ba98ac72 100644 --- a/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig +++ b/plugins/CoreVisualizations/templates/_dataTableViz_htmlTable.twig @@ -1,13 +1,20 @@ +{%- set subtablesAreDisabled = properties.visualization_properties.show_goals_columns|default(false) + and properties.visualization_properties.disable_subtable_when_show_goals|default(false) -%} <table cellspacing="0" class="dataTable"> {% include "@CoreHome/_dataTableHead.twig" %} <tbody> {% for rowId, row in dataTable.getRows() %} - {%- set rowHasSubtable = row.getIdSubDataTable() and properties.subtable_controller_action is not null -%} + {%- set rowHasSubtable = not subtablesAreDisabled and row.getIdSubDataTable() and properties.subtable_controller_action is not null -%} {%- set shouldHighlightRow = rowId == constant('Piwik\\DataTable::ID_SUMMARY_ROW') and properties.highlight_summary_row -%} - + {# display this row if it doesn't have a subtable or if we don't replace the row with the subtable #} - {% if not rowHasSubtable or not properties.visualization_properties.show_expanded|default(false) or not properties.replace_row_with_subtable|default(false) %} + {%- set showRow = subtablesAreDisabled + or not rowHasSubtable + or not properties.visualization_properties.show_expanded|default(false) + or not properties.visualization_properties.replace_row_with_subtable|default(false) -%} + + {% if showRow %} <tr {% if rowHasSubtable %}id="{{ row.getIdSubDataTable() }}"{% endif %} class="{{ row.getMetadata('css_class') }} {% if rowHasSubtable %}subDataTable{% endif %}{% if shouldHighlightRow %} highlight{% endif %}"> {% for column in properties.columns_to_display %} diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 593f2a9b64..630bf4fe57 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -105,7 +105,7 @@ class Piwik_DBStats extends Plugin $result['show_offset_information'] = false; $result['show_pagination_control'] = false; - $result['visualization_properties']['JqplotGraph']['show_all_ticks'] = true; + $result['visualization_properties']['jqplot_graph']['show_all_ticks'] = true; // translate the labels themselves $valueToTranslationStr = array( @@ -256,7 +256,7 @@ class Piwik_DBStats extends Plugin $properties['show_tag_cloud'] = false; $properties['show_table_all_columns'] = false; $properties['keep_summary_row'] = true; - $properties['visualization_properties']['HtmlTable']['disable_row_evolution'] = true; + $properties['visualization_properties']['table']['disable_row_evolution'] = true; $properties['translations'] = array( 'label' => Piwik_Translate('DBStats_Table'), 'year' => Piwik_Translate('CoreHome_PeriodYear'), diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php index 1c35d6b498..5c6f27254c 100644 --- a/plugins/ExampleUI/Controller.php +++ b/plugins/ExampleUI/Controller.php @@ -25,12 +25,20 @@ class Piwik_ExampleUI_Controller extends Controller $view->translations['label'] = "Hour of day"; $view->filter_sort_column = 'label'; $view->filter_sort_order = 'asc'; - $view->visualization_properties->max_graph_elements = 24; $view->filter_limit = 24; $view->show_exclude_low_population = false; $view->show_table_all_columns = false; - $view->visualization_properties->disable_row_evolution = true; $view->y_axis_unit = '°C'; // useful if the user requests the bar graph + $view->visualization_properties->setForVisualization( + 'Piwik\\Plugins\\CoreVisualizations\\Visualizations\\HtmlTable', + 'disable_row_evolution', + true + ); + $view->visualization_properties->setForVisualization( + 'Piwik\\Plugins\\CoreVisualizations\\Visualizations\\JqplotGraph', + 'max_graph_elements', + 24 + ); echo $view->render(); } diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php index dc199fe9d5..e4c15c1ed7 100644 --- a/plugins/Live/Live.php +++ b/plugins/Live/Live.php @@ -83,7 +83,7 @@ class Piwik_Live extends Plugin 'pageUrlNotDefined' => Piwik_Translate('General_NotDefined', Piwik_Translate('Actions_ColumnPageURL')) ), 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_row_actions' => true, ) ) diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php index 36c4b85d08..cd8ce1844e 100644 --- a/plugins/Referers/Referers.php +++ b/plugins/Referers/Referers.php @@ -336,7 +336,7 @@ class Piwik_Referers extends Plugin 'filter_limit' => 10, 'translations' => array('label' => $labelColumnTitle), 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_subtable_when_show_goals' => true, ) ), @@ -352,7 +352,7 @@ class Piwik_Referers extends Plugin 'show_goals' => true, 'filter_limit' => 20, 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_row_actions' => true ) ), @@ -371,7 +371,7 @@ class Piwik_Referers extends Plugin 'show_goals' => true, 'filter_limit' => 25, 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_subtable_when_show_goals' => true, ) ), @@ -397,7 +397,7 @@ class Piwik_Referers extends Plugin 'filter_limit' => 25, 'translations' => array('label' => Piwik_Translate('Referers_ColumnSearchEngine')), 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_subtable_when_show_goals' => true, ) ), @@ -422,7 +422,7 @@ class Piwik_Referers extends Plugin 'filter_limit' => 25, 'translations' => array('label' => Piwik_Translate('Referers_ColumnWebsite')), 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_subtable_when_show_goals' => true, ) ), @@ -439,7 +439,7 @@ class Piwik_Referers extends Plugin 'show_goals' => true, 'translations' => array('label' => Piwik_Translate('Referers_ColumnSocial')), 'visualization_properties' => array( - 'HtmlTable' => array( + 'table' => array( 'disable_subtable_when_show_goals' => true, ) ), diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index 5d82f05a25..46568956f9 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -228,7 +228,7 @@ class Piwik_UserSettings extends Plugin 'title' => Piwik_Translate('UserSettings_ColumnBrowserVersion'), 'related_reports' => $this->getBrowserRelatedReports() )); - $result['visualization_properties']['JqplotGraph']['max_graph_elements'] = 7; + $result['visualization_properties']['jqplot_graph']['max_graph_elements'] = 7; return $result; } @@ -239,7 +239,7 @@ class Piwik_UserSettings extends Plugin 'title' => Piwik_Translate('UserSettings_Browsers'), 'related_reports' => $this->getBrowserRelatedReports() )); - $result['visualization_properties']['JqplotGraph']['max_graph_elements'] = 7; + $result['visualization_properties']['jqplot_graph']['max_graph_elements'] = 7; return $result; } @@ -336,7 +336,7 @@ class Piwik_UserSettings extends Plugin 'show_exclude_low_population' => false, 'filter_limit' => 5, 'visualization_properties' => array( - 'JqplotGraph' => array( + 'jqplot_graph' => array( 'max_graph_elements' => 5 ) ) @@ -449,4 +449,4 @@ class Piwik_UserSettings extends Plugin $archiving->archivePeriod(); } } -} +}
\ No newline at end of file diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 3273daf3ea..e9873ae05c 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -135,7 +135,7 @@ class Piwik_VisitTime extends Plugin 'translations' => array('label' => Piwik_Translate('VisitTime_ColumnServerTime')), 'request_parameters_to_modify' => array('hideFutureHoursWhenToday' => 1), 'visualization_properties' => array( - 'JqplotGraph' => array( + 'jqplot_graph' => array( 'max_graph_elements' => false, ) ) @@ -146,7 +146,7 @@ class Piwik_VisitTime extends Plugin 'title' => Piwik_Translate('VisitTime_ColumnLocalTime'), 'translations' => array('label' => Piwik_Translate('VisitTime_LocalTime')), 'visualization_properties' => array( - 'JqplotGraph' => array( + 'jqplot_graph' => array( 'max_graph_elements' => false, ) ) @@ -159,7 +159,7 @@ class Piwik_VisitTime extends Plugin Piwik_Translate('General_ReportGeneratedFrom', self::getDateRangeForFooterMessage()), 'translations' => array('label' => Piwik_Translate('VisitTime_DayOfWeek')), 'visualization_properties' => array( - 'JqplotGraph' => array( + 'jqplot_graph' => array( 'show_all_ticks' => true, 'max_graph_elements' => false, ) @@ -215,4 +215,4 @@ class Piwik_VisitTime extends Plugin } return $dateRange; } -} +}
\ No newline at end of file diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index 6ea2c4eb69..569d482480 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -173,7 +173,7 @@ class Piwik_VisitorInterest extends Plugin 'show_search' => false, 'show_table_all_columns' => false, 'visualization_properties' => array( - 'JqplotGraph' => array( + 'jqplot_graph' => array( 'max_graph_elements' => 10 ) ) @@ -194,7 +194,7 @@ class Piwik_VisitorInterest extends Plugin 'show_search' => false, 'show_table_all_columns' => false, 'visualization_properties' => array( - 'JqplotGraph' => array( + 'jqplot_graph' => array( 'max_graph_elements' => 10 ) ) |