Remove js from button markup which interfered with ajax popups
authorColeman Watts <coleman@civicrm.org>
Tue, 16 Sep 2014 01:35:35 +0000 (21:35 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 16 Sep 2014 01:35:35 +0000 (21:35 -0400)
CRM/Contact/Form/Task/PDFLetterCommon.php
CRM/Profile/Form/Edit.php
templates/CRM/Contact/Page/View/SMS.tpl
templates/CRM/Profile/Form/Dynamic.tpl

index 6ef3aacdfabaf6f5a994e04cf5abf5968e63c074..a3f091244e03efd3f4cb87ae0b5e34ccc681fe55 100644 (file)
@@ -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);
   }
index 4885617df1a861909d39bf941c44ad800d468abf..7531c36b9810cb653421e11d506d86874a01a967 100644 (file)
@@ -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);
index cb45f669734815b49aa7af08d3c5e246fcd72bfd..81ea54b668aeb0c4f61227a357baee6589e59e0b 100644 (file)
 <dt>{ts}From{/ts}</dt><dd>{if $fromName}{$fromName}{else}{ts}(display name not available){/ts}{/if}</dd>
 <dt>{ts}To{/ts}</dt><dd>{$toName}</dd>
 <dt>{ts}Message{/ts}</dt><dd>{$message}</dd>
-<dt>&nbsp;</dt><dd><input type="button" name="Done" value="Done" onClick="location.href='{crmURL p='civicrm/contact/view/activity' q="history=1&show=1"}';"></dd>
+<dt>&nbsp;</dt>
+  <dd class="crm-submit-buttons">
+    <a class="button cancel" href="{crmURL p='civicrm/contact/view/activity' q="history=1&show=1"}">{ts}Done{/ts}</a>
+  </dd>
 </dl>
 </fieldset>
 </div>
index 0d9784f35611911c04130d8141c32b80626005cc..dff4c3f48dfe05034625384cf7abbefb5857acf5 100644 (file)
   <div class="icon inform-icon"></div>&nbsp;
         {ts}Are you sure you want to delete this record?{/ts}
   </div>
-  <span class="crm-button">{$form._qf_Edit_upload_delete.html}</span>
-  <div class="crm-submit-buttons" style='display:inline'>{include file="CRM/common/formButtons.tpl"}</div>
+
+  <div class="crm-submit-buttons">
+    <span class="crm-button">{$form._qf_Edit_upload_delete.html}</span>
+    <a class="button cancel" href="{$cancelURL}">{ts}Cancel{/ts}</a>
+  </div>
 {else}
 {if ! empty( $fields )}
 {* Wrap in crm-container div so crm styles are used.*}
         {assign var=floatStyle value='float:right'}
       {/if}
       <div class="crm-submit-buttons" style='{$floatStyle}'>
-      {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
+        {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
+        <a class="button cancel" href="{$cancelURL}">{ts}Cancel{/ts}</a>
       </div>
     {/if}
     {if $help_post && $action neq 4}<br /><div class="messages help">{$help_post}</div>{/if}