From 05381a97181cc234d40f38376b557328e9eef64a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 23 Feb 2015 18:52:00 -0800 Subject: [PATCH] CRM-15995 - When viewing details from AB test report, set return URL to the AB test's overall report. --- CRM/Mailing/Page/Event.php | 8 ++++++++ js/angular-crmMailing/services.js | 6 ++++-- js/angular-crmMailingAB.js | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CRM/Mailing/Page/Event.php b/CRM/Mailing/Page/Event.php index d39e35126e..0ad1a63fd5 100644 --- a/CRM/Mailing/Page/Event.php +++ b/CRM/Mailing/Page/Event.php @@ -76,6 +76,14 @@ class CRM_Mailing_Page_Event extends CRM_Core_Page { $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing"); $backUrlTitle = ts('Back to Mailing'); } + elseif ($context == 'angPage') { + $angPage = CRM_Utils_Request::retrieve('angPage', 'String', $this); + if (!preg_match(':^[a-zA-Z0-9\-_/]+$:', $angPage)) { + CRM_Core_Error::fatal('Malformed return URL'); + } + $backUrl = CRM_Utils_System::url('civicrm/a/#/' . $angPage); + $backUrlTitle = ts('Back to Report'); + } else { $backUrl = CRM_Utils_System::url('civicrm/mailing/report', "reset=1&mid={$mailing_id}"); $backUrlTitle = ts('Back to Report'); diff --git a/js/angular-crmMailing/services.js b/js/angular-crmMailing/services.js index 1577f40d17..f2669367f6 100644 --- a/js/angular-crmMailing/services.js +++ b/js/angular-crmMailing/services.js @@ -472,13 +472,15 @@ * @param mailing object * @param statType object (see statTypes above) * @param view string ('search', 'event', 'report') + * @param returnPath string|null Return path (relative to Angular base) * @return string|null */ - getUrl: function getUrl(mailing, statType, view) { + getUrl: function getUrl(mailing, statType, view, returnPath) { switch (view) { case 'events': + var retParams = returnPath ? '&context=angPage&angPage=' + returnPath : ''; return crmLegacy.url('civicrm/mailing/report/event', - 'reset=1&mid=' + mailing.id + statType.eventsFilter); + 'reset=1&mid=' + mailing.id + statType.eventsFilter + retParams); case 'search': return crmLegacy.url('civicrm/contact/search/advanced', diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 1ef737a4f8..10f108220f 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -221,7 +221,7 @@ $scope.statTypes = crmMailingStats.getStatTypes(); $scope.statUrl = function statUrl(mailing, statType, view) { - return crmMailingStats.getUrl(mailing, statType, view); + return crmMailingStats.getUrl(mailing, statType, view, 'abtest/' + $scope.abtest.ab.id); }; $scope.checkPerm = CRM.checkPerm; -- 2.25.1