Index: l10n_community/editor.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/editor.css,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 editor.css
--- l10n_community/editor.css	16 Feb 2010 14:08:50 -0000	1.1.2.5
+++ l10n_community/editor.css	16 Feb 2010 16:18:56 -0000
@@ -39,17 +39,20 @@ td.source {
     font-size:10px;
     line-height:12px;
   }
-  td.source .l10n-usage .l10n-more {
+  td.source .l10n-usage .l10n-more-info {
+    padding-left: 16px;
+  }
+  td.source .l10n-usage .l10n-more-link {
     font-size:10px;
     text-decoration:none;
     color:#000;
     opacity:0.4;
   }
-  td.source .l10n-usage .l10n-more:before {
+  td.source .l10n-usage .l10n-more-link:before {
     content:"▾ ";
   }
-  td.source .l10n-usage .l10n-more:hover,
-  td.source .l10n-usage .l10n-more:active {
+  td.source .l10n-usage .l10n-more-link:hover,
+  td.source .l10n-usage .l10n-more-link:active {
     color:#666;
   }
   td.source .l10n-usage li {
Index: l10n_community/editor.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/editor.js,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 editor.js
--- l10n_community/editor.js	16 Feb 2010 14:08:50 -0000	1.1.2.4
+++ l10n_community/editor.js	16 Feb 2010 16:18:56 -0000
@@ -33,10 +33,21 @@
   $(function () {
     
     // Replace "More information" link with AJAX output.
-    $('.l10n-more').click(function() {
-      $(this)
-        .addClass('loading')
-        .parent().load(this.href);
+    $('.l10n-more-link').click(function() {
+      if ($(this).siblings('.l10n-more-info').css('display') == 'none') {
+        // Was shown before but is currently hidden.
+        $(this).html(Drupal.t('Hide occurances')).siblings('.l10n-more-info').toggle();
+      }
+      else if ($(this).siblings('.l10n-more-info').html()) {
+        // Is shown and needs to be hidden.
+        $(this).html(Drupal.t('Show occurrences')).siblings('.l10n-more-info').toggle();
+      }
+      else {
+        // Was not yet loaded, we want to load the information fresh from the server.
+        // Append /1 to the href, telling the server we want AHAH targeted output.
+        $(this).html(Drupal.t('Hide occurrences')).siblings('.l10n-more-info').load(this.href + '/1');
+      }
+      // Prevent the actual link click from happening.
       return false;
     });
 
Index: l10n_community/l10n_community.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.module,v
retrieving revision 1.1.2.23.2.66.2.5
diff -u -p -r1.1.2.23.2.66.2.5 l10n_community.module
--- l10n_community/l10n_community.module	16 Feb 2010 07:46:50 -0000	1.1.2.23.2.66.2.5
+++ l10n_community/l10n_community.module	16 Feb 2010 16:18:56 -0000
@@ -214,7 +214,7 @@ function l10n_community_menu() {
   // AJAX callbacks for easy translation management. These are expected to be
   // used only onsite (not as remote API endpoints), so they have no versioning.
   $items['translate/details/%l10n_community_language/%'] = array(
-    'title' => 'String details',
+    'title' => 'Source string usage details',
     'page callback' => 'l10n_community_string_details',
     'page arguments' => array(2, 3),
     'file' => 'translate.inc',
Index: l10n_community/translate.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/translate.inc,v
retrieving revision 1.1.2.7.2.31.2.9
diff -u -p -r1.1.2.7.2.31.2.9 translate.inc
--- l10n_community/translate.inc	16 Feb 2010 11:18:37 -0000	1.1.2.7.2.31.2.9
+++ l10n_community/translate.inc	16 Feb 2010 16:18:56 -0000
@@ -509,7 +509,7 @@ function theme_l10n_community_translate_
   $output = theme('l10n_community_translate_actions', $element['source']);
   $output .= '<label class="l10n-string">'. drupal_render($element['source']['string']) .'</label>';
   $output .= theme('l10n_community_in_context', $element['#string']);
-  $output .= '<div class="l10n-usage"><a href="'. url('translate/details/'. $element['#langcode'] .'/'. $element['#string']->sid) .'" class="l10n-more">'. t('More information') .'</a></div>';
+  $output .= '<div class="l10n-usage"><a href="'. url('translate/details/'. $element['#langcode'] .'/'. $element['#string']->sid) .'" class="l10n-more-link">'. t('Show occurrences') .'</a><div class="l10n-more-info"></div></div>';
   return $output;
 }
 
@@ -973,31 +973,52 @@ function l10n_community_pack_string($str
  *   Language code.
  * @param $sid
  *   Source string id.
- */
-function l10n_community_string_details($langcode = NULL, $sid = 0) {
-  // Prevent devel module information.
-  $GLOBALS['devel_shutdown'] = FALSE;
-
+ * @param $ahah
+ *   Whether the request came through AHAH, in which case no page
+ *   theming should be applied.
+ */
+function l10n_community_string_details($langcode = NULL, $sid = 0, $ahah = 0) {
+
+  $output = '';
+  if ($ahah) {
+    // Prevent devel module information if doing AHAH.
+    $GLOBALS['devel_shutdown'] = FALSE;
+  }
+  else {
+    // Get data about this source string.
+    $string = db_fetch_object(db_query('SELECT value, context FROM {l10n_community_string} WHERE sid = %d', $sid));
+    $unpacked = l10n_community_unpack_string($string->value);
+    $output .= '<h3>'. t('Source string') .'</h3>'. theme('item_list', $unpacked);
+    $output .= '<h3>'. (empty($string->context) ? t('Used at the following places') : t('Used at the following places in context %context', array('%context' => $string->context))) .'</h3>';
+  }
+  
   // List of project releases, where this string is used.
-  $result = db_query('SELECT l.pid, p.title project_title, l.rid, r.title release_title, COUNT(l.lineno) as occurance_count FROM {l10n_community_line} l INNER JOIN {l10n_community_project} p ON l.pid = p.pid INNER JOIN {l10n_community_release} r ON l.rid = r.rid WHERE l.sid = %d AND p.status = 1 GROUP BY l.rid ORDER BY l.pid, l.rid', $sid);
+  $result = db_query('SELECT l.pid, p.title project_title, l.rid, r.title release_title, COUNT(l.lineno) as occurrence_count FROM {l10n_community_line} l INNER JOIN {l10n_community_project} p ON l.pid = p.pid INNER JOIN {l10n_community_release} r ON l.rid = r.rid WHERE l.sid = %d AND p.status = 1 GROUP BY l.rid ORDER BY l.pid, l.rid', $sid);
 
-  $list = array();
-  $output = array();
+  $version_list = array();
+  $project_list = array();
   $previous_project = '';
   while ($instance = db_fetch_object($result)) {
+    $release_info = $instance->release_title .' <span title="'. format_plural($instance->occurrence_count, 'Appears once in this release.', 'Appears @count times in this release.') .'">('. $instance->occurrence_count .')</span>';
     if ($instance->project_title != $previous_project) {
-      if (!empty($list)) {
-        $output[] = join(', ', $list);
+      if (!empty($version_list)) {
+        $project_list[] = join(', ', $version_list);
       }
-      $list = array('<em>'. $instance->project_title .':</em> '. $instance->release_title .' ('. $instance->occurance_count .')');
+      $version_list = array('<em>'. $instance->project_title .':</em> '. $release_info);
     }
     else {
-      $list[] = $instance->release_title .' ('. $instance->occurance_count .')';
+      $version_list[] = $release_info;
     }
     $previous_project = $instance->project_title;
   }
-  $output[] = join(', ', $list);
-  print '<strong>'. t('Used in:') .'</strong>'. theme('item_list', $output);
-
-  exit;
+  $project_list[] = join(', ', $version_list);
+  $usage_list = theme('item_list', $project_list);
+  if ($ahah) {
+    print $usage_list;
+    exit;
+  }
+  else {
+    $output .= $usage_list;
+    return $output; 
+  }
 }
Index: l10n_community/tests/l10n_community.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/tests/Attic/l10n_community.test,v
retrieving revision 1.1.2.15.2.1
diff -u -p -r1.1.2.15.2.1 l10n_community.test
--- l10n_community/tests/l10n_community.test	16 Feb 2010 07:46:50 -0000	1.1.2.15.2.1
+++ l10n_community/tests/l10n_community.test	16 Feb 2010 16:18:56 -0000
@@ -222,9 +222,9 @@ class L10nServerTestCase extends DrupalW
 
     $sid = db_result(db_query("SELECT sid FROM {l10n_community_string} WHERE value = '%s'", 'This is a test string.'));
     $this->drupalGet('translate/details/hu/'. $sid);
-    $this->assertRaw('<em>'. $this->project_names[5] .':</em> 5.x-'. $this->version_js .' (1)');
-    $this->assertRaw('<em>'. $this->project_names[6] .':</em> 6.x-'. $this->version_js .' (1), 6.x-'. $this->version_base .' (1)');
-    $this->assertRaw('<em>'. $this->project_names[7] .':</em> 7.x-'. $this->version_js .' (1)');
+    $this->assertPattern('!<em>'. preg_quote($this->project_names[5]) .':</em> '. preg_quote('5.x-'. $this->version_js) .' <span title="[^>]+">\(1\)</span>!');
+    $this->assertPattern('!<em>'. preg_quote($this->project_names[6]) .':</em> '. preg_quote('6.x-'. $this->version_js) .' <span title="[^>]+">\(1\)</span>, '. preg_quote('6.x-'. $this->version_base) .' <span title="[^>]+">\(1\)</span>!');
+    $this->assertPattern('!<em>'. preg_quote($this->project_names[7]) .':</em> '. preg_quote('7.x-'. $this->version_js) .' <span title="[^>]+">\(1\)</span>!');
 
     // WARNINGS ====
 
