Mailing popups - JS cleanup
authorColeman Watts <coleman@civicrm.org>
Mon, 24 Mar 2014 16:33:19 +0000 (12:33 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 24 Mar 2014 16:33:19 +0000 (12:33 -0400)
CRM/Mailing/BAO/Mailing.php
js/Common.js
templates/CRM/Activity/Form/ActivityView.tpl
templates/CRM/Mailing/Page/Report.tpl

index 026750bedb8214cf6b8efb43a00ff45a2347849d..50303221ee196e51429861a3a64ea684cef0797d 100644 (file)
@@ -2566,30 +2566,26 @@ SELECT  $mailing.id as mailing_id
 
     $text = CRM_Utils_Request::retrieve('text', 'Boolean', $form);
     if ($text) {
-      echo "<pre>{$textHeader}</br>{$report['mailing']['body_text']}</br>{$textFooter}</pre>";
-      CRM_Utils_System::civiExit();
+      CRM_Core_Page_AJAX::returnJsonResponse("<pre>{$textHeader}</br>{$report['mailing']['body_text']}</br>{$textFooter}</pre>");
     }
 
     if (!$isSMS) {
       $html = CRM_Utils_Request::retrieve('html', 'Boolean', $form);
       if ($html) {
         $output = $htmlHeader . $report['mailing']['body_html'] . $htmlFooter ;
-        echo str_replace( "\n", '<br />', $output );
-        CRM_Utils_System::civiExit();
+        CRM_Core_Page_AJAX::returnJsonResponse(str_replace("\n", '<br />', $output));
       }
     }
 
     if (!empty($report['mailing']['body_text'])) {
       $url = CRM_Utils_System::url('civicrm/mailing/report', 'reset=1&text=1&mid=' . $form->_mailing_id);
-      $popup = "javascript:popUp(\"$url\");";
-      $form->assign('textViewURL', $popup);
+      $form->assign('textViewURL', $url);
     }
 
     if (!$isSMS) {
       if (!empty($report['mailing']['body_html'])) {
         $url = CRM_Utils_System::url('civicrm/mailing/report', 'reset=1&html=1&mid=' . $form->_mailing_id);
-        $popup = "javascript:popUp(\"$url\");";
-        $form->assign('htmlViewURL', $popup);
+        $form->assign('htmlViewURL', $url);
       }
     }
 
index 5b0f4c769240cb35bc24ff9c72d414fc8122dcc3..aaddfd1100452536ffc1dc7865aa12252239a91c 100644 (file)
@@ -170,14 +170,6 @@ function submitOnce(obj, formId, procText) {
     }
   }
 }
-/**
- * @deprecated
- */
-function popUp(URL) {
-  day = new Date();
-  id = day.getTime();
-  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=640,height=420,left = 202,top = 184');");
-}
 
 /**
  * Function to show / hide the row in optionFields
index 5f9373caff59c6ec1f21146a135549cb7934abfa..53a6f7d35ceb288e72f4bf4ead59c786c03ff773 100644 (file)
                                   {$mailingReport.mailing.body_text|mb_truncate:30|escape|nl2br}
                                   <br />
                                   {if $values.mailingId}
-                                    <strong><a href='{$textViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
+                                    <strong><a class="crm-popup" href='{$textViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
                                   {/if}
                               </td>
                           </tr>
                                   {$mailingReport.mailing.body_html|mb_truncate:30|escape|nl2br}
                                   <br/>
                                   {if $values.mailingId}
-                                    <strong><a href='{$htmlViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
+                                    <strong><a class="crm-popup" href='{$htmlViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
                                   {/if}
                               </td>
                           </tr>
index 521a4b963c231bdc1d7195cb16babffd43d3119b..6249dd425f62cb5389d350edc1b285f4f75cec3b 100644 (file)
   <td>
     {$report.mailing.body_text|mb_truncate:30|escape|nl2br}
     <br />
-    <strong><a href='{$textViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
+    <strong><a class="crm-popup" href='{$textViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
   </td>
 </tr>
 {/if}
   <td>
     {$report.mailing.body_html|mb_truncate:30|escape|nl2br}
     <br/>
-    <strong><a href='{$htmlViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
+    <strong><a class="crm-popup" href='{$htmlViewURL}'>&raquo; {ts}View complete message{/ts}</a></strong>
   </td>
 </tr>
 {/if}