PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,45 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Controller to save archiving settings
*/
(function () {
angular.module('piwikApp').controller('ArchivingController', ArchivingController);
ArchivingController.$inject = ['$scope', 'piwikApi'];
function ArchivingController($scope, piwikApi) {
var self = this;
this.isLoading = false;
this.save = function () {
this.isLoading = true;
var enableBrowserTriggerArchiving = $('input[name=enableBrowserTriggerArchiving]:checked').val();
var todayArchiveTimeToLive = $('#todayArchiveTimeToLive').val();
piwikApi.post({module: 'API', method: 'CoreAdminHome.setArchiveSettings'}, {
enableBrowserTriggerArchiving: enableBrowserTriggerArchiving,
todayArchiveTimeToLive: todayArchiveTimeToLive
}).then(function (success) {
self.isLoading = false;
var UI = require('piwik/UI');
var notification = new UI.Notification();
notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), {
id: 'generalSettings', context: 'success'
});
notification.scrollToNotification();
}, function () {
self.isLoading = false;
});
};
}
})();

View File

@ -0,0 +1,108 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Controller to save mail smtp settings
*/
(function () {
angular.module('piwikApp').controller('BrandingController', BrandingController);
BrandingController.$inject = ['$scope', 'piwikApi'];
function BrandingController($scope, piwikApi) {
var self = this;
this.isLoading = false;
function refreshCustomLogo() {
var selectors = ['#currentLogo', '#currentFavicon'];
var index;
for (index = 0; index < selectors.length; index++) {
var imageDiv = $(selectors[index]);
if (imageDiv && imageDiv.data("src") && imageDiv.data("srcExists")) {
var logoUrl = imageDiv.data("src");
imageDiv.attr("src", logoUrl + "?" + (new Date()).getTime());
imageDiv.show();
} else {
imageDiv.hide();
}
}
}
this.updateLogo = function () {
var isSubmittingLogo = (this.customLogo != undefined && this.customLogo != '');
var isSubmittingFavicon = (this.customFavicon != undefined && this.customFavicon != '');
if (!isSubmittingLogo && !isSubmittingFavicon) {
return;
}
var $uploadError = $('.uploaderror');
$uploadError.fadeOut();
var frameName = "upload" + (new Date()).getTime();
var uploadFrame = $("<iframe name=\"" + frameName + "\" />");
uploadFrame.css("display", "none");
uploadFrame.load(function (data) {
setTimeout(function () {
var frameContent = $(uploadFrame.contents()).find('body').html();
frameContent = $.trim(frameContent);
if ('0' === frameContent) {
$uploadError.show();
} else {
// Upload succeed, so we update the images availability
// according to what have been uploaded
if (isSubmittingLogo) {
$('#currentLogo').data("srcExists", true);
}
if (isSubmittingFavicon) {
$('#currentFavicon').data("srcExists", true);
}
refreshCustomLogo();
}
if ('1' === frameContent || '0' === frameContent) {
uploadFrame.remove();
}
}, 1000);
});
$("body:first").append(uploadFrame);
var submittingForm = $('#logoUploadForm');
submittingForm.attr("target", frameName);
submittingForm.submit();
this.customLogo = '';
this.customFavicon = '';
};
refreshCustomLogo();
this.toggleCustomLogo = function () {
refreshCustomLogo();
};
this.save = function () {
this.isLoading = true;
piwikApi.post({module: 'API', method: 'CoreAdminHome.setBrandingSettings'}, {
useCustomLogo: this.enabled ? '1' : '0'
}).then(function (success) {
self.isLoading = false;
var UI = require('piwik/UI');
var notification = new UI.Notification();
notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), {
id: 'generalSettings', context: 'success'
});
notification.scrollToNotification();
}, function () {
self.isLoading = false;
});
};
}
})();

View File

@ -0,0 +1,57 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Controller to save mail smtp settings
*/
(function () {
angular.module('piwikApp').controller('MailSmtpController', MailSmtpController);
MailSmtpController.$inject = ['$scope', 'piwikApi'];
function MailSmtpController($scope, piwikApi) {
var self = this;
this.isLoading = false;
this.passwordChanged = false;
this.save = function () {
this.isLoading = true;
var mailSettings = {
mailUseSmtp: this.enabled ? '1' : '0',
mailPort: this.mailPort,
mailHost: this.mailHost,
mailType: this.mailType,
mailUsername: this.mailUsername,
mailEncryption: this.mailEncryption
};
if (this.passwordChanged) {
mailSettings.mailPassword = this.mailPassword;
}
piwikApi.withTokenInUrl();
piwikApi.post({module: 'CoreAdminHome', action: 'setMailSettings'}, mailSettings)
.then(function (success) {
self.isLoading = false;
var UI = require('piwik/UI');
var notification = new UI.Notification();
notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), {
id: 'generalSettings', context: 'success'
});
notification.scrollToNotification();
}, function () {
self.isLoading = false;
});
};
}
})();

