Merge pull request #1738 from kurund/CRM-13397
authorKurund Jalmi <kurund@civicrm.org>
Sun, 6 Oct 2013 13:23:25 +0000 (06:23 -0700)
committerKurund Jalmi <kurund@civicrm.org>
Sun, 6 Oct 2013 13:23:25 +0000 (06:23 -0700)
Revert "Merge pull request #1645 from eileenmcnaughton/CRM-13379"

CRM/Contact/Form/Task/EmailCommon.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Core/Form.php
js/Common.js
templates/CRM/Contact/Form/Task/EmailCommon.js
templates/CRM/Core/Form.js [deleted file]

index caf285c01d1b3512235d4b170bafc9d469d25e68..ca503ddb90609cd4442b8608306e961b4ba4f4dd 100644 (file)
@@ -121,8 +121,6 @@ class CRM_Contact_Form_Task_EmailCommon {
    *
    * @access public
    *
-   * @param $form
-   *
    * @return void
    */
   static function buildQuickForm(&$form) {
@@ -272,7 +270,6 @@ class CRM_Contact_Form_Task_EmailCommon {
     }
 
     $form->addFormRule(array('CRM_Contact_Form_Task_EmailCommon', 'formRule'), $form);
-    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Core/Form.js');
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js');
   }
 
@@ -310,8 +307,6 @@ class CRM_Contact_Form_Task_EmailCommon {
    *
    * @access public
    *
-   * @param $form
-   *
    * @return None
    */
   static function postProcess(&$form) {
index 2e33e17a6956985d0137183fd3d03d15734fe68d..3363a49b0290e9956e9f2c0a03b5cc54454108cc 100644 (file)
@@ -494,6 +494,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
             'name' => $contribButton,
             'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
             'isDefault' => TRUE,
+            'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"),
           ),
           array(
             'type' => 'back',
@@ -556,8 +557,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $this->setDefaults($defaults);
 
     $this->freeze();
-
-    parent::buildQuickForm();
   }
 
   /**
index 190ccdc8f31164afb70cce6c6d5d3e4702fd2644..358a90de472e636c6d77f5795d0f043352496c86 100644 (file)
@@ -556,7 +556,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     }
 
     $this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this);
-    parent::buildQuickForm();
   }
 
   /**
index e81c6f42baddf212259b2881d3ad345d75db534e..5167ab339dbf02bae15e1837e61ee0d10c0ee761 100644 (file)
@@ -285,14 +285,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    * @return void
    *
    */
-  function buildQuickForm() {
-    // @todo less cautious approach would be to add this to addButtons.
-    // it would be good to make this switch at the early stage of a release cycle.
-    // @ the moment of the 106 uses of parent::buildQuickForm only a handle are direct descendents
-    // of this class - including the contribution forms per CRM-13397 & the (tested) sms provider form.
-    //(I checked maybe another 20 directly that weren't & was also able to rule out about 40 more by virtue of common patterns
-    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Core/Form.js');
-  }
+  function buildQuickForm() {}
 
   /**
    * This virtual function is used to set the default values of
@@ -405,10 +398,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       $js = CRM_Utils_Array::value('js', $button);
       $isDefault = CRM_Utils_Array::value('isDefault', $button, FALSE);
       if ($isDefault) {
-        $attrs = array('class' => 'form-submit default crm-form-button-' . $button['type']);
+        $attrs = array('class' => 'form-submit default');
       }
       else {
-        $attrs = array('class' => 'form-submit crm-form-button-' . $button['type']);
+        $attrs = array('class' => 'form-submit');
       }
 
       if ($js) {
index 8770917b036466d8502b10a72772dee06021924f..efd5140b2c1f6b796e66bd8d55adb14b394ade16 100644 (file)
@@ -396,13 +396,8 @@ function unselectRadio(fieldName, form) {
  * @return null
  */
 var submitcount = 0;
-/**
- * @deprecated
- * Changes button label on submit, and disables button after submit for newer browsers.
- * Puts up alert for older browsers.
- * @todo CRM-13397 replaces this with an alternate (jquery) mechanism - to use the jquery mechanism add
- * parent::buildQuickForm to make buttons 'protected'
- * */
+/* Changes button label on submit, and disables button after submit for newer browsers.
+ Puts up alert for older browsers. */
 function submitOnce(obj, formId, procText) {
   // if named button clicked, change text
   if (obj.value != null) {
index 1c4dfa0f0235645f8ad269591f1eae9cf09a6c4f..bb7610e4c909b21dd44172ace5c3e43993d660e6 100644 (file)
@@ -2,4 +2,14 @@ cj(function ($) {
   //do not copy & paste this - find a way to generalise it
   'use strict';
    $().crmAccordions();
+  // NOTE: Might be safer to say $('[name=_qf_Email_upload]')
+   $('.form-submit').not('.cancel').on("click", function() {
+     $('.form-submit').not('.cancel').attr({value: ts('Processing')});
+     // CRM-13449 : setting a 0 ms timeout is needed 
+     // for some browsers like chrome. Used for purpose of
+     // submit the form and stop accidental multiple clicks
+     setTimeout(function(){
+       $('.form-submit').not('.cancel').attr({disabled: 'disabled'});
+     }, 0);
+   });
 });
diff --git a/templates/CRM/Core/Form.js b/templates/CRM/Core/Form.js
deleted file mode 100644 (file)
index 4b27202..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-cj(function ($) {
-  'use strict';
-  $('.form-submit').on("click", function() {
-    $('.form-submit').attr({value: ts('Processing'), disabled : 'disabled'});
-    $('.crm-form-button-back ').closest('span').hide();
-    $('.crm-form-button-cancel').closest('span').hide();
-    // CRM-13449 : setting a 0 ms timeout is needed
-    // for some browsers like chrome. Used for purpose of
-    // submit the form and stop accidental multiple clicks
-    setTimeout(function(){
-      $('.form-submit').not('.cancel').attr({disabled: 'disabled'});
-    }, 0);
-  });
-});
-