CRM-15995 - When viewing details from AB test report, set return URL to the AB test...
authorTim Otten <totten@civicrm.org>
Tue, 24 Feb 2015 02:52:00 +0000 (18:52 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 24 Feb 2015 02:52:00 +0000 (18:52 -0800)
CRM/Mailing/Page/Event.php
js/angular-crmMailing/services.js
js/angular-crmMailingAB.js

index d39e35126e0070ada5ea4cd543b852b122f8470f..0ad1a63fd51419bdb3f492bce8651b6901e07147 100644 (file)
@@ -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');
index 1577f40d17618b6c4acf85b73de331c6ec729d15..f2669367f664f26f3fcb5550a0f68e728470f0e7 100644 (file)
        * @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',
index 1ef737a4f868705b0058036644783385feb4ae1c..10f108220f9ea5b4feda07b33096e3a91a518103 100644 (file)
 
     $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;