View File

@ -0,0 +1,131 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Controller for image tracking code generator
*/
(function () {
// cache for not refetching data for same site twice
var sitePromises = {}, goalPromises = {};
angular.module('piwikApp').controller('ImageTrackingCodeController', ImageTrackingCodeController);
ImageTrackingCodeController.$inject = ['piwikApi', '$q'];
function ImageTrackingCodeController(piwikApi, $q) {
this.allGoals = {};
this.isLoading = false;
var piwikHost = window.location.host,
piwikPath = location.pathname.substring(0, location.pathname.lastIndexOf('/')),
self = this;
var currencyPromise = piwikApi.fetch({method: 'SitesManager.getCurrencySymbols', filter_limit: '-1'});
function requestSiteData(idSite)
{
if (!sitePromises[idSite]) {
sitePromises[idSite] = piwikApi.fetch({
module: 'API',
method: 'SitesManager.getSiteFromId',
idSite: idSite
});
}
return sitePromises[idSite];
}
function requestGoalData(idSite)
{
if (!goalPromises[idSite]) {
goalPromises[idSite] = piwikApi.fetch({
module: 'API',
method: 'Goals.getGoals',
filter_limit: '-1',
idSite: idSite
});
}
return goalPromises[idSite];
}
// function that generates image tracker link
var generateImageTrackingAjax = null,
generateImageTrackerLink = function (trackingCodeChangedManually) {
// get data used to generate the link
var postParams = {
piwikUrl: piwikHost + piwikPath,
actionName: self.pageName,
forceMatomoEndpoint: 1
};
if (self.trackGoal && self.trackIdGoal) {
postParams.idGoal = self.trackIdGoal;
postParams.revenue = self.revenue;
}
if (generateImageTrackingAjax) {
generateImageTrackingAjax.abort();
}
generateImageTrackingAjax = piwikApi.post({
module: 'API',
format: 'json',
method: 'SitesManager.getImageTrackingCode',
idSite: self.site.id
}, postParams).then(function (response) {
generateImageTrackingAjax = null;
self.trackingCode = response.value;
if (trackingCodeChangedManually) {
var jsCodeTextarea = $('#image-tracking-text .codeblock');
jsCodeTextarea.effect("highlight", {}, 1500);
}
});
};
this.updateTrackingCode = function () {
generateImageTrackerLink(true);
};
this.changeSite = function (changedManually) {
self.isLoading = true;
var sitePromise = requestSiteData(this.site.id);
var goalPromise = requestGoalData(this.site.id);
return $q.all([currencyPromise, sitePromise, goalPromise]).then(function (data) {
self.isLoading = false;
var currencySymbols = data[0] || {};
var currency = data[1].currency || '';
var goals = data[2] || [];
var goalsList = [{key: '', value: _pk_translate('UserCountryMap_None')}];
for (var key in goals) {
goalsList.push({key: goals[key].idgoal, value: goals[key].name});
}
self.allGoals = goalsList;
$('[name=image-revenue] .site-currency').text(currencySymbols[currency.toUpperCase()]);
generateImageTrackerLink(changedManually);
});
};
if (this.site && this.site.id) {
this.changeSite(false);
}
}
})();

View File

