diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-01-23 02:03:09 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-01-23 02:03:09 +0400 |
commit | c4708dc3ad8894938fb1caf0f5460e0f9a578c36 (patch) | |
tree | a5ea7bd077c6b4b939d689fe955115cead522b06 /plugins | |
parent | f415ca7d7aaac4d5c028f8caebb4435a32e0a53b (diff) |
Refs #4502 Fix bug in segment editor when editing as a view/admin user.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/SegmentEditor/API.php | 14 | ||||
-rw-r--r-- | plugins/SegmentEditor/templates/getSelector.twig | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php index 34994bfd59..0f34b25a3c 100644 --- a/plugins/SegmentEditor/API.php +++ b/plugins/SegmentEditor/API.php @@ -66,7 +66,7 @@ class API extends \Piwik\Plugin\API { if (empty($idSite)) { if (!Piwik::isUserIsSuperUser()) { - throw new Exception("idSite is required, unless you are Super User and can create the segment across all websites"); + throw new Exception($this->getMessageCannotEditSegmentCreatedBySuperUser()); } } else { if (!is_numeric($idSite)) { @@ -238,8 +238,7 @@ class API extends \Piwik\Plugin\API } } catch (Exception $e) { - throw new Exception("You can only edit the custom segments you have created yourself. This segment was created and 'shared with you' by the Super User. " . - "To modify this segment, you can first create a new one by clicking on 'Add new segment'. Then you can customize the segment's definition."); + throw new Exception($this->getMessageCannotEditSegmentCreatedBySuperUser()); } if ($segment['deleted']) { @@ -322,4 +321,13 @@ class API extends \Piwik\Plugin\API return $allUserVisibilityIsDropped || $allWebsiteVisibilityIsDropped; } + + /** + * @return string + */ + private function getMessageCannotEditSegmentCreatedBySuperUser() + { + return "You can only edit the custom segments you have created yourself. This segment was created and 'shared with you' by the Super User. " . + "To modify this segment, you can first create a new one by clicking on 'Add new segment'. Then you can customize the segment's definition."; + } } diff --git a/plugins/SegmentEditor/templates/getSelector.twig b/plugins/SegmentEditor/templates/getSelector.twig index d4ff38a816..dc65b9a2bb 100644 --- a/plugins/SegmentEditor/templates/getSelector.twig +++ b/plugins/SegmentEditor/templates/getSelector.twig @@ -102,8 +102,7 @@ </div> </div> <div class="segment-content"> - {% if isSuperUser %} - <div class="segment-top"> + <div class="segment-top" {% if not isSuperUser %}style="display:none"{% endif %}> {{ 'SegmentEditor_ThisSegmentIsVisibleTo'|translate }} <span id="enable_all_users"><strong> <select id="enable_all_users_select"> <option selected="1" value="0">{{ 'SegmentEditor_VisibleToMe'|translate }}</option> @@ -125,7 +124,6 @@ </strong></span> </div> - {% endif %} <h3>{{ 'General_Name'|translate }}: <span class="segmentName"></span> <a class="editSegmentName" href="#">{{ 'General_Edit'|translate|lower }}</a></h3> </div> <div class="segment-footer"> |