Skip to content

Commit

Permalink
Merge pull request #13520 from yashodha/number_widget
Browse files Browse the repository at this point in the history
use number widget for weight fields in all forms
  • Loading branch information
colemanw authored Feb 1, 2019
2 parents efafa9a + f20d2b0 commit 62531d8
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/LabelFormats.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function buildQuickForm() {
$this->add('text', 'SpaceY', ts('Vertical Spacing'), array('size' => 8, 'maxlength' => 8) + $disabled, $required);
$this->add('text', 'lPadding', ts('Left Padding'), array('size' => 8, 'maxlength' => 8), $required);
$this->add('text', 'tPadding', ts('Top Padding'), array('size' => 8, 'maxlength' => 8), $required);
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_LabelFormat', 'weight'), TRUE);
$this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_LabelFormat', 'weight'), TRUE);

$this->addRule('label', ts('Name already exists in Database.'), 'objectExists', array(
'CRM_Core_BAO_LabelFormat',
Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/ParticipantStatusType.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function buildQuickForm() {
$this->add('checkbox', 'is_active', ts('Active?'));
$this->add('checkbox', 'is_counted', ts('Counted?'));

$this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE);
$this->add('number', 'weight', ts('Order'), $attributes['weight'], TRUE);

$this->addSelect('visibility_id', array('label' => ts('Visibility'), 'required' => TRUE));

Expand Down
2 changes: 1 addition & 1 deletion CRM/Admin/Form/PdfFormats.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function buildQuickForm() {
$this->add('text', 'margin_right', ts('Right Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'margin_top', ts('Top Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'margin_bottom', ts('Bottom Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE);
$this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE);

$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
'CRM_Core_BAO_PdfFormat',
Expand Down
2 changes: 1 addition & 1 deletion CRM/Campaign/Form/Survey/Results.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function buildQuickForm() {
);

// weight
$this->add('text', "option_weight[$i]", ts('Order'),
$this->add('number', "option_weight[$i]", ts('Order'),
$optionAttributes['weight']
);

Expand Down
2 changes: 1 addition & 1 deletion CRM/Campaign/Form/SurveyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function buildQuickForm() {
) {
$this->freeze(array('label', 'is_active'));
}
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);
$this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);

$this->assign('id', $this->_id);
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Custom/Form/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public function buildQuickForm() {
);

// weight
$this->add('text', "option_weight[$i]", ts('Order'),
$this->add('number', "option_weight[$i]", ts('Order'),
$optionAttributes['weight']
);

Expand Down
2 changes: 1 addition & 1 deletion CRM/Custom/Form/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function buildQuickForm() {
$this->add('wysiwyg', 'help_post', ts('Post-form Help'), $attributes['help_post']);

// weight
$this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE);
$this->add('number', 'weight', ts('Order'), $attributes['weight'], TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');

// display style
Expand Down
2 changes: 1 addition & 1 deletion CRM/Custom/Form/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function buildQuickForm() {

$this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'description'));
// weight
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);
$this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');

// is active ?
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/MembershipStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function buildQuickForm() {
);
$this->add('checkbox', 'is_current_member', ts('Current Membership?'));

$this->add('text', 'weight', ts('Order'),
$this->add('number', 'weight', ts('Order'),
CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'weight')
);
$this->add('checkbox', 'is_default', ts('Default?'));
Expand Down
4 changes: 2 additions & 2 deletions CRM/Price/Form/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function buildQuickForm() {
}

// weight
$this->add('text', 'option_weight[' . $i . ']', ts('Order'), $attributes['weight']);
$this->add('number', 'option_weight[' . $i . ']', ts('Order'), $attributes['weight']);

// is active ?
$this->add('checkbox', 'option_status[' . $i . ']', ts('Active?'));
Expand All @@ -311,7 +311,7 @@ public function buildQuickForm() {
$this->add('checkbox', 'is_display_amounts', ts('Display Amount?'));

// weight
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceField', 'weight'), TRUE);
$this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceField', 'weight'), TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');

// checkbox / radio options per line
Expand Down
2 changes: 1 addition & 1 deletion CRM/Price/Form/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function buildQuickForm() {
$this->add('textarea', 'help_post', ts('Post Option Help'));

// weight
$this->add('text', 'weight', ts('Order'), NULL, TRUE);
$this->add('number', 'weight', ts('Order'), NULL, TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');

// is active ?
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Form/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function buildQuickForm() {
$this->add('text', 'label', ts('Title'), array('size' => 40), TRUE);
$this->add('text', 'value', ts('URL'), array('size' => 40), TRUE);
$this->add('text', 'name', ts('Class'), array('size' => 40), TRUE);
$element = $this->add('text', 'weight', ts('Order'), array('size' => 4), TRUE);
$element = $this->add('number', 'weight', ts('Order'), array('size' => 4), TRUE);
// $element->freeze( );
$this->add('text', 'description', ts('Description'), array('size' => 40), TRUE);

Expand Down
2 changes: 1 addition & 1 deletion CRM/UF/Form/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public function buildQuickForm() {
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFField');

// weight
$this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE);
$this->add('number', 'weight', ts('Order'), $attributes['weight'], TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');

$this->add('textarea', 'help_pre', ts('Field Pre Help'), $attributes['help_pre']);
Expand Down
2 changes: 1 addition & 1 deletion CRM/UF/Form/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function buildQuickForm() {
$this->add('wysiwyg', 'help_post', ts('Post-form Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'help_post'));

// weight
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFJoin', 'weight'), TRUE);
$this->add('number', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFJoin', 'weight'), TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');

// is this group active ?
Expand Down

0 comments on commit 62531d8

Please sign in to comment.