diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-08-05 03:05:21 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-08-05 03:05:21 +0400 |
commit | 9b5a42a62395607556893085701a8d385c464697 (patch) | |
tree | 7fe62a829f265c889bea48ae5124b879b6b43fd9 | |
parent | 2615404eab2e96048583caccf86248af2dd90d9b (diff) |
Refs #4040, #4041, change the way jqplot.js checks for viewdatatble types, changed relatedReports view property name to related_reports and fixed spelling of row_picker_mach_rows_by.
-rw-r--r-- | core/JqplotDataGenerator/Evolution.php | 6 | ||||
-rw-r--r-- | core/ViewDataTable.php | 9 | ||||
-rw-r--r-- | core/ViewDataTable/Properties.php | 10 | ||||
-rw-r--r-- | core/Visualization/JqplotGraph.php | 2 | ||||
-rw-r--r-- | core/Visualization/JqplotGraph/Evolution.php | 7 | ||||
-rw-r--r-- | plugins/Actions/Actions.php | 12 | ||||
-rw-r--r-- | plugins/CoreHome/javascripts/jqplot.js | 22 | ||||
-rw-r--r-- | plugins/CoreHome/templates/_dataTableFooter.twig | 10 | ||||
-rw-r--r-- | plugins/DBStats/DBStats.php | 8 | ||||
-rw-r--r-- | plugins/DevicesDetection/DevicesDetection.php | 10 | ||||
-rw-r--r-- | plugins/Referers/Controller.php | 2 | ||||
-rw-r--r-- | plugins/UserSettings/UserSettings.php | 12 | ||||
-rw-r--r-- | plugins/VisitTime/VisitTime.php | 2 |
13 files changed, 54 insertions, 58 deletions
diff --git a/core/JqplotDataGenerator/Evolution.php b/core/JqplotDataGenerator/Evolution.php index dab684cb0a..97d45d7797 100644 --- a/core/JqplotDataGenerator/Evolution.php +++ b/core/JqplotDataGenerator/Evolution.php @@ -70,7 +70,7 @@ class Evolution extends JqplotDataGenerator // put together configuration for row picker. // do this for every data table in the array because rows do not // have to present for each date. - if ($this->properties['row_picker_mach_rows_by'] !== false) { + if ($this->properties['row_picker_match_rows_by'] !== false) { $rowVisible = $this->handleRowForRowPicker($rowLabel); if (!$rowVisible) { continue; @@ -146,7 +146,7 @@ class Evolution extends JqplotDataGenerator $this->addSeriesPickerToView(); // configure the row picker - if ($this->properties['row_picker_mach_rows_by'] !== false) { + if ($this->properties['row_picker_match_rows_by'] !== false) { $visualization->setSelectableRows(array_values($this->rowPickerConfig)); } } @@ -162,7 +162,7 @@ class Evolution extends JqplotDataGenerator { // determine whether row is visible $isVisible = true; - if ($this->properties['row_picker_mach_rows_by'] == 'label') { + if ($this->properties['row_picker_match_rows_by'] == 'label') { $isVisible = in_array($rowLabel, $this->properties['row_picker_visible_rows']); } diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index 1d348cffec..d0dbfa4d5c 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -151,7 +151,7 @@ class ViewDataTable $this->viewProperties['exportLimit'] = Config::getInstance()->General['API_datatable_default_limit']; $this->viewProperties['highlight_summary_row'] = false; $this->viewProperties['metadata'] = array(); - $this->viewProperties['relatedReports'] = array(); + $this->viewProperties['related_reports'] = array(); $this->viewProperties['title'] = 'unknown'; $this->viewProperties['tooltip_metadata_name'] = false; $this->viewProperties['enable_sort'] = true; @@ -175,6 +175,7 @@ class ViewDataTable $this->viewProperties['subtable_controller_action'] = false; $this->viewProperties['datatable_css_class'] = false; $this->viewProperties['filters'] = array(); + $this->viewProperties['hide_annotations_view'] = true; $this->viewProperties['columns_to_display'] = array(); $columns = Common::getRequestVar('columns', false); @@ -549,7 +550,7 @@ class ViewDataTable /** * Sets a view property by name. This function handles special view properties - * like 'translations' & 'relatedReports' that store arrays. + * like 'translations' & 'related_reports' that store arrays. * * @param string $name * @param mixed $value For array properties, $value can be a comma separated string. @@ -567,7 +568,7 @@ class ViewDataTable || $name == 'filters' ) { $this->viewProperties[$name] = array_merge($this->viewProperties[$name], $value); - } else if ($name == 'relatedReports') { // TODO: should process after (in overrideViewProperties) + } else if ($name == 'related_reports') { // TODO: should process after (in overrideViewProperties) $this->addRelatedReports($value); } else if ($name == 'visualization_properties') { $this->setVisualizationPropertiesFromMetadata($value); @@ -1070,7 +1071,7 @@ class ViewDataTable } $url = $this->getBaseReportUrl($module, $action, $queryParams); - $this->viewProperties['relatedReports'][$url] = $title; + $this->viewProperties['related_reports'][$url] = $title; } private function addRelatedReports($relatedReports) diff --git a/core/ViewDataTable/Properties.php b/core/ViewDataTable/Properties.php index aab499a6a9..099b270a86 100644 --- a/core/ViewDataTable/Properties.php +++ b/core/ViewDataTable/Properties.php @@ -19,7 +19,6 @@ use ReflectionClass; * * @see ViewDataTable - for more info. * - * TODO: change the names of properties to match the const names where appropriate. * TODO: list default value for each property */ class Properties @@ -125,7 +124,7 @@ class Properties * * @see also self::TITLE. Both must be set if associating related reports. */ - const RELATED_REPORTS = 'relatedReports'; + const RELATED_REPORTS = 'related_reports'; /** * The report title. Used with related reports so report headings can be changed when switching @@ -180,7 +179,7 @@ class Properties * * @see self::ROW_PICKER_VISIBLE_VALUES */ - const ROW_PICKER_VALUE_COLUMN = 'row_picker_mach_rows_by'; + const ROW_PICKER_VALUE_COLUMN = 'row_picker_match_rows_by'; /** * Contains the list of values available for the Row Picker. @@ -373,6 +372,11 @@ class Properties const SHOW_OFFSET_INFORMATION = 'show_offset_information'; /** + * Controls whether annotations are shown or not. + */ + const HIDE_ANNOTATIONS_VIEW = 'hide_annotations_view'; + + /** * Returns the set of all valid ViewDataTable properties. The result is an array with property * names as keys. Values of the array are undefined. * diff --git a/core/Visualization/JqplotGraph.php b/core/Visualization/JqplotGraph.php index b3b6227321..4c92bec9d4 100644 --- a/core/Visualization/JqplotGraph.php +++ b/core/Visualization/JqplotGraph.php @@ -148,7 +148,7 @@ class JqplotGraph extends DataTableVisualization 'show_search' => false, 'show_export_as_image_icon' => true, 'y_axis_unit' => '', - 'row_picker_mach_rows_by' => false, + 'row_picker_match_rows_by' => false, 'row_picker_visible_rows' => array(), 'visualization_properties' => array( 'JqplotGraph' => array( diff --git a/core/Visualization/JqplotGraph/Evolution.php b/core/Visualization/JqplotGraph/Evolution.php index f385d006cb..6388309ee1 100644 --- a/core/Visualization/JqplotGraph/Evolution.php +++ b/core/Visualization/JqplotGraph/Evolution.php @@ -27,11 +27,6 @@ class Evolution extends JqplotGraph const ID = 'graphEvolution'; const SERIES_COLOR_COUNT = 8; - /** - * Controls whether annotations are shown or not. - */ - const HIDE_ANNOTATIONS_VIEW = 'hide_annotations_view'; - public function __construct($view) { parent::__construct($view); @@ -53,8 +48,8 @@ class Evolution extends JqplotGraph $result['show_table'] = false; $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']['Evolution']['hide_annotations_view'] = false; return $result; } diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 1edb4dfd31..fb5d7a677e 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -782,7 +782,7 @@ class Piwik_Actions extends Plugin 'filter_sort_column' => 'entry_nb_visits', 'filter_sort_order' => 'desc', 'title' => Piwik_Translate('Actions_SubmenuPagesEntry'), - 'relatedReports' => array( + 'related_reports' => array( 'Actions.getEntryPageTitles' => Piwik_Translate('Actions_EntryPageTitles') ), 'self_url' => $reportUrl @@ -810,7 +810,7 @@ class Piwik_Actions extends Plugin 'filter_sort_column' => 'exit_nb_visits', 'filter_sort_order' => 'desc', 'title' => Piwik_Translate('Actions_SubmenuPagesExit'), - 'relatedReports' => array( + 'related_reports' => array( 'Actions.getExitPageTitles' => Piwik_Translate('Actions_ExitPageTitles') ), 'self_url' => $reportUrl, @@ -897,7 +897,7 @@ class Piwik_Actions extends Plugin 'filter_sort_order' => 'desc', 'show_exclude_low_population' => false, 'title' => $title, - 'relatedReports' => $relatedReports + 'related_reports' => $relatedReports ); $this->addExcludeLowPopDisplayProperties($result); @@ -920,7 +920,7 @@ class Piwik_Actions extends Plugin 'columns_to_display' => array('label', 'nb_hits', 'nb_visits', 'bounce_rate', 'avg_time_on_page', 'exit_rate', 'avg_time_generation'), 'title' => Piwik_Translate('Actions_SubmenuPageTitles'), - 'relatedReports' => array( + 'related_reports' => array( 'Actions.getEntryPageTitles' => Piwik_Translate('Actions_EntryPageTitles'), 'Actions.getExitPageTitles' => Piwik_Translate('Actions_ExitPageTitles'), ), @@ -946,7 +946,7 @@ class Piwik_Actions extends Plugin ), 'columns_to_display' => array('label', 'entry_nb_visits', 'entry_bounce_count', 'bounce_rate'), 'title' => Piwik_Translate('Actions_EntryPageTitles'), - 'relatedReports' => array( + 'related_reports' => array( 'Actions.getPageTitles' => Piwik_Translate('Actions_SubmenuPageTitles'), "Actions.$entryPageUrlAction" => Piwik_Translate('Actions_SubmenuPagesEntry') ), @@ -970,7 +970,7 @@ class Piwik_Actions extends Plugin ), 'columns_to_display' => array('label', 'exit_nb_visits', 'nb_visits', 'exit_rate'), 'title' => Piwik_Translate('Actions_ExitPageTitles'), - 'relatedReports' => array( + 'related_reports' => array( 'Actions.getPageTitles' => Piwik_Translate('Actions_SubmenuPageTitles'), "Actions.$exitPageUrlAction" => Piwik_Translate('Actions_SubmenuPagesExit'), ), diff --git a/plugins/CoreHome/javascripts/jqplot.js b/plugins/CoreHome/javascripts/jqplot.js index 0911573449..fe013254c4 100644 --- a/plugins/CoreHome/javascripts/jqplot.js +++ b/plugins/CoreHome/javascripts/jqplot.js @@ -68,21 +68,17 @@ JQPlot.prototype = { /** Generic render function */ render: function (targetDivId, lang) { - var type = $('#' + targetDivId).closest('div.dataTable').data('dataTableInstance').param['viewDataTable']; + var dataTableDiv = $('#' + targetDivId).closest('div.dataTable'); // preapare the appropriate chart type - switch (type) {// TODO: should rely on CSS, not viewDataTable. otherwise ecommerceOrder row evolution will fail - case 'graphEvolution': - this.prepareEvolutionChart(targetDivId, lang); - break; - case 'graphVerticalBar': - this.prepareBarChart(targetDivId, lang); - break; - case 'graphPie': - this.preparePieChart(targetDivId, lang); - break; - default: - return; + if (dataTableDiv.hasClass('dataTableVizEvolution')) { + this.prepareEvolutionChart(targetDivId, lang); + } else if (dataTableDiv.hasClass('dataTableVizBar')) { + this.prepareBarChart(targetDivId, lang); + } else if (dataTableDiv.hasClass('dataTableVizPie')) { + this.preparePieChart(targetDivId, lang); + } else { + return; } // handle replot diff --git a/plugins/CoreHome/templates/_dataTableFooter.twig b/plugins/CoreHome/templates/_dataTableFooter.twig index e5ec62e45c..10100b9bcc 100644 --- a/plugins/CoreHome/templates/_dataTableFooter.twig +++ b/plugins/CoreHome/templates/_dataTableFooter.twig @@ -128,7 +128,7 @@ {% endif %} </ul> </div> - {% if isPluginLoaded('Annotations') and not properties.datatable_visualizations.hide_annotations_view|default(true) %} + {% if isPluginLoaded('Annotations') and not properties.hide_annotations_view %} <div class="annotationView" title="{{ 'Annotations_IconDesc_js'|translate }}"> <a class="tableIcon"> <img width="16" height="16" src="plugins/Zeitgeist/images/grey_marker.png"/> @@ -140,16 +140,16 @@ {% endif %} <div class="datatableRelatedReports"> - {% if (properties.relatedReports is not empty) and properties.show_related_reports %} - {% if properties.relatedReports|length == 1 %} + {% if (properties.related_reports is not empty) and properties.show_related_reports %} + {% if properties.related_reports|length == 1 %} {{ 'General_RelatedReport'|translate }}: {% else %} {{ 'General_RelatedReports'|translate }}: {% endif %} - <ul style="list-style:none;{% if properties.relatedReports|length == 1 %}display:inline-block;{% endif %}}"> + <ul style="list-style:none;{% if properties.related_reports|length == 1 %}display:inline-block;{% endif %}}"> <li><span href="{{ properties.self_url }}" style="display:none;">{{ properties.title }}</span></li> - {% for reportUrl,reportTitle in properties.relatedReports %} + {% for reportUrl,reportTitle in properties.related_reports %} <li><span href="{{ reportUrl }}">{{ reportTitle }}</span></li> {% endfor %} </ul> diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 8cbbeaa961..593f2a9b64 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -146,7 +146,7 @@ class Piwik_DBStats extends Plugin $this->addPresentationFilters($result); $result['title'] = Piwik_Translate('DBStats_MetricTables'); - $result['relatedReports'] = array( + $result['related_reports'] = array( 'DBStats.getMetricDataSummaryByYear' => Piwik_Translate('DBStats_MetricDataByYear') ); @@ -161,7 +161,7 @@ class Piwik_DBStats extends Plugin $result['translations']['label'] = Piwik_Translate('CoreHome_PeriodYear'); $result['title'] = Piwik_Translate('DBStats_MetricDataByYear'); - $result['relatedReports'] = array( + $result['related_reports'] = array( 'DBStats.getMetricDataSummary' => Piwik_Translate('DBStats_MetricTables') ); @@ -175,7 +175,7 @@ class Piwik_DBStats extends Plugin $this->addPresentationFilters($result); $result['title'] = Piwik_Translate('DBStats_ReportTables'); - $result['relatedReports'] = array( + $result['related_reports'] = array( 'DBStats.getReportDataSummaryByYear' => Piwik_Translate('DBStats_ReportDataByYear') ); @@ -190,7 +190,7 @@ class Piwik_DBStats extends Plugin $result['translations']['label'] = Piwik_Translate('CoreHome_PeriodYear'); $result['title'] = Piwik_Translate('DBStats_ReportDataByYear'); - $result['relatedReports'] = array( + $result['related_reports'] = array( 'DBStats.getReportDataSummary' => Piwik_Translate('DBStats_ReportTables') ); diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php index 8adc51141c..35fb148866 100644 --- a/plugins/DevicesDetection/DevicesDetection.php +++ b/plugins/DevicesDetection/DevicesDetection.php @@ -318,7 +318,7 @@ class Piwik_DevicesDetection extends Plugin 'show_exclude_low_population' => false, 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelSystemFamily")), 'title' => Piwik_Translate('DeviceDetection_OperatingSystemFamilies'), - 'relatedReports' => $this->getOsRelatedReports() + 'related_reports' => $this->getOsRelatedReports() ); } @@ -329,7 +329,7 @@ class Piwik_DevicesDetection extends Plugin 'show_exclude_low_population' => false, 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelSystemVersion")), 'title' => Piwik_Translate('DeviceDetection_OperatingSystemVersions'), - 'relatedReports' => $this->getOsRelatedReports() + 'related_reports' => $this->getOsRelatedReports() ); } @@ -340,7 +340,7 @@ class Piwik_DevicesDetection extends Plugin 'show_exclude_low_population' => false, 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelBrowserFamily")), 'title' => Piwik_Translate('DevicesDetection_BrowsersFamily'), - 'relatedReports' => $this->getBrowserRelatedReports() + 'related_reports' => $this->getBrowserRelatedReports() ); } @@ -350,7 +350,7 @@ class Piwik_DevicesDetection extends Plugin 'show_search' => false, 'show_exclude_low_population' => false, 'translations' => array('label' => Piwik_Translate("DevicesDetection_dataTableLabelBrowserVersion")), - 'relatedReports' => $this->getBrowserRelatedReports() + 'related_reports' => $this->getBrowserRelatedReports() ); } @@ -369,4 +369,4 @@ class Piwik_DevicesDetection extends Plugin 'DevicesDetection.getBrowserVersions' => Piwik_Translate('DevicesDetection_BrowserVersions') ); } -} +}
\ No newline at end of file diff --git a/plugins/Referers/Controller.php b/plugins/Referers/Controller.php index 4375b46891..1e31b6dd41 100644 --- a/plugins/Referers/Controller.php +++ b/plugins/Referers/Controller.php @@ -299,7 +299,7 @@ class Piwik_Referers_Controller extends Controller $visibleRows = array($label, $total); $view->request_parameters_to_modify['rows'] = $label . ',' . $total; } - $view->row_picker_mach_rows_by = 'label'; + $view->row_picker_match_rows_by = 'label'; $view->row_picker_visible_rows = $visibleRows; $view->documentation = Piwik_Translate('Referers_EvolutionDocumentation') . '<br />' diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index 4cfb959b01..dfed450ca0 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -208,7 +208,7 @@ class Piwik_UserSettings extends Plugin return array_merge($this->getBasicUserSettingsDisplayProperties(), array( 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnOperatingSystem')), 'title' => Piwik_Translate('UserSettings_OperatingSystems'), - 'relatedReports' => $this->getOsRelatedReports() + 'related_reports' => $this->getOsRelatedReports() )); } @@ -217,7 +217,7 @@ class Piwik_UserSettings extends Plugin return array_merge($this->getBasicUserSettingsDisplayProperties(), array( 'translations' => array('label' => Piwik_Translate('UserSettings_OperatingSystemFamily')), 'title' => Piwik_Translate('UserSettings_OperatingSystemFamily'), - 'relatedReports' => $this->getOsRelatedReports() + 'related_reports' => $this->getOsRelatedReports() )); } @@ -226,7 +226,7 @@ class Piwik_UserSettings extends Plugin $result = array_merge($this->getBasicUserSettingsDisplayProperties(), array( 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowserVersion')), 'title' => Piwik_Translate('UserSettings_ColumnBrowserVersion'), - 'relatedReports' => $this->getBrowserRelatedReports() + 'related_reports' => $this->getBrowserRelatedReports() )); $result['visualization_properties']['JqplotGraph']['max_graph_elements'] = 7; return $result; @@ -237,7 +237,7 @@ class Piwik_UserSettings extends Plugin $result = array_merge($this->getBasicUserSettingsDisplayProperties(), array( 'translations' => array('label' => Piwik_Translate('UserSettings_ColumnBrowser')), 'title' => Piwik_Translate('UserSettings_Browsers'), - 'relatedReports' => $this->getBrowserRelatedReports() + 'related_reports' => $this->getBrowserRelatedReports() )); $result['visualization_properties']['JqplotGraph']['max_graph_elements'] = 7; return $result; @@ -260,7 +260,7 @@ class Piwik_UserSettings extends Plugin 'show_offset_information' => false, 'show_pagination_control' => false, 'title' => Piwik_Translate('UserSettings_ColumnTypeOfScreen'), - 'relatedReports' => $this->getWideScreenDeviceTypeRelatedReports() + 'related_reports' => $this->getWideScreenDeviceTypeRelatedReports() )); } @@ -269,7 +269,7 @@ class Piwik_UserSettings extends Plugin return array_merge($this->getBasicUserSettingsDisplayProperties(), array( 'translations' => array('label' => Piwik_Translate('UserSettings_MobileVsDesktop')), 'title' => Piwik_Translate('UserSettings_MobileVsDesktop'), - 'relatedReports' => $this->getWideScreenDeviceTypeRelatedReports() + 'related_reports' => $this->getWideScreenDeviceTypeRelatedReports() )); } diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 4fee297eba..3273daf3ea 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -168,7 +168,7 @@ class Piwik_VisitTime extends Plugin // add the visits by day of week as a related report, if the current period is not 'day' if (Common::getRequestVar('period', 'day') != 'day') { - $properties['VisitTime.getVisitInformationPerLocalTime']['relatedReports'] = array( + $properties['VisitTime.getVisitInformationPerLocalTime']['related_reports'] = array( 'VisitTime.getByDayOfWeek' => Piwik_Translate('VisitTime_VisitsByDayOfWeek') ); } |