Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-02-04 06:29:16 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-02-04 06:29:16 +0400
commitdb7d1b5bb0d1a760d757483c05ef516409c4002b (patch)
treeda41c89b1687398de82881ff97ad02ce8edbe6db
parent1d6488271e0db0d926f52e5605e641ed86e67453 (diff)
refs #4569 display warning in case browser archiving is disabled
-rw-r--r--lang/en.json4
-rw-r--r--plugins/SegmentEditor/SegmentSelectorControl.php25
-rw-r--r--plugins/SegmentEditor/javascripts/Segmentation.js4
-rw-r--r--plugins/SegmentEditor/templates/_segmentSelector.twig7
4 files changed, 37 insertions, 3 deletions
diff --git a/lang/en.json b/lang/en.json
index 4ef71b738e..68230a1661 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -2411,7 +2411,9 @@
"ChooseASegment": "Choose a segment",
"LoadingSegmentedDataMayTakeSomeTime": "Processing segmented visitor data may take a few minutes...",
"AutoArchiveRealTime": "segmented reports are processed in real time",
- "AutoArchivePreProcessed": "segmented reports are pre-processed (faster, requires archive.php cron)"
+ "AutoArchivePreProcessed": "segmented reports are pre-processed (faster, requires archive.php cron)",
+ "SegmentNotApplied": "Segment '%s' not applied",
+ "SegmentNotAppliedExplanation": "You are requesting data for the Custom Segment '%s', the current Piwik configuration prevents the real time processing of this segment. Please ask your Piwik admin to change the setting in the config file (browser_archiving_disabled_enforce) or edit this Segment to be Processed by the cron archive.php script."
},
"Events": {
"Events": "Events",
diff --git a/plugins/SegmentEditor/SegmentSelectorControl.php b/plugins/SegmentEditor/SegmentSelectorControl.php
index f4ad38a68f..08324a5bca 100644
--- a/plugins/SegmentEditor/SegmentSelectorControl.php
+++ b/plugins/SegmentEditor/SegmentSelectorControl.php
@@ -9,6 +9,7 @@
namespace Piwik\Plugins\SegmentEditor;
use Piwik\Common;
+use Piwik\Config;
use Piwik\Piwik;
use Piwik\Plugins\API\API as APIMetadata;
use Piwik\View;
@@ -31,6 +32,8 @@ class SegmentSelectorControl extends View
$this->isSuperUser = Access::getInstance()->hasSuperUserAccess();
$this->idSite = Common::getRequestVar('idSite', false, 'int');
+ $currentSelectedSegment = Common::getRequestVar('segment', false, 'string');
+
$segments = APIMetadata::getInstance()->getSegmentsMetadata($this->idSite);
$segmentsByCategory = $customVariablesSegments = array();
@@ -46,18 +49,36 @@ class SegmentSelectorControl extends View
}
uksort($segmentsByCategory, array($this, 'sortSegmentCategories'));
- $this->segmentsByCategory = $segmentsByCategory;
+ $this->segmentsByCategory = $segmentsByCategory;
+ $this->nameOfCurrentSegment = '';
+ $this->isSegmentNotAppliedBecauseBrowserArchivingIsDisabled = 0;
$savedSegments = API::getInstance()->getAll($this->idSite);
foreach ($savedSegments as &$savedSegment) {
$savedSegment['name'] = Common::sanitizeInputValue($savedSegment['name']);
+
+ if (!empty($currentSelectedSegment) && $currentSelectedSegment == $savedSegment['definition']) {
+ $this->nameOfCurrentSegment = $savedSegment['name'];
+ $this->isSegmentNotAppliedBecauseBrowserArchivingIsDisabled = $this->wouldApplySegment($savedSegment) ? 0 : 1;
+ }
}
+
$this->savedSegmentsJson = Common::json_encode($savedSegments);
$this->authorizedToCreateSegments = !Piwik::isUserIsAnonymous();
-
$this->segmentTranslations = Common::json_encode($this->getTranslations());
}
+ private function wouldApplySegment($savedSegment)
+ {
+ $isBrowserArchivingDisabled = Config::getInstance()->General['browser_archiving_disabled_enforce'];
+
+ if (!$isBrowserArchivingDisabled) {
+ return true;
+ }
+
+ return (bool) $savedSegment['auto_archive'];
+ }
+
public function sortSegmentCategories($a, $b)
{
// Custom Variables last
diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js
index 9bb4ba3943..ad26f21310 100644
--- a/plugins/SegmentEditor/javascripts/Segmentation.js
+++ b/plugins/SegmentEditor/javascripts/Segmentation.js
@@ -996,6 +996,10 @@ $(document).ready( function(){
return;
}
+ if ((typeof isSegmentNotAppliedBecauseBrowserArchivingIsDisabled != "undefined") && isSegmentNotAppliedBecauseBrowserArchivingIsDisabled) {
+ piwikHelper.modalConfirm('#pleaseChangeBrowserAchivingDisabledSetting', {yes: function () {}});
+ }
+
var changeSegment = function(segmentDefinition){
$('#segmentEditorPanel').find('a.close').click();
segmentDefinition = cleanupSegmentDefinition(segmentDefinition);
diff --git a/plugins/SegmentEditor/templates/_segmentSelector.twig b/plugins/SegmentEditor/templates/_segmentSelector.twig
index dc65b9a2bb..f66dbf4e2b 100644
--- a/plugins/SegmentEditor/templates/_segmentSelector.twig
+++ b/plugins/SegmentEditor/templates/_segmentSelector.twig
@@ -145,7 +145,14 @@
<input role="no" type="button" value="{{ 'General_No'|translate }}"/>
</div>
+<div class="ui-confirm" id="pleaseChangeBrowserAchivingDisabledSetting">
+ <h2>{{ 'SegmentEditor_SegmentNotApplied'|translate(nameOfCurrentSegment) }}</h2>
+ <p class="description">{{ 'SegmentEditor_SegmentNotAppliedExplanation'|translate(nameOfCurrentSegment) }}</p>
+ <input role="yes" type="button" value="{{ 'General_Ok'|translate }}"/>
+</div>
+
<script type="text/javascript">
var availableSegments = {{ savedSegmentsJson|raw }};
var segmentTranslations = {{ segmentTranslations|raw }};
+var isSegmentNotAppliedBecauseBrowserArchivingIsDisabled = {{ isSegmentNotAppliedBecauseBrowserArchivingIsDisabled }};
</script>