? .cvsignore
? truncation_setting.patch
Index: userpoints.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints/Attic/userpoints.admin.inc,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 userpoints.admin.inc
--- userpoints.admin.inc	1 Dec 2010 10:15:03 -0000	1.1.2.11
+++ userpoints.admin.inc	25 Jan 2011 13:03:33 -0000
@@ -151,7 +151,7 @@ function userpoints_admin_txn($form, &$f
       '#access' => count($options) > 1,
     );
   }
-  
+
   $form['operation'] = array(
       '#type' => 'textfield',
       '#title' => t('Operation'),
@@ -708,6 +708,14 @@ function userpoints_admin_settings($form
       '#description' => t('When listing !points by user limit how many users are displayed on a single page', userpoints_translation()),
   );
 
+  $form[$group]['userpoints_truncate'] = array(
+    '#type'          => 'textfield',
+    '#title'         => t('Truncation length for the "Reason" column in transaction listings'),
+    '#description'   => t('Choose the truncation length in characters for the "Reason" column in transaction listings. The reason is not truncated on the transaction details page.'),
+    '#default_value' => variable_get('userpoints_truncate', 70),
+    '#size'          => 5,
+    '#maxlength'     => 5,
+  );
 
   // Categories will only appear if the taxonomy module is enabled as
   // the module is required for this functionality but not necessarily
Index: userpoints.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints/userpoints.module,v
retrieving revision 1.68.2.23
diff -u -p -r1.68.2.23 userpoints.module
--- userpoints.module	22 Jan 2011 22:12:29 -0000	1.68.2.23
+++ userpoints.module	25 Jan 2011 13:03:37 -0000
@@ -1250,7 +1250,7 @@ function userpoints_views_api() {
  *   The operation being performed.
  * @param &$params
  *   Parameters to be passed to the hook.
- * 
+ *
  * @return
  *   An array of return values of the hook implementations. If modules return
  *   arrays from their implementations, those are merged into one array.
@@ -1304,11 +1304,27 @@ function userpoints_get_info($operation 
  *  * description of the transaction.
  *  * name of the operation.
  *
+ * @param $transaction
+ *   The transaction object for which the description shall be generated.
+ *
+ * @param $options
+ *   Array of options:
+ *   - link: If FALSE, no link is generated to the linked entity even if there
+ *     were one. Defaults to TRUE.
+ *   - truncate: Define if the reason should be truncated. Defaults to TRUE.
+ *
  * @return
  *   The reason for that transaction, linked to the referenced
  *   entity if available.
  */
 function userpoints_create_description($transaction, array $options = array()) {
+
+  // Default options.
+  $options += array(
+    'link' => TRUE,
+    'truncate' => TRUE,
+  );
+
   // Check if there is a valid entity referenced and which can be linked to.
   $entity = NULL;
   if ($transaction->entity_type && entity_get_info($transaction->entity_type)) {
@@ -1336,11 +1352,18 @@ function userpoints_create_description($
   if (empty($description)) {
     $description = $transaction->operation;
   }
+
+  // Truncate description.
+  $title = $description;
+  if ($options['truncate'] && drupal_strlen($description) > variable_get('userpoints_truncate', 70) + 3) {
+    $description = truncate_utf8($description, variable_get('userpoints_truncate', 70), TRUE, TRUE);
+  }
+
   // Link to the referenced entity, if available.
-  if ($entity && (!isset($options['link']) || $options['link'] != FALSE)) {
+  if ($entity && $options['link']) {
     $uri = entity_uri($transaction->entity_type, $entity);
     if ($uri) {
-      $description = l($description, $uri['path'], $uri['options'] + array('html' => $safe));
+      $description = l($description, $uri['path'], $uri['options'] + array('html' => $safe, 'attributes' => array('title' => $title)));
     }
   }
   if ((empty($entity) || empty($uri)) && !$safe) {
Index: userpoints.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints/Attic/userpoints.pages.inc,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 userpoints.pages.inc
--- userpoints.pages.inc	19 Nov 2010 00:47:21 -0000	1.1.2.7
+++ userpoints.pages.inc	25 Jan 2011 13:03:38 -0000
@@ -247,7 +247,7 @@ function userpoints_view_transaction($tr
   $content['details']['reason'] = array(
     '#theme' => 'userpoints_view_item',
     '#title' => t('Reason'),
-    '#value' => userpoints_create_description($transaction),
+    '#value' => userpoints_create_description($transaction, array('truncate' => FALSE)),
     '#weight' => 40,
     '#attributes' => array('class' => array('userpoints-item-reason')),
   );
