Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-03-20-15-52-17
[civicrm-core.git] / CRM / Admin / Form / Tag.php
index dda9c8ff20bf1fb520b5c04988b2435299a029ec..eb871d066b506263a783e447c08dcb319d9d7486 100644 (file)
@@ -54,20 +54,6 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
         CRM_Utils_System::redirect($url);
         return TRUE;
       }
-      else {
-        $this->addButtons(array(
-            array(
-              'type' => 'next',
-              'name' => ts('Delete'),
-              'isDefault' => TRUE,
-            ),
-            array(
-              'type' => 'cancel',
-              'name' => ts('Cancel'),
-            ),
-          )
-        );
-      }
     }
     else {
       $this->_isTagSet = CRM_Utils_Request::retrieve('tagset', 'Positive', $this);
@@ -86,7 +72,7 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
       }
 
       if (!$this->_isTagSet) {
-        $this->add('select', 'parent_id', ts('Parent Tag'), $allTag);
+        $this->add('select', 'parent_id', ts('Parent Tag'), $allTag, FALSE, array('class' => 'crm-select2'));
       }
 
       $this->assign('isTagSet', $this->_isTagSet);
@@ -107,10 +93,7 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
 
       $isReserved = $this->add('checkbox', 'is_reserved', ts('Reserved?'));
 
-      $usedFor = $this->add('select', 'used_for', ts('Used For'),
-        CRM_Core_OptionGroup::values('tag_used_for')
-      );
-      $usedFor->setMultiple(TRUE);
+      $usedFor = $this->addSelect('used_for', array('multiple' => TRUE, 'option_url' => NULL));
 
       if ($this->_id &&
         CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $this->_id, 'parent_id')
@@ -131,8 +114,8 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
       }
       $this->assign('adminReservedTags', $adminReservedTags);
 
-      parent::buildQuickForm();
     }
+    parent::buildQuickForm();
   }
 
   /**
@@ -166,7 +149,9 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
 
     if ($this->_action == CRM_Core_Action::DELETE) {
       if ($this->_id > 0) {
+        $tag = civicrm_api3('tag', 'getsingle', array('id' => $this->_id));
         CRM_Core_BAO_Tag::del($this->_id);
+        CRM_Core_Session::setStatus(ts('The tag \'%1\' has been deleted.', array(1 => $tag['name'])), ts('Deleted'), 'success');
       }
     }
     else {