@ -0,0 +1,167 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Controller for javascript tracking code generator
*/
(function () {
// gets the list of custom variables entered by the user in a custom variable section
function getCustomVariables(customVars) {
var result = [];
angular.forEach(customVars, function (customVar) {
result.push([customVar.name, customVar.value]);
});
return result;
}
// quickly gets the host + port from a url
function getHostNameFromUrl(url) {
var element = $('<a></a>')[0];
element.href = url;
return element.hostname;
}
angular.module('piwikApp').controller('JsTrackingCodeController', JsTrackingCodeController);
JsTrackingCodeController.$inject = ['$scope', 'piwikApi'];
function JsTrackingCodeController($scope, piwikApi) {
this.showAdvanced = false;
this.isLoading = false;
this.customVars = [];
this.siteUrls = {};
this.hasManySiteUrls = false;
this.maxCustomVariables = parseInt(angular.element('[name=numMaxCustomVariables]').val(), 10);
this.canAddMoreCustomVariables = this.maxCustomVariables && this.maxCustomVariables > 0;
// get preloaded server-side data necessary for code generation
var piwikHost = window.location.host,
piwikPath = location.pathname.substring(0, location.pathname.lastIndexOf('/')),
self = this;
// queries Piwik for needed site info for one site
var getSiteData = function (idSite, sectionSelect, callback) {
// if data is already loaded, don't do an AJAX request
if (self.siteUrls[idSite]) {
callback();
return;
}
// disable section
self.isLoading = true;
piwikApi.fetch({
module: 'API',
method: 'SitesManager.getSiteUrlsFromId',
idSite: idSite,
filter_limit: '-1'
}).then(function (data) {
self.siteUrls[idSite] = data || [];
// re-enable controls
self.isLoading = false;
callback();
});
};
// function that generates JS code
var generateJsCodeAjax = null;
var generateJsCode = function (trackingCodeChangedManually) {
// get params used to generate JS code
var params = {
piwikUrl: piwikHost + piwikPath,
groupPageTitlesByDomain: self.groupByDomain ? 1 : 0,
mergeSubdomains: self.trackAllSubdomains ? 1 : 0,
mergeAliasUrls: self.trackAllAliases ? 1 : 0,
visitorCustomVariables: self.trackCustomVars ? getCustomVariables(self.customVars) : 0,
customCampaignNameQueryParam: null,
customCampaignKeywordParam: null,
doNotTrack: self.doNotTrack ? 1 : 0,
disableCookies: self.disableCookies ? 1 : 0,
crossDomain: self.crossDomain ? 1 : 0,
trackNoScript: self.trackNoScript ? 1: 0,
forceMatomoEndpoint: 1
};
if (self.useCustomCampaignParams) {
params.customCampaignNameQueryParam = self.customCampaignName;
params.customCampaignKeywordParam = self.customCampaignKeyword;
}
if (generateJsCodeAjax) {
generateJsCodeAjax.abort();
}
generateJsCodeAjax = piwikApi.post({
module: 'API',
format: 'json',
method: 'SitesManager.getJavascriptTag',
idSite: self.site.id
}, params).then(function (response) {
generateJsCodeAjax = null;
self.trackingCode = response.value;
if(trackingCodeChangedManually) {
var jsCodeTextarea = $('#javascript-text .codeblock');
jsCodeTextarea.effect("highlight", {}, 1500);
}
});
return generateJsCodeAjax;
};
this.onCrossDomainToggle = function () {
if (this.crossDomain) {
this.trackAllAliases = true;
}
};
this.addCustomVar = function () {
if (this.canAddMoreCustomVariables) {
this.customVars.push({name: '', value: ''});
}
this.canAddMoreCustomVariables = this.maxCustomVariables > this.customVars.length;
};
this.addCustomVar();
this.updateTrackingCode = function () {
generateJsCode(true);
};
this.changeSite = function (trackingCodeChangedManually) {
getSiteData(this.site.id, '#js-code-options', function () {
$('.current-site-name').text(self.site.name);
self.hasManySiteUrls = self.siteUrls[self.site.id] && self.siteUrls[self.site.id].length > 1;
if (!self.hasManySiteUrls) {
self.crossDomain = false; // we make sure to disable cross domain if it has only one url or less
}
var siteHost = getHostNameFromUrl(self.siteUrls[self.site.id][0]);
$('.current-site-host').text(siteHost);
var defaultAliasUrl = 'x.' + siteHost;
$('.current-site-alias').text(self.siteUrls[self.site.id][1] || defaultAliasUrl);
generateJsCode(true);
});
};
if (this.site && this.site.id) {
this.changeSite(false);
}
}
})();

View File

@ -0,0 +1,59 @@
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
(function () {
angular.module('piwikApp').controller('TrackingFailuresController', TrackingFailuresController);
TrackingFailuresController.$inject = ['piwikApi', 'piwik'];
function TrackingFailuresController(piwikApi, piwik){
var self = this;
this.failures = [];
this.sortColumn = 'idsite';
this.sortReverse = false;
this.isLoading = false;
this.changeSortOrder = function (columnToSort) {
if (this.sortColumn === columnToSort) {
this.sortReverse = !this.sortReverse;
} else {
this.sortColumn = columnToSort;
}
};
this.fetchAll = function () {
this.failures = [];
this.isLoading = true;
piwikApi.fetch({method: 'CoreAdminHome.getTrackingFailures', filter_limit: '-1'}).then(function (failures) {
self.failures = failures;
self.isLoading = false;
}, function () {
self.isLoading = false;
});
};
this.deleteAll = function () {
piwik.helper.modalConfirm('#confirmDeleteAllTrackingFailures', {yes: function () {
self.failures = [];
piwikApi.fetch({method: 'CoreAdminHome.deleteAllTrackingFailures'}).then(function () {
self.fetchAll();
});
}});
};
this.deleteFailure = function (idSite, idFailure) {
piwik.helper.modalConfirm('#confirmDeleteThisTrackingFailure', {yes: function () {
self.failures = [];
piwikApi.fetch({method: 'CoreAdminHome.deleteTrackingFailure', idSite: idSite, idFailure: idFailure}).then(function () {
self.fetchAll();
});
}});
};
this.fetchAll();
}
})();

