From fc942baa3db0a36684447ba8271fdf8210d9bf73 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 15 Sep 2014 21:35:35 -0400 Subject: [PATCH] Remove js from button markup which interfered with ajax popups --- CRM/Contact/Form/Task/PDFLetterCommon.php | 57 +++++------------------ CRM/Profile/Form/Edit.php | 16 +------ templates/CRM/Contact/Page/View/SMS.tpl | 5 +- templates/CRM/Profile/Form/Dynamic.tpl | 10 ++-- 4 files changed, 24 insertions(+), 64 deletions(-) diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index 6ef3aacdfa..a3f091244e 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -175,54 +175,19 @@ class CRM_Contact_Form_Task_PDFLetterCommon { CRM_Mailing_BAO_Mailing::commonLetterCompose($form); - if ($form->_single) { - $cancelURL = CRM_Utils_System::url( - 'civicrm/contact/view', - "reset=1&cid={$form->_cid}&selectedChild=activity", - FALSE, - NULL, - FALSE + $buttons = array(); + if ($form->get('action') != CRM_Core_Action::VIEW) { + $buttons[] = array( + 'type' => 'submit', + 'name' => $form->_single ? ts('Make PDF') : ts('Make PDFs'), + 'isDefault' => TRUE, ); - - if ($form->get('action') == CRM_Core_Action::VIEW) { - $form->addButtons(array( - array( - 'type' => 'cancel', - 'name' => ts('Done'), - 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"), - ), - ) - ); - } - else { - $form->addButtons(array( - array( - 'type' => 'submit', - 'name' => ts('Make PDF Letter'), - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Done'), - 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"), - ), - ) - ); - } - } - else { - $form->addButtons(array( - array( - 'type' => 'submit', - 'name' => ts('Make PDF Letters'), - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Done'), - ), - )); } + $buttons[] = array( + 'type' => 'cancel', + 'name' => $form->get('action') == CRM_Core_Action::VIEW ? ts('Done') : ts('Cancel'), + ); + $form->addButtons($buttons); $form->addFormRule(array('CRM_Contact_Form_Task_PDFLetterCommon', 'formRule'), $form); } diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index 4885617df1..7531c36b98 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -213,18 +213,13 @@ SELECT module,is_reserved parent::buildQuickForm(); + $this->assign('cancelURL', $this->_cancelURL); + if (($this->_multiRecord & CRM_Core_Action::DELETE) && $this->_recordExists) { $this->_deleteButtonName = $this->getButtonName('upload', 'delete'); $this->addElement('submit', $this->_deleteButtonName, ts('Delete')); - $buttons[] = array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - 'isDefault' => TRUE, - 'js' => array('onclick' => "location.href='{$this->_cancelURL}'; return false;"), - ); - $this->addButtons($buttons); return; } @@ -245,13 +240,6 @@ SELECT module,is_reserved 'isDefault' => TRUE, ); - $buttons[] = array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - 'isDefault' => TRUE, - 'js' => array('onclick' => "location.href='{$this->_cancelURL}'; return false;"), - ); - $this->addButtons($buttons); $this->addFormRule(array('CRM_Profile_Form', 'formRule'), $this); diff --git a/templates/CRM/Contact/Page/View/SMS.tpl b/templates/CRM/Contact/Page/View/SMS.tpl index cb45f66973..81ea54b668 100644 --- a/templates/CRM/Contact/Page/View/SMS.tpl +++ b/templates/CRM/Contact/Page/View/SMS.tpl @@ -31,7 +31,10 @@
{ts}From{/ts}
{if $fromName}{$fromName}{else}{ts}(display name not available){/ts}{/if}
{ts}To{/ts}
{$toName}
{ts}Message{/ts}
{$message}
-
 
+
 
+
+ {ts}Done{/ts} +
diff --git a/templates/CRM/Profile/Form/Dynamic.tpl b/templates/CRM/Profile/Form/Dynamic.tpl index 0d9784f356..dff4c3f48d 100644 --- a/templates/CRM/Profile/Form/Dynamic.tpl +++ b/templates/CRM/Profile/Form/Dynamic.tpl @@ -33,8 +33,11 @@
  {ts}Are you sure you want to delete this record?{/ts} - {$form._qf_Edit_upload_delete.html} -
{include file="CRM/common/formButtons.tpl"}
+ +
+ {$form._qf_Edit_upload_delete.html} + {ts}Cancel{/ts} +
{else} {if ! empty( $fields )} {* Wrap in crm-container div so crm styles are used.*} @@ -222,7 +225,8 @@ {assign var=floatStyle value='float:right'} {/if}
- {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if} + {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if} + {ts}Cancel{/ts}
{/if} {if $help_post && $action neq 4}
{$help_post}
{/if} -- 2.25.1