From 9d30c8d11e0ffe73dc38527346ecc4dfecc844cb Mon Sep 17 00:00:00 2001 From: colemanw Date: Mon, 17 Aug 2020 20:49:42 -0400 Subject: [PATCH] Revert "Swap out button/submit inputs for button elements" --- CRM/Admin/Form/Preferences/Display.php | 12 +-- CRM/Admin/Form/Setting/Smtp.php | 7 +- CRM/Batch/Form/Entry.php | 9 +-- CRM/Case/Form/CaseView.php | 8 +- CRM/Contact/Form/Contact.php | 26 ++----- CRM/Contact/Form/Search.php | 3 +- CRM/Contact/Form/Task/AddToParentClass.php | 9 +-- CRM/Contribute/Form/ContributionPage.php | 5 +- .../Form/ContributionPage/Widget.php | 5 +- CRM/Contribute/Import/Form/DataSource.php | 5 +- CRM/Core/BAO/Mapping.php | 14 +--- CRM/Core/Form.php | 24 ++---- CRM/Custom/Form/Field.php | 7 +- CRM/Custom/Form/Group.php | 5 +- CRM/Custom/Form/Option.php | 10 +-- CRM/Event/Form/ManageEvent/Fee.php | 8 +- CRM/Financial/Form/BatchTransaction.php | 12 ++- CRM/Financial/Form/Search.php | 3 +- CRM/Price/Form/Field.php | 7 +- CRM/Profile/Form.php | 8 +- CRM/Profile/Form/Edit.php | 6 +- CRM/Report/Form.php | 7 +- CRM/UF/Form/Field.php | 7 +- CRM/UF/Form/Group.php | 5 +- css/civicrm.css | 73 +++++++++++++++++-- css/joomla.css | 4 +- install/template.html | 6 +- js/Common.js | 30 +++++++- js/crm.ajax.js | 4 +- js/crm.searchForm.js | 2 +- js/jquery/jquery.dashboard.js | 4 +- setup/plugins/blocks/advanced.tpl.php | 2 +- setup/plugins/blocks/install.tpl.php | 5 +- setup/plugins/blocks/requirements.tpl.php | 2 +- setup/res/template.css | 11 +-- setup/src/Setup/UI/SetupController.php | 2 +- .../CRM/Admin/Form/Preferences/Display.tpl | 5 +- templates/CRM/Admin/Page/APIExplorer.tpl | 6 +- templates/CRM/Admin/Page/CKEditorConfig.tpl | 12 +-- templates/CRM/Batch/Form/Entry.tpl | 4 +- templates/CRM/Block/Add.tpl | 2 +- templates/CRM/Block/FullTextSearch.tpl | 2 +- templates/CRM/Contact/Form/Contact.tpl | 10 ++- templates/CRM/Contact/Form/Search/Builder.js | 2 +- templates/CRM/Contact/Page/View/Print.tpl | 2 +- .../Form/Contribution/PremiumBlock.tpl | 5 +- .../Event/Form/ManageEvent/Registration.tpl | 2 +- templates/CRM/Mailing/Page/Event.tpl | 2 +- templates/CRM/Mailing/Page/Resubscribe.tpl | 4 +- templates/CRM/Profile/Form/Dynamic.tpl | 8 +- templates/CRM/Report/Form/Layout/Graph.tpl | 1 - templates/CRM/common/TabHeader.js | 2 +- .../CRM/common/deferredFinancialType.tpl | 2 +- templates/CRM/common/formButtons.tpl | 17 ++++- templates/CRM/common/navigation.js.tpl | 2 +- 55 files changed, 225 insertions(+), 222 deletions(-) diff --git a/CRM/Admin/Form/Preferences/Display.php b/CRM/Admin/Form/Preferences/Display.php index 0716cdebd2..775fa2c04e 100644 --- a/CRM/Admin/Form/Preferences/Display.php +++ b/CRM/Admin/Form/Preferences/Display.php @@ -50,17 +50,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences { $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); $this->assign('invoicing', CRM_Invoicing_Utils::isInvoicingEnabled()); - $this->addElement( - 'xbutton', - 'ckeditor_config', - CRM_Core_Page::crmIcon('fa-wrench') . ' ' . ts('Configure CKEditor'), - [ - 'type' => 'submit', - 'class' => 'crm-button', - 'style' => 'display:inline-block;vertical-align:middle;float:none!important;', - 'value' => 1, - ] - ); + $this->addElement('submit', 'ckeditor_config', ts('Configure CKEditor')); $editOptions = CRM_Core_OptionGroup::values('contact_edit_options', FALSE, FALSE, FALSE, 'AND v.filter = 0'); $this->assign('editOptions', $editOptions); diff --git a/CRM/Admin/Form/Setting/Smtp.php b/CRM/Admin/Form/Setting/Smtp.php index 79e0da4f77..da909c7f08 100644 --- a/CRM/Admin/Form/Setting/Smtp.php +++ b/CRM/Admin/Form/Setting/Smtp.php @@ -61,12 +61,7 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { $this->addFormRule(['CRM_Admin_Form_Setting_Smtp', 'formRule']); parent::buildQuickForm(); $buttons = $this->getElement('buttons')->getElements(); - $buttons[] = $this->createElement( - 'xbutton', - $this->_testButtonName, - CRM_Core_Page::crmIcon('fa-envelope-o') . ' ' . ts('Save & Send Test Email'), - ['type' => 'submit'] - ); + $buttons[] = $this->createElement('submit', $this->_testButtonName, ts('Save & Send Test Email'), ['crm-icon' => 'fa-envelope-o']); $this->getElement('buttons')->setElements($buttons); if (!empty($setStatus)) { diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 35c407a79f..e60ababdb4 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -173,14 +173,9 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { // add the force save button $forceSave = $this->getButtonName('upload', 'force'); - $this->addElement('xbutton', + $this->addElement('submit', $forceSave, - ts('Ignore Mismatch & Process the Batch?'), - [ - 'type' => 'submit', - 'value' => 1, - 'class' => 'crm-button crm-button_qf_Entry_upload_force-save', - ] + ts('Ignore Mismatch & Process the Batch?') ); $this->addButtons([ diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index 4c21b837e1..646d48cfd0 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -272,10 +272,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { ['class' => 'crm-select2 crm-action-menu fa-list-ol'] ); } - $this->addElement('xbutton', $this->getButtonName('next'), ' ', [ - 'class' => 'hiddenElement', - 'type' => 'submit', - ]); + $this->addElement('submit', $this->getButtonName('next'), ' ', ['class' => 'hiddenElement']); $this->buildMergeCaseForm(); @@ -520,12 +517,11 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { FALSE, ['class' => 'crm-select2 huge'] ); - $this->addElement('xbutton', + $this->addElement('submit', $this->getButtonName('next', 'merge_case'), ts('Merge'), [ 'class' => 'hiddenElement', - 'type' => 'submit', ] ); } diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index 798050800c..04e3c8a897 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -808,31 +808,17 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $this->addField('image_URL', ['maxlength' => '255', 'label' => ts('Browse/Upload Image')]); // add the dedupe button - $this->addElement('xbutton', + $this->addElement('submit', $this->_dedupeButtonName, - ts('Check for Matching Contact(s)'), - [ - 'type' => 'submit', - 'value' => 1, - 'class' => "crm-button crm-button{$this->_dedupeButtonName}", - ] + ts('Check for Matching Contact(s)') ); - $this->addElement('xbutton', + $this->addElement('submit', $this->_duplicateButtonName, - ts('Save Matching Contact'), - [ - 'type' => 'submit', - 'value' => 1, - 'class' => "crm-button crm-button{$this->_duplicateButtonName}", - ] + ts('Save Matching Contact') ); - $this->addElement('xbutton', + $this->addElement('submit', $this->getButtonName('next', 'sharedHouseholdDuplicate'), - ts('Save With Duplicate Household'), - [ - 'type' => 'submit', - 'value' => 1, - ] + ts('Save With Duplicate Household') ); $buttons = [ diff --git a/CRM/Contact/Form/Search.php b/CRM/Contact/Form/Search.php index dcaa084d0e..322dc47e31 100644 --- a/CRM/Contact/Form/Search.php +++ b/CRM/Contact/Form/Search.php @@ -468,9 +468,8 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search { // also set the group title and freeze the action task with Add Members to Group $groupValues = ['id' => $this->_amtgID, 'title' => $this->_group[$this->_amtgID]]; $this->assign_by_ref('group', $groupValues); - $this->add('xbutton', $this->_actionButtonName, ts('Add Contacts to %1', [1 => $this->_group[$this->_amtgID]]), + $this->add('submit', $this->_actionButtonName, ts('Add Contacts to %1', [1 => $this->_group[$this->_amtgID]]), [ - 'type' => 'submit', 'class' => 'crm-form-submit', ] ); diff --git a/CRM/Contact/Form/Task/AddToParentClass.php b/CRM/Contact/Form/Task/AddToParentClass.php index aee54878d4..f98aa34e32 100644 --- a/CRM/Contact/Form/Task/AddToParentClass.php +++ b/CRM/Contact/Form/Task/AddToParentClass.php @@ -65,13 +65,8 @@ class CRM_Contact_Form_Task_AddToParentClass extends CRM_Contact_Form_Task { $this->assign('searchCount', $searchCount); $this->assign('searchDone', $this->get('searchDone')); $this->assign('contact_type_display', $contactType); - $buttonAttrs = [ - 'type' => 'submit', - 'class' => 'crm-form-submit', - 'value' => 1, - ]; - $this->addElement('xbutton', $this->getButtonName('refresh'), ts('Search'), $buttonAttrs); - $this->addElement('xbutton', $this->getButtonName('cancel'), ts('Cancel'), $buttonAttrs); + $this->addElement('submit', $this->getButtonName('refresh'), ts('Search'), ['class' => 'crm-form-submit']); + $this->addElement('submit', $this->getButtonName('cancel'), ts('Cancel'), ['class' => 'crm-form-submit']); $this->addButtons([ [ 'type' => 'next', diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index 76e245eabd..ba8bb64ec0 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -222,10 +222,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { // views are implemented as frozen form if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); - $this->addElement('xbutton', 'done', ts('Done'), [ - 'type' => 'button', - 'onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'", - ]); + $this->addElement('button', 'done', ts('Done'), ['onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'"]); } // don't show option for contribution amounts section if membership price set diff --git a/CRM/Contribute/Form/ContributionPage/Widget.php b/CRM/Contribute/Form/ContributionPage/Widget.php index 4b8b5adc3b..d59c1f6c45 100644 --- a/CRM/Contribute/Form/ContributionPage/Widget.php +++ b/CRM/Contribute/Form/ContributionPage/Widget.php @@ -188,10 +188,9 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co $this->assign_by_ref('colorFields', $this->_colorFields); $this->_refreshButtonName = $this->getButtonName('refresh'); - $this->addElement('xbutton', + $this->addElement('submit', $this->_refreshButtonName, - ts('Save and Preview'), - ['type' => 'submit'] + ts('Save and Preview') ); parent::buildQuickForm(); $this->addFormRule(['CRM_Contribute_Form_ContributionPage_Widget', 'formRule'], $this); diff --git a/CRM/Contribute/Import/Form/DataSource.php b/CRM/Contribute/Import/Form/DataSource.php index 6833eafd0e..f1c72357c7 100644 --- a/CRM/Contribute/Import/Form/DataSource.php +++ b/CRM/Contribute/Import/Form/DataSource.php @@ -38,10 +38,7 @@ class CRM_Contribute_Import_Form_DataSource extends CRM_Import_Form_DataSource { $this->setDefaults(['onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP]); - $this->addElement('xbutton', 'loadMapping', ts('Load Mapping'), [ - 'type' => 'submit', - 'onclick' => 'checkSelect()', - ]); + $this->addElement('submit', 'loadMapping', ts('Load Mapping'), NULL, ['onclick' => 'checkSelect()']); $this->addContactTypeSelector(); } diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 3c9bf18bea..e2e0e7057a 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -318,12 +318,8 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $hasRelationTypes = []; $columnCount = $columnNo; - $form->addElement('xbutton', 'addBlock', ts('Also include contacts where'), - [ - 'type' => 'submit', - 'class' => 'submit-link', - 'value' => 1, - ] + $form->addElement('submit', 'addBlock', ts('Also include contacts where'), + ['class' => 'submit-link'] ); $contactTypes = CRM_Contact_BAO_ContactType::basicTypes(); @@ -557,11 +553,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping { $form->add('text', "value[$x][$i]", ''); } - $form->addElement('xbutton', "addMore[$x]", ts('Another search field'), [ - 'type' => 'submit', - 'class' => 'submit-link', - 'value' => 1, - ]); + $form->addElement('submit', "addMore[$x]", ts('Another search field'), ['class' => 'submit-link']); } //end of block for diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 158a6eedbb..9f589ff153 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -668,13 +668,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $attrs = ['class' => 'crm-form-submit'] + (array) CRM_Utils_Array::value('js', $button); - // A lot of forms use the hacky method of looking at - // `$params['button name']` (dating back to them being inputs with a - // "value" of the button label) rather than looking at - // `$this->controller->getButtonName()`. It makes sense to give buttons a - // value by default as a precaution. - $attrs['value'] = 1; - if (!empty($button['class'])) { $attrs['class'] .= ' ' . $button['class']; } @@ -693,8 +686,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { } if ($button['type'] === 'reset') { - $attrs['type'] = 'reset'; - $prevnext[] = $this->createElement('xbutton', 'reset', $button['name'], $attrs); + $prevnext[] = $this->createElement($button['type'], 'reset', $button['name'], $attrs); } else { if (!empty($button['subName'])) { @@ -712,11 +704,12 @@ class CRM_Core_Form extends HTML_QuickForm_Page { if (in_array($button['type'], ['next', 'upload', 'done']) && $button['name'] === ts('Save')) { $attrs['accesskey'] = 'S'; } - $buttonContents = CRM_Core_Page::crmIcon($button['icon'] ?? $defaultIcon) . ' ' . $button['name']; + $icon = CRM_Utils_Array::value('icon', $button, $defaultIcon); + if ($icon) { + $attrs['crm-icon'] = $icon; + } $buttonName = $this->getButtonName($button['type'], CRM_Utils_Array::value('subName', $button)); - $attrs['class'] .= " crm-button crm-button-type-{$button['type']} crm-button{$buttonName}"; - $attrs['type'] = 'submit'; - $prevnext[] = $this->createElement('xbutton', $buttonName, $buttonContents, $attrs); + $prevnext[] = $this->createElement('submit', $buttonName, $button['name'], $attrs); } if (!empty($button['isDefault'])) { $this->setDefaultAction($button['type']); @@ -2452,10 +2445,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $this->_actionButtonName = $this->getButtonName('next', 'action'); } $this->assign('actionButtonName', $this->_actionButtonName); - $this->add('xbutton', $this->_actionButtonName, ts('Go'), [ - 'type' => 'submit', - 'class' => 'hiddenElement crm-search-go-button', - ]); + $this->add('submit', $this->_actionButtonName, ts('Go'), ['class' => 'hiddenElement crm-search-go-button']); // Radio to choose "All items" or "Selected items only" $selectedRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', ['checked' => 'checked']); diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php index f214af7026..f5e6096c0e 100644 --- a/CRM/Custom/Form/Field.php +++ b/CRM/Custom/Form/Field.php @@ -565,13 +565,10 @@ class CRM_Custom_Form_Field extends CRM_Core_Form { if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); $url = CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid); - $this->addElement('xbutton', + $this->addElement('button', 'done', ts('Done'), - [ - 'type' => 'button', - 'onclick' => "location.href='$url'", - ] + ['onclick' => "location.href='$url'"] ); } } diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php index 09cffc7533..0c37d90374 100644 --- a/CRM/Custom/Form/Group.php +++ b/CRM/Custom/Form/Group.php @@ -351,10 +351,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { // TODO: Is this condition ever true? Can this code be removed? if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); - $this->addElement('xbutton', 'done', ts('Done'), [ - 'type' => 'button', - 'onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'", - ]); + $this->addElement('button', 'done', ts('Done'), ['onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'"]); } } diff --git a/CRM/Custom/Form/Option.php b/CRM/Custom/Form/Option.php index 05f6dcd81e..3bb6a5fb6c 100644 --- a/CRM/Custom/Form/Option.php +++ b/CRM/Custom/Form/Option.php @@ -201,14 +201,10 @@ class CRM_Custom_Form_Option extends CRM_Core_Form { 'reset=1&action=browse&fid=' . $this->_fid . '&gid=' . $this->_gid, TRUE, NULL, FALSE ); - $this->addElement('xbutton', + $this->addElement('button', 'done', - CRM_Core_Page::crmIcon('fa-times') . ' ' . ts('Done'), - [ - 'type' => 'button', - 'onclick' => "location.href='$url'", - 'class' => 'crm-form-submit cancel', - ] + ts('Done'), + ['onclick' => "location.href='$url'", 'class' => 'crm-form-submit cancel', 'crm-icon' => 'fa-times'] ); } } diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index 60c124a679..1462a3697c 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -355,12 +355,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { $this->add('datepicker', 'discount_end_date[' . $i . ']', ts('Discount End Date'), [], FALSE, ['time' => FALSE]); } $_showHide->addToTemplate(); - $this->addElement('xbutton', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'), - [ - 'type' => 'submit', - 'class' => 'crm-form-submit cancel', - 'value' => 1, - ] + $this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'), + ['class' => 'crm-form-submit cancel'] ); if (Civi::settings()->get('deferred_revenue_enabled')) { $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType(); diff --git a/CRM/Financial/Form/BatchTransaction.php b/CRM/Financial/Form/BatchTransaction.php index 20848b58ec..408a84e729 100644 --- a/CRM/Financial/Form/BatchTransaction.php +++ b/CRM/Financial/Form/BatchTransaction.php @@ -75,7 +75,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search { */ public function buildQuickForm() { if ($this->_batchStatus == 'Closed') { - $this->add('xbutton', 'export_batch', ts('Export Batch'), ['type' => 'submit']); + $this->add('submit', 'export_batch', ts('Export Batch')); } // do not build rest of form unless it is open/reopened batch @@ -85,9 +85,9 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search { parent::buildQuickForm(); if (CRM_Batch_BAO_Batch::checkBatchPermission('close', $this->_values['created_id'])) { - $this->add('xbutton', 'close_batch', ts('Close Batch'), ['type' => 'submit']); + $this->add('submit', 'close_batch', ts('Close Batch')); if (CRM_Batch_BAO_Batch::checkBatchPermission('export', $this->_values['created_id'])) { - $this->add('xbutton', 'export_batch', ts('Close & Export Batch'), ['type' => 'submit']); + $this->add('submit', 'export_batch', ts('Close & Export Batch')); } } @@ -99,9 +99,8 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search { ts('Task'), ['' => ts('- actions -')] + ['Remove' => ts('Remove from Batch')]); - $this->add('xbutton', 'rSubmit', ts('Go'), + $this->add('submit', 'rSubmit', ts('Go'), [ - 'type' => 'submit', 'class' => 'crm-form-submit', 'id' => 'GoRemove', ]); @@ -124,9 +123,8 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search { ts('Task'), ['' => ts('- actions -')] + ['Assign' => ts('Assign to Batch')]); - $this->add('xbutton', 'submit', ts('Go'), + $this->add('submit', 'submit', ts('Go'), [ - 'type' => 'submit', 'class' => 'crm-form-submit', 'id' => 'Go', ]); diff --git a/CRM/Financial/Form/Search.php b/CRM/Financial/Form/Search.php index 069c6e0a9a..985d9ddfbb 100644 --- a/CRM/Financial/Form/Search.php +++ b/CRM/Financial/Form/Search.php @@ -93,9 +93,8 @@ class CRM_Financial_Form_Search extends CRM_Core_Form { ts('Task'), ['' => ts('- actions -')] + $batchAction); - $this->add('xbutton', 'submit', ts('Go'), + $this->add('submit', 'submit', ts('Go'), [ - 'type' => 'submit', 'class' => 'crm-form-submit', 'id' => 'Go', ]); diff --git a/CRM/Price/Form/Field.php b/CRM/Price/Form/Field.php index aed5e90a8d..571ab77be1 100644 --- a/CRM/Price/Form/Field.php +++ b/CRM/Price/Form/Field.php @@ -376,13 +376,10 @@ class CRM_Price_Form_Field extends CRM_Core_Form { if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); $url = CRM_Utils_System::url('civicrm/admin/price/field', 'reset=1&action=browse&sid=' . $this->_sid); - $this->addElement('xbutton', + $this->addElement('button', 'done', ts('Done'), - [ - 'type' => 'button', - 'onclick' => "location.href='$url'", - ] + ['onclick' => "location.href='$url'"] ); } } diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index c6594fd4bd..8d8f46cd88 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -904,13 +904,9 @@ class CRM_Profile_Form extends CRM_Core_Form { if ($this->_context == 'dialog') { $this->addElement( - 'xbutton', + 'submit', $this->_duplicateButtonName, - ts('Save Matching Contact'), - [ - 'type' => 'submit', - 'class' => 'crm-button', - ] + ts('Save Matching Contact') ); } } diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index b2cfc16bf4..7564dc37fc 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -209,11 +209,7 @@ SELECT module,is_reserved if (($this->_multiRecord & CRM_Core_Action::DELETE) && $this->_recordExists) { $this->_deleteButtonName = $this->getButtonName('upload', 'delete'); - $this->addElement('xbutton', $this->_deleteButtonName, ts('Delete'), [ - 'type' => 'submit', - 'value' => 1, - 'class' => 'crm-button', - ]); + $this->addElement('submit', $this->_deleteButtonName, ts('Delete')); return; } diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 07bd815673..d202b84561 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1535,7 +1535,7 @@ class CRM_Report_Form extends CRM_Core_Form { if (!empty($this->_charts)) { $this->addElement('select', "charts", ts('Chart'), $this->_charts); $this->assign('charts', $this->_charts); - $this->addElement('xbutton', $this->_chartButtonName, ts('View'), ['type' => 'submit']); + $this->addElement('submit', $this->_chartButtonName, ts('View')); } } @@ -1660,10 +1660,7 @@ class CRM_Report_Form extends CRM_Core_Form { $this->assign('group', TRUE); } - $this->addElement('xbutton', $this->_groupButtonName, '', [ - 'type' => 'submit', - 'style' => 'display: none;', - ]); + $this->addElement('submit', $this->_groupButtonName, '', ['style' => 'display: none;']); $this->addChartOptions(); $showResultsLabel = $this->getResultsLabel(); diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index 997962cd40..4bfcb214af 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -467,11 +467,8 @@ class CRM_UF_Form_Field extends CRM_Core_Form { // if view mode pls freeze it with the done button. if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); - $this->addElement('xbutton', 'done', ts('Done'), - [ - 'type' => 'button', - 'onclick' => "location.href='civicrm/admin/uf/group/field?reset=1&action=browse&gid=" . $this->_gid . "'", - ] + $this->addElement('button', 'done', ts('Done'), + ['onclick' => "location.href='civicrm/admin/uf/group/field?reset=1&action=browse&gid=" . $this->_gid . "'"] ); } diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php index 5a4d3dd570..a9fef4dc8f 100644 --- a/CRM/UF/Form/Group.php +++ b/CRM/UF/Form/Group.php @@ -231,10 +231,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form { // views are implemented as frozen form if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); - $this->addElement('xbutton', 'done', ts('Done'), [ - 'type' => 'button', - 'onclick' => "location.href='civicrm/admin/uf/group?reset=1&action=browse'", - ]); + $this->addElement('button', 'done', ts('Done'), ['onclick' => "location.href='civicrm/admin/uf/group?reset=1&action=browse'"]); } $this->addFormRule(['CRM_UF_Form_Group', 'formRule'], $this); diff --git a/css/civicrm.css b/css/civicrm.css index a2d6695b68..cf61ef5a7d 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -1173,7 +1173,7 @@ input.crm-form-entityref { cursor: pointer; } -#crm-container button.submit-link { +#crm-container input.submit-link { color: #285286; background: none transparent; border: none; @@ -1833,6 +1833,17 @@ input.crm-form-entityref { margin-left: .5em; } +.crm-container .crm-button input { + background: none; + border: medium none; + color: #FFF; + cursor: pointer; + font-size: 13px; + font-weight: normal; + margin: 0; + padding: 1px 8px 2px 4px; +} + .crm-container .crm-button-type-cancel, .crm-container .crm-button-type-back { margin-left: 20px; @@ -1847,7 +1858,9 @@ input.crm-form-entityref { .crm-container a.button, .crm-container a.button:link, .crm-container a.button:visited, +.crm-container input.crm-form-submit, .crm-container .ui-dialog-buttonset .ui-button, +.crm-container input[type=button], .crm-container .crm-button { text-shadow: 0 1px 0 black; background: #696969; @@ -1859,15 +1872,48 @@ input.crm-form-entityref { text-decoration: none; cursor: pointer; border: 1px solid #3e3e3e; +} + +.crm-container a.button, +.crm-container a.button:link, +.crm-container a.button:visited, +.crm-container span.crm-button { display: block; float: left; overflow: hidden; line-height: 135%; - border-radius: 3px; +} + +/* Preserving the important but not sure why */ +.crm-container span.crm-button { + float: left !important; +} + +.crm-container button.crm-button { + padding: 3px 6px; +} + +.crm-container button.crm-button .icon { + margin-bottom: -4px; +} + +.crm-container input.crm-form-submit, +.crm-container input[type=button] { + padding: 2px 6px; +} + +.crm-container .crm-button input[type=button], +.crm-container .crm-button input.crm-form-submit { + padding: 0; + margin: 0; + background: none; + border: none; } .crm-container .crm-button:hover, .crm-container .crm-button:focus, +.crm-container input[type=submit]:hover, +.crm-container input[type=button]:hover, .crm-container .ui-dialog-buttonset .ui-button:hover, .crm-container .ui-dialog-buttonset .ui-button:focus, .crm-container a.button:hover, @@ -1878,24 +1924,28 @@ input.crm-form-entityref { .crm-container .crm-button-disabled, .crm-container .crm-button.crm-button-disabled, .crm-container .ui-dialog-buttonset .ui-button[disabled], +.crm-container input.crm-form-submit[disabled], +.crm-container input[type=button][disabled], .crm-container .crm-button[disabled] { opacity: .6; cursor: default; } +.crm-container .crm-button-disabled input[disabled] { + opacity: 1; +} + .crm-container .ui-dialog-buttonpane { background: linear-gradient(to bottom, #f2f2f2 0%,#ffffff 35%); } +.crm-container .ui-dialog-buttonset .ui-button { + padding: 0; +} .crm-container .ui-dialog-buttonset .ui-button .ui-icon { background-image: url("../i/icons/jquery-ui-FFFFFF.png"); } -/* Override of a line in crm-i.css that may not be important anymore */ -.crm-container .ui-dialog-buttonset .ui-button .ui-icon[class*=" fa-"] { - margin-top: 0; -} - /* No crm-button styling for PayPal Express buttons */ .crm-container input#_qf_Register_upload_express, .crm-container input#_qf_Payment_upload_express, @@ -2838,6 +2888,15 @@ tbody.scrollContent tr.alternateRow { } /* rounded corners */ +.crm-container .crm-button, +.crm-container a.button, +.crm-container a.button:link, +.crm-container input.crm-form-submit, +.crm-container input[type=button] { + border-radius: 3px; +} + + .crm-container div.status, .crm-container #help, .crm-container .help, diff --git a/css/joomla.css b/css/joomla.css index 80b9ad96f0..a59b3a047a 100644 --- a/css/joomla.css +++ b/css/joomla.css @@ -352,7 +352,7 @@ div#toolbar-box, div#toolbar-box div.m{ .crm-container input { height: auto; } -.crm-container button[type=submit] { +.crm-container input[type=submit] { height: auto; } @@ -377,7 +377,7 @@ div#toolbar-box, div#toolbar-box div.m{ } /* Remove Joomla subhead toolbar & whitespace border */ - + body.admin.com_civicrm .subhead-collapse { display:none; } diff --git a/install/template.html b/install/template.html index eb12944d22..e95165536b 100644 --- a/install/template.html +++ b/install/template.html @@ -34,7 +34,7 @@ if ($text_direction == 'rtl') {

- +

-

+

diff --git a/js/Common.js b/js/Common.js index 056c11cfe0..88acc9ef4d 100644 --- a/js/Common.js +++ b/js/Common.js @@ -145,6 +145,32 @@ function showHideByValue(trigger_field_id, trigger_value, target_element_id, tar } var submitcount = 0; +/** + * Old submit-once function. Will be removed soon. + * @deprecated + */ +function submitOnce(obj, formId, procText) { + // if named button clicked, change text + if (obj.value != null) { + cj('input[name=' + obj.name + ']').val(procText + " ..."); + } + cj(obj).closest('form').attr('data-warn-changes', 'false'); + if (document.getElementById) { // disable submit button for newer browsers + cj('input[name=' + obj.name + ']').attr("disabled", true); + document.getElementById(formId).submit(); + return true; + } + else { // for older browsers + if (submitcount == 0) { + submitcount++; + return true; + } + else { + alert("Your request is currently being processed ... Please wait."); + return false; + } + } +} /** * Function to show / hide the row in optionFields @@ -192,7 +218,7 @@ if (!CRM.vars) CRM.vars = {}; $.propHooks.disabled = { set: function (el, value, name) { // Sync button enabled status with wrapper css - if ($(el).is('.crm-button.crm-form-submit')) { + if ($(el).is('span.crm-button > input.crm-form-submit')) { $(el).parent().toggleClass('crm-button-disabled', !!value); } // Sync button enabled status with dialog button @@ -971,7 +997,7 @@ if (!CRM.vars) CRM.vars = {}; $('form[data-submit-once]', e.target) .submit(submitOnceForm) .on('invalid-form', submitFormInvalid); - $('form[data-submit-once] button[type=submit]', e.target).click(function(e) { + $('form[data-submit-once] input[type=submit]', e.target).click(function(e) { submitButton = e.target; }); }) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 757ebef063..e65bd7b2a2 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -498,7 +498,7 @@ var buttonContainers = '.crm-submit-buttons, .action-link', buttons = [], added = []; - $(buttonContainers, $el).find('.crm-form-submit, .crm-form-xbutton, a.button, button').each(function() { + $(buttonContainers, $el).find('input.crm-form-submit, a.button, button').each(function() { var $el = $(this), label = $el.is('input') ? $el.attr('value') : $el.text(), identifier = $el.attr('name') || $el.attr('href'); @@ -522,7 +522,7 @@ $el.dialog('option', 'buttons', buttons); } // Allow a button to prevent ajax submit - $('input[data-no-ajax-submit=true], button[data-no-ajax-submit=true]').click(function() { + $('input[data-no-ajax-submit=true]').click(function() { $(this).closest('form').ajaxFormUnbind(); }); // For convenience, focus the first field diff --git a/js/crm.searchForm.js b/js/crm.searchForm.js index c84d0f5ec2..42a371dcec 100644 --- a/js/crm.searchForm.js +++ b/js/crm.searchForm.js @@ -134,7 +134,7 @@ // When selecting a task .on('change', 'select#task', function(e) { var $form = $(this).closest('form'), - $go = $('button.crm-search-go-button', $form); + $go = $('input.crm-search-go-button', $form); var $selectedOption = $(this).find(':selected'); if (!$selectedOption.val()) { // do not blank refresh the empty option. diff --git a/js/jquery/jquery.dashboard.js b/js/jquery/jquery.dashboard.js index 00c65260ec..4191285449 100644 --- a/js/jquery/jquery.dashboard.js +++ b/js/jquery/jquery.dashboard.js @@ -526,8 +526,8 @@ html += '
'; html += '
'; html += '
'; - html += ' '; - html += ' '; + html += ' '; + html += ' '; html += '
'; html += '
'; return html; diff --git a/setup/plugins/blocks/advanced.tpl.php b/setup/plugins/blocks/advanced.tpl.php index abfc039260..971d22c1fd 100644 --- a/setup/plugins/blocks/advanced.tpl.php +++ b/setup/plugins/blocks/advanced.tpl.php @@ -26,7 +26,7 @@ endif; ?>
- +