diff options
author | Thomas ZILLIOX <thomas@zilliox.me> | 2013-07-02 20:08:38 +0400 |
---|---|---|
committer | Thomas ZILLIOX <thomas@zilliox.me> | 2013-07-02 20:08:38 +0400 |
commit | 287dcbbe9eecd9d6e4c5cd89a5a2fa7fe14bb09a (patch) | |
tree | 3ca1c8b4a1fd14cca3c5f492cf6ea8391f1a1060 /plugins/CoreHome | |
parent | 3b367dd3afffa6d44fdf0069f62b00c2bb487a5a (diff) |
Merge with master
Diffstat (limited to 'plugins/CoreHome')
31 files changed, 183 insertions, 133 deletions
diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index cd949995fe..724bb1f472 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -219,4 +219,25 @@ class Piwik_CoreHome_Controller extends Piwik_Controller $view->promoVideoUrl = 'http://www.youtube.com/watch?v=OslfF_EH81g'; echo $view->render(); } + + /** + * Redirects the user to a paypal so they can donate to Piwik. + */ + public function redirectToPaypal() + { + $parameters = Piwik_API_Request::getRequestArrayFromString($request = null); + foreach ($paramaters as $name => $param) { + if ($name == 'idSite' + || $name == 'module' + || $name == 'action' + ) { + unset($parameters[$name]); + } + } + + $url = "https://www.paypal.com/cgi-bin/webscr?".Piwik_Url::getQueryStringFromParameters($parameters); + + header("Location: $url"); + exit; + } } diff --git a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php index 4c4a964c2e..1e761a0aae 100644 --- a/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php +++ b/plugins/CoreHome/DataTableRowAction/MultiRowEvolution.php @@ -74,12 +74,13 @@ class Piwik_CoreHome_DataTableRowAction_MultiRowEvolution /** * Generic method to get an evolution graph or a sparkline for the row evolution popover. * Do as much as possible from outside the controller. + * * @return Piwik_ViewDataTable */ public function getRowEvolutionGraph() { $view = parent::getRowEvolutionGraph(); - $view->setCustomParameter(self::IS_MULTI_EVOLUTION_PARAM, true); + $view->setCustomParameter(self::IS_MULTI_EVOLUTION_PARAM, 1); // set in JS return $view; } } diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php index 8561d8734a..9a8ba5cc48 100644 --- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php +++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php @@ -74,8 +74,9 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution $this->apiMethod = Piwik_Common::getRequestVar('apiMethod', '', 'string'); if (empty($this->apiMethod)) throw new Exception("Parameter apiMethod not set."); - $this->label = Piwik_Common::getRequestVar('label', '', 'string'); - $this->label = Piwik_Common::unsanitizeInputValue($this->label); + $this->label = Piwik_API_ResponseBuilder::getLabelFromRequest($_GET); + $this->label = $this->label[0]; + if ($this->label === '') throw new Exception("Parameter label not set."); $this->period = Piwik_Common::getRequestVar('period', '', 'string'); @@ -90,7 +91,7 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution list($this->date, $lastN) = Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution::getDateRangeAndLastN($this->period, $end); } - $this->segment = Piwik_Common::getRequestVar('segment', '', 'string'); + $this->segment = Piwik_ViewDataTable::getRawSegmentFromRequest(); $this->loadEvolutionReport(); } @@ -132,7 +133,7 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution $parameters = array( 'method' => 'API.getRowEvolution', - 'label' => urlencode($this->label), + 'label' => $this->label, 'apiModule' => $apiModule, 'apiAction' => $apiAction, 'idSite' => $this->idSite, @@ -212,14 +213,14 @@ class Piwik_CoreHome_DataTableRowAction_RowEvolution $min = isset($metricData['min']) ? $metricData['min'] : 0; $change = isset($metricData['change']) ? $metricData['change'] : false; - $unit = Piwik_API_API::getUnit($metric, $this->idSite); + $unit = Piwik_Metrics::getUnit($metric, $this->idSite); $min .= $unit; $max .= $unit; $details = Piwik_Translate('RowEvolution_MetricBetweenText', array($min, $max)); if ($change !== false) { - $lowerIsBetter = Piwik_API_API::isLowerValueBetter($metric); + $lowerIsBetter = Piwik_Metrics::isLowerValueBetter($metric); if (substr($change, 0, 1) == '+') { $changeClass = $lowerIsBetter ? 'bad' : 'good'; $changeImage = $lowerIsBetter ? 'arrow_up_red' : 'arrow_up'; diff --git a/plugins/CoreHome/javascripts/autocomplete.js b/plugins/CoreHome/javascripts/autocomplete.js index 0e5fa3d1fa..d100de6e58 100644 --- a/plugins/CoreHome/javascripts/autocomplete.js +++ b/plugins/CoreHome/javascripts/autocomplete.js @@ -14,7 +14,7 @@ function switchSite(id, name, showAjaxLoading, idCanBeAll) { $('.sites_autocomplete input').val(id); $('.custom_select_main_link').text(name); $('.custom_select_main_link').addClass('custom_select_loading'); - broadcast.propagateNewPage('idSite=' + id, showAjaxLoading); + broadcast.propagateNewPage('segment=&idSite=' + id, showAjaxLoading); } return false; } @@ -29,6 +29,15 @@ $(function () { // sets up every un-inited site selector widget piwik.initSiteSelectors = function () { + function getUrlForWebsiteId(idSite) { + var idSiteParam = 'idSite=' + idSite; + var newParameters = 'segment=&' + idSiteParam; + var hash = broadcast.isHashExists() ? broadcast.getHashFromUrl() : "", + linkUrl = piwikHelper.getCurrentQueryStringWithParametersModified(newParameters) + + '#' + piwikHelper.getQueryStringWithParametersModified(hash.substring(1), newParameters); + return linkUrl; + } + $('.sites_autocomplete').each(function () { var selector = $(this); @@ -64,6 +73,8 @@ $(function () { source: '?module=SitesManager&action=getSitesForAutocompleter', appendTo: $('.custom_select_container', selector), select: function (event, ui) { + event.preventDefault(); + if (ui.item.id > 0) { // set attributes of selected site display (what shows in the box) $('.custom_select_main_link', selector) @@ -117,23 +128,14 @@ $(function () { } }).data("ui-autocomplete")._renderItem = function (ul, item) { $(ul).addClass('siteSelect'); - - var idSiteParam = 'idSite=' + item.id, - hash = broadcast.isHashExists() ? broadcast.getHashFromUrl().replace(/idSite=[0-9]+/, idSiteParam) : "", - linkUrl = piwikHelper.getCurrentQueryStringWithParametersModified(idSiteParam) + hash, - link = $("<a></a>").html(item.label).attr('href', linkUrl), + var linkUrl = getUrlForWebsiteId(item.id); + var link = $("<a></a>").html(item.label).attr('href', linkUrl), listItem = $('<li></li>'); listItem.data("item.ui-autocomplete", item) .append(link) .appendTo(ul); - link.click(function (e) { - // in ie8, the event would bubble up and cause an error - e.stopPropagation(); - return true; - }); - return listItem; }; @@ -162,12 +164,10 @@ $(function () { $('.custom_select_block', selector).on('mouseenter', function () { $('.custom_select_ul_list li a', selector).each(function () { - var hash = broadcast.getHashFromUrl(); - hash = hash ? hash.replace(/idSite=[0-9]+/, 'idSite=' + $(this).attr('siteid')) : ""; + var idSite = $(this).attr('siteid'); - var queryString = piwikHelper.getCurrentQueryStringWithParametersModified( - 'idSite=' + $(this).attr('siteid')); - $(this).attr('href', queryString + hash); + var linkUrl = getUrlForWebsiteId(idSite); + $(this).attr('href', linkUrl); }); }); diff --git a/plugins/CoreHome/javascripts/broadcast.js b/plugins/CoreHome/javascripts/broadcast.js index ccfb145033..868623b8c5 100644 --- a/plugins/CoreHome/javascripts/broadcast.js +++ b/plugins/CoreHome/javascripts/broadcast.js @@ -9,14 +9,6 @@ * broadcast object is to help maintain a hash for link clicks and ajax calls * so we can have back button and refresh button working. * - * Other file that currently depending on this are: - * calendar.js - * period_select.tpl - * sites_selections.tpl - * menu.js, ...etc - * - * !! Load this once and only once. !! - * * @type {object} */ var broadcast = { @@ -229,12 +221,6 @@ var broadcast = { * Expecting: * str = "param1=newVal1¶m2=newVal2"; * - * Currently being use by: - * - * handlePeriodClick, - * calendar.js, - * sites_selection.tpl - * * NOTE: This method will refresh the page with new values. * * @param {string} str url with parameters to be updated @@ -307,10 +293,13 @@ var broadcast = { if (paramValue == '') { newParamValue = ''; } + var getQuotedRegex = function(str) { + return (str+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); + }; + if (valFromUrl != '') { // replacing current param=value to newParamValue; - valFromUrl = valFromUrl.replace(/\$/g, '\\$'); - valFromUrl = valFromUrl.replace(/\./g, '\\.'); + valFromUrl = getQuotedRegex(valFromUrl); var regToBeReplace = new RegExp(paramName + '=' + valFromUrl, 'ig'); if (newParamValue == '') { // if new value is empty remove leading &, aswell @@ -459,7 +448,10 @@ var broadcast = { hashStr = url.substring(url.indexOf("#"), url.length); } else { - hashStr = decodeURIComponent(location.hash); + locationSplit = location.href.split('#'); + if(typeof locationSplit[1] != 'undefined') { + hashStr = '#' + locationSplit[1]; + } } return hashStr; @@ -485,27 +477,36 @@ var broadcast = { }, /** - * Returns all key-value pairs in query string of url. - * - * @param {string} url url to check. if undefined, null or empty, current url is used. - * @return {object} key value pair describing query string parameters + * Extracts from a query strings, the request array + * @param queryString + * @returns {object} */ - getValuesFromUrl: function (url) { - var searchString = this._removeHashFromUrl(url).split('?')[1] || '', - pairs = searchString.split('&'); - + extractKeyValuePairsFromQueryString: function (queryString) { + var pairs = queryString.split('&'); var result = {}; for (var i = 0; i != pairs.length; ++i) { // attn: split with regex has bugs in several browsers such as IE 8 // so we need to split, use the first part as key and rejoin the rest var pair = pairs[i].split('='); - var key = pair.shift(); + var key = pair.shift(); result[key] = pair.join('='); } return result; }, /** + * Returns all key-value pairs in query string of url. + * + * @param {string} url url to check. if undefined, null or empty, current url is used. + * @return {object} key value pair describing query string parameters + */ + getValuesFromUrl: function (url) { + var searchString = this._removeHashFromUrl(url).split('?')[1] || ''; + return this.extractKeyValuePairsFromQueryString(searchString); + }, + + + /** * help to get param value for any given url string with provided param name * if no url is provided, it will get param from current address. * return: @@ -558,9 +559,12 @@ var broadcast = { endStr = url.length; } var value = url.substring(startStr + param.length + 1, endStr); - // sanitize values - value = value.replace(/[^_%\+\-\<\>!@\$\.=,;0-9a-zA-Z]/gi, ''); + // we sanitize values to add a protection layer against XSS + // &segment= value is not sanitized, since segments are designed to accept any user input + if(param != 'segment') { + value = value.replace(/[^_%~\*\+\-\<\>!@\$\.()=,;0-9a-zA-Z]/gi, ''); + } return value; } else { return ''; diff --git a/plugins/CoreHome/javascripts/calendar.js b/plugins/CoreHome/javascripts/calendar.js index 16bd263225..4eb1d9d610 100644 --- a/plugins/CoreHome/javascripts/calendar.js +++ b/plugins/CoreHome/javascripts/calendar.js @@ -289,8 +289,8 @@ }; var togglePeriodPickers = function (showSingle) { - $('#periodString .period-date').toggle(showSingle); - $('#periodString .period-range').toggle(!showSingle); + $('#periodString').find('.period-date').toggle(showSingle); + $('#periodString').find('.period-range').toggle(!showSingle); $('#calendarRangeApply').toggle(!showSingle); }; @@ -379,13 +379,13 @@ return false; }; - $("#otherPeriods label").on('click', function (e) { + $("#otherPeriods").find("label").on('click', function (e) { var id = $(e.target).attr('for'); changePeriodOnClick($('#' + id)); }); // when non-range period is clicked, change the period & refresh the date picker - $("#otherPeriods input").on('click', function (e) { + $("#otherPeriods").find("input").on('click', function (e) { var request_URL = $(e.target).val(), period = broadcast.getValueFromUrl('period', request_URL), lastPeriod = selectedPeriod; @@ -442,8 +442,11 @@ }); // reset date/period when opening calendar - $('#periodString #date').click(function () { - $("#periodMore").toggle(); + $("#periodString").on('click', "#date,.calendar-icon", function () { + var periodMore = $("#periodMore").toggle(); + if (periodMore.is(":visible")) { + periodMore.find(".ui-state-highlight").removeClass('ui-state-highlight'); + } }); $('body').on('click', function(e) { @@ -497,7 +500,7 @@ if (!isValidDate(oDateFrom) || !isValidDate(oDateTo) || oDateFrom > oDateTo) { - $('#alert h2').text(_pk_translate('General_InvalidDateRange_js')); + $('#alert').find('h2').text(_pk_translate('General_InvalidDateRange_js')); piwikHelper.modalConfirm('#alert', {}); return false; } diff --git a/plugins/CoreHome/javascripts/corehome.js b/plugins/CoreHome/javascripts/corehome.js index 7c2ede9c2f..b80b54e57a 100755 --- a/plugins/CoreHome/javascripts/corehome.js +++ b/plugins/CoreHome/javascripts/corehome.js @@ -25,8 +25,7 @@ ajaxRequest.setLoadingElement('#header_message .loadingPiwik'); ajaxRequest.addParams({ module: 'CoreHome', - action: 'checkForUpdates', - token_auth: piwik.token_auth + action: 'checkForUpdates' }, 'get'); ajaxRequest.setCallback(function (response) { headerMessage.fadeOut('slow', function () { diff --git a/plugins/CoreHome/javascripts/datatable.js b/plugins/CoreHome/javascripts/datatable.js index 71c4da7cb8..0e4f5ffc43 100644 --- a/plugins/CoreHome/javascripts/datatable.js +++ b/plugins/CoreHome/javascripts/datatable.js @@ -84,7 +84,8 @@ dataTable.prototype = 'disable_generic_filters', 'columns', 'flat', - 'include_aggregate_rows' + 'include_aggregate_rows', + 'totalRows' ]; for (var key in filters) { @@ -1366,8 +1367,8 @@ dataTable.prototype = // if this url is also the url of a menu item, better to click that menu item instead of // doing AJAX request var menuItem = null; - $("#root>ul.nav a").each(function () { - if ($(this).attr('name') == url) { + $("#root").find(">ul.nav a").each(function () { + if ($(this).attr('href') == url) { menuItem = this; return false } diff --git a/plugins/CoreHome/javascripts/datatable_rowactions.js b/plugins/CoreHome/javascripts/datatable_rowactions.js index 62931dd61e..5aea12e4b1 100644 --- a/plugins/CoreHome/javascripts/datatable_rowactions.js +++ b/plugins/CoreHome/javascripts/datatable_rowactions.js @@ -213,6 +213,7 @@ DataTable_RowAction.prototype.getLabelFromTr = function (tr) { if (!value) { value = label.text(); } + value = value.trim(); return encodeURIComponent(value); }; diff --git a/plugins/CoreHome/javascripts/menu.js b/plugins/CoreHome/javascripts/menu.js index 3be160b1ca..b2010152be 100644 --- a/plugins/CoreHome/javascripts/menu.js +++ b/plugins/CoreHome/javascripts/menu.js @@ -29,7 +29,7 @@ menu.prototype = onItemClick: function (item) { $('ul.nav').trigger('piwikSwitchPage', item); - broadcast.propagateAjax($(item).attr('name')); + broadcast.propagateAjax( $(item).attr('href').substr(1) ); return false; }, @@ -45,7 +45,7 @@ menu.prototype = // for all sub menu we want to have a unique id based on their module and action // for main menu we want to add just the module as its id. this.menuNode.find('li').each(function () { - var url = $(this).find('a').attr('name'); + var url = $(this).find('a').attr('href').substr(1); var module = broadcast.getValueFromUrl("module", url); var action = broadcast.getValueFromUrl("action", url); var moduleId = broadcast.getValueFromUrl("idGoal", url) || broadcast.getValueFromUrl("idDashboard", url); diff --git a/plugins/CoreHome/templates/ReportRenderer/_htmlReportBody.twig b/plugins/CoreHome/templates/ReportRenderer/_htmlReportBody.twig index 992dab8fd1..6cec9b77c2 100644 --- a/plugins/CoreHome/templates/ReportRenderer/_htmlReportBody.twig +++ b/plugins/CoreHome/templates/ReportRenderer/_htmlReportBody.twig @@ -31,16 +31,18 @@ {% endfor %} </thead> <tbody> - {% set cycleValues=['','background-color: rgb('+tableBgColor+')'] %} + {% set cycleValues=['','background-color: rgb('~tableBgColor~')'] %} + {% set cycleIndex=0 %} {% for rowId,row in reportRows %} - {% set rowMetrics=row->getColumns() %} + {% set rowMetrics=row.columns %} {% if reportRowsMetadata[rowId] is defined %} - {% set rowMetadata=reportRowsMetadata[rowId]->getColumns() %} + {% set rowMetadata=reportRowsMetadata[rowId].columns %} {% else %} {% set rowMetadata=null %} {% endif %} - <tr style="{{ cycle(cycleValues) }}"> + <tr style="{{ cycle(cycleValues, cycleIndex) }}"> + {% set cycleIndex=cycleIndex+1 %} {% for columnId, columnName in reportColumns %} <td style="font-size: {{ reportTableRowTextSize }}pt; border-bottom: 1px solid rgb({{ tableCellBorderColor }}); padding: 5px 0 5px 5px;"> {% if columnId == 'label' %} @@ -52,7 +54,7 @@ {% if rowMetadata.url is defined %} <a style="color: rgb({{ reportTextColor }});" href='{% if rowMetadata.url|slice(0,4) not in ['http','ftp:'] %}http://{% endif %}{{ rowMetadata.url }}'> {% endif %} - {{ rowMetrics[columnId] }} + {{ rowMetrics[columnId] | raw }}{# labels are escaped by SafeDecodeLabel filter in core/API/Response.php #} {% if rowMetadata.url is defined %} </a> {% endif %} @@ -75,4 +77,4 @@ <a style="text-decoration:none; color: rgb({{ reportTitleTextColor }}); font-size: {{ reportBackToTopTextSize }}pt" href="#reportTop"> {{ 'PDFReports_TopOfReport'|translate }} </a> -{% endif %}
\ No newline at end of file +{% endif %} diff --git a/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig b/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig index d0932a0934..21b4bb35f9 100644 --- a/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig +++ b/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig @@ -14,6 +14,12 @@ {{ description }} - {{ 'General_DateRange'|translate }} {{ prettyDate }} </p> +{% if displaySegment %} +<p style="color: rgb({{ reportTitleTextColor }});"> + {{ 'PDFReports_CustomVisitorSegment'|translate("Piwik") }} {{ segmentName }} +</p> +{% endif %} + {% if reportMetadata|length > 1 %} <h2 style="color: rgb({{ reportTitleTextColor }}); font-size: {{ reportTitleTextSize }}pt;"> {{ 'PDFReports_TableOfContent'|translate }} diff --git a/plugins/CoreHome/templates/ReportsByDimension/_reportsByDimension.twig b/plugins/CoreHome/templates/ReportsByDimension/_reportsByDimension.twig index de23fe1053..184d6fe56a 100644 --- a/plugins/CoreHome/templates/ReportsByDimension/_reportsByDimension.twig +++ b/plugins/CoreHome/templates/ReportsByDimension/_reportsByDimension.twig @@ -2,11 +2,12 @@ <div class="entityList"> {% for category, dimensions in dimensionCategories %} + {% set firstCategory = (loop.index0 == 0) %} <div class='dimensionCategory'> {{ category|translate }} <ul class='listCircle'> {% for idx, dimension in dimensions %} - <li class="reportDimension {% if idx == 0 and loop.parent.index0 == 0 %}activeDimension{% endif %}" + <li class="reportDimension {% if idx == 0 and firstCategory %}activeDimension{% endif %}" data-url="{{ dimension.url }}"> <span class='dimension'>{{ dimension.title|translate }}</span> </li> @@ -16,7 +17,7 @@ {% endfor %} </div> - <div style="float:left;"> + <div style="float:left;max-width:900px;"> <div class="loadingPiwik" style="display:none"> <img src="plugins/Zeitgeist/images/loading-blue.gif" alt=""/>{{ 'General_LoadingData'|translate }} </div> diff --git a/plugins/CoreHome/templates/_dataTable.twig b/plugins/CoreHome/templates/_dataTable.twig index 8322f86a19..9548d3d9ef 100644 --- a/plugins/CoreHome/templates/_dataTable.twig +++ b/plugins/CoreHome/templates/_dataTable.twig @@ -1,6 +1,6 @@ <div class="dataTable" data-table-type="dataTable" data-report="{{ properties.uniqueId }}" data-params="{{ javascriptVariablesToSet|json_encode }}"> <div class="reportDocumentation"> - {% if reportDocumentation is not empty %}<p>{{ reportDocumentation }}</p>{% endif %} + {% if reportDocumentation is not empty %}<p>{{ reportDocumentation|raw }}</p>{% endif %} {% if properties.metadata.archived_date is defined %}<span class='helpDate'>{{ properties.metadata.archived_date }}</span>{% endif %} </div> {% set class %} @@ -26,7 +26,7 @@ id="{{ row.idsubdatatable }}"{% endif %}{% if row.issummaryrow is defined and row.issummaryrow and properties.highlight_summary_row %} class="highlight"{% endif %}> {% for column in dataTableColumns %} <td> - {% include "@CoreHome/_dataTableCell.twig" %} + {% include "@CoreHome/_dataTableCell.twig" with properties %} </td> {% endfor %} </tr> diff --git a/plugins/CoreHome/templates/_dataTableActions.twig b/plugins/CoreHome/templates/_dataTableActions.twig index cc5988e06a..996d6c3c9e 100644 --- a/plugins/CoreHome/templates/_dataTableActions.twig +++ b/plugins/CoreHome/templates/_dataTableActions.twig @@ -19,7 +19,7 @@ {% else %}class="actionsDataTable rowToProcess"{% endif %}> {% for column in dataTableColumns %} <td> - {% include "@CoreHome/_dataTableCell.twig" with {'column': column, 'row': row} only %} + {% include "@CoreHome/_dataTableCell.twig" with {'column': column, 'row': row} %} </td> {% endfor %} </tr> diff --git a/plugins/CoreHome/templates/_dataTableActions_recursive.twig b/plugins/CoreHome/templates/_dataTableActions_recursive.twig index c5935e696d..3426dd11ed 100644 --- a/plugins/CoreHome/templates/_dataTableActions_recursive.twig +++ b/plugins/CoreHome/templates/_dataTableActions_recursive.twig @@ -1,6 +1,6 @@ <div class="dataTable" data-table-type="actionDataTable" data-report="{{ properties.uniqueId }}" data-params="{{ javascriptVariablesToSet|json_encode }}"> <div class="dataTableActionsWrapper"> - {% if arrayDataTable.result is define and arrayDataTable.result == 'error' %} + {% if arrayDataTable.result is defined and arrayDataTable.result == 'error' %} {{ arrayDataTable.message }} {% else %} {% if arrayDataTable|length == 0 %} @@ -13,7 +13,7 @@ <tbody> {% for row in arrayDataTable %} <tr {% if row.idsubdatatable %}class="level{{ row.level }} rowToProcess subActionsDataTable" id="{{ row.idsubdatatable }}" - {% else %}class="actionsDataTable rowToProcess level{$row.level}"{% endif %}> + {% else %}class="actionsDataTable rowToProcess level{{ row.level }}"{% endif %}> {% for column in dataTableColumns %} <td> {% include "@CoreHome/_dataTableCell.twig" %} diff --git a/plugins/CoreHome/templates/_dataTableCell.twig b/plugins/CoreHome/templates/_dataTableCell.twig index dab9a6401d..c7d3556c5f 100644 --- a/plugins/CoreHome/templates/_dataTableCell.twig +++ b/plugins/CoreHome/templates/_dataTableCell.twig @@ -1,23 +1,23 @@ -{% set tooltipIndex %}{{ column }}_tooltip{% endset %} +{% spaceless %} +{% set tooltipIndex = column ~ '_tooltip' %} {% if row.metadata[tooltipIndex] is defined %}<span class="cell-tooltip" data-tooltip="{{ row.metadata[tooltipIndex] }}">{% endif %} -{% if not row.idsubdatatable and column=='label' and row.metadata.url is not empty %} +{% if not row.idsubdatatable and column=='label' and row.metadata.url is defined %} <a target="_blank" href='{% if row.metadata.url|slice(0,4) not in ['http','ftp:'] %}http://{% endif %}{{ row.metadata.url }}'> - {% if row.metadata.logo is empty %} + {% if row.metadata.logo is not defined %} <img class="link" width="10" height="9" src="plugins/Zeitgeist/images/link.gif"/> {% endif %} {% endif %} {% if column=='label' %} {% import 'macros.twig' as piwik %} {{ piwik.logoHtml(row.metadata, row.columns.label) }} - {% if row.metadata.html_label_prefix is not empty %}<span class='label-prefix'>{{ row.metadata.html_label_prefix }}</span>{% endif %} - <span class='label{% if row.metadata.is_aggregate is not empty and row.metadata.is_aggregate %} highlighted{% endif %}' - {% if properties.tooltip_metadata_name is not empty %}title="{{ row.metadata[properties.tooltip_metadata_name] }}"{% endif %}> - {# make sure there are no whitespaces inside the span #} - {% if row.metadata.html_label_suffix is not empty %}<span class='label-suffix'>{{ row.metadata.html_label_suffix }}</span>{% endif %} -{% endif %} -{% if row.columns[column] is defined %}{{ row.columns[column]|raw }}{% else %}{{ defaultWhenColumnValueNotDefined }}{% endif %} + {% if row.metadata.html_label_prefix is defined %}<span class='label-prefix'>{{ row.metadata.html_label_prefix | raw }} </span>{% endif -%} + <span class='label{% if row.metadata.is_aggregate is defined and row.metadata.is_aggregate %} highlighted{% endif %}' + {% if properties is defined and properties.tooltip_metadata_name is not empty %}title="{{ row.metadata[properties.tooltip_metadata_name] }}"{% endif %}> + {%- if row.metadata.html_label_suffix is defined %}<span class='label-suffix'>{{ row.metadata.html_label_suffix | raw }}</span>{% endif -%} +{% endif %}{% if row.columns[column] is defined %}{{- row.columns[column]|raw -}}{% else %}{{ defaultWhenColumnValueNotDefined }}{% endif %} {% if column=='label' %}</span>{% endif %} -{% if not row.idsubdatatable and column=='label' and row.metadata.url is not empty %} +{% if not row.idsubdatatable and column=='label' and row.metadata.url is defined %} </a> {% endif %} -{% if row.metadata[tooltipIndex] is defined %}</span>{% endif %}
\ No newline at end of file +{% if row.metadata[tooltipIndex] is defined %}</span>{% endif %} +{% endspaceless %}
\ No newline at end of file diff --git a/plugins/CoreHome/templates/_dataTableCloud.twig b/plugins/CoreHome/templates/_dataTableCloud.twig index 1007628587..1e0a465a5a 100644 --- a/plugins/CoreHome/templates/_dataTableCloud.twig +++ b/plugins/CoreHome/templates/_dataTableCloud.twig @@ -1,6 +1,6 @@ <div class="dataTable" data-report="{{ properties.uniqueId }}" data-params="{{ javascriptVariablesToSet|json_encode }}"> {% if reportDocumentation is not empty and javascriptVariablesToSet.viewDataTable != 'tableGoals' %} - <div class="reportDocumentation"><p>{{ reportDocumentation }}</p></div> + <div class="reportDocumentation"><p>{{ reportDocumentation|raw }}</p></div> {% endif %} <div class="tagCloud"> {% if cloudValues|length == 0 %} diff --git a/plugins/CoreHome/templates/_dataTableFooter.twig b/plugins/CoreHome/templates/_dataTableFooter.twig index bf4e932068..8d6f1f1469 100644 --- a/plugins/CoreHome/templates/_dataTableFooter.twig +++ b/plugins/CoreHome/templates/_dataTableFooter.twig @@ -94,11 +94,11 @@ </span> <span class="exportToFormatItems" style="display:none"> {{ 'General_Export'|translate }}: - <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="CSV" filter_limit="{$properties.exportLimit}">CSV</a> | - <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="TSV" filter_limit="{$properties.exportLimit}">TSV (Excel)</a> | - <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="XML" filter_limit="{$properties.exportLimit}">XML</a> | - <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="JSON" filter_limit="{$properties.exportLimit}">Json</a> | - <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="PHP" filter_limit="{$properties.exportLimit}">Php</a> + <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="CSV" filter_limit="{{ properties.exportLimit }}">CSV</a> | + <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="TSV" filter_limit="{{ properties.exportLimit }}">TSV (Excel)</a> | + <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="XML" filter_limit="{{ properties.exportLimit }}">XML</a> | + <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="JSON" filter_limit="{{ properties.exportLimit }}">Json</a> | + <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="PHP" filter_limit="{{ properties.exportLimit }}">Php</a> {% if properties.show_export_as_rss_feed %} | <a target="_blank" methodToCall="{{ properties.apiMethodToRequestDataTable }}" format="RSS" filter_limit="{{ properties.exportLimit }}" date="last10"> @@ -148,14 +148,14 @@ {% endif %} <div class="datatableRelatedReports"> - {% if (properties.relatedReports is not empty) and (arrayDataTable is not empty) or (cloudValues is not empty) or (isDataAvailable is defined and isDataAvailable) and properties.show_related_reports %} + {% if (properties.relatedReports is not empty) and properties.show_related_reports %} {% if properties.relatedReports|length == 1 %} - {{ 'General_RelatedReport'|translate }} + {{ 'General_RelatedReport'|translate }}: {% else %} - {{ 'General_RelatedReports'|translate }} - {% endif %}: + {{ 'General_RelatedReports'|translate }}: + {% endif %} <ul style="list-style:none;{% if properties.relatedReports|length == 1 %}display:inline-block;{% endif %}}"> - <li><span href="{$properties.self_url}" style="display:none;">{{ properties.title }}</span></li> + <li><span href="{{ properties.self_url }}" style="display:none;">{{ properties.title }}</span></li> {% for reportUrl,reportTitle in properties.relatedReports %} <li><span href="{{ reportUrl }}">{{ reportTitle }}</span></li> @@ -164,8 +164,8 @@ {% endif %} </div> - {% if properties.show_footer_message is not empty %} - <div class='datatableFooterMessage'>{{ properties.show_footer_message }}</div> + {% if properties.show_footer_message is defined and properties.show_footer_message is not empty %} + <div class='datatableFooterMessage'>{{ properties.show_footer_message | raw }}</div> {% endif %} </div> diff --git a/plugins/CoreHome/templates/_dataTableGraph.twig b/plugins/CoreHome/templates/_dataTableGraph.twig index d0012fdca4..1e076d021b 100644 --- a/plugins/CoreHome/templates/_dataTableGraph.twig +++ b/plugins/CoreHome/templates/_dataTableGraph.twig @@ -1,7 +1,7 @@ <div class="dataTable" data-report="{{ properties.uniqueId }}" data-params="{{ javascriptVariablesToSet|json_encode }}"> <div class="reportDocumentation"> - {% if reportDocumentation is not empty %}<p>{{ reportDocumentation }}</p>{% endif %} + {% if reportDocumentation is not empty %}<p>{{ reportDocumentation|raw }}</p>{% endif %} {% if properties.metadata.archived_date is defined %}<p>{{ properties.metadata.archived_date }}</p>{% endif %} </div> @@ -11,7 +11,7 @@ <div class="jqplot-{{ graphType }}" style="padding-left: 6px;"> <div class="piwik-graph" style="position: relative; width: {{ width }}{% if width|slice(-1,1) != '%' %}px{% endif %}; height: {{ height }}{% if height|slice(-1,1) != '%' %}px{% endif %};" - data-data="{{ data }}" + data-data="{{ data|e('html') }}" data-graph-type="{{ graphType }}" {% if properties.externalSeriesToggle is defined and properties.externalSeriesToggle %} data-external-series-toggle="{{ properties.externalSeriesToggle }}" @@ -33,7 +33,8 @@ {% if properties.show_footer %} {% include "@CoreHome/_dataTableFooter.twig" %} - {% include "@CoreHome/_dataTableJS.twig" %} {% endif %} + + {% include "@CoreHome/_dataTableJS.twig" %} </div> </div> diff --git a/plugins/CoreHome/templates/_donate.twig b/plugins/CoreHome/templates/_donate.twig index c33dfffe9e..ad5ad8dee7 100755 --- a/plugins/CoreHome/templates/_donate.twig +++ b/plugins/CoreHome/templates/_donate.twig @@ -13,7 +13,7 @@ <div class="donate-form-instructions">({{ 'CoreHome_DonateFormInstructions'|translate }})</div> - <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> + <form action="index.php?module=CoreHome&action=redirectToPaypal&idSite=1" method="post" target="_blank"> <input type="hidden" name="cmd" value="_s-xclick"/> <input type="hidden" name="hosted_button_id" value="DVKLY73RS7JTE"/> <input type="hidden" name="currency_code" value="USD"/> @@ -36,7 +36,7 @@ <input type="image" src="plugins/Zeitgeist/images/paypal_subscribe.gif" border="0" name="submit" title="{{ 'CoreHome_SubscribeAndBecomePiwikSupporter'|translate }}"/> <a class="donate-spacer">{{ 'CoreHome_MakeOneTimeDonation'|translate }}</a> - <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RPL23NJURMTFA&bb2_screener_=1357583494+83.233.186.82" + <a href="index.php?module=CoreHome&action=redirectToPaypal&idSite=1&cmd=_s-xclick&hosted_button_id=RPL23NJURMTFA&bb2_screener_=1357583494+83.233.186.82" target="_blank" class="donate-one-time">{{ 'CoreHome_MakeOneTimeDonation'|translate }}</a> </div> diff --git a/plugins/CoreHome/templates/_headerMessage.twig b/plugins/CoreHome/templates/_headerMessage.twig index c929db3c03..d0740661d8 100644 --- a/plugins/CoreHome/templates/_headerMessage.twig +++ b/plugins/CoreHome/templates/_headerMessage.twig @@ -27,7 +27,16 @@ {{ 'General_PiwikXIsAvailablePleaseNotifyPiwikAdmin'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org/' target='_blank'>Piwik</a> <a href='?module=Proxy&action=redirect&url=http://piwik.org/changelog/' target='_blank'>{{ latest_version_available }}</a>")|raw }} {% endif %} {% else %} - {{ 'General_PiwikIsACollaborativeProjectYouCanContributeAndDonate'|translate("<a href='?module=Proxy&action=redirect&url=http://piwik.org' target='_blank'>",piwik_version+"</a>","<br />","<a target='_blank' href='?module=Proxy&action=redirect&url=http://piwik.org/contribute/'>","</a>",'<br/>',"<a href='http://piwik.org/donate/' target='_blank'><strong><em>","</em></strong></a>")|raw }} + {{ 'General_PiwikIsACollaborativeProjectYouCanContributeAndDonate'|translate( + "<a href='?module=Proxy&action=redirect&url=http://piwik.org' target='_blank'>", + piwik_version~"</a>", + "<br />", + "<a target='_blank' href='?module=Proxy&action=redirect&url=http://piwik.org/contribute/'>", + "</a>", + '<br/>', + "<a href='http://piwik.org/donate/' target='_blank'><strong><em>", + "</em></strong></a>" + )|raw }} {% endif %} {% if hasSomeAdminAccess %} <br/> diff --git a/plugins/CoreHome/templates/_menu.twig b/plugins/CoreHome/templates/_menu.twig index c1318b1bac..ba88ca1de2 100644 --- a/plugins/CoreHome/templates/_menu.twig +++ b/plugins/CoreHome/templates/_menu.twig @@ -6,9 +6,11 @@ <ul> {% for name,urlParameters in level2 %} {% if name|slice(0,1) != '_' %} - <li id="{{ urlParameters._url|urlRewriteWithParameters }}"> - <a href="#{{ urlParameters._url|urlRewriteWithParameters|slice(1) }}" - onclick="return piwikMenu.onItemClick(this);">{{ name|translate }}</a> + <li> + <a href='#{{ urlParameters._url|urlRewriteWithParameters|slice(1) }}' + onclick='return piwikMenu.onItemClick(this);'> + {{ name|translate }} + </a> </li> {% endif %} {% endfor %} diff --git a/plugins/CoreHome/templates/_periodSelect.twig b/plugins/CoreHome/templates/_periodSelect.twig index bf63a6d752..b0b3b81123 100644 --- a/plugins/CoreHome/templates/_periodSelect.twig +++ b/plugins/CoreHome/templates/_periodSelect.twig @@ -2,6 +2,7 @@ <div id="periodString"> <div id="date">{{ 'General_DateRange'|translate }} <b>{{ prettyDate }}</b></div> + <div class="calendar-icon"></div> <div id="periodMore"> <div class="period-date"> <h6>{{ 'General_Date'|translate }}</h6> @@ -24,7 +25,7 @@ <h6>{{ 'General_Period'|translate }}</h6> <span id="otherPeriods"> {% for label,thisPeriod in periodsNames %} - <input type="radio" name="period" id="period_id_{{ label }}" value="{url period=$label}"{% if label==period %} checked="checked"{% endif %} /> + <input type="radio" name="period" id="period_id_{{ label }}" value="{{ linkTo( { 'period': label} ) }}"{% if label==period %} checked="checked"{% endif %} /> <label for="period_id_{{ label }}">{{ thisPeriod.singular }}</label> <br/> {% endfor %} diff --git a/plugins/CoreHome/templates/_siteSelect.twig b/plugins/CoreHome/templates/_siteSelect.twig index d7c904a6c6..80d337828b 100644 --- a/plugins/CoreHome/templates/_siteSelect.twig +++ b/plugins/CoreHome/templates/_siteSelect.twig @@ -29,7 +29,7 @@ <div class="custom_select"> <a href="#" onclick="return false" class="custom_select_main_link" siteid="{% if idSite is defined %}{{ idSite }}{% else %}{{ sites[0].idsite }}{% endif %}"> - {% if siteName is defined %}{{ siteName }}{% else %}{{ sites[0].name }}{% endif %} + {% if siteName is defined %}{{ siteName|raw }}{% else %}{{ sites[0].name|raw }}{% endif %} </a> <div class="custom_select_block"> @@ -40,7 +40,7 @@ <ul class="custom_select_ul_list"> {% for info in sites %} <li {% if (showSelectedSite is not defined or showSelectedSite == false) and idSite == info.idsite %} style="display: none"{% endif %}> - <a href="#" siteid="{{ info.idsite }}">{{ info.name }}</a> + <a href="#" siteid="{{ info.idsite }}">{{ info.name|raw }}</a> </li> {% endfor %} </ul> diff --git a/plugins/CoreHome/templates/_topBarHelloMenu.twig b/plugins/CoreHome/templates/_topBarHelloMenu.twig index 5d3fb16a12..34503d12bf 100644 --- a/plugins/CoreHome/templates/_topBarHelloMenu.twig +++ b/plugins/CoreHome/templates/_topBarHelloMenu.twig @@ -1,6 +1,6 @@ <div id="topRightBar"> {% set helloAlias %} - {% if userAlias %} + {% if userAlias is defined %} <strong>{{ userAlias }}</strong> {% else %} <strong>{{ userLogin }}</strong> diff --git a/plugins/CoreHome/templates/_topScreen.twig b/plugins/CoreHome/templates/_topScreen.twig index 1a304b510f..1feec9e857 100644 --- a/plugins/CoreHome/templates/_topScreen.twig +++ b/plugins/CoreHome/templates/_topScreen.twig @@ -1,7 +1,4 @@ <div id="header"> {% include "@CoreHome/_logo.twig" %} - {% include "@CoreHome/_javaScriptDisabled.twig" %} - {% if (showTopMenu == false or showTopMenu) %} - {% include "@CoreHome/_topBar.twig" %} - {% endif %} + {% include "@CoreHome/_topBar.twig" %} </div> diff --git a/plugins/CoreHome/templates/_warningInvalidHost.twig b/plugins/CoreHome/templates/_warningInvalidHost.twig index 58ec1b397f..7868e936d7 100644 --- a/plugins/CoreHome/templates/_warningInvalidHost.twig +++ b/plugins/CoreHome/templates/_warningInvalidHost.twig @@ -1,5 +1,5 @@ {# untrusted host warning #} -{% if (isValidHost and invalidHostMessage and isValidHost == false) %} +{% if (isValidHost is defined and invalidHostMessage is defined and isValidHost == false) %} <div class="ajaxSuccess" style='clear:both;width:800px'> <a style="float:right" href="http://piwik.org/faq/troubleshooting/#faq_171" target="_blank"><img src="plugins/Zeitgeist/images/help_grey.png"/></a> <strong>{{ 'General_Warning'|translate }}: </strong>{{ invalidHostMessage }} diff --git a/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig b/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig index a4a2a6c704..daf93f91b7 100644 --- a/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig +++ b/plugins/CoreHome/templates/getMultiRowEvolutionPopover.twig @@ -1,7 +1,7 @@ <div class="rowevolution multirowevolution"> <div class="popover-title">{{ 'RowEvolution_MultiRowEvolutionTitle'|translate }}</div> <div class="graph"> - {{ graph }} + {{ graph | raw }} </div> <div class="metrics-container"> <h2>{{ availableRecordsText|translate }}</h2> @@ -14,7 +14,7 @@ <td class="text"> {% import 'macros.twig' as piwik %} {{ piwik.logoHtml(metric, "") }} - <span style="color:{{ metric.color }}">{{ metric.label }}</span><br/> + <span style="color:{{ metric.color }}">{{ metric.label|raw }}</span><br/> <span class="details">{{ metric.details }}</span> </td> </tr> @@ -27,11 +27,11 @@ <h2>{{ 'RowEvolution_AvailableMetrics'|translate }}</h2> <select name="metric" class="multirowevoltion-metric"> {% for metric, metricName in availableMetrics %} - <option value="{$metric|escape:'html'}"{% if selectedMetric == metric %} selected="selected"{% endif %}> + <option value="{{ metric }}"{% if selectedMetric == metric %} selected="selected"{% endif %}> {{ metricName }} </option> {% endfor %} </select> </div> {% endif %} -</div>
\ No newline at end of file +</div> diff --git a/plugins/CoreHome/templates/getPromoVideo.twig b/plugins/CoreHome/templates/getPromoVideo.twig index 487a743564..c162f0bc95 100755 --- a/plugins/CoreHome/templates/getPromoVideo.twig +++ b/plugins/CoreHome/templates/getPromoVideo.twig @@ -25,7 +25,7 @@ <img src="plugins/Referers/images/socials/twitter.com.png" /> </a> - {* email *} + {# email #} <a href="mailto:?body={{ shareTextLong|url_encode(true) }}&subject={{ shareText|url_encode(true) }}" target="_blank"> <img src="plugins/Zeitgeist/images/email.png" /> </a> diff --git a/plugins/CoreHome/templates/getRowEvolutionPopover.twig b/plugins/CoreHome/templates/getRowEvolutionPopover.twig index f93089a687..6179cfd5cf 100644 --- a/plugins/CoreHome/templates/getRowEvolutionPopover.twig +++ b/plugins/CoreHome/templates/getRowEvolutionPopover.twig @@ -1,10 +1,10 @@ <div class="rowevolution"> - <div class="popover-title">{{ popoverTitle }}</div> + <div class="popover-title">{{ popoverTitle | raw }}</div> <div class="graph"> {{ graph|raw }} </div> <div class="metrics-container"> - <h2>{{ availableMetricsText }}</h2> + <h2>{{ availableMetricsText|raw }}</h2> <div class="rowevolution-documentation"> {{ 'RowEvolution_Documentation'|translate }} @@ -13,10 +13,10 @@ {% for metric in metrics %} <tr> <td class="sparkline"> - {{ metric.sparkline }} + {{ metric.sparkline | raw }} </td> <td class="text"> - <span style="color:{{ metric.color }}">{{ metric.label }}</span> + <span style="color:{{ metric.color }}">{{ metric.label|raw }}</span> {% if metric.details %}: <span class="details">{{ metric.details }}</span> {% endif %} @@ -29,8 +29,8 @@ <h2>{{ 'RowEvolution_CompareRows'|translate }}</h2> <div class="rowevolution-documentation"> - {{ 'RowEvolution_CompareDocumentation'|translate }} + {{ 'RowEvolution_CompareDocumentation'|translate|raw }} </div> <a href="#" class="rowevolution-startmulti">» {{ 'RowEvolution_PickARow'|translate }}</a> </div> -</div>
\ No newline at end of file +</div> |