Index: messaging.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/messaging/messaging.module,v
retrieving revision 1.7.2.2
diff -u -r1.7.2.2 messaging.module
--- messaging.module	12 Mar 2008 20:29:53 -0000	1.7.2.2
+++ messaging.module	13 Mar 2008 05:17:48 -0000
@@ -1,7 +1,7 @@
 <?php
 /**
  * Drupal Messaging Framework
- * 
+ *
  * This is a messaging framework to allow message sending in a channel independent way
  * It will provide a common API for sending while allowing plugins for multiple channels
  * 
@@ -62,7 +62,7 @@
       'path' => 'admin/settings/messaging/edit',
       'callback' => 'messaging_admin_message_edit',
       'type' => MENU_CALLBACK,
-    );    
+    );
     $items[] = array(
       'title' => t('Settings'),
       'path' => 'admin/settings/messaging/settings',
@@ -83,7 +83,7 @@
 
 /**
  * Implementation of hook_user().
- * 
+ *
  * Adds fieldset and default sending method setting.
  */
 function messaging_user($type, $edit, &$user, $category = NULL) {
@@ -138,7 +138,7 @@
     $list[] = l($group_info['name'], 'admin/settings/messaging/edit/'.$group);
   }
   $output .= theme('box', t('Message groups'), theme('item_list', $list));
-  return $output;  
+  return $output;
 }
 
 /**
@@ -148,9 +148,10 @@
   $output = '';
   $groups = module_invoke_all('messaging', 'message groups');
   if (isset($groups[$group])) {
-    drupal_set_title($groups[$group]['name']);    
-    
+    drupal_set_title($groups[$group]['name']);
+
     $output .= drupal_get_form('messaging_admin_message_form', $group, $groups[$group]);
+
   }
   return $output;
 }
@@ -181,6 +182,14 @@
   }
   // Tokens for text replacement
   if ($tokens = messaging_tokens_get_list($group)) {
+    $headers = array(t('Token'), t('Replacement value'));
+    $rows = array();
+    foreach ($tokens as $token => $token_description) {
+        $row = array();
+        $row[] = '[' . $token . ']';
+        $row[] = $token_description;
+        $rows[] = $row;
+    }
     $form['tokens'] = array(
       '#title' => t('Available tokens'),
       '#type' => 'fieldset',
@@ -189,7 +198,7 @@
       '#collapsed' => TRUE,
     );
     $form['tokens']['list'] = array(
-      '#value' => theme('item_list', $tokens),    
+      '#value' => theme('table', $headers, $rows, array('class' => 'description'))
     );
   }
   $form['submit'] = array(
@@ -201,25 +210,25 @@
 
 /**
  * Get list of tokens for text replacement
- * 
+ *
  * @param $group
  *   Message group to get tokens for
  * @param $tokens
- *   
+ *
  */
 function messaging_tokens_get_list($group) {
   // First compile token types for this message group
   $type_list = module_invoke_all('messaging', 'tokens', $group);
-  
+
   // Now get token list from token module for each type
   $return = array();
   foreach ($type_list as $type) {
     if ($list = token_get_list($type)) {
       foreach ($list as $category => $tokens) {
         foreach ($tokens as $token => $description) {
-          $return[$token] = "<em>[$token]</em> $description";
+          $return[$token] = $description;
         }
-      }      
+      }
     }
   }
 
@@ -297,14 +306,14 @@
 
 /**
  * Send message to user represented by account
- * 
+ *
  * We are applying same output filter for everybody, depending on send method
- * 
+ *
  * The final rendering of the message depends on send method too. I.e. a mail messaging
  * method may want to insert '--' before the body footer.
- * 
+ *
  * @ TODO Consider whether it makes sense to allow users decide on formatting
- * 
+ *
  * @param $message
  *   Array of message parts that will be compiled depending on send method.
  *   Mandatory message parts, which may have nexted parts are:
@@ -369,7 +378,7 @@
 
 /**
  * Pull pending messages for given methods and user accounts
- * 
+ *
  * Each returned message will be an array with the following elements
  * - 'to', destination uid
  * - 'from', originating uid
@@ -384,7 +393,7 @@
  * @param $delete
  *   Optional whether to delete messages when fetching
  * @return array()
- *   Array of pending messages.   
+ *   Array of pending messages.
  */
 function messaging_pull_pending($method, $users, $limit = 0, $delete = TRUE) {
   // Collect messages checking limit after each module
@@ -407,7 +416,7 @@
 
 /**
  * Returns list of messaging methods for a type
- * 
+ *
  * I.e. all messaging methods of pull type
  */
 function messaging_method_type($type) {
@@ -422,7 +431,7 @@
 
 /**
  * List sending methods
- * 
+ *
  * @param $account
  *   Optional user account, for checking permissions against this account
  */
@@ -441,7 +450,7 @@
 
 /**
  * Check permission for method and account
- * 
+ *
  * @param $method
  *   Sending method id
  * @param $account
@@ -467,15 +476,15 @@
   }
   else {
     return key(messaging_method_info());
-  }  
+  }
 }
 
 /**
  * Returns parts of messages, that may be formatted for each sending method
- * 
+ *
  * @ TODO Review logic, optimizations, text pre-fetching
  * @ TODO Glue text in a method-dependent way
- * 
+ *
  * First checks for message, key, method
  * Then checks for message, key for method 'default'
  * Finally checks default values from modules and hook_messaging()
@@ -490,7 +499,7 @@
  *   Boolean, whether to use the default if a specific message isn't available for the used method. OPTIONAL, Defaults to true.
  *
  * @return
- *   Assembled text of a message part.  
+ *   Assembled text of a message part.
  */
 function messaging_message_part($group, $key, $method = 'default', $getdefault = TRUE) {
   static $cache;
@@ -511,7 +520,7 @@
     if ($text_part && is_array($text_part)) {
       $text_part = implode("\n", $text_part);
     }
-    $cache[$group][$key][$method] = $text_part;  
+    $cache[$group][$key][$method] = $text_part;
   }
 
   return $text_part ? $text_part : '';
@@ -519,7 +528,7 @@
 
 /**
  * Replaces variables in text
- * 
+ *
  * Obsoleted.
  */
 function messaging_text_vars($text, $variables) {
@@ -541,13 +550,13 @@
   }
   foreach ($text as $key => $line) {
     $text[$key] = strtr($line, $args);
-  }  
-  return $text;  
+  }
+  return $text;
 }
 
 /**
  * Returns parts of messages, that may be formatted for each sending method
- * 
+ *
  * @param $group
  *   Message group.
  * @param $key
@@ -571,7 +580,7 @@
 
 /**
  * Returns information about message groups
- * 
+ *
  * @param $group
  *   Optional message group. Returns all groups if null.
  * @param $key
@@ -595,7 +604,7 @@
 
 /**
  * Returns messaging methods properties
- * 
+ *
  * @param $method
  *   Optional, Method to get properties for, none or NULL for all methods
  * @param $property
@@ -628,7 +637,7 @@
         if (isset($values[$property])) {
           $properties[$property][$method] = $values[$property];
         }
-      }      
+      }
     }
     return $properties[$property];
   } else {
