CRM-12882 - Allow all admins to view payment processors page. Clarify error message...
[civicrm-core.git] / CRM / Admin / Form / MessageTemplates.php
index 279f83d1fd0378ff32ae130c3c9570b0683cb906..537a2d99a67358f65ac23b923e08070538327747 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -60,12 +60,12 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
    *
    * @access public
    *
-   * @return None
+   * @return void
    */
   public function setDefaultValues() {
     $defaults = $this->_values;
 
-    if (!CRM_Utils_Array::value('pdf_format_id', $defaults)) {
+    if (empty($defaults['pdf_format_id'])) {
       $defaults['pdf_format_id'] = 'null';
     }
 
@@ -112,7 +112,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
   /**
    * Function to build the form
    *
-   * @return None
+   * @return void
    * @access public
    */
   public function buildQuickForm() {
@@ -158,36 +158,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
     //get the tokens.
     $tokens = CRM_Core_SelectValues::contactTokens();
 
-    //sorted in ascending order tokens by ignoring word case
-    natcasesort($tokens);
-    $this->assign('tokens', json_encode($tokens));
-
-    $this->add('select', 'token1', ts('Insert Tokens'),
-      $tokens, FALSE,
-      array(
-        'size' => "5",
-        'multiple' => TRUE,
-        'onchange' => "return tokenReplText(this);",
-      )
-    );
-
-    $this->add('select', 'token2', ts('Insert Tokens'),
-      $tokens, FALSE,
-      array(
-        'size' => "5",
-        'multiple' => TRUE,
-        'onchange' => "return tokenReplHtml(this);",
-      )
-    );
-
-    $this->add('select', 'token3', ts('Insert Tokens'),
-      $tokens, FALSE,
-      array(
-        'size' => "5",
-        'multiple' => TRUE,
-        'onchange' => "return tokenReplText(this);",
-      )
-    );
+    $this->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens));
 
     $this->add('textarea', 'msg_text', ts('Text Message'),
       "cols=50 rows=6"
@@ -231,7 +202,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
    *
    * @access public
    *
-   * @return None
+   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {