From d839d441878640bda2d114dc279a9b82558d7d97 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 24 Mar 2014 12:33:19 -0400 Subject: [PATCH] Mailing popups - JS cleanup --- CRM/Mailing/BAO/Mailing.php | 12 ++++-------- js/Common.js | 8 -------- templates/CRM/Activity/Form/ActivityView.tpl | 4 ++-- templates/CRM/Mailing/Page/Report.tpl | 4 ++-- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 026750bedb..50303221ee 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -2566,30 +2566,26 @@ SELECT $mailing.id as mailing_id $text = CRM_Utils_Request::retrieve('text', 'Boolean', $form); if ($text) { - echo "
{$textHeader}
{$report['mailing']['body_text']}
{$textFooter}
"; - CRM_Utils_System::civiExit(); + CRM_Core_Page_AJAX::returnJsonResponse("
{$textHeader}
{$report['mailing']['body_text']}
{$textFooter}
"); } if (!$isSMS) { $html = CRM_Utils_Request::retrieve('html', 'Boolean', $form); if ($html) { $output = $htmlHeader . $report['mailing']['body_html'] . $htmlFooter ; - echo str_replace( "\n", '
', $output ); - CRM_Utils_System::civiExit(); + CRM_Core_Page_AJAX::returnJsonResponse(str_replace("\n", '
', $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); } } diff --git a/js/Common.js b/js/Common.js index 5b0f4c7692..aaddfd1100 100644 --- a/js/Common.js +++ b/js/Common.js @@ -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 diff --git a/templates/CRM/Activity/Form/ActivityView.tpl b/templates/CRM/Activity/Form/ActivityView.tpl index 5f9373caff..53a6f7d35c 100644 --- a/templates/CRM/Activity/Form/ActivityView.tpl +++ b/templates/CRM/Activity/Form/ActivityView.tpl @@ -101,7 +101,7 @@ {$mailingReport.mailing.body_text|mb_truncate:30|escape|nl2br}
{if $values.mailingId} - » {ts}View complete message{/ts} + » {ts}View complete message{/ts} {/if} @@ -114,7 +114,7 @@ {$mailingReport.mailing.body_html|mb_truncate:30|escape|nl2br}
{if $values.mailingId} - » {ts}View complete message{/ts} + » {ts}View complete message{/ts} {/if} diff --git a/templates/CRM/Mailing/Page/Report.tpl b/templates/CRM/Mailing/Page/Report.tpl index 521a4b963c..6249dd425f 100644 --- a/templates/CRM/Mailing/Page/Report.tpl +++ b/templates/CRM/Mailing/Page/Report.tpl @@ -169,7 +169,7 @@ {$report.mailing.body_text|mb_truncate:30|escape|nl2br}
- » {ts}View complete message{/ts} + » {ts}View complete message{/ts} {/if} @@ -180,7 +180,7 @@ {$report.mailing.body_html|mb_truncate:30|escape|nl2br}
- » {ts}View complete message{/ts} + » {ts}View complete message{/ts} {/if} -- 2.25.1