View File

@ -0,0 +1,59 @@
<div piwik-content-block
content-title="{{ 'CoreAdminHome_TrackingFailures'|translate }}"
class="matomoTrackingFailures">
<p>
{{ 'CoreAdminHome_TrackingFailuresIntroduction'|translate:2 }}
<br /><br />
<input class="btn deleteAllFailures"
ng-show="!trackingFailures.isLoading && trackingFailures.failures.length > 0"
type="button" ng-click="trackingFailures.deleteAll();"
value="{{'CoreAdminHome_DeleteAllFailures'|translate}}">
</p>
<div piwik-activity-indicator loading="trackingFailures.isLoading"></div>
<table piwik-content-table>
<thead>
<tr>
<th ng-click="trackingFailures.changeSortOrder('idsite')">{{ 'General_Measurable'|translate }}</th>
<th ng-click="trackingFailures.changeSortOrder('problem')">{{ 'CoreAdminHome_Problem'|translate }}</th>
<th ng-click="trackingFailures.changeSortOrder('solution')">{{ 'CoreAdminHome_Solution'|translate }}</th>
<th ng-click="trackingFailures.changeSortOrder('date_first_occurred')">{{ 'General_Date'|translate }}</th>
<th ng-click="trackingFailures.changeSortOrder('url')">{{ 'Actions_ColumnPageURL'|translate }}</th>
<th ng-click="trackingFailures.changeSortOrder('request_url')">{{ 'CoreAdminHome_TrackingURL'|translate }}</th>
<th class="action">{{ 'General_Action'|translate }}</th>
</tr>
</thead>
<tbody>
<tr><td colspan="7" ng-show="!trackingFailures.isLoading && trackingFailures.failures.length == 0">{{'CoreAdminHome_NoKnownFailures'|translate}} <span class="icon-ok"></span></td></tr>
<tr ng-repeat="failure in trackingFailures.failures | orderBy:trackingFailures.sortColumn:trackingFailures.sortReverse">
<td>{{ failure.site_name }} ({{'General_Id'|translate}} {{ failure.idsite }})</td>
<td>{{ failure.problem }}</td>
<td>{{ failure.solution }} <a ng-show="failure.solution_url" rel="noopener noreferrer" ng-href="{{ failure.solution_url }}">{{'CoreAdminHome_LearnMore'|translate }}</a></td>
<td class="datetime">{{ failure.pretty_date_first_occurred }}</td>
<td>{{ failure.url }}</td>
<td><span ng-show="!failure.showFullRequestUrl" title="{{'CoreHome_ClickToSeeFullInformation'|translate}}"
ng-click="failure.showFullRequestUrl = true">{{ failure.request_url|limitTo:100 }}...</span>
<span ng-show="failure.showFullRequestUrl">{{ failure.request_url }}</span></td>
<td><span class="table-action icon-delete"
title="{{'General_Delete'|translate}}"
ng-click="trackingFailures.deleteFailure(failure.idsite, failure.idfailure)"></span></td>
</tr>
</tbody>
</table>
<div class="ui-confirm" id="confirmDeleteAllTrackingFailures">
<h2>{{ 'CoreAdminHome_ConfirmDeleteAllTrackingFailures'|translate }}</h2>
<input type="button" value="{{ 'General_Yes'|translate }}" role="yes"/>
<input type="button" value="{{ 'General_No'|translate }}" role="no" />
</div>
<div class="ui-confirm" id="confirmDeleteThisTrackingFailure">
<h2>{{ 'CoreAdminHome_ConfirmDeleteThisTrackingFailure'|translate }}</h2>
<input type="button" value="{{ 'General_Yes'|translate }}" role="yes"/>
<input type="button" value="{{ 'General_No'|translate }}" role="no" />
</div>
</div>

View File

@ -0,0 +1,25 @@
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Usage:
* <div matomo-tracking-failures>
*/
(function () {
angular.module('piwikApp').directive('matomoTrackingFailures', matomoTrackingFailures);
matomoTrackingFailures.$inject = ['piwik'];
function matomoTrackingFailures(piwik){
return {
restrict: 'A',
templateUrl: 'plugins/CoreAdminHome/angularjs/trackingfailures/trackingfailures.directive.html?cb=' + piwik.cacheBuster,
controller: 'TrackingFailuresController',
controllerAs: 'trackingFailures'
};
}
})();

View File

@ -0,0 +1,9 @@
.matomoTrackingFailures {
.icon-delete,
th:not(.action) {
cursor: pointer;
}
th.action {
width: 60px;
}
}