update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -0,0 +1,22 @@
|
|||
/*!
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
(function () {
|
||||
angular.module('piwikApp').controller('ManageCustomVarsController', ManageCustomVarsController);
|
||||
|
||||
ManageCustomVarsController.$inject = ['manageCustomVarsModel', 'piwik', '$filter'];
|
||||
|
||||
function ManageCustomVarsController(manageCustomVarsModel, piwik, $filter) {
|
||||
manageCustomVarsModel.fetchUsages();
|
||||
|
||||
this.model = manageCustomVarsModel;
|
||||
this.siteName = piwik.siteName;
|
||||
this.scopes = [
|
||||
{value: 'visit', name: _pk_translate('General_TrackingScopeVisit')},
|
||||
{value: 'page', name: _pk_translate('General_TrackingScopePage')}
|
||||
];
|
||||
}
|
||||
})();
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<div class="manageCustomVars">
|
||||
<h2 piwik-enriched-headline help-url="http://piwik.org/docs/custom-variables/">{{ 'CustomVariables_CustomVariables'|translate }}</h2>
|
||||
|
||||
<p>
|
||||
<span ng-bind-html="'CustomVariables_ManageDescription'|translate:manageCustomVars.siteName"></span>
|
||||
</p>
|
||||
|
||||
<div class="alert alert-info" ng-show="!manageCustomVars.model.isLoading && manageCustomVars.model.hasCustomVariablesInGeneral && !manageCustomVars.model.hasAtLeastOneUsage">
|
||||
{{ 'CustomVariables_SlotsReportIsGeneratedOverTime'|translate }}
|
||||
</div>
|
||||
|
||||
<div ng-repeat="scope in manageCustomVars.scopes">
|
||||
<h2 class="secondary">{{ 'CustomVariables_ScopeX'|translate:(scope.name) }}</h2>
|
||||
<table class="dataTable entityTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{'CustomVariables_Index'|translate }}</th>
|
||||
<th>{{'CustomVariables_Usages'|translate }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3" ng-show="manageCustomVars.model.isLoading">{{ 'General_Loading'|translate }}</td>
|
||||
</tr>
|
||||
<tr ng-repeat="customVariables in manageCustomVars.model.customVariables|filter:{scope: scope.value}">
|
||||
<td class="index">{{ customVariables.index }}</td>
|
||||
<td>
|
||||
<span ng-show="(customVariables.usages|length) === 0"
|
||||
class="unused">{{'CustomVariables_Unused'|translate }}</span>
|
||||
<span ng-show="customVariables.usages|length" ng-repeat="cvar in customVariables.usages|orderBy:'-nb_actions'">
|
||||
<span title="{{ 'CustomVariables_UsageDetails'|translate:(cvar.nb_visits ? cvar.nb_visits : 0):(cvar.nb_actions ? cvar.nb_actions : 0) }}">{{ cvar.name }}</span><span ng-show="!$last">, </span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h2 class="secondary" ng-show="!manageCustomVars.model.isLoading">{{ 'CustomVariables_CreateNewSlot'|translate }}</h2>
|
||||
|
||||
<p ng-show="!manageCustomVars.model.isLoading">
|
||||
{{ 'CustomVariables_CreatingCustomVariableTakesTime'|translate }}
|
||||
<br /><br />
|
||||
<span ng-bind-html="'CustomVariables_CurrentAvailableCustomVariables'|translate:('<strong>'+manageCustomVars.model.numSlotsAvailable+'</strong>')"></span>
|
||||
<br />
|
||||
<br />
|
||||
{{ 'CustomVariables_ToCreateCustomVarExecute'|translate }}
|
||||
<br />
|
||||
<br />
|
||||
<code>./console customvariables:set-max-custom-variables {{ manageCustomVars.model.numSlotsAvailable + 1 }}</code>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*!
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Usage:
|
||||
* <div piwik-manage-custom-vars>
|
||||
*/
|
||||
(function () {
|
||||
angular.module('piwikApp').directive('piwikManageCustomVars', piwikManageCustomVars);
|
||||
|
||||
piwikManageCustomVars.$inject = ['piwik'];
|
||||
|
||||
function piwikManageCustomVars(piwik){
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {},
|
||||
templateUrl: 'plugins/CustomVariables/angularjs/manage-custom-vars/manage-custom-vars.directive.html?cb=' + piwik.cacheBuster,
|
||||
controller: 'ManageCustomVarsController',
|
||||
controllerAs: 'manageCustomVars'
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
.manageCustomVars {
|
||||
.unused {
|
||||
color: @color-silver;
|
||||
}
|
||||
|
||||
table, p {
|
||||
width: 900px;
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.scope, .index {
|
||||
width: 90px;
|
||||
max-width: 90px;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*!
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
(function () {
|
||||
angular.module('piwikApp').factory('manageCustomVarsModel', manageCustomVarsModel);
|
||||
|
||||
manageCustomVarsModel.$inject = ['piwikApi'];
|
||||
|
||||
function manageCustomVarsModel(piwikApi) {
|
||||
|
||||
var model = {
|
||||
customVariables : [],
|
||||
extractions : [],
|
||||
isLoading: false,
|
||||
fetchUsages: fetchUsages,
|
||||
hasCustomVariablesInGeneral: false,
|
||||
hasAtLeastOneUsage: false,
|
||||
numSlotsAvailable: 5,
|
||||
};
|
||||
|
||||
return model;
|
||||
|
||||
function fetchCustomVariables() {
|
||||
return piwikApi.fetch({method: 'CustomVariables.getCustomVariables', period: 'year', date: 'today', filter_limit: 1})
|
||||
.then(function (customVariables) {
|
||||
model.hasCustomVariablesInGeneral = (customVariables && customVariables.length > 0);
|
||||
});
|
||||
}
|
||||
|
||||
function fetchUsages() {
|
||||
|
||||
model.isLoading = true;
|
||||
|
||||
fetchCustomVariables().then(function () {
|
||||
return piwikApi.fetch({method: 'CustomVariables.getUsagesOfSlots'});
|
||||
|
||||
}).then(function (customVariables) {
|
||||
model.customVariables = customVariables;
|
||||
|
||||
angular.forEach(customVariables, function (customVar) {
|
||||
if (customVar.index > model.numSlotsAvailable) {
|
||||
model.numSlotsAvailable = customVar.index;
|
||||
}
|
||||
|
||||
if (customVar.usages && customVar.usages.length > 0) {
|
||||
model.hasAtLeastOneUsage = true;
|
||||
}
|
||||
});
|
||||
|
||||
})['finally'](function () { // .finally() is not IE8 compatible see https://github.com/angular/angular.js/commit/f078762d48d0d5d9796dcdf2cb0241198677582c
|
||||
model.isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue