From 6ec195ca8a7b16e9180525f5d31252f291b995ee Mon Sep 17 00:00:00 2001 From: Shawn Kwang Date: Tue, 24 Oct 2017 14:18:17 -0500 Subject: [PATCH 1/2] Drupal: Reverted code to use a comma as separated between BOINC usernames. https://dev.gridrepublic.org/browse/DBOINCP-411 --- .../modules/contrib/privatemsg/privatemsg.module | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module b/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module index 55fb9eac95..1fd58be731 100644 --- a/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module +++ b/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module @@ -896,8 +896,8 @@ function privatemsg_new(&$form_state, $recipients = array(), $subject = '', $thr $to_themed[$user->uid] = $myname; } if (!empty($to)) { - $recipients_string = implode(' ', $to); - $recipients_string .= ' '; + $recipients_string = implode(', ', $to); + $recipients_string .= ', '; } if (isset($form_state['values'])) { if (isset($form_state['values']['recipient'])) { @@ -913,7 +913,6 @@ function privatemsg_new(&$form_state, $recipients = array(), $subject = '', $thr elseif (!$thread_id) { drupal_set_title(t('Write new message')); } - $form = array(); if (isset($form_state['privatemsg_preview'])) { $form['message_header'] = array( @@ -936,7 +935,7 @@ function privatemsg_new(&$form_state, $recipients = array(), $subject = '', $thr $form['privatemsg']['recipient'] = array( '#type' => 'textfield', '#title' => t('To'), - '#description' => t('Separate multiple names with a space. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.'), + '#description' => t('Separate multiple names with a comma followed by one space. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.'), '#default_value' => $recipients_string, '#required' => TRUE, '#weight' => -10, @@ -1089,7 +1088,7 @@ function _privatemsg_load_thread_participants($thread_id) { */ function _privatemsg_parse_userstring($input) { if (is_string($input)) { - $input = explode(' ', $input); + $input = explode(', ', $input); } // Start working through the input array. @@ -1420,7 +1419,7 @@ function privatemsg_sql_deleted(&$fragments, $days) { function privatemsg_user_name_autocomplete($string) { $names = array(); // 1: Parse $string and build list of valid user names. - $fragments = explode(' ', $string); + $fragments = explode(', ', $string); foreach ($fragments as $index => $name) { if ($name = trim($name)) { $names[$name] = $name; @@ -1435,11 +1434,11 @@ function privatemsg_user_name_autocomplete($string) { db_set_active('boinc'); $result = db_query_range($query['query'], $fragment, 0, 10); db_set_active('default'); - $prefix = count($names) ? implode(' ', $names) . ' ' : ''; + $prefix = count($names) ? implode(', ', $names) . ', ' : ''; // 3: Build proper suggestions and print. while ($user = db_fetch_object($result)) { $myname = preg_replace("/ /", "\xc2\xa0", $user->name); - $matches[$prefix . $myname . "_" . $user->id . ' '] = htmlentities($myname) . '(' . $user->id . ')'; + $matches[$prefix . $myname . "_" . $user->id . ', '] = htmlentities($myname) . '(' . $user->id . ')'; } } // convert to object to prevent drupal bug, see http://drupal.org/node/175361 From dbd7c7707dfac8f7ab55c202d1dd4647f3904d16 Mon Sep 17 00:00:00 2001 From: Shawn Kwang Date: Thu, 26 Oct 2017 10:07:57 -0500 Subject: [PATCH 2/2] Drupal: Added space between username and BOINC id in autocomplete box. --- .../default/boinc/modules/contrib/privatemsg/privatemsg.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module b/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module index 1fd58be731..3fd91e5097 100644 --- a/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module +++ b/drupal/sites/default/boinc/modules/contrib/privatemsg/privatemsg.module @@ -1438,7 +1438,7 @@ function privatemsg_user_name_autocomplete($string) { // 3: Build proper suggestions and print. while ($user = db_fetch_object($result)) { $myname = preg_replace("/ /", "\xc2\xa0", $user->name); - $matches[$prefix . $myname . "_" . $user->id . ', '] = htmlentities($myname) . '(' . $user->id . ')'; + $matches[$prefix . $myname . "_" . $user->id . ', '] = htmlentities($myname) . ' (' . $user->id . ')'; } } // convert to object to prevent drupal bug, see http://drupal.org/node/175361